System Hacking

[pwnable.kr] blukat

BIGFROG 2020. 1. 9. 18:13
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
char flag[100];
char password[100];
char* key = "3\rG[S/%\x1c\x1d#0?\rIS\x0f\x1c\x1d\x18;,4\x1b\x00\x1bp;5\x0b\x1b\x08\x45+";
void calc_flag(char* s){
        int i;
        for(i=0; i<strlen(s); i++){
                flag[i] = s[i] ^ key[i];
        }
        printf("%s\n", flag);
}
int main(){
        FILE* fp = fopen("/home/blukat/password", "r");
        fgets(password, 100, fp);
        char buf[100];
        printf("guess the password!\n");
        fgets(buf, 128, stdin);
        if(!strcmp(password, buf)){
                printf("congrats! here is your flag: ");
                calc_flag(password);
        }
        else{
                printf("wrong guess!\n");
                exit(0);
        }
        return 0;
}

 

 

gdb로 확인해보고 password로 들어가는 인자를 확인했더니 permission denied가 그대로 나온다.



혹시 해서 ls -al로 보니까 그룹 권한이 blukat_pwn이다.

 

 



id 명령어로 보면 내 그룹 권한이 1104,1105(blukat_pwn)임

password로 cat: password: Permission denied
를 넣어주면 플래그 획득.

flag
Pl3as_DonT_Miss_youR_GrouP_Perm!!

'System Hacking' 카테고리의 다른 글

[pwnable.kr] horcruxes  (0) 2020.01.09
[pwnable.kr] asm  (0) 2020.01.09
[pwnable.kr] memcpy  (0) 2020.01.09
[pwnable.kr] uaf  (0) 2020.01.09
[pwnable.kr] cmd2  (0) 2020.01.09