본문 바로가기

전체 글

(90)
[sstf-2023] BOF101 #include #include #include #include void printflag(){ char buf[32]; int fd = open("/flag", O_RDONLY); read(fd, buf, sizeof(buf)); close(fd); puts(buf); } int main() { int check=0xdeadbeef; char name[140]; printf("printflag()'s addr: %p\n", &printflag); printf("What is your name?\n: "); scanf("%s", name); if (check != 0xdeadbeef){ printf("[Warning!] BOF detected!\n"); exit(0); } return 0; } 0..
[sstf-2023] spli 101 sql injection 문제이다. 그냥 간단하게 guest:guest를 넣어 보니 admin이 아니라는 것과 힌트로 sql 쿼리문이 나온다. 그래서 간단하게 admin’ or ‘1’ = ‘1을 넣어 보았다. 근데 OR이 들어가면 안 된다고 한다. sql injection에서 배웠던 주석인 —를 사용하여 로그인 해 보려고 했으나 다 실패하였다. admin’ — 도대체 왜 안 되나… 싶어서 다른 주석인 #를 사용해 보니 admin 계정으로 로그인에 성공했다 admin’ # : whatever —은 왜 안 되는지… 아마 필터링이 있지 않을까 싶다
[드림핵/워게임] basic_exploitation_002 basic_exploitation_002 https://dreamhack.io/wargame/challenges/4 문제 파일을 다운 받으면 basic_exploitation_002.c와 실행 파일이 있다. #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, ch..
[드림핵/워게임] out_of_bound_000 https://dreamhack.io/wargame/challenges/9
[드림핵/워게임] off_by_one_001 https://dreamhack.io/wargame/challenges/10
[드림핵/워게임] off_by_one_000 https://dreamhack.io/wargame/challenges/9 30초 후 실행 종료 2. 전역 변수 cp_name에 read로 입력 3. cpy 함수 호출 4. 지역 변수 real_name에 strcpy로 cp_name 값 복사 5. cp_name 값 출력 -> 실행 종료 디버깅 해 보면 256개의 A를 넣었을 때, SFP의 하위 1바이트가 덮이는 것을 볼 수 있다. 이렇게 SFP의 하위 1바이트가 덮이면 어떻게 될까? 하위 1바이트가 덮인 것과 안 덮인 것이다. 하위 1바이트가 덮이면 변수 한 가운데의 0x41414141을 가리키는 것을 볼 수 있는데, 이를 통해 get_shell 함수를 반복적으로 넣어 256만큼 채워 주면 궁극적으로 get_shell 함수의 주소로 간다는 것을 유추할 수..
[드림핵/워게임] sint https://dreamhack.io/wargame/challenges/25 sint Description 이 문제는 서버에서 작동하고 있는 서비스(sint)의 바이너리와 소스 코드가 주어집니다. 프로그램의 취약점을 찾고 익스플로잇해 get_shell 함수를 실행시키세요. 셸을 획득한 후, "flag" 파 dreamhack.io 문제 파일을 다운 받으면 sint.c와 실행 파일이 있다. #include #include #include #include void alarm_handler() { puts("TIME OUT"); exit(-1); } void initialize() { setvbuf(stdin, NULL, _IONBF, 0); setvbuf(stdout, NULL, _IONBF, 0); sign..
[드림핵/워게임] ssp_001 https://dreamhack.io/wargame/challenges/33 ssp_001 Description 이 문제는 작동하고 있는 서비스(ssp_001)의 바이너리와 소스코드가 주어집니다. 프로그램의 취약점을 찾고 SSP 방어 기법을 우회하여 익스플로잇해 셸을 획득한 후, "flag" 파일을 읽으세 dreamhack.io 문제 파일을 다운 받으면 ssp_001.c와 실행 파일이 있다. #include #include #include #include void alarm_handler() { puts("TIME OUT"); exit(-1); } void initialize() { setvbuf(stdin, NULL, _IONBF, 0); setvbuf(stdout, NULL, _IONBF, 0); s..