Skip to content

fix(files/storage): add SSRF host validation to DAV storage constructor#41576

Open
DeepDiver1975 wants to merge 3 commits into
masterfrom
security/fix-dav-storage-ssrf
Open

fix(files/storage): add SSRF host validation to DAV storage constructor#41576
DeepDiver1975 wants to merge 3 commits into
masterfrom
security/fix-dav-storage-ssrf

Conversation

@DeepDiver1975
Copy link
Copy Markdown
Member

Summary

  • DAV storage constructor stored user-supplied host without any IP range or hostname validation
  • When user external storage mounting is enabled (admin opt-in), any authenticated user could target 169.254.169.254 (AWS metadata), localhost services, or RFC-1918 ranges
  • New validateHost() method blocks loopback, link-local, private IPv4/IPv6 ranges before the value is stored

Security Impact

High — SSRF allowing internal network reconnaissance and cloud metadata exfiltration when user mounting is enabled

Test plan

  • testSsrfBlockedHostThrows() — 23 blocked hosts (loopback, link-local, private ranges, IPv6 equivalents) each throw \InvalidArgumentException
  • testSsrfAllowedHostDoesNotThrow() — 7 legitimate public hostnames pass through unchanged
  • Run make test TEST_PHP_SUITE=lib/private/Files/Storage

🤖 Generated with Claude Code

The DAV storage class accepted arbitrary host values (including loopback,
link-local 169.254.x.x, RFC-1918 private ranges, and IPv6 equivalents)
without validation. When user external storage mounting is enabled, any
authenticated user could force the server to make HTTP requests to
cloud metadata endpoints, localhost services, or internal network hosts.

Adds validateHost() called immediately after scheme-stripping so all
downstream HTTP sinks (Guzzle GET/PUT and Sabre DAV Client) are covered.

Signed-off-by: Thomas Müller <thomas.mueller@owncloud.com>
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
@update-docs
Copy link
Copy Markdown

update-docs Bot commented Jun 5, 2026

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
… pass SSRF validation

Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
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