fix: SSRF in IndicatorAction URL handler
#2822
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Version: 0.7.2
CVSS: 3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Score: 9.8 (Critical)
Description
There is a critical Server-Side Request Forgery (SSRF) vulnerability in IndicatorAction that allows remote attackers to perform arbitrary HTTP requests from the server. The vulnerability stems from the IndicatorAssistantAgent's complete lack of input validation when processing LLM-generated JSON containing URL parameters.
The
IndicatorAction.run()method directly passes user-influenced parameters (api, method, args) to Python's requests library without any URL validation, whitelisting, or security controls. Attackers can exploit this through prompt injection to make the LLM generate malicious JSON payloads that trigger requests to internal network resources, cloud metadata endpoints, or arbitrary external services.The IndicatorAssistantAgent is automatically registered via the agent scanning mechanism and exposed through the agent chat API endpoints, making this vulnerability remotely exploitable by default in all DB-GPT installations.
Source - Sink Analysis
Source: User-controlled message content in agent chat API requests
Call Chain:
/api/v1/agent/chat) with user messageapp_agent_chat()function inpackages/dbgpt-serve/src/dbgpt_serve/agent/agents/controller.py:409agent_chat_v2()function inpackages/dbgpt-serve/src/dbgpt_serve/agent/agents/controller.py:162agent_team_chat_new()function inpackages/dbgpt-serve/src/dbgpt_serve/agent/agents/controller.py:477user_proxy.initiate_chat()inpackages/dbgpt-core/src/dbgpt/agent/core/base_agent.py:688ConversableAgent.receive()→generate_reply()→act()inpackages/dbgpt-core/src/dbgpt/agent/core/base_agent.py:609IndicatorAction.run()inpackages/dbgpt-core/src/dbgpt/agent/expand/actions/indicator_action.py:88self._input_convert(ai_message, IndicatorInput)inpackages/dbgpt-core/src/dbgpt/agent/expand/actions/indicator_action.py:100requests.get(),requests.post(), orrequests.request()with unvalidated user-controlled URL inpackages/dbgpt-core/src/dbgpt/agent/expand/actions/indicator_action.py:106-121Proof of Concept
Impact
cc: @fangyinc @Aries-ckt