strace -fi
eip추적
ltrace -fi
라이브러리 추적
xxd
x/100s 0x0804800
문자열 찾기 쉬움!!
GNU 위치 0x08048174
메모리 맵
pid 보는법
gdb 돌린다음 info proc
gdb 에서 shell 치면 shell명령어 쓸수 있음
cat /proc/[pid]/maps
cat/proc/self/maps하면 지금 돌아가고 있는 맵스 볼 수 있음
bt
gdb디버깅중 프로그램이 죽었을 때 죽은 위치의 스택확인
ps -aux
실행중인 프로세스 목록
ldd 파일이름
프로그램실행시 로드되는 라이브러리 이름
plt주소 구하는법
그냥 어셈코드 보면됨
readelf -S
영역 주소
gcc -m32
32비트로 컴파일
strcpy("안쓰는 주소","/bin/sh") proc [pid]
libc 베이스 주소
python -c 'import sys; standout.~~ maps -> libc basic add구할수 있음 ->계산해서 offset구하기 libcstart-libc시작주소=libc basic add
system offset - start offset 구해서 basic add에 더하면 system주소구할수 있음
system offset=
return에 안쓰는주소(/bin/sh)덮어쓰기
gdb 에서 파이썬 인풋
r < <(python )
프로세스 서버 올리는 명령어(xinetd안될떄)
socat TCP-LISTEN:9999,reuseaddr,fork,bind=0.0.0.0 EXEC:"/home/rootbutcute/asdfas"
flush buffer
sudo socat TCP-LISTEN:7777,reuseaddr,fork,bind=0.0.0 exec:"stdbuf -i0 -o0 -e0 ./breakout"
socat TCP-LISTEN:7777,reuseaddr,fork,bind=0.0.0.0 exec:"./breakout",pty,ctty,echo=0
pop ret gadget찾을때
objdump -d (파일명) | grep -03 "ret"
<gadget찾기>
ROPgadget --binary (파일) -ropchain
<gadget string찾기>
ROPgadget --binary (파일 ) --string (문자)
자식프로세스를 디버깅
set follow-fork-mode child
0<&(fd)
fd에서 stdin으로 입력을 받음
1>&(fd)
출력을 fd로 전달
system('/bin/sh 0<&(fd) 1>&(fd)')하면
서버에서 쉘을 띄웠을때 stdin stdout에 입출력이 가능하다!!
<gdb reg eip 편하게 보기>
gdb -tui -q
layout asm
layout regs
끄기:
ctrl + x a
checksec
메모리 보호기법 뭐 걸려있는지 보여줌
'시스템 > 리눅스 기본' 카테고리의 다른 글
objdump 사용법 (0) | 2016.10.18 |
---|---|
라이브러리 참조순서 (0) | 2016.10.15 |
gdb layout (0) | 2016.10.13 |
find 명령어 정리 (0) | 2016.09.30 |
shellcode (0) | 2016.09.20 |