RET overwrite

System Hacking Advanced

[dreamhack] Return Address Overwrite

Return Address Overwritevoid get_shell() { char *cmd = "/bin/sh"; char *args[] = {cmd, NULL}; execve(cmd, args, NULL);}int main() { char buf[0x28]; init(); printf("Input: "); scanf("%s", buf); return 0;}scanf("%s", buf)에서 길이 검증이 없다. 따라서 BOF가 발생한다. BOF 취약점을 이용해서 RET을 get_shell() 주소로 덮으면 쉘을 얻을 수 있다. gdb로 get_shell 주소를 구했다. 다음으로 buf ~ RET 거리를 구해보자. 를 보면 scanf() 호출 전에 [rbp-0x30]를 rax에 넣고 이를 ..

keyme
'RET overwrite' 태그의 글 목록