Summary
TinyWeb web server versions prior to 2.03 contain an integer overflow in the string-to-integer conversion routine used to process the HTTP Content-Length header.
By crafting oversized or boundary-value Content-Length values, an unauthenticated remote attacker can desynchronize HTTP message parsing and perform request smuggling, potentially bypassing security controls and poisoning downstream caches on persistent (Keep-Alive) connections.
Affected context
This vulnerability arises in TinyWeb deployments (HTTP/HTTPS) on Win32 where:
- The server is running a version earlier than 2.03
- HTTP persistent connections (Keep-Alive) are enabled or commonly used
- TinyWeb is fronted by, or chained with, other HTTP intermediaries such as proxies, load balancers, or caching servers
- The server relies on
Content-Lengthfor request delimitation and may enforce size-based restrictions or filtering
Under these conditions, mismatches in perceived request boundaries between TinyWeb and downstream components can be triggered by maliciously crafted Content-Length headers.
Exploit preconditions
- Attack surface: Public-facing HTTP/HTTPS listener of a TinyWeb instance.
- Required access: No authentication required; attacker only needs the ability to send raw HTTP requests to the server.
- Trigger point: Submission of HTTP requests containing specially crafted
Content-Lengthvalues that cause integer overflow in the_Valconversion routine. - Why exploitation is possible:
- The server converts the string value of
Content-Lengthto an integer without robust overflow detection. - The resulting integer value differs from the actual intended length, causing TinyWeb and any chained intermediaries to disagree on where a request ends.
- On persistent connections, this desynchronization enables one logical TCP connection to carry multiple, attacker-controlled HTTP messages that are parsed inconsistently, enabling request smuggling.
Why this happens
The core issue is an integer overflow (CWE-190) in TinyWeb's _Val routine, which parses the Content-Length header from a string into a numeric type without enforcing safe bounds or rejecting values that exceed the representable range.
When a specially crafted, overly large, or edge-case Content-Length is processed, the computed integer wraps around, yielding an incorrect effective content length.
This flawed length is then used to determine HTTP request boundaries, aligning with CWE-444: Inconsistent Interpretation of HTTP Requests ('HTTP Request Smuggling'), where different components in the HTTP processing chain (TinyWeb vs. proxies/caches/filters) interpret the same stream differently.
Abstractly, the pattern is:
- Trusting attacker-controlled protocol metadata (headers) for message framing
- Performing unsafe numeric conversion without overflow checks
- Relying on the resulting value as a security-relevant delimiter for downstream processing.
Potential impact
- Unauthorized access to protected resources via desynchronized, smuggled requests that bypass front-end filters or authentication layers.
- Bypass of security filters, WAF rules, or size-based inspection policies that rely on accurate
Content-Lengthhandling. - HTTP cache poisoning, where attacker-controlled responses are stored and later served to other users.
- Execution of unintended requests under another user's session or origin context within complex deployments.
- Potential leverage of desynchronization for session fixation, CSRF amplification, or credential harvesting in multi-tier architectures.
- Disruption or degradation of service through malformed request streams that confuse intermediaries.
General mitigation guidance
Effective mitigation focuses on robust request framing, safe numeric handling, and defense in depth around HTTP parsing:
- Use hardened string-to-integer conversion routines that:
- Enforce strict upper and lower bounds on acceptable
Content-Lengthvalues - Explicitly detect and reject overflow or malformed numeric representations
- Fail closed (terminate the connection or reject the request) on parsing anomalies
- Normalize and validate all request metadata used for message delimitation, especially
Content-LengthandTransfer-Encoding, ensuring only one framing mechanism is accepted per request. - Treat large or unusual
Content-Lengthvalues as suspicious, applying conservative limits and rejecting values that approach integer boundaries or configured maximum body sizes. - Configure intermediaries (proxies, load balancers, caches) to use consistent HTTP parsing rules and to drop ambiguous or conflicting requests rather than attempting to guess intent.
- Prefer secure-by-default HTTP server configurations that:
- Disable or strictly manage Keep-Alive where parsing inconsistencies cannot be ruled out
- Apply least-privilege principles to downstream components that act on parsed requests.
- Introduce centralized parsing libraries or middleware so all components interpret HTTP messages consistently, rather than reimplementing parsing logic in multiple places.
How teams detect issues like this
Organizations can identify and monitor for this vulnerability class using a mix of code-level and runtime approaches:
- Static analysis and code review:
- Flag uses of custom or low-level string-to-integer routines for header parsing, especially for
Content-Length. - Review boundary checks on numeric conversions, verifying that overflow is handled explicitly.
- Look for multiple independent HTTP parsing implementations instead of shared, vetted libraries.
- Ensure that header parsing and request framing paths treat parsing failures as hard errors, not silently corrected values.
- Security testing and fuzzing:
- Apply HTTP protocol fuzzers that vary
Content-Lengthvalues, including extremely large numbers, negative values, leading zeros, and conflicting headers. - Conduct request smuggling tests against the full chain (client → proxy/load balancer → TinyWeb → backends) to detect inconsistencies.
- Operational monitoring:
- Monitor logs for parsing anomalies such as repeated connection resets, truncated bodies, or unexpected 4xx/5xx bursts associated with unusual
Content-Lengthvalues. - Instrument reverse proxies and WAFs to alert on ambiguous requests (e.g., both
Content-LengthandTransfer-Encoding, or improbable body size headers). - Automated tooling:
- Integrate HTTP parser consistency checks into CI/CD pipelines.
- Use security scanners capable of probing for request smuggling patterns as part of pre-deployment testing.

