Ph0wn CTF 2019 - Smart Devices CTF
Another week another CTF, this time it was the Ph0wn at Sophia Antipolis (France). I teamed up with members from @Maki, @iansus, @MansourCyril and @0hax. We reached the second place of this IoT/Hardware CTF.
Writeups’ challenges
- Rookie - Sunny day
- Hardware - Ant-Maker
- Misc - Compromised Sensor
- Misc - Domotics
- Crypto - Shamir Quest
Rookie - Sunny day
The weather is always nice on the French Riveria. Yet, it is great to monitor this (sunny) weather with a weather station. There is a weather station in Biot, and there is an Android app for it. But somebody told me that there could be a hidden treasure in its main layout
First we ran the new MobSF application and drag’n dropped the APK file into it : docker run -it --name mobsf -p 8000:8000 opensecurity/mobile-security-framework-mobsf:latest
. After inspecting the source code we stumbled upon the following Java/Android at http://localhost:8000/ViewSource/?file=tux/android/biotmeteo/MainActivity.java&md5=1b6d26562ca11c2d0c13fae063c93cd9&type=apk indicating the flag was around.
We extracted the biotmeteo.apk as a zip file and started looking for the flag pattern ph0wn{
recursively. We will find inside biotmeteo\res\layout\main.xml.
Flag : ph0wn{IsTheWeatherNiceT0night?}
Hardware - Ant-Maker
To receive the signal, you have to fabricate a RHCP antenna at 868MHz. Use the 3D_ant file as a model to mount the antenna. Collect your PCBs and use some tools and a soldering iron. Once your are ready, register on list to test if your prototype can receive the signal. 3 teams will make the test each 30mn. The Master of the Chamber, Fabien, will guide you to the anechoic room.
We were given two PCB and an antenna, in order to get the flag we had to solder them the right way. To help us the organizers provided each team with this file : Ph0wn-3D_ant.step.
It’s a step file containing a 3D vizualization of the final PCB. From there we knew what to solder and where, we loaded it into https://3d-viewers.com/step-viewer.html.
The challenge wasn’t hard but takes a lot of time and thorough effort to create a “working” antenna.
Flag : ph{LoRa_From_Space}
Misc - Compromised Sensor
I swear I saw a masked attacker come with a big syringe and a huge needle infect those glucose sensors for diabetics. What did he inject in those NFC sensors?!
- Come and get a sensor at the organizer desk (see the attached image to recognize the device you need to get)
- Nota. Due to a server crash, if you see an IP address, modify with 35.241.137.50 (no DoS)
Since the NFC is used by the sensor, let’s check it with our proxmark3. With these data in mind we can find more informations about the sensor, it seems to be a FreeStyle Libre sensors.
On a StackOverflow post we find this goldmine :
Instead, you will have to find out what commands the blood sugar meter actually supports (probably it will support the ISO/IEC 15693 READ SINGLE BLOCK command
Now we know there is dump equivalent for NFC-V (ISO 15693), let’s try it with the proxmark.
Some data are cropped, we tried several applications on our Android device. NFC TagInfo by NXP was the right one, it allows us to scan the entire memory.
We get the following credential for the IP 10.210.17.66
From there we can download a PDF file containing a mention to Examen réalisé par marquage de type “Ange Albertini” CCC’2014 ou PoC||GTFO
. Ange Albertini gave a talk Funky File Formats on NoLimitSecu, we guess there is another file hidden in the PDF, running binwalk in extract mode will gave us thezip/FLAG containing the flag.
Flag : ph0wn{BeS@feAndTakeCare}
Misc - Domotics
Pico le Croco would like to control the power consumption of equipment in his wine cellar and in his pool. For that, he has bought a nice power meter, EcoCompteur from Legrand.
Configuration:
-
In Setup / Hardware, a Ph0wn EcoCompteur hardware is already partly configured for you (along with weather sensors), but you need to fix the IP address to: http://10.210.17.34:20000.
-
Unfortunately, you may encounter a bug where you are unable to modify the existing hardware. In that case, delete it and create a new one. Also, the port 20000 must be specified in both the remote address and the port (other bug).
-
Then, among Devices, you might like to tag “Conso 1” and “Conso 2”: Conso 1 is the wine cellar, Conso 2 is the pool.
A new docker instance is deployed for each team when they click on the challenge, this instance is binded to a random port of the server 10.210.17.34. Since there is no authentication to access the EcoCompteur we guessed we could access other contestants panel.
We downloaded the usage for both Conso 1 and Conso 2.
We can clearly identify some ASCII char, let’s display them using Javascript.
The URL was a little buggy, we grabbed the flag at http://10.210.17.34:20000/n1ceflag
Flag: ph0wn{h0w_about_using_a_candle_instead}
Crypto - Shamir Quest
Ph0wn is so coooool. We’ve implemented a Dragon Ball game for your Android smartphone, so you can play and relax. Oh?! Looks like there’s a flag in there!
The Android application is running Cordova, basically all the code is in some Javascript file. Every Dragon ball of the game is mapped like this int(1-7) - long(…). Based on the challenge name we know we have a Shamir Shared Secret. We can recover it with the following python script.
Flag : ph0wn{Sh4m1r_4nd_G0ku_P4rtyt1me}