Containerized differential PoC for CVE-2026-76954: pre-auth SQL injection in the Synology DSM Auth API. DBEscapeStrings truncates a %q-escaped field to 4095 bytes, splitting a doubled quote and turning the next pre-auth field into stacked SQL against syno-pam-key.db. Real DSM libraries; all four branches proven vulnerable vs fixed.
# CVE-2026-76954 — Synology DSM Auth API pre-auth SQL injection via truncating escape in `SynoPamKeyImpl::DBEscapeStrings`
| | |
|---|---|
| **CVE** | CVE-2026-76954 |
| **Component** | Synology DiskStation Manager, Auth API — `libsyno-pam-login.so.7.0`, `SynoPamKeyImpl::DBEscapeStrings` (`syno-pam-key-impl.cpp`) against the real `libsynodb.so` |
| **Affected** | DSM ≤ 7.2.1-69057-12 · 7.2.2-72806 · 7.3.2-86009 · 7.4.1-90080 |
| **Fixed in** | 7.2.1-69057-13 · 7.2.2-72806-10 · 7.3.2-86009-5 · 7.4.1-90080-1 (Synology-SA-26:19) |
| **CWE** | CWE-89 — Improper Neutralization of Special Elements used in an SQL Command |
| **Impact** | Arbitrary SQL execution in `syno-pam-key.db` with stacked statements; per the vendor advisory this allows reading and writing arbitrary files and denial of service |
| **Vector** | Network, unauthenticated, pre-auth (`device_id` of the Auth API login) |
| **Trigger** | An escaped field whose `%q`-escaped form exceeds 4095 bytes, with a quote split by the truncation boundary |
| **CVSS3** | 9.8 Critical — CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| **Credit** | Nguyễn Bá Nam Dũng (@greengrass19000) and Hà Thế Long (LongHT), Viettel Cyber Security Research Lab (@vcslab); Warisse Valentin (Aytio) |
| **Advisory** | https://www.synology.com/en-global/security/advisory/Synology_SA_26_19 |
| **Repository** | https://github.com/googlesky/CVE-2026-76954 |
The Auth API stores per-device login keys in a SQLite database through
`libsyno-pam-login.so.7.0`. Every column value is escaped by
`SynoPamKeyImpl::DBEscapeStrings`, which in the affected builds calls
`SYNODBEscapeStringEX` with a fixed 4096-byte global buffer. The SQLite
backend of `libsynodb.so` implements that escape as
`sqlite3_mprintf("%q", input)` followed by `snprintf(out, 4096, "%s", escaped)`,
which silently truncates the escaped text to 4095 bytes. A field crafted so
that its escaped form is exactly 4096 bytes loses the second quote of a
doubled pair at the cut, leaving an odd q