본문 바로가기
  • Tried. Failed. Logged.
728x90

pwntools3

DreamHack - basic_exploitation_000 풀이 basic_exploitation_000.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); } int main(int argc, char *argv[]) { char buf[0x80]; initialize(); printf("buf = (%p)\n", buf); scanf("%141s", buf); return 0; } 사용자로부터 141 바이트 크기의 문자열을 입.. 2023. 4. 26.
DreamHack - basic_exploitation_001 풀이 checksec으로 파일 보호 기법들 확인 NX(No-eXecute) 보호 기법이 활성화되어 있으므로, 쉘 코드는 실행되지 않지만, Stack Canary가 활성화되지 않은 것으로 보아 Return Address Overwrite에 취약하다는 것을 알 수 있다. basic_exploitation_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); signal(SIGALRM, alarm_handler); alarm(30); } vo.. 2023. 4. 25.
시스템 보안 - pwntools pwntools는 리눅스 환경에서 실행 프로그램의 익스플로잇을 작성하도록 도움을 주는 파이썬 라이브러리이다. CTF에서도 유용하게 사용될 수 있다. pip 설치 명령어 python3 -m pip install --upgrade pwntools 사용 예제 >>> conn = remote('ftp.ubuntu.com',21) >>> conn.recvline() # doctest: +ELLIPSIS b'220 ...' >>> conn.send(b'USER anonymous\r\n') >>> conn.recvuntil(b' ', drop=True) b'331' >>> conn.recvline() b'Please specify the password.\r\n' >>> conn.close() nc(NetCat), .. 2023. 3. 25.
728x90