본문 바로가기

Wargame Write-Up/HackCTF69

(HackCTF) 훈폰정음 writeup TL;DR heap challenge, tcache tcache 가 있는 GLIBC 2.27 라이브러리를 사용하는문제다. add table 배열의 index 0~6 에 0x000 ~ 0x400 size 의 chunk 를 할당받아 저장해줄 수 있다. 이미 chunk 가 존재하면 안됨 size 는 size 배열에 저장된다. edit table[index] 에 chunk 가 있으면, size[index] 만큼 수정가능. delete int delete() { int result; // eax int v2; // [rsp+Ch] [rbp-4h] puts("인덱스를 입력하시오:"); result = smooth(); v2 = result; while ( v2 >= 0 && v2 2022. 2. 26.
(HackCTF) Adult_FSB writeup int __cdecl __noreturn main(int argc, const char **argv, const char **envp) { int i; // [rsp+Ch] [rbp-144h] char buf[312]; // [rsp+10h] [rbp-140h] BYREF unsigned __int64 v5; // [rsp+148h] [rbp-8h] v5 = __readfsqword(0x28u); Init(); for ( i = 0; i next; if (*listp != NULL) /* Don't free the last element in the chain, this is the statically allocate element. */ free (cur); ~~~ 대충 *listp→next 가 nul.. 2022. 2. 24.
(HackCTF) ChildFSB writeup int __cdecl main(int argc, const char **argv, const char **envp) { char buf[24]; // [rsp+0h] [rbp-20h] BYREF unsigned __int64 v5; // [rsp+18h] [rbp-8h] v5 = __readfsqword(0x28u); Init(argc, argv, envp); puts("hello"); read(0, buf, 0x19uLL); printf(buf); return 0; } baby fsb 문제는, leak&got overwrite 으로 __stack_check_fail 함수에서 메인으로 돌린 뒤, 릭한 주소로 onegadget 을 구해 __stack_check_fail@got 에 덮었다. 이번엔 input.. 2022. 2. 24.
(HackCTF) wishlist writeup TL;DR, no heap ex, ROP with stack pivoting puts("1. make wish"); puts("2. view wish"); puts("3. remove wish"); make, view, remove 할 수 있는 heap challenge __int64 sub_4008A7() { char buf[16]; // [rsp+0h] [rbp-10h] BYREF printf("input: "); read(0, buf, 0x20uLL); return (unsigned __int8)buf[0]; } 1,2,3 번호입력할 떄 사용하는 함수. buf[0] 을 리턴하긴 하지만 ret address 까지 덮을 수 있다. 수상하다 1. make __int64 sub_400910() { int .. 2022. 2. 24.