Files
moloapp/audit/MOLO-H1-001

MOLO-H1-001: chunked-body cap bypass via chunk-size addition overflow

Scope: audit · README · AGENTS

In-house finding (not a public CVE), modeled on the same bug class as CVE-2022-29361-style chunked-transfer-coding integer handling and the general HTTP request-smuggling / resource-exhaustion family (CWE-190 integer overflow leading to CWE-400 uncontrolled resource consumption).

Where

src/runtime/http/v1/parser.cpp, Parser::FeedChunkSize:

if (body_.size() + size > body_cap_) {
  state_ = State::Failed;
  return ParseResult::Error413;
}

size is attacker-controlled (parsed from the chunk-size line, up to 16 hex digits, already overflow-checked against SIZE_MAX on its own). body_.size() + size is not checked for overflow. A chunk declaring size 0xFFFFFFFFFFFFFFFF on top of a non-empty body_ wraps the sum to a small number, so the cap comparison passes when it should fail with 413. chunk_left_ is then set to the huge declared size, and every subsequent byte the client sends is appended to body_ in FeedChunkData with no further cap check until that one chunk ends (which an attacker need never do).

Relevance

kBodyMaxDefault (10 MiB, src/runtime/caps.h) is the framework's hard ceiling on request body size, the exact kind of static ceiling AGENTS.md/the base rules require ("every knob has a hard static cap"). This bug makes that ceiling bypassable by anyone who can open an HTTP/1.1 connection and send one request: memory grows without bound as long as the client keeps writing, which is an unauthenticated remote DoS lever against any MoloApp server (the living example, or any app built with molo new).

What the check does

Starts build/bin/runtime_interop_server on a scratch port, opens a real TCP connection, sends POST /echo with Transfer-Encoding: chunked, announces the overflowing chunk size, then streams 14 MiB of chunk "data" past the 10 MiB cap and confirms the server never responds 413 or closes the connection, i.e. the cap was bypassed. PASS means a future fix (checking size > body_cap_ - body_.size()) made the server reject before the cap, or the overflow attempt itself failed to run (SKIP covers a missing build).

Caveats

This is a size-cap bypass proven by pushing memory growth past the configured ceiling, not a crash; it stops at the harness's own 64 MiB send cap (molo_audit.MAX_SEND_BYTES) regardless of verdict, so the check itself never becomes the DoS it is checking for.

Run: make test in this directory, or make -C audit test from the repo root.