[태그:] RTL

PADOCON 2010 CTF trililogy200 풀이 – RTL

이번 문제의 풀이는 이렇다. 우선 로또번호 6 자리를 맞추어야 한다. 그리고 맞추고 나면 argv[7] 값을 strcpy() 함수를 이용하 복사를 하나 이부분에서 오버플로우가 발생한다. 다만 역시 랜덤스택이라 RTL을 이용하여 풀이을 하여야 한다. 우선 로또값을 맞추는 코드부터 작성해 보자. #!/usr/bin/python import os, re p = os.popen('./lotto 1 2 3 4 5 6', 'r', 512) data = p.readlines() …

BOF 원정대 – Level 18 (nightmare)

문제 소스는 아래와 같다. /* The Lord of the BOF : The Fellowship of the BOF – nightmare – PLT */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <dumpcode.h> main(int argc, char *argv[]) { char buffer[40]; char *addr; if(argc < 2){ printf(argv error\n); exit(0); } // check address addr = (char *)&strcpy; if(memcmp(argv[1]+44, &addr, 4) …

BOF 원정대 – Level 17 (succubus)

문제 소스는 아래와 같다. /* The Lord of the BOF : The Fellowship of the BOF – succubus – calling functions continuously */ #include <stdio.h> #include <stdlib.h> #include <dumpcode.h> // the inspector int check = 0; void MO(char *cmd) { if(check != 4) exit(0); printf(welcome to the MO!\n); // olleh! system(cmd); } void YUT(void) { …

BOF 원정대 – Level 15 (assassin)

우선 문제소스는 아래와 같다. /* The Lord of the BOF : The Fellowship of the BOF – assassin – no stack, no RTL */ #include <stdio.h> #include <stdlib.h> main(int argc, char *argv[]) { char buffer[40]; if(argc < 2){ printf(argv error\n); exit(0); } if(argv[1][47] == '\xbf') { printf(stack retbayed you!\n); exit(0); } if(argv[1][47] == '\x40') { …

BOF 원정대 – Level 14 (giant)

문제 소스는 아래와 같다. /* The Lord of the BOF : The Fellowship of the BOF – giant – RTL2 */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> main(int argc, char *argv[]) { char buffer[40]; FILE *fp; char *lib_addr, *execve_offset, *execve_addr; char *ret; if(argc < 2){ printf(argv error\n); exit(0); } // gain address of execve fp …

BOF 원정대 – Level 13 (bugbear)

문제 소스는 아래와 같습니다. /* The Lord of the BOF : The Fellowship of the BOF – bugbear – RTL1 */ #include <stdio.h> #include <stdlib.h> main(int argc, char *argv[]) { char buffer[40]; int i; if(argc < 2){ printf(argv error\n); exit(0); } if(argv[1][47] == '\xbf') { printf(stack betrayed you!!\n); exit(0); } strcpy(buffer, argv[1]); printf(%s\n, buffer); } …

RTL(Returning into libc) 스터디 – 2

문제 환경은 아래와 같습니다. [byjjoon@ByJJoon RTL]$ cat /etc/redhat-release Fedora release 9 (Sulphur) [byjjoon@ByJJoon RTL]$ sysctl -a | grep random -bash: sysctl: command not found [byjjoon@ByJJoon RTL]$ /sbin/sysctl -a | grep random error: permission denied on key 'kernel.cad_pid' kernel.random.poolsize = 4096 kernel.random.entropy_avail = 606 kernel.random.read_wakeup_threshold = 64 kernel.random.write_wakeup_threshold = 128 kernel.random.boot_id = aa842921-f1e2-416e-8a72-240fa7054ae5 kernel.random.uuid = 0f6a6b7f-11ed-4ba4-8b27-94cfbe6b62bb …

CODEGATE 2010 CHALLENGE 4, 5 (RTL)

http://www.vnsecurity.net/2010/03/codegate-2010-online-ctf-challenge-4-5-writeup/ 위 페이지를 참고하여 문제를 다시 한번 풀고 정리한 내용 입니다. RTL을 이해하는데 도움이 될 거 같네요… hugh@codegate-desktop:/tmp/by$ gdb -q easy Reading symbols from /tmp/by/easy…done. (gdb) b main Breakpoint 1 at 0x804850e (gdb) r Starting program: /tmp/by/easy Breakpoint 1, 0x0804850e in main () (gdb) x/x execl 0x1ea0c0 <execl>: 0x53565755 (gdb) q execl 주소를 확인하여 보면 …

RTL(Returning into libc) 스터디 – 1

OS : Red Hat Linux 9.0 환경 : 랜덤스택 RTL 기법은 실행이 불가능한 스택일 경우 가능한 공격입니다. 공격 방법은 우리가 원하는 주소를 libc의 특정 함수로 리턴시켜 원하는 행동을 하도록 하는 것입니다. 그럼 공격을 해보도록 하자. 타켓 파일은 아래와 같습니다. int main(int argc, char *argv[]) { char buffer[5]; strcpy(buffer, argv[1]); return 0; } 우선 gdb를 이용하여 …

PADOCON 2010 Live Hacking 풀이

금일 파도콘 컨퍼런스에 가서 라이브 해킹 대회가 있어 msi님이랑 참여하여 우승을 하였습니다 😀 대회에 대한 자세한 풀이를 기록 합니다.. 1. 첫번째 문제 – Zeroboard XE 첫번째 문제는 Zeroboard XE 관련 문제 였습니다. 게시판에 이미지 파일을 하나 올려 확인한 결과 이미지 첨부파일이 위치하는 경로(/public_html/zbxe/files/attach/images)가 디렉토리 인덱싱이 가능한 것을 확인하였습니다. 따 라서 첨부파일이 위치하는 경로(/public_html/zbxe/files/attach/binaries)도 인덱싱이 될거라 …