system hacking/개념, 준비물 7

ida64 free 다운로드와 설치, qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found오류

다시 다운로드하려고 하니 오류가 생겨서 글을 남긴다. https://hex-rays.com/ida-free/ IDA Freeware IDA Freeware The free binary code analysis tool to kickstart your reverse engineering experience. hex-rays.com 에서 IDA Freeware for Linux (76MB)를 다운받는다. chmod로 execute권한을 추가해 실행시켜주고 설치한다. sudo ln -s ~/idafree-7.7/ida64 /usr/bin/ 소프트링크를 /usr/bin/에 추가해서 어느 경로에서든 실행시킬 수 있게 한다. 아래 오류가 뜬다면 특정 모듈을 설치 하면 된다. apt install libxcb-xin..

docker (pwnable 문제 다양한 ubuntu버전에서 실행하기)

포너블을 풀 때 매번 libc의 버전이 다르고 내부 동작이 다르면 gdb로 분석할 때 서버 작동과 다르다. docker를 이용해서 가상 환경을 만들고 포너블 하자. docker는 vmware과는 다르다. 1. 도커를 잘 모른다면 다음 블로그를 읽어보자. docker의 이해: https://subicura.com/2017/01/19/docker-guide-for-beginners-1.html 초보를 위한 도커 안내서 - 도커란 무엇인가? 도커를 처음 접하는 시스템 관리자나 서버 개발자를 대상으로 도커 전반에 대해 얕고 넓은 지식을 담고 있습니다. 도커가 등장한 배경과 도커의 역사, 그리고 도커의 핵심 개념인 컨테이너와 이 subicura.com 2. 도커 설치 https://subicura.com/2017..

libc 링킹(patchelf)

워게임 문제를 풀다보면, libc가 자신의 pc와 다르다면 로컬 환경에서 문제의 libc버전을 링킹해주어야지 제대로 문제를 풀 수 있다. https://github.com/NixOS/patchelf GitHub - NixOS/patchelf: A small utility to modify the dynamic linker and RPATH of ELF executables A small utility to modify the dynamic linker and RPATH of ELF executables - GitHub - NixOS/patchelf: A small utility to modify the dynamic linker and RPATH of ELF executables github.com 를 ..

heap

dreamhack에서 use after free내용을 보다가 이해가 되지 않아서 정리를 하고 넘어가자. 먼저 chunk에 대해서 알아보자. 참고: https://rninche01.tistory.com/entry/heap3-glibc-malloc2-feat-chunk?category=838537 32bit system: 8bytes의 배수로 할당 64bit system: 16bytes의 배수로 할당 example debugging gdb로 example을 디버깅해보자. malloc을 두번 한 후 heap을 보자. 1바이트, 2바이트를 요구했지만 0x20(32byte)씩 할당되었다. 그리고, 왜 malloc은 하나 했지만 청크는 3개가 생기는지 보자. 현재 malloc을 한번했는데, chunk는 3개가 있다..

쉘코드 pwntools로 넣기

1. 넣어야 하는 쉘코드가 무엇인지 알아낸다. 2. 쉘코드를 c언어로 작성하고 컴파일한다. 3. ida로 실행 파일을 열고, 어느 명령어부터 어느 명령어까지 쉘코드로 사용하는지 알아낸다. 4. ida스크립트를 이용해서 쉘코드를 바이너리로 저장한다. auto fname = "save.bin"; auto address = 0x0400000; auto size = 0x030; auto file= fopen(fname, "wb"); savefile(file, 0, address, size); fclose(file); 5. python pwntools의 payload항목에 불러온 후, 서버에 send한다.