Dreamhack [misc] Exercise: Welcome-Beginners

2024. 5. 21. 09:11Wargame/dreamhack

320x100
320x100

기타 워게임입니다.

 

문제

 

문제 파일 소스코드

// Name: chall.c
// Compile Option: gcc chall.c -o chall -fno-stack-protector

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>

#define FLAG_SIZE 0x45

void init() {
	setvbuf(stdin, 0, 2, 0);
	setvbuf(stdout, 0, 2, 0);
}

int main(void) {
    int fd;
    char *flag;

    init();

    // read flag
    flag = (char *)malloc(FLAG_SIZE);
    fd = open("./flag", O_RDONLY);
    read(fd, flag, FLAG_SIZE);

    char cmp_str[10] = "Dreamhack";
    char inp_str[10];   
    printf("Enter \"Dreamhack\" : ");
    scanf("%9s", inp_str);

    if(strcmp(cmp_str, inp_str) == 0){
        puts("Welcome Beginners!");
        // print flag
        puts(flag);
    }
    
    return 0;
}

 

 

서버에 들어갔더니

 

웹에 접속할 수 없다.

 

1. nc

ubuntu에서 nc 설치 후 접속 시도

sudo apt update && sudo apt install netcat

 

nc 명령어 입력

nc host3.dreamhack.games 21090

 

 

2. telnet

cmd 접속 후 telnet 명령어

telnet host3.dreamhack.games 21090

 

 

접속만 할 수 있다면 쉽게 flag를 얻을 수 있다.

320x100
320x100

'Wargame > dreamhack' 카테고리의 다른 글

Dreamhack [crypto] Double DES  (0) 2024.06.30
Dreamhack [web] flying chars  (0) 2024.05.21
DreamHack [crypto] basic_crypto1  (0) 2024.05.21
DreamHack [reversing • forensics] Enc-JPG  (0) 2024.05.07
DreamHack [pwnable] bof  (0) 2024.05.06