Onion host: FORCE_SSL_ADMIN makes wp-login.php / wp-admin unreachable #20
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type: availability. Follow-up to #16.
What happens
With
FORCE_SSL_ADMINon, a plain-http request towp-login.phpon a configured onion host gets core's https-upgrade redirect (wp-login.php:15,auth_redirect()). The URL rewriter always emits onion URLs ashttp, so theLocationcomes back ashttp://<onion>/wp-login.phpand the browser loops. Without the plugin, core would send the visitor tohttps://<onion>/, which normally has no TLS listener, so onion admin is unusable either way.auth_redirect()also readsSECURE_AUTH_COOKIEwheneverforce_ssl_admin()is true. A plain-http onion login never sets that cookie, so stopping only the redirect would still bounce wp-admin back to the login page.Proposed fix
When the request resolves to an onion host, call
force_ssl_admin( false )while the plugin boots. Core'swp_ssl_constants()has already run by then (it runs before regular plugins load), so this overridesFORCE_SSL_ADMINfor that request only. This switches off the wp-login upgrade, theauth_redirect()upgrade and secure-cookie check, and httpsadmin/loginURL schemes together. Also filtersecure_signon_cookietofalseon onion requests so the legacy per-useruse_ssloption can't issue a Secure-only auth cookie over http.Clearnet hosts are unaffected. Onion services are end-to-end encrypted by Tor, so
FORCE_SSL_ADMIN's purpose (no plaintext credentials or cookies) still holds. A network attacker who could make a victim's browser sendHost: <onion>over clearnet could equally serve their own fake login page, so this adds no attack surface. Auth cookies stay host-only (orCOOKIE_DOMAIN-scoped), so clearnet cookies are never sent to the onion host.