Repository navigation
Closed
Labels
pentestFrom penetration testing reportpriority-p0Blocking/urgentsecuritySecurity vulnerabilityseverity-highHigh severity security finding
Milestone
Description
Pentest Finding 3.1.4 — High (CVSS 8.5)
CVSS Vector: CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Location: POST /api/agents/{name}/ssh-access — services/ssh_service.py lines 56–83, routers/agents.py line 1368
Impact
When SSH access is enabled with auth_method=key, the server generates an SSH key pair entirely server-side and returns the private key in plaintext in the HTTP response body. The private key is:
- Transmitted over HTTP (unencrypted by default)
- Potentially logged by reverse proxies
- Stored in browser history
- Accessible in any intermediate system between client and server
Exploitation consequences:
- Docker network MitM — compromise of any container on the same Docker network yields the private key
- Host-level attacker —
nsenterortcpdumpon the host captures all internal Docker HTTP traffic - Key impersonation — server retains every private key ever issued without client knowledge
- Container takeover — SSH key grants developer shell access to agent containers with credentials,
.envfiles,.mcp.json - Credential pivot — once inside a container, injected credentials are directly accessible at
/home/developer/.env
Root Cause
services/ssh_service.py lines 56–83 generate the keypair server-side with NoEncryption() and return the private key bytes directly. routers/agents.py line 1368 includes private_key verbatim in the JSON response.
Steps to Reproduce
POST /api/agents/shared/ssh-access
Authorization: Bearer {USER_TOKEN}
# Response includes full unencrypted private key in "private_key" fieldRemediation
- Remove server-side keypair generation entirely — change the API to accept a client-supplied
public_keyparameter - Server only calls
inject_ssh_key(public_key)to append toauthorized_keys; private key never leaves the client - If server-side generation must be kept for UX reasons, mandate TLS-only deployment and suppress logging of the response body
- Enforce owner-only (not just
can_user_access_agent) access on the endpoint
References
Source: UnderDefense Web Pentest Report, March 2026
Metadata
Metadata
Assignees
Labels
pentestFrom penetration testing reportpriority-p0Blocking/urgentsecuritySecurity vulnerabilityseverity-highHigh severity security finding
Activity
vybe commentedon Mar 26, 2026
Fixed in upcoming PR. Changes:
Root cause: Server-side keypair generation returned private key in plaintext API response.
Fix:
generate_ssh_keypair()andcryptographydependency deleted)public_keyparameter — private key never leaves the clientcan_user_delete_agent— admin/owner only, not shared users)private_keyfield from API response and MCP typesFiles changed:
agent_ssh.py,ssh_service.py,agents.ts,client.ts,types.ts,test_ssh_service.pyfix(security): Remove server-side SSH keypair generation — require cl…
merge: Resolve changelog conflict after merging upstream/main
merge: integrate upstream/main into feature branch
fix(ssh): remove the broken password auth method from ssh-access (#1615…