GitHub Advisoryadvisory · Maven

GHSA-q8f2-hxq5-cp4h Absent Input Validation in BinaryHttpParser

HIGH Published 2024-07-18 Modified 2024-07-19 Official page ↗
Aliases
CVE-2024-40642
Ecosystem
Maven
Packages
io.netty.incubator:netty-incubator-codec-bhttp
Severity
High
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
Weaknesses
CWE-20
Reviewed
2024-07-18

Affected packages

• Maven io.netty.incubator:netty-incubator-codec-bhttp: < 0.0.13.Final → fixed in 0.0.13.Final

Description

Summary `BinaryHttpParser` does not properly validate input values thus giving attackers almost complete control over the HTTP requests constructed from the parsed output. Attackers can abuse several issues individually to perform various injection attacks including HTTP request smuggling, desync attacks, HTTP header injections, request queue poisoning, caching attacks and Server Side Request Forgery (SSRF). Attacker could also combine several issues to create well-formed messages for other text-based protocols which may result in attacks beyond the HTTP protocol. Details Path, Authority, Scheme The BinaryHttpParser class implements the readRequestHead method which performs most of the relevant parsing of the received request. The data structure prefixes values with a variable length integer value. The algorithm to create a variable length integer value is below: ``` def encode_int(n): if n ... nodes) { this.values = (Node[])(new Node[MathUtil.findNextPositivePowerOfTwo(nodes.length)]); this.valuesMask = this.values.length - 1; Node[] var2 = nodes; int var3 = nodes.length; for(int var4 = 0; var4 node = var2[var4]; int i = hashCode(node.key) & this.valuesMask; if (this.values[i] != null) { throw new IllegalArgumentException("index " + i + " collision between values: [" + this.values[i].key + ", " + node.key + ']'); } this.values[i] = node; } } T get(String name) { Node node = this.values[hashCode(name) & this.valuesMask]; return node != null && node.key.equals(name) ? node.value : null; } ``` Note that `EnumNameMap.get()` returns a boolean value, which is not `null`. Therefore, any arbitrary http verb used within a `BinaryHttpRequest` will yield a valid `HttpMethod` object. When the `HttpMethod` object is constructed, the name is checked for whitespace and similar characters. Therefore, we cannot perform complete injection attacks using the HTTP verb alone. However, when combined with the other input validation issues, such as that in the path field, we can construct somewhat arbitrary data blobs that satisfy text-based protocol message formats. Impact Method is partially validated while other values are not validated at all. Software that relies on netty to apply input validation for binary HTTP data may be vulnerable to various injection and protocol based attacks.

Related

Alias · CVE (1)

  • CVE-2024-40642 The netty incubator codec.bhttp is a java language binary http parser. vulnerability

Weakness · CWE (1)

  • CWE-20 Improper Input Validation weakness

References