Skip to content

Commit cb03ca9

Browse files
author
jvoisin
committed
Make php_cgi_arg_injection work in certain environnement
This commit sets two more options to `0` in the payload: - [cgi.force_redirect](https://secure.php.net/manual/en/ini.core.php#ini.cgi.force-redirect) - [cgi.redirect_status_env](https://secure.php.net/manual/en/ini.core.php#ini.cgi.redirect-status-env) The configuration directive `cgi.force_redirect` prevents anyone from calling PHP directly with a URL like http://my.host/cgi-bin/php/secretdir/script.php. Instead, PHP will only parse in this mode if it has gone through a web server redirect rule. The string set in the configuration directive `cgi.redirect_status_env` is the one that PHP will look for to know it's ok to continue its execution. This might be use together with the previous configuration option as a security measure. Setting those variables to 0 is (as stated in the documentation) a security issue, but it also make the exploit work on some Apache2 setup.
1 parent d0f6d4e commit cb03ca9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

modules/exploits/multi/http/php_cgi_arg_injection.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ def exploit
114114
create_arg("-d",'disable_functions=""'),
115115
create_arg("-d","open_basedir=none"),
116116
create_arg("-d","auto_prepend_file=php://input"),
117+
create_arg("-d", "cgi.force_redirect=0"),
118+
create_arg("-d", "cgi.redirect_status_env=0"),
117119
rand_opt_equiv("-n")
118120
]
119121

0 commit comments

Comments
 (0)