Difficulty: easy

Category: rev

Author: xnull

Description:

### Flag Checker

This program builds a flag internally and checks if your input matches it.

You can see how the flag is constructed by looking at the program's code.

Solution

We just open up the program in our favorite disassembler and look at the main function:

int64_t main()

{
    char var_48;
    __builtin_strncpy(&var_48,
        "ENDLM{d1s4ss3mbly_1s_fun_8c4b}", 0x1f);
    _IO_puts("=== Flag Checker ===");
    _IO_puts("This program has a flag built in…");
    _IO_printf("Enter the flag: ", 0);
    char var_b8[0x70];

    if (!_IO_fgets(&var_b8, 0x64, stdin))
        return 1;

    var_b8[j_strcspn(&var_b8, &data_488058)] = 0;

    if (j_strcmp(&var_b8, &var_48, &var_48))
    {
        _IO_puts("Wrong!");
        _IO_puts("Hint: Look at how the flag is co…");
    }
    else
        _IO_printf("\nCorrect! The flag is: %s\n", 0);

    return 0;
}

Flag: ENDLM{d1s4ss3mbly_1s_fun_8c4b}