Skip to content

SSRF in agent HTTP tools + RSS loader (missing/fail-open URL guard) #1022

Closed

Description

@AmitoVrito

Summary

Several agent HTTP tools and one loader fetch attacker/LLM/document-derived URLs with no SSRF guard, or a fail-open one. The repo already ships a correct, fail-closed reference guard at loaders/_url_guard.py (validate_public_url / assert_response_url_public) used by loaders/web.py and loaders/sitemap.py. These sites don't use it:

  • agents/tools/http_request.py:101 — LLM-supplied url passed straight to session.request(...). No scheme allowlist, no private-IP block → http://169.254.169.254/ metadata exfil, file:///internal services.
  • agents/tools/graphql.py:88 — same, LLM-supplied endpoint.
  • agents/tools/api_builder.py — worse: request URL assembled from an OpenAPI spec's servers[0].url + LLM-selected path, and the spec itself is fetched from a remote openapi_url. No scheme/IP validation; an absolute path in urljoin overrides the base.
  • agents/tools/web_scraper.py:23-42 — rolls its own guard that fails open: on socket.gaierror/ValueError it returns (allows), is IPv4-only via gethostbyname, and checks only the first resolved address.
  • loaders/rss.py:20 — feedparser.parse(self._url) on an unvalidated URL; accepts file:// (local file read), unlike its hardened siblings.

Severity

HIGH (http_request/graphql/api_builder — clean metadata-exfil path) / MEDIUM (web_scraper fail-open, rss file://).

Fix (non-breaking)

Route every fetch through loaders/_url_guard.validate_public_url before the request; re-validate on redirect hops where the client follows them (assert_response_url_public). For rss.py, block non-http(s) schemes and private IPs while still allowing plain local file paths (no scheme) for backward compatibility. Delete web_scraper.py's bespoke fail-open guard in favour of the shared one.

Acceptance

  • Regression tests: 169.254.169.254, 127.0.0.1, RFC1918, and file:// all rejected at each site; DNS-failure fails closed; public URLs still allowed.
  • CHANGELOG [Unreleased] Security entry.

Activity

  1. added
    bug
    security
    on Sep 8, 2026
  2. added 2 commits that reference this issue on Sep 12, 2026
    608b28c
    910602e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsecurity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions