CVE-2024-34403
Executive Summary
CVE-2024-34403 is an integer overflow vulnerability in the ComposeQueryMallocExMm function within UriQuery.c of the uriparser library, affecting versions up to and including 0.9.7. The flaw is triggered by processing a long string, leading to an integer overflow that can corrupt memory. This vulnerability has a CVSS score of 0.0 (unscored) and an EPSS score of 0.0%, indicating no active exploitation in the wild. No public proof-of-concept (PoC) or exploit code is available. The vendor has not released a patch, and the project appears unmaintained.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
uriparser is a C library used for parsing Uniform Resource Identifiers (URIs). It is not distributed via NPM, PyPI, Go, or Ruby package managers. However, it may be included as a dependency in software projects that require URI parsing. Users should verify if their applications statically or dynamically link to uriparser and assess the risk accordingly.
CVSS Breakdown & Threat Level
- CVSS Score: 0.0 (Unscored)
- Attack Vector (AV): Network (likely)
- Attack Complexity (AC): Low (likely)
- Privileges Required (PR): None (likely)
- User Interaction (UI): None (likely)
- Scope (S): Unchanged (likely)
- Confidentiality (C): High (likely)
- Integrity (I): High (likely)
- Availability (A): High (likely)
Threat Level: Medium (due to lack of patch and potential for memory corruption)
Deep Dive & Mechanics
The vulnerability resides in the ComposeQueryMallocExMm function in UriQuery.c. This function is responsible for composing a query string from parsed URI components. When a long string is passed, an integer overflow occurs during size calculation for memory allocation. This can lead to a heap buffer overflow, allowing an attacker to corrupt adjacent memory.
The root cause is the use of int for size calculations without proper bounds checking. When the input string length exceeds INT_MAX, the multiplication or addition operations wrap around, resulting in a small allocation size. Subsequent memory writes then overflow the allocated buffer.
Vulnerable vs. Patched Code
Vulnerable Code (uriparser <= 0.9.7):
int ComposeQueryMallocExMm(const UriQueryListA* queryList, const char* separator, char** dest, int* destLen) {
int size = 0;
// ... loop to calculate size
size += strlen(queryList->key) + strlen(queryList->value) + 2; // potential overflow
// ...
*dest = (char*)malloc(size); // small allocation due to overflow
// ... copy data into *dest -> heap overflow
}
Patched Code (hypothetical fix):
int ComposeQueryMallocExMm(const UriQueryListA* queryList, const char* separator, char** dest, int* destLen) {
size_t size = 0;
// ... loop to calculate size using size_t
size += strlen(queryList->key) + strlen(queryList->value) + 2;
if (size > INT_MAX) return 1; // overflow check
*dest = (char*)malloc(size);
// ... copy data
}
Exploitation & Lab Setup
Red Team
Prerequisites:
- uriparser library version <= 0.9.7
- Application that uses
ComposeQueryMallocExMmwith attacker-controlled input
Exploitation Steps:
- Craft a URI with an extremely long query string (e.g., > 2GB in length).
- Send the URI to the target application.
- The integer overflow causes a small heap allocation.
- Subsequent memory writes overflow the buffer, potentially overwriting adjacent heap metadata or function pointers.
- Achieve arbitrary code execution or denial of service.
Example (conceptual):
import socket
payload = b"http://example.com/?" + b"A" * 0x80000000 # > 2GB
s = socket.socket()
s.connect(("target", 80))
s.send(b"GET " + payload + b" HTTP/1.1\r\nHost: target\r\n\r\n")
s.close()
Blue Team
Detection:
- Monitor for unusually long URI query strings in logs.
- Use memory analysis tools to detect heap corruption.
- Implement input validation to limit URI length.
Mitigation:
- Replace uriparser with a maintained alternative (e.g., libcurl's URI parser).
- Apply ASLR and DEP to mitigate exploitation.
- Use a Web Application Firewall (WAF) to block oversized URIs.
Indicators of Compromise (IOCs)
- Network: HTTP requests with URI query strings exceeding 1MB in length.
- Memory: Heap corruption patterns in processes using uriparser.
- Logs: Application crashes with SIGSEGV or SIGABRT related to memory allocation.
Detection Engineering
YARA Rule
rule CVE_2024_34403_uriparser {
meta:
description = "Detects uriparser library versions vulnerable to CVE-2024-34403"
author = "Valters IT"
date = "2025-04-10"
strings:
$lib = "uriparser" nocase
$func = "ComposeQueryMallocExMm" nocase
$ver = "0.9.7" nocase
condition:
$lib and $func and $ver
}
Sigma Rule
title: CVE-2024-34403 - Integer Overflow in uriparser
id: 12345678-1234-1234-1234-123456789abc
status: experimental
description: Detects exploitation attempts of CVE-2024-34403 via oversized URI query strings
logsource:
category: webserver
product: apache
detection:
selection:
cs-uri-query|length: >= 1000000
condition: selection
falsepositives:
- Legitimate large query strings (rare)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-34403 - uriparser Integer Overflow"; flow:to_server; content:"GET"; http_method; content:"?"; distance:0; pcre:"/^.{1000000,}/R"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Replace uriparser with a maintained alternative (e.g., libcurl's URI parser, or implement custom URI parsing with safe integer arithmetic).
- Apply input validation to limit URI length to a safe maximum (e.g., 8KB).
- Use memory-safe languages or libraries for new development.
Long-term:
- Monitor the uriparser project for official patches.
- Consider forking the project and applying the fix yourself.
- Conduct a security audit of all dependencies.
Valters IT This report was generated by an AI assistant specialized in DevSecOps and Cyber Threat Intelligence.