Today, I am going through TryHackMe CTF room called Compiled, you are given a file which you can do thing to get the password.
The problem is the file is x86_64
kali@kali:~$ file Compiled-1688545393558.Compiled
Compiled-1688545393558.Compiled: ELF 64-bit LSB pie executable, x86-64,
version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2,
BuildID[sha1]=06dcfaf13fb76a4b556852c5fbf9725ac21054fd, for GNU/Linux 3.2.0, not stripped
To run this, we need to install qemu (kali official documentation)
Run these command one by one to install:
kali@kali:~$ wget https://snapshot.debian.org/archive/debian/20240509T024809Z/pool/main/q/qemu/qemu-user-static_8.2.3%2Bds-2_arm64.deb
kali@kali:~$ sudo apt install ./qemu-user-static_8.2.3+ds-2_arm64.deb
kali@kali:~$ sudo apt update
kali@kali:~$ sudo apt install -y qemu-user-static binfmt-support
kali@kali:~$ sudo dpkg --add-architecture amd64
kali@kali:~$ sudo apt update
kali@kali:~$ sudo apt install libc6:amd64
Then add execution permission to user:
kali@kali:~$ chmod u+x Compiled-1688545393558.Compiled
Execute the file with qemu:
kali@kali:~$ qemu-x86_64 ./Compiled-1688545393558.Compiled
That’s it! if you get stuck with this room you can check the write up that people posted.
What about ELF 32-bit LSB executable, Intel 80386 (32bits)
just install another package:
kali@kali:~$ sudo apt-get install libc6-i386
add execution to the file and run
kali@kali:~$ qemu-i386 ./code
Cheers