
PoC and lab for CVE-2026-131852: stored format-string in OwnTracks Recorder's json_response() leaks pointers via %p and crashes the daemon with %n, tested on 1.0.4 vs fixed 1.0.5.
tid (unauthenticated)| CVE | CVE-2026-131852 |
| Component | OwnTracks Recorder — json_response() in http.c (bundled mongoose) |
| Affected | Recorder before 1.0.5 |
| Fixed in | 1.0.5 (genuine vendor fix, commit 64a86050) |
| CWE | CWE-134 (Use of Externally-Controlled Format String) |
| Impact | Unauthenticated stored format string: an attacker publishes a location whose tid holds printf specifiers, then reads it back through the HTTP API — the response expands %p into live stack/libc pointers (ASLR defeat) and %n writes through pointers popped from the stack, crashing the daemon (SIGSEGV) and, as measured in this lab, leaving the storage corrupted so every subsequent startup crash-loops — a persistent DoS |
| Vector | Network, unauthenticated — POST /pub (HTTP) or MQTT publish, then GET /api/0/last |
| Trigger | one stored location with tid: "%p.%p.%p" (leak) or "%n.%n…" (crash/write) |
json_response() passes the freshly serialized JSON — which embeds
attacker-controlled fields verbatim — as the format string of
mg_printf_data():
// http.c @ 1.0.4, json_response()
char *js = json_stringify(json, ...);
...
mg_printf_data(conn, js); // js = attacker data as FORMAT
The vendor fix (1.0.5) passes it as data, the way it always should have been:
mg_printf_data(conn, "%s", js);
The same commit hardened the sibling sinks emit_xml_line,
emit_csv_line, send_status and fixed an ns_avprintf 8192-byte
truncation bug (> → >=). This laboratory runs the real Recorder
1.0.4 vs the vendor-fixed 1.0.5 over plain HTTP.
Any user-controlled string that reaches the JSON response body becomes a
printf format. The location tid (tracker ID) is the cleanest carrier:
it is stored by the publish path and echoed verbatim by /api/0/last.
No authentication is required to publish (POST /pub?u=<user>&d=<device>)
or to read the API by default. mg_printf_data feeds the string into
vsnprintf, so %p pops and prints stack arguments (pointer disclosure)
and %n writes through them (memory write / crash). Because the value is
stored, a single publish poisons every later read.
| service | image | role |
|---|---|---|
otr-vuln | cve-2026-131852:vuln | ot-recorder built from upstream tag 1.0.4 |
otr-fixed | cve-2026-131852:fixed | ot-recorder built from upstream tag 1.0.5 (vendor fix) |
poc | cve-2026-131852-poc:local | stdlib-only Python driver |
Both sides run with the same flags (-A 8083 --http-host 0.0.0.0,
filesystem storage, MQTT disabled — the HTTP path is the CVE vector and
MQTT shares the same sink). The recorder runs under a small supervisor
that restarts it after a crash and logs the exit code to
/work/crash.log, so the %n SIGSEGV is observable and captured
(evidence/probe-vuln-crash.log).
./run-lab.sh build # builds ot-recorder 1.0.4 / 1.0.5 from source
./run-lab.sh up # cve131852lab network: otr-vuln, otr-fixed
./run-lab.sh sweep # check / exploit / probe / mitigation on both sides
./run-lab.sh down
A standalone full-chain exploit script ships at exploit/exploit.py
(python3 exploit/exploit.py --host=<target>; exit 1 on confirmed
exploitation, 0 on a safe target).
poc/poc.py (stdlib only):
tid (persistence sanity), then a %p
tid; poll /api/0/last until visible (the filesystem backend lands
writes asynchronously); pointer-shaped hex in the response means the
format-string path fired. Exit 1 vulnerable, 0 safe, 3 no worker,
2 unreachable.%p leak / %n crash with supervisor-restart
observation.| run | otr-vuln (1.0.4) | otr-fixed (1.0.5) |
|---|---|---|
check | %p expands → 3 live pointers leaked, exit 1 | tid echoed literally, exit 0 |
exploit | pointer list printed | (no expansion) |
probe leak row | leak: 0x… | literal |
probe %n row | daemon SIGSEGV (rc=139), crash-loops on the corrupted store | n/a (no leak to build on) |
Captured runs: evidence/check-*-run.txt, evidence/exploit-*-run.txt,
evidence/probe-*-run.txt, evidence/mitigation-*-run.txt,
evidence/probe-vuln-crash.log (the rc=139 sequence),
evidence/versions.txt, evidence/0day-sweep.txt.
cve131852lab
network.evidence/0day-sweep.txt and evidence/probe-vuln-crash.log record two
things the advisory does not spell out:
%n SIGSEGV, the storage the daemon
wrote through the corrupted in-memory state is poisoned: every
subsequent startup dies with rc=139 again. Recovery requires clearing
the store; a single unauthenticated publish thus knocks a Recorder
instance out permanently.emit_xml_line,
emit_csv_line, send_status and the mongoose ns_avprintf
8192-byte truncation path share the flaw class; the ?format=xml|csv
variants of the read API were equally exploitable on 1.0.4.On the fixed 1.0.5 build every specifier is echoed literally and no second bypass form was found.
README.md this write-up
run-lab.sh environment driver (build / up / sweep / down)
Makefile convenience targets
exploit/exploit.py standalone full-chain exploit
poc/poc.py the PoC (check / exploit / probe / mitigation)
poc/Dockerfile runner image (python:3.12-alpine)
lab/lab.Dockerfile multi-stage build (ot-recorder 1.0.4 / 1.0.5)
lab/supervisord.sh crash supervisor (restart loop + crash.log)
evidence/ captured runs of every mode on both sides
TRACKING.md excluded (working record)