[pwnable.kr] blukat 풀이

2021. 3. 26. 05:31·Write-Up/pwnable.kr
반응형
#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;
}

 

calc_flag만 보면

전달된 s만큼 s한글자와 i한글자 씩 xor연산을 해서 flag값으로 넣어준다.

근데 여기서 의아한점이 우리는 password를 모르는데 어떻게 password를 맞추나 생각을 했다.

 

엄청 어렵게만 생각했는데 생각보다 쉬웠다.

password에 접근할수 있었다.

 

반응형

'Write-Up > pwnable.kr' 카테고리의 다른 글

[pwnable.kr] random 풀이  (0) 2021.07.26
[pwnable.kr] passcode 풀이  (0) 2021.07.22
[pwnable.kr] memcpy 풀이  (0) 2021.03.25
[pwnable.kr] cmd2 풀이  (0) 2021.03.24
[pwnable.kr] cmd1 풀이  (0) 2021.03.24
'Write-Up/pwnable.kr' 카테고리의 다른 글
  • [pwnable.kr] random 풀이
  • [pwnable.kr] passcode 풀이
  • [pwnable.kr] memcpy 풀이
  • [pwnable.kr] cmd2 풀이
Penguin Dev
Penguin Dev
What does the Penguin say?
    글쓰기 관리
  • Penguin Dev
    Pengha!
    Penguin Dev
  • 전체
    오늘
    어제
    • 분류 전체보기 (151) N
      • Java & Spring (3) N
      • System Hacking (4)
      • Algorithm (8)
        • Sorting algorithm (3)
      • Python (6)
      • DB (1)
      • Web (2)
        • Web Hacking & Security (2)
      • Write-Up (108)
        • pwnable.kr (17)
        • HackCTF (16)
        • 해커스쿨 FTZ (21)
        • LOB(lord of bufferoverflow) (19)
        • LOS (lord of sql injection) (28)
        • XSS-game (6)
        • Webhacking.kr (1)
      • SUA (19)
        • 오픈소스 보안 (19)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    AtomicLong
    DB정리
    시스템해킹
    동시성처리
    sqlinjection
    MAP
    nop sled
    putval()
    lord of bufferoverflow
    computeifabsent
    코딩테스트
    thread-safe
    hashmap vs concurrenthashmap
    spring boot
    Bubble Sort
    동시성
    selection sort
    코드트리조별과제
    concurrenthashmap vs hashmap
    Java
    LOB
    tabat
    enumerate #list comprehension
    computeifpresent
    computeifpresent()
    코드트리
    ConcurrentHashMap
    computeifabsent()
    CountDownLatch
    spring
  • 최근 댓글

  • 반응형
  • hELLO· Designed By정상우.v4.10.3
Penguin Dev
[pwnable.kr] blukat 풀이
상단으로

티스토리툴바