Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-76954 — Containerized differential PoC and lab for CVE-2026-76954, a pre-auth SQL injection in Synology DSM Auth API caused by a 4095-byte escape truncation, with real DSM libraries. | Kitploit
Tools/GitHubGitHub/googlesky/cve-2026-76954
Container SecurityVulnerability AnalysisExploitationWeb Application ExploitationAuthenticationPapers & ResearchDatabase SecurityLabs & Practice
GitHubgooglesky/cve-2026-76954

CVE-2026-76954

Containerized differential PoC and lab for CVE-2026-76954, a pre-auth SQL injection in Synology DSM Auth API caused by a 4095-byte escape truncation, with real DSM libraries.

4 days agoNot yet reviewed
Share
View Repository

CVE-2026-76954 — Synology DSM Auth API pre-auth SQL injection via truncating escape in SynoPamKeyImpl::DBEscapeStrings

CVECVE-2026-76954
ComponentSynology DiskStation Manager, Auth API — libsyno-pam-login.so.7.0, SynoPamKeyImpl::DBEscapeStrings (syno-pam-key-impl.cpp) against the real libsynodb.so
AffectedDSM ≤ 7.2.1-69057-12 · 7.2.2-72806 · 7.3.2-86009 · 7.4.1-90080
Fixed in7.2.1-69057-13 · 7.2.2-72806-10 · 7.3.2-86009-5 · 7.4.1-90080-1 (Synology-SA-26:19)
CWECWE-89 — Improper Neutralization of Special Elements used in an SQL Command
ImpactArbitrary 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
VectorNetwork, unauthenticated, pre-auth (device_id of the Auth API login)
TriggerAn escaped field whose %q-escaped form exceeds 4095 bytes, with a quote split by the truncation boundary
CVSS39.8 Critical — CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CreditNguyễn Bá Nam Dũng (@greengrass19000) and Hà Thế Long (LongHT), Viettel Cyber Security Research Lab (@vcslab); Warisse Valentin (Aytio)
Advisoryhttps://www.synology.com/en-global/security/advisory/Synology_SA_26_19
Repositoryhttps://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 quote count inside the INSERT statement that the library builds next. The statement template then re-pairs that dangling quote with its own, swallows the comma separator, and the next attacker-controlled field is parsed as raw SQL. SYNODBExecute runs the statement through sqlite3_get_table, so stacked statements execute. The attacker reaches this path before authentication: the device_id parameter of the Auth API login flows through SynoPAMLogin_V2, the syno-otp-trust-device-id PAM environment, the pam_syno_otp.so module of the webui stack, and into SynoPamKey::SetID / SynoPamKey::Save. The fix replaces the fixed-buffer escape with SYNODBEscapeStrAllocEX, which allocates 2*len+1 bytes and never truncates.

This repository contains a containerised differential laboratory that runs the real, unmodified Synology libraries of every affected branch, a standard-library-only proof of concept, the captured evidence of the differential, and a 0-day sweep of the fixed line.


1. Root cause

1.1 The affected escape

SynoPamKeyImpl::DBEscapeStrings, vulnerable build (libsyno-pam-login.so.7.0, 7.2.2-72806, sha256 90992ce1…, function at +0x122bb0). For each of the seven string fields (id, user, scope, key, attribute1, attribute2, extrainfo):

for (lVar9 = 0x200; lVar9 != 0; lVar9 = lVar9 + -1) {   // zero the 4096-byte buffer
    *puVar12 = 0;
}
iVar4 = SYNODBEscapeStringEX(*(undefined8 *)(this + 0x20),   // db handle
                             &DAT_001faf00,                  // one global .bss buffer
                             0x1000,                         // fixed size: 4096
                             local_128);                     // attacker-controlled field
...
Json::Value::Value(local_148, (char *)&DAT_001faf00);        // statement uses the buffer

The fixed build (7.2.2-72806-10, sha256 41fd4452…, function at +0x122bd0) replaces the fixed-buffer call:

pcVar13 = SYNODBEscapeStrAllocEX(*(undefined8 *)(this + 0x20), local_128);
... SYNODBFreemem(pcVar13);

A full function-by-function comparison of both builds (385 named functions, Ghidra decompilation) shows this escape API swap is the entire fix; the five SQL builders are semantically identical apart from syslog line shifts.

1.2 The truncation in libsynodb.so

SYNODBEscapeStringEX dispatches through the connection's engine table to SQLITEEscapeString (sqlite.c), verified in the shipped libsynodb.so (format string %q at virtual address 0x10706a):

lVar1 = sqlite3_mprintf("%q", param_3);        // doubles ' — output is 2*len+1 worst case
snprintf(param_1, (long)param_2, "%s", lVar1); // silent truncation at 4095 bytes
sVar2 = strlen(param_1);                       // returns the truncated length

The arithmetic that breaks: an input of 4094 A characters plus one ' escapes to A×4094 + '' = 4096 bytes; snprintf keeps 4095 bytes = A×4094 + '. One quote of the doubled pair survives alone. The lab probe (evidence/escape-probe.txt) confirms this on the real library: input length 4095 returns rc=4095 with the escaped output ending in a lone ', while the fixed API SYNODBEscapeStrAllocEX returns all 4096 bytes.

1.3 The statement that turns truncation into injection

SynoPamKeyImpl::Save builds (template constants verified in .rodata and by tracing sqlite3_get_table):

INSERT OR REPLACE INTO key( id,user,scope,key,attribute1,attribute2,extrainfo,enabled)
VALUES ('<escaped id>','<escaped user>',...,'<escaped extrainfo>',<enabled>);

With the truncated id ending in a lone ' and the attacker choosing user freely, the generated statement becomes:

VALUES ('AAAA…AAAA'',' ,1,1,1,1,1,1,1); CREATE TABLE poc_marker(x); --','webui',...

The template quote after the dangling ' forms an escaped '' inside the literal, the comma separator is swallowed, the literal closes on the next template quote, and the user body is parsed as raw SQL. The injected text completes the eight-column VALUES list with seven fillers, terminates the INSERT with );, executes a stacked CREATE TABLE poc_marker(x);, and comments out the remaining template with --. The full statements captured from both builds are in evidence/sql-vulnerable.txt and evidence/sql-fixed.txt.

1.4 The pre-auth path

SynoPAMLogin_V2 (decompiled at +0x117060) maps its sixth parameter to a PAM environment entry:

SYNO::PamConf::SetEnv(conf, "syno-otp-trust-device-id", param_6);

pam_syno_otp.so, part of the webui PAM stack (/etc.defaults/pam.d/webui), reads that environment entry and stores the device through the exported API of the same library: _ZN10SynoPamKey5SetIDERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE, _ZN10SynoPamKey4SaveEv, _ZN10SynoPamKey4LoadEv, _ZN10SynoPamKey5PurgeEl (verified in its dynamic symbol table). Every field of the database row is therefore attacker-controlled before authentication succeeds. The database is opened at the hardcoded path /usr/syno/etc/private/session/syno-pam-key.db by SynoPamKeyImpl::DBContact (syno-pam-key-impl.cpp:0xd1).

2. Reproduction environment

Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    696
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    499
  • 3

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    396
  • 4

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    340
  • 5

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    258
  • 6

    antifox

    antifox-ai/antifox

    AI multi-agent autonomous penetration testing platform that runs recon, attack-surface discovery, exploitation validation and evidence-backed report delivery.

    257

Explore all tools

Browse our collection of tools

View all tools →