Detect Daptin Unauthenticated SQL Injection via `sort` Parameter (CVE-2026-77367) in Microsoft Sentinel
Detects exploitation of CVE-2026-77367, an unauthenticated SQL injection vulnerability in Daptin (github.com/daptin/daptin) versions <= 0.12.29. The `sort` query parameter on every entity list endpoint (e.g. GET /api/{entity}?sort=...) is concatenated directly into the ORDER BY clause of the backend SQL query without validation or allowlisting (CWE-20/CWE-89), allowing an unauthenticated attacker to inject arbitrary SQL. Because ORDER BY context forbids UNION directly, attackers typically weaponise this with subqueries, boolean/time-based blind techniques (e.g. CASE WHEN ... THEN ... ELSE), or stacked statements depending on the backend (SQLite/MySQL/Postgres). Detection focuses on anomalous `sort` parameter values on Daptin entity list endpoints containing SQL metacharacters and injection keywords from unauthenticated clients. Fixed in v0.12.30 (commit b0bcc1318832b9055781f032853ef9d2264652cf).
MITRE ATT&CK
- Tactic
- Initial Access Collection
KQL Detection Query
// df00tech DF00-d8c004827c · https://df00tech.com/detections/CVE-2026-77367 · licence: https://df00tech.com/detections/licence
let sqlPatterns = dynamic(["select","union","case when"," then ","sleep(","pg_sleep","benchmark(","randomblob","waitfor delay","substr(","substring(","extractvalue","updatexml","information_schema","sqlite_master","--","/*","0x"]);
let sqlChars = dynamic(["'","\"","(",")",";"]);
W3CIISLog
| where csUriStem has "/api/"
| where csUriQuery has "sort="
| extend sortVal = tolower(url_decode(extract(@"[?&]sort=([^&]+)", 1, csUriQuery)))
| where isnotempty(sortVal)
| where sortVal has_any (sqlPatterns) or sortVal has_any (sqlChars)
| project TimeGenerated, cIP, csMethod, csUriStem, csUriQuery, sortVal, scStatus, csUserAgent, sSiteName
| summarize hits=count(), queries=make_set(sortVal, 20) by cIP, csUriStem, bin(TimeGenerated, 1h)
| sort by hits desc Flags requests to Daptin entity list endpoints (/api/...) where the decoded `sort` parameter contains SQL injection keywords or metacharacters. Works against IIS/reverse-proxy logs fronting Daptin. Aggregates by source IP and endpoint.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate multi-column sorts that use commas and parentheses in column expressions
- Security scanners and authorized penetration tests probing the sort parameter
- Applications that pass encoded or templated sort expressions containing quotes for legitimate column aliases
Other platforms for CVE-2026-77367
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 blind SQLi probe via sort parameter
Expected signal: Web/proxy access log entry for GET /api/user_account with URL-encoded sort parameter containing 'CASE WHEN'
- Test 2 Time-based blind SQLi via sort parameter (SQLite)
Expected signal: Access log entry with elevated response time and sort parameter containing 'randomblob'
- Test 3 Quote/comment metacharacter injection probe
Expected signal: Web log entry with URL-encoded sort value name'-- and likely HTTP 500 response
References (5)
- https://github.com/daptin/daptin/security/advisories/GHSA-hq2p-f2vj-v3cm
- https://nvd.nist.gov/vuln/detail/CVE-2026-77367
- https://github.com/daptin/daptin/commit/b0bcc1318832b9055781f032853ef9d2264652cf
- https://github.com/daptin/daptin/releases/tag/v0.12.30
- https://github.com/advisories/GHSA-hq2p-f2vj-v3cm
Response Playbook
Triage
- Confirm the targeted host runs Daptin and determine its version; versions <= 0.12.29 are vulnerable. Check the release/banner or deployment manifest and compare against the fixed v0.12.30.
- Extract and URL-decode the full `sort` parameter value from the flagged request(s) and classify the injection technique (boolean-blind CASE WHEN, time-based sleep/pg_sleep/benchmark/randomblob, subquery data exfiltration, or stacked statements).
- Determine whether the request was unauthenticated (no/invalid session token), this CVE requires no authentication, so unauthenticated hits on entity list endpoints are high priority.
- Review response status codes and sizes/timing for the flagged requests: HTTP 500 errors or anomalously long response times indicate the injection was processed by the database.
Containment
- Deploy a WAF/reverse-proxy rule to reject requests to Daptin /api/ endpoints where the `sort` parameter does not match a strict column-name allowlist (alphanumeric, underscore, optional leading '-' and comma-separated fields only).
- Upgrade Daptin to v0.12.30 or later (commit b0bcc1318832b9055781f032853ef9d2264652cf) across all instances; if immediate patching is not possible, restrict network access to the Daptin API to trusted sources.
- Block the identified attacker source IP(s) at the perimeter and invalidate any sessions or API tokens observed from them.
Evidence Collection
- Preserve full web/proxy access logs containing the raw and decoded `sort` parameter values, source IPs, user agents, timestamps, and response codes/sizes.
- Capture the Daptin application and database query logs for the affected time window to identify which SQL statements executed and what data was read.
- Snapshot the backing database (SQLite file / MySQL / Postgres) and Daptin configuration to support damage assessment and determine whether credentials or sensitive entity data were exfiltrated.
Escalation Criteria
- !Escalate to incident response if the injected payload demonstrates successful data retrieval (differential boolean responses, measurable time delays, or error-based data in responses) rather than mere probing.
- !Escalate if evidence shows exfiltration of user credentials, API tokens, or administrative records, or if stacked-statement write/DDL activity is observed against the database.
- !Escalate to the application owner and change management to expedite the v0.12.30 upgrade if any vulnerable internet-exposed Daptin instance is confirmed.
Investigation Guide
Forensic Artifacts
- >
Web/reverse-proxy access logs with the raw and URL-decoded `sort` query parameter - >
Daptin application logs and database query/slow logs showing the executed ORDER BY clause - >
Backing database audit trail and any error logs referencing malformed ORDER BY syntax
Tuning Guidance
Baseline the legitimate `sort` values produced by your Daptin front-end and whitelist them; most real traffic uses simple column names with an optional leading '-' for descending order. Tighten the metacharacter match (quotes, parentheses, semicolons, comment sequences) if commas/parentheses appear in legitimate multi-column sorts. Exclude known scanner source IPs used for authorized testing. Prioritise alerts where the source is unauthenticated and where response status is 500 or response timing is anomalous, which distinguish successful injection from benign keyword collisions.
Hunting Queries
Hunt for SQL injection payloads in the Daptin `sort` parameter across historical web logs, grouped by source IP to surface repeat offenders and blind-injection probing.
// df00tech DF00-d8c004827c · https://df00tech.com/detections/CVE-2026-77367 · licence: https://df00tech.com/detections/licence
W3CIISLog | where csUriStem has "/api/" and csUriQuery has "sort=" | extend sortVal = url_decode(extract(@"[?&]sort=([^&]+)", 1, csUriQuery)) | where sortVal matches regex @"(?i)(case\s+when|sleep\(|pg_sleep|benchmark\(|randomblob|'|--)" | summarize count(), make_set(sortVal) by cIP ``` df00tech DF00-d8c004827c · https://df00tech.com/detections/CVE-2026-77367 · licence: https://df00tech.com/detections/licence ```
index=web uri_query="*sort=*" uri_path="*/api/*" | rex field=uri_query "(?i)[?&]sort=(?<s>[^&]+)" | eval s=urldecode(s) | search s="*select*" OR s="*case when*" OR s="*sleep(*" OR s="*'*" OR s="*--*" | stats count values(s) by src_ip Atomic Red Team Tests
Sends a CASE WHEN conditional payload in the sort parameter to a lab Daptin instance to test whether differential responses reveal the injection.
Command
curl -s -G 'http://daptin.lab.local:6336/api/user_account' --data-urlencode "sort=(CASE WHEN (1=1) THEN name ELSE email END)" Cleanup
echo 'No cleanup required; read-only request' Expected Telemetry
Web/proxy access log entry for GET /api/user_account with URL-encoded sort parameter containing 'CASE WHEN'
Expected Detection
KQL/SPL/EQL rules match on the 'case when' keyword in the decoded sort parameter
Injects a randomblob-based delay payload in the sort parameter against a lab Daptin instance using a SQLite backend to confirm time-based blind injection.
Command
curl -s -o /dev/null -w '%{time_total}\n' -G 'http://daptin.lab.local:6336/api/world' --data-urlencode "sort=(CASE WHEN 1=1 THEN randomblob(100000000) ELSE 1 END)" Cleanup
echo 'No cleanup required; read-only request' Expected Telemetry
Access log entry with elevated response time and sort parameter containing 'randomblob'
Expected Detection
Detection rules match 'randomblob' keyword; anomalous response timing corroborates successful injection
Sends a single-quote and comment-terminator payload in the sort parameter to trigger a SQL syntax error, confirming unsanitised concatenation.
Command
powershell -Command "Invoke-WebRequest -UseBasicParsing 'http://daptin.lab.local:6336/api/document?sort=name%27--'" Cleanup
Write-Output 'No cleanup required; read-only request' Expected Telemetry
Web log entry with URL-encoded sort value name'-- and likely HTTP 500 response
Expected Detection
Detection rules match the %27 (encoded quote) and -- comment indicators in the sort parameter