Rating:


> This just looks like a binary...
Lets try to decompile it...
Wait, this isn't C...

> Author: MichaelK522

We're given a single file `flag_checker_1`.

`strings` implies we're looking at Fortran. It doesn't really end up mattering...

In the main function we see that a variable gets set up

```
mov [rbp+target], 63h ; 'c'
mov [rbp+target+2], 65h ; 'e'
mov [rbp+target+4], 64h ; 'd'
mov [rbp+target+6], 67h ; 'g'
...
mov [rbp+target+28h], 84h
mov [rbp+target+2Ah], 65h ; 'e'
mov [rbp+target+2Ch], 47h ; 'G'
mov [rbp+target+2Eh], 84h
```

And then the following loops are performed
```c++
for ( i = 1; i <= 25; ++i )
maybe_input[i - 1] = *(&maybe_input[31] + i + 1);
for ( i = 1; i <= 25; ++i )
{
maybe_input[i - 1] += i;
if ( maybe_input[i - 1] != target[i - 1] )
{
<FAIL>
}
}
<SUCCESS>
}
```

I didn't really understand where `maybe_input` was set, but went on autopilot and undid the for-loop, which was sufficient to get the flag.

```python
>>> ct
['99', '101', '100', '103', '121', '108', '130', '110', '57', '124', '127', '126', '65', '92', '110', '121', '70', '113', '118', '68', '132', '101', '71', '132', '150']
>>> ''.join([chr(int(c) - 1 - i) for i, c in enumerate(ct)])
'bcactf{f0rtr4N_i5_c0oO0l}'
```

Flag: `bcactf{f0rtr4N_i5_c0oO0l}`

Original writeup (https://eb-h.github.io/bcactf-2021/#wait-this-isnt-c).