Last active
March 30, 2021 13:02
-
-
Save iAugur/4233bb9e251a51d661994471db176110 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# block if request has header HTTP_USER_AGENTT | |
# e.g. Useful to protect against the PHP "zerodium" backdoor | |
# https://thehackernews.com/2021/03/phps-git-server-hacked-to-insert-secret.html | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{HTTP:HTTP_USER_AGENTT} !^$ | |
RewriteRule ^ - [F] | |
</IfModule> | |
# Another approach would be to always unset the header from the request | |
# before PHP receives it | |
<IfModule mod_headers.c> | |
RequestHeader unset HTTP_USER_AGENTT early | |
</IfModule> | |
# Test: curl -v -I 'https://yourwebsite.com/' -H 'HTTP_USER_AGENTT:anyvalue but could start with zerodium' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment