본문 바로가기

[ ★ ]Study/War Game29

[Toddler's Bottle] pwnable.kr cmd1 풀이 putenv를 통해서 PATH가 변경이 됩니다. filter 함수를 통해 flag, sh, tmp 문자가 들어가면 안된다는 것도 알 수 있네요. 심볼링 링크로 이름을 변경해서 실행하면 어떨까 라는 생각을 했습니다. tmp 문자를 보고 tmp폴더에서 작업을 해보자라는 생각도 들더군요. cmd1 실행파일과 flag 파일을 만들어주었습니다. flag 라는 문자대신 fl을 사용했습니다. 쉽게 푼 것 같습니다. 다른 분들은 어떻게 풀었는지 궁금해서 검색좀 했는데, ./cmd1 "export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin&&find . -name fla* -exec cat {} \;" 출처: http://kit2013.tisto.. 2017. 9. 15.
[Toddler's Bottle] pwnable.kr lotto 풀이 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697#include #include #include #include unsigned char submit[6]; void play(){ int i; printf("Submit your 6 lotto bytes : "); fflush(stdout); int r; r = read(0, submit, 6); printf("Lotto Start!\n"); //sleep(1); // gene.. 2017. 9. 15.
[Toddler's Bottle] pwnable.kr blackjack 풀이 소스코드는 양이 방대해서 생략! 백만장자가 되면 flag를 준다고 합니다. 뭐.. .게임 열심히해서 이겨도 되겠죠 ㅎ.. 핵심만 적어드리자면, 게임을 시작하거나 돈을 탕진했을 때 cash 에 500을 채워줍니다. 이건 뭐 규칙이죠. 그리고 이겼을 때는, cash = cash+bet 베팅한 금액을 더해줍니다. 이기면 x2 x3 이런건 없어요. 마지막 핵심인 아래 코드입니다. 123456789 if (bet > cash) //If player tries to bet more money than player has { printf("\nYou cannot bet more money than you have."); printf("\nEnter Bet: "); scanf("%d", &bet); return bet.. 2017. 9. 15.
[Toddler's Bottle] pwnable.kr shellshock 풀이 ■ setresuid/setresgid : SET R(eal), E(ffective), S(aved) UID/GID ■ 현재 동작중인 프로세스의 권한을 변경한다. ■ man page : http://linux.die.net/man/2/setresuid 간단하게 이 shellshock 프로그램을 실행시켜서 cat flag를 해야된다는 점입니다. 그러기 위해서는 bash 취약점 shellshock(쉘쇼크)를 이용하라고 제목에서 알려줍니다. 구글에 shellshock 및 쉘쇼크라고 검색을 하면 정말 많은 자료가 나오지만, 대부분 정보가 겹치는 것을 확인하실 수 있습니다. 가장 흔히 보시는 것이 TEST 쉘 쇼크 test진단이라고 많이 보실텐데, 한 번 저희도 진단을 해봐야겠죠. hi 라는 부분이 출력되면 위험.. 2017. 9. 15.
[Toddler's Bottle] pwnable.kr mistake 풀이 123456789101112131415161718192021222324252627282930313233343536373839404142#include #include #define PW_LEN 10#define XORKEY 1 void xor(char* s, int len) { int i; for (i=0; i 0)){ printf("read error\n"); close(fd); return 0; } 이 부분에서도 fd의 값은 반환된 값 0으로 들어가게 되면서 표준 입력을 하게 됩니다. 때문에 이 코드는 원래의 목적( password를 읽어와 pw_buf에 저장) 이 아니라, 저희가 pw_buf 변수에 값을 넣을 수 있도록 되었습니다. 때문에, pw_buf, pw_buf2 모두 우리의 것입니다. xor.. 2017. 9. 15.
[Toddler's Bottle] pwnable.kr leg 풀이 12345678910111213141516171819202122232425262728293031323334353637#include #include int key1() { asm("mov r3, pc\n");}int key2() { asm( "push {r6}\n" "add r6, pc, $1\n" "bx r6\n" ".code 16\n" "mov r3, pc\n" "add r3, $0x4\n" "push {r3}\n" "pop {pc}\n" ".code 32\n" "pop {r6}\n" );}int key3() { asm("mov r3, lr\n");}int main() { int key=0; printf("Daddy has very strong arm! : "); scanf("%d", &key); i.. 2017. 9. 15.