Skip to main content
← Vulnerabilities

`codeq`: decoding untrusted input can allocate memory from an unchecked length prefix (denial of service)

Affects codeq 0.6.2 and earlier in applications that decode untrusted data through it, such as String or Vec<u8> values from network messages or on-disk records. Fixed in 0.6.3.

Written by anthropic/claude-haiku-5.5 from the sources below. Verify against them.

Exploited
No known exploitation
Fix
Fixed in 0.6.3
Who is exposed
Not reported

Do first: Upgrade to a fixed version: 0.6.3.

Published
Last modified
27/100
Unclear
None on Exploit-DB, Metasploit or GitHub

Summary

The `codeq` serialization library, specifically its `Decode` implementations for `String` and `Vec<u8>`, is affected. Code that decodes untrusted input through `codeq` can be made to allocate up to about 4 GiB of memory from a tiny length prefix, which can exhaust memory and crash the process.

Read the original description

codeq is a serialization library whose Decode trait reads length-prefixed values. For String and Vec<u8>, the length-prefixed Decode implementations read a 4-byte big-endian length and allocate a buffer of that size before reading the payload. Because the declared length is taken straight from the input with no upper bound and no cross-check against the bytes actually available, a tiny input can force an allocation of up to ~4 GiB. Code that decodes untrusted data through codeq can therefore be made to spike memory use and be OOM-killed (CWE-400, uncontrolled resource consumption).

The affected path, in src/codec/impls/string_impl.rs:

impl Decode for String {
    fn decode<R: io::Read>(mut r: R) -> Result<Self, io::Error> {
        let len = r.read_u32::<BigEndian>()? as usize;
        let mut buf = vec![0; len];   // allocates `len` bytes up front
        r.read_exact(&mut buf)?; 
        String::from_utf8(buf).map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))
    }
}

Any code that decodes attacker-controlled bytes through codeq can be forcedcto allocate up to ~4 GiB per decode call from a 4-byte length prefix. On a service decoding untrusted input this is a cheap denial of service (crash / OOM-kill). The practical severity depends on how the embedding wires codeq to untrusted bytes.

Remediation

Fixed in 0.6.3, which grows the decode buffers as payload bytes actually arrive instead of pre-allocating the full declared length (commit 9f15313, "fix: codec: grow decode buffers as payload bytes arrive"). Upgrade to codeq >= 0.6.3.

cve.now Index

27cve.now Index 27 of 100 · methodology v3
  • Exploitation?/40Unknown. No CISA SSVC exploitation rating yet
  • Exposure17/25No login or user action needed, reachable over the network without a login · Unknown: Advisories don't say whether default setups are affected
  • Reach10/20Affects crates.io packages
  • Severity?/10Unknown. No CVSS score or vendor rating
  • No patch0/5No signal

What would change the score

  • Would score about 72 if added to CISA KEV
  • Would score about 67 if CISA's SSVC rates exploitation active
  • Would score about 32 if advisories confirm default setups are exposed

What to do

  • Upgrade to a fixed version: 0.6.3.

Timeline

  1. Advisory published2 days
  2. Record last updated
  3. First seen by cve.now

Affected versions

  • codeqcrates.io

    From 0.0.0-0 · fixed in 0.6.3

Evidence 3

  1. Advisory
  2. Report
  3. Link

Corrections

None so far.

Something wrong on this page? Report an error. Every fix is listed here.

Questions about RUSTSEC-2026-0432

Is RUSTSEC-2026-0432 being exploited?

It is not in CISA's Known Exploited Vulnerabilities catalog, and CISA's SSVC assessment does not mark exploitation as active. That does not mean it has not been attacked: vendors and researchers can report attacks before CISA lists them. No public exploit code is tracked.Source: cve.now feed data

What does this mean?

A tiny crafted input can make codeq allocate a large buffer, up to about 4 GiB, when decoding. This can spike memory use and lead to an OOM-kill or a crash of the process.Source: github.com, rustsec.org

Which versions are affected by RUSTSEC-2026-0432?

codeq (crates.io): from 0.0.0-0 before 0.6.3.Source: cve.now feed data

Am I affected, and how do I check?

The bug is in codeq 0.6.2 and earlier. To check, look at the codeq version in the project's Cargo.lock or run cargo tree. It matters only for code that decodes untrusted data through codeq, such as String or Vec<u8> values read from network messages or on-disk records.Source: github.com, rustsec.org

How do I fix RUSTSEC-2026-0432?

Upgrade codeq to 0.6.3 or later, which contains the fix.Source: github.com, rustsec.org