
Python PoC driver for CVE-2026-116567: fingerprints FreeSWITCH mod_rtmp over RTMP, sends escalating user-control bodies to trigger the pre-auth stack overflow, and verifies listener crash.
Pre-auth stack overflow in the FreeSWITCH mod_rtmp control-message handler.
How it works · Capabilities · Quick start · Workflow · Architecture · Field results
rtmp_handle_control() renders an RTMP user-control message body into a fixed 200-byte stack buffer with an unbounded sprintf loop, three output bytes per input byte. The length comes straight off the chunk header and the code runs before any login, so roughly seventy bytes of body corrupt the stack frame on a listener that authenticates nothing. This repository carries a driver that proves the listener is mod_rtmp before firing, the upstream fix and advisory, a reproducible local target, and the validation matrix.
flowchart LR
A[Target host] --> B[Port probe 1935<br/>1936 · 19350]
B -->|closed| X[skip]
B -->|open| C[Handshake C0/C1 → S0/S1/S2 → C2]
C --> D[connect · app live/sofia/default]
D --> E{fmsVer}
E -->|1| F[mod_rtmp]
E -->|FMS/3,0,1,123| G[nginx-rtmp · skip]
E -->|silent reset| G
F --> H[SetChunkSize 4096]
H --> I["USERCTRL 0x04<br/>body 70 → 2000 bytes"]
I --> J{listener down?<br/>polled 150 ms}
J -->|no| I
J -->|yes| K[wait recovery · record]
mod_rtmp is commented out of both the default module list and modules.conf.xml, so port 1935 in the wild is more often BigBlueButton's nginx-rtmp than FreeSWITCH. The fingerprint exists because of that: mod_rtmp answers connect with numeric fmsVer 1, nginx-rtmp with the string FMS/3,0,1,123, and firing blind at nginx produces confident false negatives. The oracle is the listener disappearing, polled at 150 ms — a bare socket reset is not trusted, because servers close sessions for unrelated reasons.
| Area | What the driver provides |
|---|---|
| Transport | Own RTMP framing: handshake, chunk header, AMF0 connect, SetChunkSize; TCP with configurable port |
| Fingerprinting | mod_rtmp vs nginx-rtmp from the connect _result, so 1935 collisions do not produce false hits |
| Payload | Escalating body sizes 70,96,128,192,384,768,2000, stopping at the first that kills the listener |
| Oracle | Port polling at 150 ms for the listener going away, not socket teardown |
| Recovery | Waits for the port to return, reports recover_s, keeps going |
| Batching | -i hosts.txt -w 16, JSON lines on stdout, per-target verdicts |
| Second CVE | --connect also exercises CVE-2026-116782 with a non-object AMF argument |
| Safety | Nothing is written to the target; a crash ends active calls, so it is a DoS by nature |
3.9+, no third-party packagesmod_rtmp loaded and TCP 1935 reachablegit clone https://github.com/carterlasalle/CVE-2026-116567
cd CVE-2026-116567
chmod +x rtmpcrash.py
./rtmpcrash.py 203.0.113.10
Exit codes: 0 crashed, 1 survived, 2 unreachable, 3 not mod_rtmp.
./rtmpcrash.py -i hosts.txt -w 16 --json
scripts/local-target.sh starts safarov/freeswitch:1.10.12 on 127.0.0.1:11936, enables mod_rtmp, and prints the command to run. A 1.11.3 control container on :11935 shows the patched behaviour.
./scripts/local-target.sh vulnerable
./rtmpcrash.py 127.0.0.1 -p 11936
identify() sends connect for live, sofia and default and reads fmsVer from the _result.mod_rtmp is skipped unless --force is given.recovered/recover_s, and stops escalating.--connect then fires CVE-2026-116782 and reports crash/survived..
├── rtmpcrash.py single-file driver: framing, fingerprint, payload, oracle, batch
├── docs/
│ ├── writeup.md the bug, the fix, the trigger conditions, the limits
│ ├── patch-116567.diff upstream fix commit fc0db82
│ └── advisory.html GHSA-hj6x-9653-p796 as published
├── scripts/
│ └── local-target.sh docker 1.10.12 target, mod_rtmp enabled
├── .github/workflows/
│ └── lint.yml py_compile + --help smoke test
└── README.md
rtmpcrash.py stays one file on purpose: it is a field tool, and the only state is a per-target verdict. The only external surface is the CLI.
SetChunkSize 4096 is negotiated first so a large body is one chunk and cannot be lost in continuation handling.mod_rtmp listeners are skipped instead of fired at, keeping batches honest at the cost of needing --force for a customised banner.Validation matrix, 2026-11-06:
| Target | Version | Result |
|---|---|---|
local safarov/freeswitch:1.10.12 | vulnerable | process dies at 70 bytes, 0.31 s, exit 0 |
local safarov/freeswitch:1.11.3 | patched | survives 70/96/140 bytes, exit 1 |
| 116.203.53.154, 51.38.43.64, 193.198.68.11, 102.129.76.5 | nginx-rtmp on 1935 | correctly skipped |
A 100-host sample of hosts carrying a FreeSWITCH-issued TLS certificate found 37 with SIP answering on 5060 and 23 below 1.11.2, but only four with 1935 open and all four were nginx. mod_rtmp is off by default, so the internet population is thin. Narrow before sweeping:
host.services.port:1935 and not host.services.software.product:"nginx"
No hosted component. The driver runs locally and prints JSON lines; Docker is needed only for the local reproduction target.
.github/workflows/lint.yml byte-compiles, runs --help, shell-checks the target script, and asserts a JSON verdict on an unmatched host. Hosted runners are blocked by a billing lock on the account, so runs show as failed-at-start; the same steps pass on a clean clone locally (ci-steps-ok, 2026-11-08).
docs/writeup.md carries the full mechanics, the affected-version range (< 1.11.2), and the reason the overflow is DoS-only: every byte written is %02x output, so only ASCII hex digits and spaces reach the stack frame.
| File | Contents |
|---|---|
| docs/writeup.md | Trigger conditions, fix, validation, known limits |
| docs/patch-116567.diff | Upstream fix commit fc0db82 |
| docs/advisory.html | GHSA-hj6x-9653-p796 |