fix(agents): prevent path traversal in AgentTool config_path resolution#5826
fix(agents): prevent path traversal in AgentTool config_path resolution#5826adilburaksen wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Response from ADK Triaging Agent Hello @adilburaksen, thank you for creating this PR! We really appreciate your contribution to fixing this path traversal vulnerability. However, it looks like this PR is currently not fully following our Contribution Guidelines. Could you please address the following items:
Once these items are addressed, it will be much easier and faster for our reviewers to evaluate your PR. Thank you! |
|
I have read the CLA Documents and I hereby sign the CLA. |
Absolute config_path values were accepted unconditionally, and relative paths were joined without boundary validation, allowing traversal outside the agent directory via "../../../etc/passwd" style inputs. Fix: reject absolute paths; for relative paths, verify the normalized result stays within the parent agent's directory before loading.
c04372a to
1274b09
Compare
Summary
resolve_agent_referenceinconfig_agent_utils.pyaccepted absoluteconfig_pathvalues unconditionally and joined relative paths without any boundary validation. An attacker-controlledconfig_pathfield in an agent YAML could traverse outside the intended agent directory.Vulnerable pattern (before):
PoC config:
This causes
open("/etc/passwd", "r")server-side. AFileNotFoundErrorvsValidationErrordifference also leaks path existence.Fix
config_pathvalues withValueErrorfrom_configRelated
Same vulnerability exists in
adk-java(PR: google/adk-java#...) andadk-go(PR: google/adk-go#...) — fix pattern is identical.Note: This is distinct from the
resolve_code_referenceRCE (different function, different field, file-read impact vs code execution).