Currently working as a Senior Consultant at Netcompany spending my full-time job solving the SharePoint riddles. In the free time I'm expanding my understanding of cybersecurity through hacking activities. Git fanboy.
You found one of their space suits forgotten in a room. You wear it, but before you go away, a guard stops you and asks some questions
Complete write up for the Passphrase challenge at Cyber Apocalypse 2021 CTF hosted by HackTheBox.eu. This article is a part of a CTF: Cyber Apocalypse 2021 series. You can fork all my writeups directly from the GitHub.
Learn more from additional readings found at the end of the article. I would be thankful if you mention me when using parts of this article in your work. Enjoy!
First things first, analyze what we have with the file tool:
$ file passphrase
passphrase: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked,
interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=60f6b6064d2e34a2b6a24dda9feb943b0b8c360f, not stripped
Symbols are left within the executable. This is good as it makes working with the file easier.
Running strings. Between the output lines I've got the following:
Halt!
You do not look familiar..
Tell me the secret passphrase:
[31m
Intruder alert!
[32m
Sorry for suspecting you, please transfer this important message to the chief: CHTB{%s}
;*3$"
It looks like it is going to do some string comparisons maybe..
Nothing out stands, just regular libraries. Also, none is missing.
Symbols are included in the executable (not stripped) so lets list them:
$ nm passphrase
0000000000202010 B __bss_start
0000000000202028 b completed.7698
w __cxa_finalize@@GLIBC_2.2.50000000000202000 D __data_start
0000000000202000 W data_start
0000000000000890 t deregister_tm_clones
0000000000000920 t __do_global_dtors_aux
0000000000201d78 d __do_global_dtors_aux_fini_array_entry
0000000000202008 D __dso_handle
0000000000201d80 d _DYNAMIC
0000000000202010 D _edata
0000000000202030 B _end
U fgets@@GLIBC_2.2.50000000000000bb4 T _fini
0000000000000960 t frame_dummy
0000000000201d70 d __frame_dummy_init_array_entry
0000000000000dfc r __FRAME_END__
0000000000201f70 d _GLOBAL_OFFSET_TABLE_
w __gmon_start__
0000000000000c94 r __GNU_EH_FRAME_HDR
0000000000000780 T _init
0000000000201d78 d __init_array_end
0000000000201d70 d __init_array_start
0000000000000bc0 R _IO_stdin_used
w _ITM_deregisterTMCloneTable
w _ITM_registerTMCloneTable
0000000000000bb0 T __libc_csu_fini
0000000000000b40 T __libc_csu_init
U __libc_start_main@@GLIBC_2.2.500000000000009c6 T main
U printf@@GLIBC_2.2.5000000000000096a T printstr
U putchar@@GLIBC_2.2.5
U puts@@GLIBC_2.2.500000000000008d0 t register_tm_clones
U setbuf@@GLIBC_2.2.5
U sleep@@GLIBC_2.2.5
U __stack_chk_fail@@GLIBC_2.40000000000000860 T _start
0000000000202020 B stdin@@GLIBC_2.2.50000000000202010 B stdout@@GLIBC_2.2.5
U strcmp@@GLIBC_2.2.5
U strlen@@GLIBC_2.2.50000000000202010 D __TMC_END__
U usleep@@GLIBC_2.2.5
We can see that at the address 0x00202010 it does string compare. So, it confirms the assumption from before.