Detect Payload CMS SQL Injection via SQLite/Postgres Adapter (CVE-2026-105845) in Microsoft Sentinel
Detects exploitation attempts and post-exploitation signals for CVE-2026-105845, a critical (CVSS 9.8, CWE-89) SQL injection vulnerability in Payload CMS (npm package 'payload') affecting versions >= 3.0.0, < 3.88.0 and >= 4.0.0-canary.0, < 4.0.0-canary.27. An untrusted user who can query readable collections through dynamic filters or joins can submit a request that causes SQL injection in the SQLite and Postgres adapters. The issue is fixed in 3.88.0 and 4.0.0-canary.27. Detection focuses on SQL metacharacters and injection tokens appearing in Payload API request parameters, anomalous database errors, and outbound Node.js process behaviour consistent with injection.
MITRE ATT&CK
KQL Detection Query
// df00tech DF00-7174c825e6 · https://df00tech.com/detections/CVE-2026-105845 · licence: https://df00tech.com/detections/licence
let siTokens = dynamic(["' OR ","' or ","union select","UNION SELECT","--","/*","*/","; drop ","; DROP ","pg_sleep","sleep(","waitfor delay","information_schema","sqlite_master","xp_cmdshell","' AND '1'='1","0x","char(","concat(","/**/"]);
let payloadPaths = dynamic(["/api/","/graphql","?where","?sort","&where","&sort"]);
union isfuzzy=true
(
W3CIISLog
| project TimeGenerated, SourceIp=cIP, Host=sSiteName, Uri=strcat(csUriStem, "?", csUriQuery), Method=csMethod, Status=scStatus, UA=csUserAgent
),
(
AzureDiagnostics
| where ResourceType == "APPLICATIONGATEWAYS"
| project TimeGenerated, SourceIp=clientIp_s, Host=host_s, Uri=requestUri_s, Method=httpMethod_s, Status=httpStatus_d, UA=userAgent_s
)
| where Uri has_any (payloadPaths)
| where Uri has_any (siTokens)
| extend DecodedUri = url_decode(Uri)
| where DecodedUri has_any (siTokens)
| summarize Attempts=count(), DistinctUris=dcount(Uri), SampleUri=make_set(Uri, 5), StatusCodes=make_set(Status, 5) by SourceIp, Host, Method, bin(TimeGenerated, 10m)
| where Attempts >= 1
| order by Attempts desc Flags HTTP requests to Payload CMS REST (/api/) or GraphQL endpoints whose query strings (notably 'where' and 'sort' operators) contain SQL-injection tokens after URL decoding. Covers IIS/W3C logs and Azure Application Gateway diagnostics in front of the Node.js app.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate 'where' filters that contain comparison operators or literal strings resembling SQL (e.g. article bodies with the word UNION or code-sample content being saved).
- Automated security scanners and approved penetration tests generating injection payloads.
- Developers or QA submitting test data containing SQL metacharacters in rich-text or code fields.
Other platforms for CVE-2026-105845
Testing Methodology
Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are further down this page.
- Test 1 Boolean-based SQLi probe via Payload REST 'where' operator
Expected signal: Web server / proxy access log entry for GET /api/posts with a URL-decoded query string containing "' OR '1'='1".
- Test 2 UNION-based SQLi attempt via GraphQL variable
Expected signal: POST /api/graphql access log and application/DB log showing a UNION SELECT token reaching the SQLite/Postgres adapter.
- Test 3 Time-based blind SQLi with pg_sleep
Expected signal: Access log with pg_sleep( in the decoded query string and a correspondingly delayed response time; Postgres log showing the sleep query.
Response Playbook
Triage
- Identify the Payload CMS instance targeted and confirm its version: inspect package.json / package-lock.json or `npm ls payload`. Versions >= 3.0.0 < 3.88.0 and >= 4.0.0-canary.0 < 4.0.0-canary.27 are vulnerable.
- Extract and URL-decode the full offending request(s) from the alert. Determine which parameter carried the injection (REST 'where'/'sort' operators, GraphQL variables, or nested field operators) and whether the payload is a probe (boolean/UNION) or data-exfiltration attempt.
- Correlate the source IP against authentication logs and prior activity to determine if the request was authenticated, from a known scanner, or from an unexpected origin; check response status codes and sizes for signs of successful data return (large/200 responses vs 500 DB errors).
- Review database (Postgres/SQLite) logs for the same time window for malformed queries, syntax errors, or unexpectedly expensive queries tied to the request.
Containment
- Apply the fix immediately: upgrade Payload to >= 3.88.0 (or >= 4.0.0-canary.27 on the canary line); the fix is commit a742140ab4fca3160f7f83e9e7d996552ffc3b5a.
- If patching cannot be done immediately, place a WAF/reverse-proxy rule in front of the Node.js app blocking SQL-injection tokens in 'where'/'sort' query parameters on /api/ and /graphql, and restrict the API to authenticated/trusted networks.
- Rotate database credentials and any secrets reachable by the application DB user if exploitation is confirmed, and revoke sessions/API keys associated with the attacking requests.
Evidence Collection
- Preserve raw web server / reverse-proxy / WAF access logs covering the attack window, including full query strings and request bodies, plus Postgres/SQLite query logs.
- Capture the running Payload version artifacts (package-lock.json, deployed node_modules/payload/package.json) and container image digest to document exposure.
- Snapshot the database and relevant tables to establish whether data was read or modified, and export application logs showing the executed queries.
Escalation Criteria
- !Escalate to incident response if responses indicate successful data retrieval (UNION-based output, boolean/time-based confirmation, or large anomalous 200 responses) or if sensitive tables (users, credentials, tokens) were queried.
- !Escalate if the vulnerable version is confirmed internet-exposed and unauthenticated access to the API is possible, given the CVSS 9.8 rating.
- !Escalate to data-protection/legal if PII or credential data may have been exfiltrated via the injection.
Investigation Guide
Forensic Artifacts
- >
Web server / reverse-proxy / WAF access logs with URL-decoded query strings showing injection tokens in 'where'/'sort' parameters. - >
Postgres/SQLite server logs showing anomalous or malformed SQL and unusually expensive queries. - >
Payload application (Node.js) logs and stack traces referencing the SQLite/Postgres adapter, plus package-lock.json documenting the installed version.
Tuning Guidance
Baseline legitimate Payload 'where'/'sort' usage for your application: many apps legitimately send 'or' operators and comparison tokens, so prefer high-signal patterns (UNION SELECT, pg_sleep, sqlite_master, information_schema, stacked '; DROP') over broad metacharacters to reduce noise. Allowlist known scanners and CI/CD test runners by source IP, and exclude rich-text/code-snippet fields known to contain SQL-like content. Once Payload is confirmed patched to >= 3.88.0 across all instances, lower severity or scope the rule to residual probing detection rather than active-exploitation response.
Hunting Queries
Hunt across historical web logs for Payload CMS API/GraphQL requests whose decoded query strings carry SQL-injection signatures, to identify prior probing or exploitation before the alert window.
// df00tech DF00-7174c825e6 · https://df00tech.com/detections/CVE-2026-105845 · licence: https://df00tech.com/detections/licence
W3CIISLog | extend q = url_decode(csUriQuery) | where csUriStem has_any ("/api/", "/graphql") | where q has_any ("union select","pg_sleep(","sqlite_master","information_schema","' or '","--") | project TimeGenerated, cIP, csUriStem, q, scStatus | order by TimeGenerated desc ``` df00tech DF00-7174c825e6 · https://df00tech.com/detections/CVE-2026-105845 · licence: https://df00tech.com/detections/licence ```
index=web (uri_path="*/api/*" OR uri_path="*/graphql*") | eval q=urldecode(uri_query) | search q="*union select*" OR q="*pg_sleep(*" OR q="*sqlite_master*" OR q="*information_schema*" OR q="*' or '*" | table _time src_ip uri_path q status Atomic Red Team Tests
Sends a REST API request with a SQL-injection payload in a 'where' field operator against a lab Payload CMS instance to confirm the detection fires on API query strings.
Command
curl -s -G 'http://localhost:3000/api/posts' --data-urlencode "where[title][equals]=x' OR '1'='1" -o /tmp/payload_sqli_probe.out Cleanup
rm -f /tmp/payload_sqli_probe.out Expected Telemetry
Web server / proxy access log entry for GET /api/posts with a URL-decoded query string containing "' OR '1'='1".
Expected Detection
KQL/SPL/EQL rules match on the SQL-injection token within the /api/ request query string.
Issues a GraphQL query whose variable carries a UNION SELECT payload against a lab Payload instance to validate GraphQL-path detection.
Command
curl -s -X POST 'http://localhost:3000/api/graphql' -H 'Content-Type: application/json' --data '{"query":"query($w:String){Posts(where:{title:{equals:$w}}){docs{id}}}","variables":{"w":"x UNION SELECT username,password FROM users--"}}' -o /tmp/payload_sqli_union.out Cleanup
rm -f /tmp/payload_sqli_union.out Expected Telemetry
POST /api/graphql access log and application/DB log showing a UNION SELECT token reaching the SQLite/Postgres adapter.
Expected Detection
Detection matches on 'union select' and 'graphql' indicators in web/HTTP telemetry.
Sends a time-based blind injection using pg_sleep via the 'where' operator to a lab Payload instance backed by Postgres, confirming detection of time-based payloads.
Command
curl -s -G 'http://localhost:3000/api/posts' --data-urlencode "where[title][like]=x');SELECT pg_sleep(5)--" -o /tmp/payload_sqli_time.out Cleanup
rm -f /tmp/payload_sqli_time.out Expected Telemetry
Access log with pg_sleep( in the decoded query string and a correspondingly delayed response time; Postgres log showing the sleep query.
Expected Detection
Detection matches on 'pg_sleep(' and stacked-query tokens in the request.