After downloading the zip file we were faced with a linux memory dump. After building the correct profile for volatility you had to perform a known plain text attack on an encrypted and splited zip file to recover the file flag.txt.
Introduction
After downloading the file MI1.zip we had a memdump. You first have to check wether it’s a linux or a windows memdump. You can run the following command to determine this :
1 2 3 4 5
$ strings challenge.elf | grep "Linux version"
Linux version %d.%d.%d
Linux version 3.16.0-6-amd64 (debian-kernel@lists.debian.org) (gcc version 4.9.2 (Debian 4.9.2-10+deb8u1) ) #1 SMP Debian 3.16.57-2 (2018-07-14)
Linux version 3.16.0-6-amd64 (debian-kernel@lists.debian.org) (gcc version 4.9.2 (Debian 4.9.2-10+deb8u1) ) #1 SMP Debian 3.16.57-2 (2018-07-14)
^C
So we have a linux memdump. To use volatility we have to build a special profile and to do that we need :
A debian distribution
The right version of the kernel
Additional tools
I downloaded the last Debian release installed it on a VM and run :
1 2
$ uname -a
Linux santa 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 GNU/Linux
I didn’t have the right kernel version so I installed the right one
1
$ sudo apt-get install linux-image-3.16.0-6-amd64
reboot my VM and select in the grub the right kernel version.
1 2
$ uname -a
Linux santa 3.16.0-6-amd64 #1 SMP Debian 3.16.57-2 (2018-07-14) x86_64 GNU/Linux
Building the profile
Then we need to install the kernel headers, it gave me a lot of pain, nothing was working, dependencies were missing. I finally had to install everything by hand.
Ok so we got something here let’s try to understand this. We have a backup.zip file which was built with specials options and an interesting directory called a-strong-hero.com/.
After reading the zip manual we can understand this command
r is for recursively
e is for encrypted
s is for spliting the final zip into serveral parts of 64 Ko
The first file is flag.txt, we now know that we have to decrypt this zip archive to validate this challenge. I recently read an attack on encrypted zip files. If we have a clear copy of a file that is present on an encrypted zip archive we can retrieve all the files in the encrypted zip. It’s a known plain text attack.
We can use a tool called pkcrack to do it and I choosed the file bootstrap.min.js as the known file
$ ./pkcrack -C encrypted.zip -c "jcvd-website/js/bootstrap.min.js" -P bootstrap.min.js.zip -p "bootstrap.min.js" -d decrypted.zip
Files read. Starting stage 1 on Tue Dec 25 16:42:41 2018
Generating 1st generation of possible key2_9747 values...done.
Found 4194304 possible key2-values.
Now we're trying to reduce these...
Lowest number: 940 values at offset 5497
Lowest number: 897 values at offset 5349
Lowest number: 862 values at offset 4869
Lowest number: 847 values at offset 4780
Lowest number: 829 values at offset 4066
Lowest number: 825 values at offset 3886
Lowest number: 749 values at offset 3885
Lowest number: 697 values at offset 3880
Lowest number: 695 values at offset 3875
Done. Left with 695 possible Values. bestOffset is 3875.
Stage 1 completed. Starting stage 2 on Tue Dec 25 16:43:01 2018
Ta-daaaaa! key0=751f036a, key1=397078fa, key2=d156dfac
Probabilistic test succeeded for 5877 bytes.
Ta-daaaaa! key0=751f036a, key1=397078fa, key2=d156dfac
Probabilistic test succeeded for 5877 bytes.
Ta-daaaaa! key0=751f036a, key1=397078fa, key2=d156dfac
Probabilistic test succeeded for 5877 bytes.
Ta-daaaaa! key0=751f036a, key1=397078fa, key2=d156dfac
Probabilistic test succeeded for 5877 bytes.
Stage 2 completed. Starting zipdecrypt on Tue Dec 25 16:43:41 2018
Decrypting flag.txt (91c644af94249dd314b62b57)... OK!
Decrypting jcvd-website/js/.DS_Store (2fe6d64c750f20da2d6b7b4e)... OK!
Decrypting jcvd-website/js/bootstrap.min.js (31beae5a6417af2fcee27b4e)... OK!
Decrypting jcvd-website/js/jquery-1.11.3.min.js (68cffaef64b77eca810f7b4e)... OK!
Decrypting jcvd-website/js/bootstrap.js (172450e6004efe284b507b4e)... OK!
Decrypting jcvd-website/js/custom.js (4038fc0d73419d37a34f7b4e)... OK!
Decrypting jcvd-website/js/ie10-viewport-bug-workaround.js (71f134fe12dcf4d413c17b4e)... OK!
Decrypting jcvd-website/js/jquery.easing.min.js (dd66d46318af5411b24b7b4e)... OK!
Decrypting jcvd-website/.DS_Store (ccc90b8c7a949b1dd0297b4e)... OK!
Decrypting jcvd-website/images/concert.jpg (2531ab52a4c3f2af90017b4e)... OK!
Decrypting jcvd-website/images/.DS_Store (cd53bfa34fee99aade507b4e)... OK!
Decrypting jcvd-website/images/microphone.jpg (e04e73cca1576915c96f7b4e)... OK!
Decrypting jcvd-website/images/iphone.jpg (7d0e3ddec5bb0eb5d5537b4e)... OK!
Decrypting jcvd-website/images/header.jpg (558cd122c491a4c95df47b4e)... OK!
Decrypting jcvd-website/images/writing.jpg (de9b24799ceac1377f317b4e)... OK!
Decrypting jcvd-website/images/pencil_sharpener.jpg (89cbb73d79aa6c0472607b4e)... OK!
Decrypting jcvd-website/index.html (e2b688ad4623c81471017b4e)... OK!
*** Error in `./pkcrack': corrupted size vs. prev_size: 0x000055b2dbb0a280 ***
I got an error and when I tried to unzip the decrypted.zip, it also gave me an error because the file was corrupted. After many tries and hours spent on this challenge I finally used the A option of zip and the tool zipdecrypt with the previous keys that we found. (zipdecrypt is in the pkcrack github repository)
Event Challenge Category Points Solves ecsc Hello Rootkitty pwn 500 24 TL;DR A custom kernel module was vulnerable to a buffer overflow, with a small ropchain I escalated my privileges to root and with a sys_chmod syscalls I got the flag.
Description Recon I’m not a Linux kernel expert, everything might not be 100% correct, but I’ll do my best to summarize what I understood.
Introduction I recently bought a DVID board which is an open source vulnerable designed IoT device. In this post I will try to explain how to solve the third challenge of the DVID project. In this challenge we need to write data to a special characteristic.
Challenge Let’s flash the firmware, enable and setup the usb dongle:
1
2
3
sudo avrdude -c usbasp -p m328p -U flash:w:characteristics2.
Introduction I recently bought a DVID board which is an open source vulnerable designed IoT device. In this post I will try to explain how to solve the second Bluetooth challenge of the DVID project. In this challenge we need to read data from a special characteristic.
Challenge Let’s flash the firmware, enable Bluetooth and setup the usb dongle:
1
2
3
sudo avrdude -c usbasp -p m328p -U flash:w:characteristics.
Introduction I recently bought a DVID board which is an open source vulnerable designed IoT device. In this post I will try to explain how the Bluetooth protocol works and how we can solve the first Bluetooth challenge of the DVID project.
Bluetooth protocol This talk is a good introduction to Bluetooth hacking, what’s following come from this document, but if you want more details you should read it. The next diagram shows how a typical connection between a phone and a Bluetooth device work.
Event Challenge Category Points Solves AperiCtf TMNT web 300 6 TL;DR In this challenge we need to trigger an XSS, first we need to bypass the template engine of the browser to insert custom tags in the page. We can then trigger the XSS with some specific tag and use a DOM-based JavaScript injection vulnerability.
Step 1 This is my first web write-up, I usually prefer popping shell, but this time we will pop some alert boxes !
Event Challenge Category Points Solves AperiCtf PwnRunSee 1 pwn 175 5 AperiCtf PwnRunSee 2 pwn 250 2 TL;DR This challenge was a use after free vulnerability which allow the user to get a shell on the remote docker after a call to execve with some user controlled parameters. Once inside the docker, we can abuse some privileges to mount the host disk inside the container and get the last flag.
Event Challenge Category Points Solves ecsc2019 filereader pwn 1000 20 TL;DR We need to exploit binary which read the content of files listed in an other file. A buffer-overflow is present in one of the function and we can leak the address of libc thanks to /proc/self/map since we can read files. A onegadget is then used to pop a shell.
Event Challenge Category Points Solves inshack-2019 gimme-your-shell pwn 50 67 TL;DR This is a remote buffer overflow challenge, there is no protection on the binary but ASLR is enable on the remote server. I redirected the execution flow to write my shellcode to a controled area, then jump to it and execute it.
Getting informations First I looked at the protections on the binary :
Event Challenge Category Points Solves santhacklausctf mi1 Forensic/Crypto 800 18 TL;DR After downloading the zip file we were faced with a linux memory dump. After building the correct profile for volatility you had to perform a known plain text attack on an encrypted and splited zip file to recover the file flag.txt.
Introduction After downloading the file MI1.zip we had a memdump.
Event Challenge Category Points Solves santhacklausctf mi2 Forensic/Crypto/network 500 22 TL;DR In the second part of the challenge we also had a memory dump of a Debian system and a network capture. When you analyse the network capture you can see that some data were exfiltrated, if you look into the memdup you can see that the tool DET (Data Exfiltration Toolkit), has been used to exfiltrate the data.