CVE-2026-136126 — C-icap C-icap-server (0.5.16) — CWE-415
c-icap-server through 0.5.15 and 0.6.5 contains an out-of-bounds write in process_encapsulated() that allows unauthenticated attackers to corrupt heap memory by sending six Encapsulated entities. Attackers can send a single ICAP request whose sixth entity overwrites trash_entities[0], triggering use-after-free and double free in ci_request_destroy() during teardown.
c-icap-server through 0.5.15 and 0.6.5 contains an out-of-bounds write in process_encapsulated() that allows unauthenticated attackers to corrupt heap memory by sending six Encapsulated entities. Attackers can send a single ICAP request whose sixth entity overwrites trash_entities[0], triggering use-after-free and double free in ci_request_destroy() during teardown.
🎯 What is this vulnerability?
This vulnerability is a Heap Corruption flaw, specifically classified as CWE-415: Double Free (though the description also highlights an Out-of-Bounds Write leading to Use-After-Free). It resides in the process_encapsulated() function of the c-icap-server software.
The core technical failure is a logic error in how the server manages memory for ICAP (Internet Content Adaptation Protocol) request entities. The server maintains a data structure, likely an array or list, to track "trash" entities (entities that have been processed and are pending cleanup). The variable trash_entities[0] suggests a fixed-size buffer or a specific slot in a management structure.
The flaw occurs when an attacker sends a single ICAP request containing six Encapsulated entities. The server's parsing logic fails to properly bound-check or manage the lifecycle of these entities. Specifically, the processing of the sixth entity causes an out-of-bounds write that corrupts the memory pointer or structure associated with trash_entities[0].
During the teardown phase, when the server calls ci_request_destroy() to clean up the request, it attempts to free the memory associated with the entities. Because the memory pointer for the first entity was corrupted (overwritten) by the sixth entity's processing, the server attempts to free an invalid or already-freed memory address. This triggers a Use-After-Free and subsequently a Double Free condition. In C/C++ applications, heap corruption of this nature often leads to arbitrary code execution if the attacker can control the contents of the overwritten memory or influence the heap layout.
⚡ Attack Chain
1. Discovery & Reconnaissance
- Service Identification: The attacker scans for open port 1344 (the default port for ICAP).
- Version Fingerprinting: The attacker sends a benign ICAP request (e.g.,
REQMOD) and inspects theServer:header or error messages to identify the software asc-icap-serverand confirm the version is0.5.16(or<= 0.5.15/0.6.5). - Capability Check: The attacker verifies that the server accepts
Encapsulatedheaders, which are standard in ICAP for multipart requests.
2. Exploitation
The attacker crafts a single ICAP request containing sixEncapsulated entities. The exact binary payload required to achieve reliable code execution depends on the specific heap layout and ASLR bypass techniques, but the structural trigger is the count of entities.Illustrative PoC (Conceptual):
Note: The following is an illustrative example of the ICAP protocol structure required to trigger the bug. The specific byte offsets for the "sixth entity" to overwrite trash_entities[0] would require reverse engineering of the specific c-icap-server binary version.
REQMOD / HTTP/1.0
Host: target.example.com
Encapsulated: req=0, req=100, req=200, req=300, req=400, req=500
Content-Length: 1000
[Entity 1 Data: 100 bytes]
[Entity 2 Data: 100 bytes]
[Entity 3 Data: 100 bytes]
[Entity 4 Data: 100 bytes]
[Entity 5 Data: 100 bytes]
[Entity 6 Data: 100 bytes - Crafted to corrupt trash_entities[0]]Mechanism:
1. The server parses the Encapsulated header and allocates memory for six entities.
2. As it processes entities 1-5, it manages the trash_entities list correctly.
3. When processing the sixth entity, a buffer overflow or logic error in process_encapsulated() writes data beyond the intended buffer, corrupting the metadata or pointer stored at trash_entities[0].
4. The request processing completes, and the server initiates teardown via ci_request_destroy().
5. ci_request_destroy() iterates through the entity list. It attempts to free() the pointer stored in trash_entities[0].
6. Because this pointer was corrupted, the free() call operates on invalid memory, causing a crash or, if the attacker has controlled the heap layout, executing shellcode.
Curl Command (Illustrative):
# Note: This is a structural example. The actual payload requires precise byte manipulation.
curl -X "REQMOD" \
-H "Host: target.example.com" \
-H "Encapsulated: req=0, req=100, req=200, req=300, req=400, req=500" \
--data-binary @crafted_payload.bin \
http://target.example.com:1344/3. Post-exploitation
c-icap-server process (often root or a dedicated icap user).🌍 Real World Impact
c-icap-server process. If the server is not configured to auto-restart, this results in a complete outage of the ICAP service. Even with auto-restart, repeated exploitation can cause resource exhaustion.c-icap-server instance. It does not directly compromise other systems unless the attacker uses the compromised server as a pivot.Practical Consequences:
🛡️ Remediation & Mitigation
1. Patching
c-icap-server through 0.5.15 and 0.6.5.c-icap-server where the process_encapsulated() function has been fixed to properly manage entity memory and prevent out-of-bounds writes. Check the official c-icap project repository for the specific patch release.2. Workarounds
1344 to trusted internal networks only. Use firewall rules (iptables/nftables) to block external access.# Example iptables rule to block external access to ICAP
iptables -A INPUT -p tcp --dport 1344 -s 0.0.0.0/0 -j DROP
iptables -A INPUT -p tcp --dport 1344 -s 192.168.1.0/24 -j ACCEPTEncapsulated entities.# ModSecurity Rule (Illustrative)
SecRule REQUEST_HEADERS:Encapsulated "@rx req=[0-9]+.*req=[0-9]+.*req=[0-9]+.*req=[0-9]+.*req=[0-9]+.*req=[0-9]+" \
"id:100001,phase:1,deny,status:403,msg:'ICAP Encapsulated Entity Overflow Attempt'"Note: This rule is a heuristic and may produce false positives. It is not a substitute for patching.
3. Detection
c-icap-server logs for crashes, segmentation faults, or abnormal termination messages.Segmentation fault, double free or corruption, invalid pointer in server logs.
Encapsulated entities.Encapsulated: req=0, req=100, req=200, req=300, req=400, req=500 (or similar patterns with 6+ entities).
c-icap-server user, which could indicate successful code execution.⚠️ Urgency
Action Plan:
1. Immediately restrict network access to the ICAP server to trusted internal IPs only.
2. Apply the vendor patch or upgrade to the latest version.
3. Monitor logs for signs of exploitation attempts.
4. If the server was exposed, perform a full forensic investigation to determine if compromise occurred.
[🤖 CVE Professor AI Security Engine]
FOFA Query