CVE-2026-142097 — CWE-125
Swoole before 6.1.14 and 6.2.x before 6.2.7 contains an out-of-bounds read in onAccept() of swoole_http_server_coro.cc that mishandles requests prefixed with CRLFCRLF. Remote unauthenticated attackers can make getContent() return up to 64 KB of heap memory, leaking other connections' Authorization and Cookie headers or crashing the server.
Swoole before 6.1.14 and 6.2.x before 6.2.7 contains an out-of-bounds read in onAccept() of swoole_http_server_coro.cc that mishandles requests prefixed with CRLFCRLF. Remote unauthenticated attackers can make getContent() return up to 64 KB of heap memory, leaking other connections' Authorization and Cookie headers or crashing the server.
🎯 What is this vulnerability?
Technical Flaw:
This is a classic Out-of-Bounds Read (OOB Read) vulnerability, classified under CWE-125. The flaw resides in the onAccept() function within swoole_http_server_coro.cc, a core component of the Swoole extension for PHP.
Root Cause Analysis:
The Swoole HTTP server coroutine implementation fails to correctly validate the length and content of the initial HTTP request buffer when it encounters a specific sequence: CRLF CRLF (\r\n\r\n) at the very beginning of the payload.
1. Input Validation Failure: When onAccept() processes the incoming socket data, it likely assumes a standard HTTP request structure (Method + Space + URI). However, if the buffer starts with CRLF CRLF, the internal pointer arithmetic or string length calculation is mishandled.
2. Memory Corruption: This mishandling causes the internal getContent() method to return a pointer to a heap buffer that is not properly bounded. Instead of returning the actual (empty or malformed) request body, it returns a chunk of adjacent heap memory.
3. Information Disclosure: The returned data can be up to 64 KB of raw heap memory. In a multi-connection server environment (like Swoole), this heap memory often contains data from other concurrent connections. This includes sensitive headers such as Authorization: Bearer <token> and Cookie: session_id=... from other users.
4. Denial of Service: If the OOB read accesses unmapped memory pages, it triggers a segmentation fault, crashing the Swoole worker process and potentially the entire server.
CVSS Vector Breakdown:
- AV:N (Network): Exploitable remotely via standard HTTP requests.
- AC:L (Low Complexity): No race conditions or complex timing required; simply sending a malformed header sequence triggers it.
- PR:N (No Privileges): Unauthenticated access is sufficient.
- UI:N (No User Interaction): No victim action required.
- S:U (Unchanged Scope): The impact is confined to the vulnerable application/server.
- C:H (High Confidentiality): Leaks sensitive data (auth tokens, cookies) from other sessions.
- I:N (None Integrity): No modification of data.
- A:H (High Availability): Can crash the server.
- Target Identification: The attacker scans for services running PHP with the Swoole extension. This can be identified by: * Response headers:
- Version Fingerprinting: The attacker attempts to determine the Swoole version. While Swoole doesn't always expose its version in headers, the attacker can assume any version < 6.1.14 or 6.2.x < 6.2.7 is vulnerable. If the version cannot be confirmed, the attack is still attempted due to the low complexity.
⚡ Attack Chain
1. Discovery & Reconnaissance
Server: swoole or specific Swoole-related headers.
* Error pages: Swoole-specific error messages (e.g., "Swoole HTTP Server").
* Port scanning: Common PHP ports (80, 443, 8080, 9501).
2. Exploitation
The attacker sends an HTTP request where the body or the initial part of the stream starts withCRLF CRLF. The exact mechanism depends on how Swoole buffers the initial read. Typically, this involves sending a minimal HTTP request with a malformed body or a specific header configuration that triggers the onAccept() parser to misinterpret the buffer start.Illustrative PoC (curl):
Note: The exact byte sequence may vary slightly based on the Swoole version's internal buffering, but the core trigger is the CRLF CRLF prefix in the context of the onAccept() handler.
# Illustrative PoC: Sending a request with a body starting with CRLF CRLF
# The -d flag sends the data as the body. We prepend \r\n\r\n to the body.
# In some implementations, the vulnerability might be triggered by a malformed header line,
# but the CVE specifies "requests prefixed with CRLFCRLF", implying the start of the payload.
curl -v -X POST http://target-server:8080/ \
-H "Content-Type: application/octet-stream" \
--data-binary $'\r\n\r\nAAAA'Alternative Trigger (if the prefix is in the header section):
If the "prefix" refers to the start of the raw TCP stream, the attacker might send:
# Raw TCP payload
printf "\r\n\r\nGET / HTTP/1.1\r\nHost: target\r\n\r\n" | nc target-server 8080Result:
The server responds with a 200 OK (or similar) status, but the response body contains up to 64 KB of heap memory. The attacker parses this response to extract:
Authorization: Bearer eyJhbGciOi... (JWT tokens from other users)Cookie: PHPSESSID=abc123; session_token=xyz789 (Session cookies)3. Post-Exploitation
Authorization headers or Cookie values to impersonate other users. This allows access to their accounts, data, and potentially administrative functions if an admin session is leaked.🌍 Real World Impact
Confidentiality (High): This is the most severe impact. In multi-tenant SaaS applications, e-commerce platforms, or any web app using Swoole for high-concurrency HTTP handling, an attacker can steal authentication credentials of any* user currently connected to the server. This is a critical breach of trust and data privacy.
Practical Consequences:
🛡️ Remediation & Mitigation
1. Upgrade (Primary Fix)
2. Workarounds (If Immediate Upgrade is Not Possible)
CRLF CRLF in the body or have malformed header structures.SecRule REQUEST_BODY "@pm \r\n\r\n" "id:100001,phase:2,deny,status:403,msg:'Blocked Swoole OOB Read Attempt'" Note: This may have false positives if legitimate applications send binary data starting with CRLF. Test thoroughly.*
3. Detection
POST / HTTP/1.1 with a body starting with \r\n\r\n.
Example Log Entry:*192.168.1.100 - - [02/Dec/2026:10:00:00 +0000] "POST / HTTP/1.1" 200 65536 "-" "curl/7.68.0"Note: A response size of 65536 (64 KB) for a simple POST request is a strong indicator of the OOB read.
Log Pattern:*
Segmentation fault (core dumped) in Swoole worker logs.⚠️ Urgency
[🤖 CVE Professor AI Security Engine]