Skip to content

fix(agents): prevent path traversal in AgentTool config_path resolution#1218

Open
adilburaksen wants to merge 1 commit into
google:mainfrom
adilburaksen:fix/config-path-traversal
Open

fix(agents): prevent path traversal in AgentTool config_path resolution#1218
adilburaksen wants to merge 1 commit into
google:mainfrom
adilburaksen:fix/config-path-traversal

Conversation

@adilburaksen
Copy link
Copy Markdown

Summary

resolveSubAgentFromConfigPath in ConfigAgentUtils.java accepted absolute configPath values unconditionally and resolved relative paths without boundary validation. An attacker-controlled config_path field in an agent YAML could read arbitrary files.

Vulnerable pattern (before):

if (Path.of(configPath).isAbsolute()) {
    subAgentConfigPath = Path.of(configPath);   // absolute accepted
} else {
    subAgentConfigPath = configDir.resolve(configPath);  // no ".." check
}

Fix

  • Reject absolute configPath values with ConfigurationException
  • Normalize the resolved path and verify it stays within configDir before loading

Related

Same vulnerability exists in adk-python (PR: google/adk-python#5826) and adk-go — fix pattern is identical across all three SDKs.

@google-cla
Copy link
Copy Markdown

google-cla Bot commented May 23, 2026

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.

@adilburaksen
Copy link
Copy Markdown
Author

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; normalize and verify the resolved path stays
within the parent agent's directory before loading.
@adilburaksen adilburaksen force-pushed the fix/config-path-traversal branch from 4421e80 to 6e306c8 Compare May 23, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant