Skip to content

Patch against host header injection and host-based redirect poisoning#830

Merged
Fraenkiman merged 2 commits intoflatpressblog:masterfrom
Fraenkiman:Patch-against-host-header-injection
Mar 1, 2026
Merged

Patch against host header injection and host-based redirect poisoning#830
Fraenkiman merged 2 commits intoflatpressblog:masterfrom
Fraenkiman:Patch-against-host-header-injection

Conversation

@Fraenkiman
Copy link
Collaborator

@Fraenkiman Fraenkiman commented Mar 1, 2026

  • Prevents host header injection and host-based redirect poisoning when determining the BLOG_BASEURL.
  • wp_redirect() previously broke IPv6 redirects (it strips [ ]). This has now been adjusted so that IPv6 URLs remain valid in redirects.
  • We do not use host allowlists + 400 for mismatches and switching to relative URLs in templates so that FlatPress works correctly and optimally on as many web server platforms and web hosts as possible.

- Prevents host header injection and host-based redirect poisoning when determining the BLOG_BASEURL.
- wp_redirect() previously broke IPv6 redirects (it strips [ ]). This has now been adjusted so that IPv6 URLs remain valid in redirects.
- We do not use host allowlists + 400 for mismatches and switching to relative URLs in templates so that FlatPress works correctly and optimally on as many web server platforms and web hosts as possible.
@Fraenkiman Fraenkiman merged commit 66f794e into flatpressblog:master Mar 1, 2026
3 checks passed
Fraenkiman added a commit to Fraenkiman/flatpress that referenced this pull request Mar 1, 2026
- The setup must also be adjusted, otherwise no valid URLs will be output.
Fraenkiman added a commit that referenced this pull request Mar 1, 2026
- The setup must also be adjusted, otherwise no valid URLs will be output.
Fraenkiman added a commit to Fraenkiman/flatpress that referenced this pull request Mar 1, 2026
- With empty general [‘www’] and Request Host: evil.example, /admin.php still delivered Location: http://evil.example/login.php.

- It should now be fixed.
Fraenkiman added a commit that referenced this pull request Mar 1, 2026
- With empty general [‘www’] and Request Host: evil.example, /admin.php still delivered Location: http://evil.example/login.php.

- It should now be fixed.
Fraenkiman added a commit to Fraenkiman/flatpress that referenced this pull request Mar 1, 2026
- canonical_server_host() could unbracketed IPv6 in SERVER_NAME (::1) – but bracketed ([::1]) was converted back to localhost due to subsequent validation.
- general[‘www’] is now always set to the public canonical URL.
Fraenkiman added a commit that referenced this pull request Mar 1, 2026
- canonical_server_host() could unbracketed IPv6 in SERVER_NAME (::1) – but bracketed ([::1]) was converted back to localhost due to subsequent validation.
- general[‘www’] is now always set to the public canonical URL.
@Fraenkiman Fraenkiman deleted the Patch-against-host-header-injection branch March 4, 2026 22:31
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