Skip to content

Fix SSRF bypass of trusted_uri in {fetch} (PT-03-2026)#1187

Open
wisskid wants to merge 1 commit into
masterfrom
hotfix/vulnreportpositivetechnologies
Open

Fix SSRF bypass of trusted_uri in {fetch} (PT-03-2026)#1187
wisskid wants to merge 1 commit into
masterfrom
hotfix/vulnreportpositivetechnologies

Conversation

@wisskid
Copy link
Copy Markdown
Member

@wisskid wisskid commented May 18, 2026

Summary

  • {fetch} with an https:// (or other non-http) URL called file_get_contents without a stream context. PHP's HTTP wrapper auto-follows redirects, so an Open Redirect on a trusted host could be used to bypass the trusted_uri security policy and reach arbitrary internal addresses (SSRF).
  • When security_policy is active, the fetch now uses a stream context with follow_location=0 / max_redirects=1. Behaviour is unchanged for users without a security policy (no BC break).
  • The http:// branch goes through fsockopen, which never auto-followed redirects, so it was already safe.

Report

Reported by Aleksey Solovev (Positive Technologies), advisory PT-03-2026. Handled as a normal patch release; no CVE filing requested.

Files

  • src/FunctionHandler/Fetch.php — add stream context disabling redirect following under security policy.
  • changelog/ssrf-pt-03-2026.md — changelog snippet.

Compatibility

  • PHP 7.2–8.5, no API surface change.
  • Users without enableSecurity() see no behaviour change.

When a security policy is active and {fetch} is used with a non-http URL
scheme (https, ftp, ...), file_get_contents was called without a stream
context. PHP's HTTP wrapper follows redirects by default, so an Open
Redirect on a trusted host could be used to bypass the trusted_uri check
and reach arbitrary internal addresses (SSRF).

Pass a stream context with follow_location=0 and max_redirects=1 when a
security policy is configured. Behaviour is unchanged for users without
a security policy.

Reported by Aleksey Solovev (Positive Technologies), PT-03-2026.
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