Preparing .gdbinit
# r2 lina
[0x0804d520]> aar
[0x0804d520]> s sym.imp.setitimer
[0x0804cf94]> vp
||||||| ;-- imp.setitimer:
||||||| ; CALL XREF from 0x08c8ff2b (unk)
||||||| ; CALL XREF from 0x08c8ffc8 (unk)
||||||| ; CALL XREF from 0x08c900d8 (unk)
||||||| ; CALL XREF from 0x08c9011e (unk)
||||||| 0x0804cf94 ff253c93bc09 jmp dword [reloc.setitimer_60] ; reloc.setitimer
||||||| 0x0804cf9a 6878060000 push 0x678
========< 0x0804cf9f e9f0f2ffff jmp 0x804c294 ;[1]
:> s 0x08c900d8
0x08c900d8 e8b7ce3bff call sym.imp.setitimer ;[1]
0x08c900dd c9 leave
0x08c900de c3 ret
0x08c900df 90 nop
; CALL XREF from 0x0805e9ba (unk)
; CALL XREF from 0x08c91ed9 (unk)
0x08c900e0 55 push ebp
0x08c900e1 89e5 mov ebp, esp
0x08c900e3 83ec28 sub esp, 0x28 ; '('
0x08c900e6 8b0da46ad109 mov ecx, dword [0x9d16aa4] ; [0x9d16aa4:4]=0x4c
0x08c900ec 81f93f420f00 cmp ecx, 0xf423f
,=< 0x08c900f2 7f34 jg 0x8c90128
# cat .gdbinit
Option 1: Modifying the rootfs
# cat enable_gdb.sh
# ./enable_gdb.sh asa842-k8.bin
# # Checksum bypass
# scp -oKexAlgorithms=+diffie-hellman-group1-sha1 asa842-k8.bin admin@asa:asa842-k8-gdb.bin
# gdb
asa(config)# boot system disk0:/asa842-k8-gdb.bin
asa(config)# wr
asa(config)# reload
Option 2: Modifying kernel boot parameters
# r2 -w asa842-k8.bin
[0x00000000]> / quiet
[0x00000000]> s hit0_1
[0x017ed8dc]> px
[0x017ed8dc]> w rdinit=/bin/sh k
[0x017ed8dc]> px
# # Checksum bypass
# scp -oKexAlgorithms=+diffie-hellman-group1-sha1 asa842-k8.bin admin@asa:asa842-k8-binsh.bin
# gdb
asa(config)# boot system disk0:/asa842-k8-binsh.bin
asa(config)# wr
asa(config)# reload
# sed -i 's/#\(.*\)ttyUSB0\(.*\)/\1ttyS0\2/' /asa/scripts/rcS
# exec /sbin/init
References
http://www.slideshare.net/CanSecWest/csw2016-wheeler-barksdalegruskovnjakexecutemypacket
http://2014.ruxcon.org.au/assets/2014/slides/Breaking%20Bricks%20Ruxcon%202014.pdf
https://community.rapid7.com/community/metasploit/blog/2016/06/14/asa-hack
https://blog.silentsignal.eu/2016/08/25/bake-your-own-extrabacon/
No comments:
Post a Comment