Summarizing this from a WMF Slack conversation.
The Web Task Creation Form linked at https://www.mediawiki.org/wiki/Reading/Web/Request_process throws a 403.
Narrowing this down, so does the following:
https://phabricator.wikimedia.org/maniphest/task/edit/form/1/?title=%3F
From /var/log/apache2/phabricator_error.log:
[Mon Jul 15 20:38:16.826622 2024] [rewrite:error] [pid 947281:tid 947294] [client redacted] AH10508: Unsafe URL with %3f URL rewritten without UnsafeAllow3F
This led us to a Stackoverflow question (403 Forbidden when URL contains GET with encoded question mark / UnsafeAllow3F / rawurlencode), and thus to CVE-2024-38474:
Substitution encoding issue in mod_rewrite in Apache HTTP Server 2.4.59 and earlier allows attacker to execute scripts in directories permitted by the configuration but not directly reachable by any URL or source disclosure of scripts meant to only to be executed as CGI. Users are recommended to upgrade to version 2.4.60, which fixes this issue. Some RewriteRules that capture and substitute unsafely will now fail unless rewrite flag "UnsafeAllow3F" is specified.
Upstream patch:
Some verbatim discussion:
- @bd808: "Setting this flag is required to allow a rewrite to continue If the HTTP request being written has an encoded question mark, '%3f', and the rewritten result has a '?' in the substiution." -- https://httpd.apache.org/docs/current/rewrite/flags.html#flag_unsafe_allow_3f
- @bd808: The RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA] rule at https://gerrit.wikimedia.org/r/plugins/gitiles/operations/puppet/+/refs/heads/production/modules/phabricator/templates/phabricator-default.conf.erb#75 is going to trigger on this. Not sure what else.
- @brennen: if "permitted by the configuration" just means /srv/phab/phabricator/webroot, this might not matter any, but i'm not confident about that.
I only know of this affecting phabricator.wikimedia.org, but it seems possible it might come up elsewhere. Initially filing this as a security task out of a probable excess of caution.