전체 글 33

[리버싱, C] 소프트웨어 취약점 (I'm a boy)

소프트웨어가 가진 오류안에 예외가 있고 Crush가 있고 그 안에 취약점이 있다. 만약 EIP값을 조작할 수 있다면 공격을 성공 시킬 수 있다. 취약점 => 입력 1. 사용자 입력 (키보드) -> 문자(배)열 OverFlow가 발생(Crash) => OverRun 길이가 가변인 놈들은 모두 공격에 사용될 수 있다. Protocol(HTTP) 프로토콜도 입력이다. 대표적으로 HTTP를 생각해보면 protocol field 자체가 문자열로 되어있다. 문자열이 아니더라고 바이너리 형태에서 규칙이 발견되거나 사이드 필드를 강제로 늘리거나... File Data (PDF, HWP...) Init File (설정을 담고 있는 파일) Registry Web pararmeter ActiveX 위 c 파일을 실행하면 아..

리버싱 2023.02.16

[DreamHack] Exploit Tech: Shellcode (ORW, EXECVE)

Shellcode(shellcode)는 익스플로잇을 위해 제작된 어셈블리 코드 조각 주로 일반적으로 셸을 획득하기 위해서는 exec 셸 코드를 사용한다. 만약 해커가 rip를 자신이 작성한 셸코드로 옮길 수 있다면 무시무시하겠져?? 셸코드는 어셈블리어로 구성되므로 공격을 수행할 대상 아키텍쳐와 운영체제에 따라, 그리고 셸코드의 목적에 따라 다르게 작성된다. 파일 읽고 쓰기(open-read-write, orw), 셸 획득(execve)과 관련된 셸코드를 작성해본다! ORW SYSCALL syscall rax arg0 (rdi) arg1 (rsi) arg2 (rdx) read 0x00 unsigned int fd char *buf size_t count write 0x01 unsigned int fd co..

[DreamHack] System Hacking introduction (solve_me)

https://dreamhack.io/lecture/courses/35 Welcome Hackers👨‍💻 시스템 해킹에 입문하려는 분들을 위한 강의 dreamhack.io 기본적인 시스템 공부를 시작하려면 C언어와 파이썬에 대한 기초 지식이 필요하다ㅏㅏ!! 지금 밑에 있는 코드를 보고 "Welcome Hackers :)"가 출력 되는 입력값은 찾는다면 당신은 컴퓨터의 깊고 깊은 심연을 들여다 볼 준비가 되었다는 뜻이다! ㅎㅎ (과연!?!?) 관문은 총 2개로 준비되어 있다!! #include #include #include int main() { int sz = 0x30; char *buf = (char *)malloc(sizeof(char) * sz); puts("Hello World!"); print..

[pwnable] 시스템 해킹 ProtoStar - Stack7

https://github.com/z3tta/Exploit-Exercises-Protostar/blob/master/07-Stack7.md GitHub - z3tta/Exploit-Exercises-Protostar: Solutions for Exploit-Exercises Protostar Solutions for Exploit-Exercises Protostar. Contribute to z3tta/Exploit-Exercises-Protostar development by creating an account on GitHub. github.com gcc -z execstack -w -no-pie -o stack7 stack7.c 오오오 벌써 7번이네요 ㅎ Stack6번 문제와 비슷한데 6번에 대해 ..

[pwnable] 시스템 해킹 ProtoStar - Stack6 (PLT, GO)

https://github.com/z3tta/Exploit-Exercises-Protostar/blob/master/06-Stack6.md GitHub - z3tta/Exploit-Exercises-Protostar: Solutions for Exploit-Exercises Protostar Solutions for Exploit-Exercises Protostar. Contribute to z3tta/Exploit-Exercises-Protostar development by creating an account on GitHub. github.com gcc -z exexstack -w -no-pie -o stack6 stack6.c IF문을 보면 ret & 0xbf000000 과 and 연산을 하는데 ..

[pwnable] 시스템 해킹 ProtoStar - Stack5 (PLT, GOT)

이전에 풀었던 5번을 다른 방식으로 푼다. 바로 PLT, GOT를 이용한 풀이이다. PLT와 GOT란? PLT(procedure Linkage Table) : 외부 프로시저를 연결해주는 테이블, PLT를 통해 다른 라이브러리에 있는 프로시저를 호출 할 수 있다. GOT(Global Offset Table) : PLT가 참조하는 테이블, 프로시저들의 주소가 들어있다. 함수 호출(PLT) -> GOT (실제 함수의 주소가 저장) -> 처음일 때 -> 어떤 과정으로 주소를 가져옴 (생략) 함수 호출(PLT) -> GOT (실제 함수의 주소가 저장) -> 두 번째 -> 첫 번째 호출에서 알아낸 주소 참고) https://bpsecblog.wordpress.com/2016/03/07/about_got_plt_1/..

[pwnable] 시스템 해킹 ProtoStar - Stack5 (msfvenom, 어태치)

https://github.com/z3tta/Exploit-Exercises-Protostar/blob/master/05-Stack5.md GitHub - z3tta/Exploit-Exercises-Protostar: Solutions for Exploit-Exercises Protostar Solutions for Exploit-Exercises Protostar. Contribute to z3tta/Exploit-Exercises-Protostar development by creating an account on GitHub. github.com gcc -z execstack -w -no-pie -o stack5 stack5.c https://github.com/rapid7/metasploit-fr..

[pwnable] 시스템 해킹 ProtoStar - Stack4 (Return Address)

gcc -z execstack -w -no-pie -o stack4 stack4.c https://github.com/z3tta/Exploit-Exercises-Protostar/blob/master/04-Stack4.md GitHub - z3tta/Exploit-Exercises-Protostar: Solutions for Exploit-Exercises Protostar Solutions for Exploit-Exercises Protostar. Contribute to z3tta/Exploit-Exercises-Protostar development by creating an account on GitHub. github.com gets에서 BOF가 가능함!! return address를 win()..

[pwnable] 시스템 해킹 ProtoStar - Stack3 (ret2lib)

https://github.com/z3tta/Exploit-Exercises-Protostar/blob/master/03-Stack3.md GitHub - z3tta/Exploit-Exercises-Protostar: Solutions for Exploit-Exercises Protostar Solutions for Exploit-Exercises Protostar. Contribute to z3tta/Exploit-Exercises-Protostar development by creating an account on GitHub. github.com gcc -z execstack -w -no-pie -o stack3 stack3.c win() 함수를 호출하면 통과할 수 있다. fp의 주소에 win() ..

[pwnable] 시스템 해킹 ProtoStar - Stack2(환경변수 BOF)

https://github.com/z3tta/Exploit-Exercises-Protostar/blob/master/02-Stack2.md gcc -z execstack -w -no-pie -o stack2 stack2.c GitHub - z3tta/Exploit-Exercises-Protostar: Solutions for Exploit-Exercises Protostar Solutions for Exploit-Exercises Protostar. Contribute to z3tta/Exploit-Exercises-Protostar development by creating an account on GitHub. github.com 일단 실행! GREENIE 라는 환경변수가 필요하는 메시지가 출력된다...