보안/Wargame 24

[System Hacking] validator

소스코드 분석 & 보호기법 확인__int64 __fastcall main(int a1, char **a2, char **a3){ char s[128]; // [rsp+0h] [rbp-80h] BYREF memset(s, 0, 0x10uLL); read(0, s, 0x400uLL); sub_400580((__int64)s, 0x80uLL); return 0LL;}buffer에 사용자의 입력을 받고,이것이 sub_400580()를 통과하면 프로그램은 정상 종료된다.__int64 __fastcall sub_400580(__int64 a1, unsigned __int64 a2){ unsigned int i; // [rsp+1Ch] [rbp-4h] int j; // [rsp+1Ch] [rbp-4h] ..

보안/Wargame 2025.03.17

[System Hacking] cmd_center

소스코드 & 보호기법 확인#include #include #include #include void init() { setvbuf(stdin, 0, 2, 0); setvbuf(stdout, 0, 2, 0);}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);}center_name 변수에 이것의 크기보다 큰 100바이트를 읽어..

보안/Wargame 2025.03.13

[System Hacking] Tcache Poisoning

보호기법 확인PIE 없음NX 적용됨 -> 셸코드를 실행하기 어려움FULL RELRO 적용됨 -> GOT 오버라이트 공격 수행하기 어려움 => hook overwrite 고려.소스코드 분석// Name: tcache_poison.c// Compile: gcc -o tcache_poison tcache_poison.c -no-pie -Wl,-z,relro,-z,now#include #include #include int main() { void *chunk = NULL; unsigned int size; int idx; setvbuf(stdin, 0, 2, 0); setvbuf(stdout, 0, 2, 0); while (1) { printf("1. Allocate\n"); printf..

보안/Wargame 2025.02.13

[System Hacking] out_of_bound

>> 소스코드 >> 메모리 구조 higher.. --stack-- Return addressold EBP [ebp]push ecx [ebp - 4]? [ebp - 8]? [ebp - 12]idx값 [ebp - 16] -- stack-- namecommand lower.. Q. idx의 주소는 어떻게 알았는가?A.소스 코드를 보면 idx는 scanf()의 두번째 argument로 입력되므로,어셈블리에서 scanf()가 호출되기 전 부분을 보고, 그 순간에 stack에 push되는 걸 보자.   0x08048723 :    lea    eax, [ebp-0x10]    0x08048726 :    push   eax    0x08048727 :    push   0x8048832    0x0804872c :..

보안/Wargame 2024.07.10