Skip to content

fix(plugin): block SSRF to private and metadata hosts in tool HTTP calls - #2758

Open
BetterAndBetterII wants to merge 1 commit into
coze-dev:mainfrom
BetterAndBetterII:fix/plugin-ssrf-block-internal-hosts
Open

BetterAndBetterII wants to merge 1 commit into
coze-dev:mainfrom
BetterAndBetterII:fix/plugin-ssrf-block-internal-hosts

Conversation

@BetterAndBetterII

Copy link
Copy Markdown

Summary

Plugin tool HTTP invocation built requests from attacker-controlled server/path values with no scheme check and no private/metadata IP blocking, so any authenticated user could reach internal-only hosts (loopback, RFC1918, link-local metadata, CGNAT) and non-HTTP schemes via tool execution / Test Run.

This change:

  • Allows only http/https
  • Rejects loopback, private, link-local, unspecified, multicast, and CGNAT (100.64.0.0/10) addresses (including IPv4-mapped forms)
  • Re-validates the resolved IP at dial time (DNS rebinding)
  • Re-validates redirect targets

Fixes #2711

Test plan

  • cd backend && go test ./domain/plugin/service/tool/ -count=1
  • Unit coverage for loopback / RFC1918 / link-local metadata / CGNAT / non-HTTP schemes / public TEST-NET allow / dial-time reject

Plugin tool execution built requests from attacker-controlled server URLs
with no scheme or destination checks. Restrict to http/https, reject
loopback/private/link-local/CGNAT/metadata addresses, and re-validate at
dial and redirect time.

Fixes coze-dev#2711
Copilot AI lite review requested due to automatic review settings August 31, 2026 00:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

Unrestricted SSRF in plugin tool execution allows any authenticated user to reach internal-only network services

2 participants