0x03 - rev by helithumper
| binary | rev |
|---|---|
| sha256 | 2b704c51b17fe6ed1461f4068eb7d8824a7a66d37eae56dc9adcf0d2cbd0cce2 |
This is a very straightforward one by helithumper, called rev. It’s another 64-bit, non-stripped ELF:
❯ file rev
rev: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=e4dbcb1281821db359d566c68fea7380aeb27378, for GNU/Linux 3.2.0, not stripped
❯ nm rev
0000000000004010 B __bss_start
U calloc@@GLIBC_2.2.5
0000000000004010 b completed.7963
w __cxa_finalize@@GLIBC_2.2.5
0000000000004000 D __data_start
0000000000004000 W data_start
00000000000010c0 t deregister_tm_clones
0000000000001130 t __do_global_dtors_aux
0000000000003da0 d __do_global_dtors_aux_fini_array_entry
0000000000004008 D __dso_handle
0000000000003da8 d _DYNAMIC
0000000000004010 D _edata
0000000000004018 B _end
0000000000001334 T _fini
0000000000001170 t frame_dummy
0000000000003d98 d __frame_dummy_init_array_entry
00000000000021ec r __FRAME_END__
0000000000003f98 d _GLOBAL_OFFSET_TABLE_
w __gmon_start__
0000000000002080 r __GNU_EH_FRAME_HDR
0000000000001000 t _init
0000000000003da0 d __init_array_end
0000000000003d98 d __init_array_start
0000000000002000 R _IO_stdin_used
U __isoc99_scanf@@GLIBC_2.7
w _ITM_deregisterTMCloneTable
w _ITM_registerTMCloneTable
0000000000001330 T __libc_csu_fini
00000000000012d0 T __libc_csu_init
U __libc_start_main@@GLIBC_2.2.5
0000000000001175 T main
U puts@@GLIBC_2.2.5
00000000000010f0 t register_tm_clones
U __stack_chk_fail@@GLIBC_2.4
0000000000001090 T _start
U strlen@@GLIBC_2.2.5
0000000000004010 D __TMC_END__
00000000000011ea T validate
Since this binary isn’t stripped, we of course have some symbols available to us. There is a function called validatewhich sounds interesting, and we also have main:
|
|
Note that I’ve already gone ahead and changed variable names to make things clearer. The validatefunction is where the key validation happens. It simply takes the input buffer and checks each byte against a static set of bytes:
|
|
I copied these bytes into a Go program to print out the flag:
|
|
When we run the solver, the flag is returned:
❯ go run ./cmd/main.go
flag{HuCf_lAb}
And finally, test it against the actual binary:
❯ ./rev
Welcome to the Salty Spitoon™, How tough are ya?
flag{HuCf_lAb}
Right this way...