Reverse-Engineering Xiaomi IoT Firmware

IoT devices rarely ever just do what they’re advertised. They’ll almost always take up more space than they need to – on top of that, their processor and memory alone should be enough to run a multitude of other tasks while not necessarily compromising the task they were built to do.

That’s partially the motivation for rooting any device, but for Xiaomi devices, it’s a bit more fun – that is to say, it’s a little bit harder when you’re reverse engineering its firmware from scratch.

Similar to his other DEF CON 26 talk on modifying ARM Cortex-M firmware, [Dennis Giese] returns with a walkthrough of how to reverse-engineer Xiaomi IoT devices. He starts off talking about the Xiaomi ecosystem and the drawbacks of reusing firmware across all the different devices connected to the same cloud network before jumping into the walkthrough for accessing the devices.

Continue reading “Reverse-Engineering Xiaomi IoT Firmware”

Customizing Xiaomi ARM Cortex-M Firmware

This hack was revealed a while ago at DEFCON26, but it’s still a fascinating look into vulnerabilities that affect some of the most widely used IoT devices.

[Dennis Giese] figured out a way to modify ARM Cortex-M based firmware for use in customizing the functionality of devices or removing access to the vendor. Obviously, there are more malicious activities that can be done with this type of hack, as with any exploits of firmware, but they are (also) obviously not condoned.

The talk goes into the structure of Xiaomi ecosystem and products before going into a step-by-step approach to binary patching the firmware. The first step was to acquire the firmware, either by dumping SPI flash memory (using JTAG, SWD, or desoldered Flash pins) or intercepting traffic during a firmware update and downloading the firmware. There’s also a possibility of downloading the firmware using a URL, although this can be more difficult to find.

The firmware can then be parsed, which first requires the format to be converted from a proprietary format to and ELF file. This conversion makes it easier to load into IDA pro, and gives information on the segments of the firmware and its entry point. Python tools luckily exist for converting binary files to ELF, which simplifies the task.

After loading the ELF file into the disassembler, you’ll want to find the key memory area, denoted by “TAG_MAC”, “TAG_DID”, and “TAG_KEY” in the example firmware (for storing the MAC address, device ID, and key). In order to prepare the firmware for Nexmon – a software that supported C-based firmware binary patching for ARM Cortex-A and ARM Cortex-M binaries – you’ll need to partition some space in the memory for patches and know the function names and signatures for the firmware.

The latter is done by doing a difference comparison in the disassembler between an unknown executable and the example executable.

With the necessary information gathered, you can now use Nexmon to make your modifications. The fact that this can be done for smart devices at home means that smart devices you acquire – especially those partitioned by others – may contain malicious code, so take care when handling used devices.

Continue reading “Customizing Xiaomi ARM Cortex-M Firmware”

Faxsploit – Exploiting A Fax With A Picture

Security researchers have found a way to remotely execute code on a fax machine by sending a specially crafted document to it. So… who cares about fax? Well apparently a lot of persons are still using it in many institutions, governments and industries, including the healthcare industry, legal, banking and commercial. Bureaucracy and old procedures tend to die hard.

This is one of those exploits that deserve proper attention, for many reasons. It is well documented and is a great piece of proper old school hacking and reverse engineering. [Eyal Itkin], [Yannay Livneh] and [Yaniv Balmas] show us their process in a nicely done article that you can read here. If you are into security hacks, it’s really worth reading and also worth watching the DEFCON video. They focused their attention in a all-in-one printer/scanner/fax and the results were as good as it gets.

Our research set out to ask what would happen if an attacker, with merely a phone line at his disposal and equipped with nothing more than his target`s fax number, was able to attack an all-in-one printer by sending a malicious fax to it.

In fact, we found several critical vulnerabilities in all-in-one printers which allowed us to ‘faxploit’ the all-in-one printer and take complete control over it by sending a maliciously crafted fax.

As the researchers note, once an all-in-one printer has been compromised, it could be used to a wide array of malicious activity, from infiltrating the internal network, to stealing printed documents even to mining Bitcoin. In theory they could even produce a fax worm, replicating via the phone line.

The attack summary video is bellow, demonstrating an exploit that allows an attacker to pivot into an internal network and taking over a Windows machine using Eternal Blue NSA exploit.

Continue reading “Faxsploit – Exploiting A Fax With A Picture”

Hackaday Links: April 7, 2019

It’s April, which means all the people responsible for doubling the number of badges at DEF CON are hard at work getting their prototypes ready and trying to fund the entire thing. The first one out of the gate is Da Bomb, by [netik] and his crew. This is the same team that brought you the Ides of DEF CON badge, a blinky wearable multiplayer game that’s SPQR AF. Da Bomb is now a Kickstarter campaign to get the funding for the run of 500, and you’re getting a wearable badge filled with puzzles, Easter eggs, and a radio-based sea battle game that obviously can’t be called Battleship, because the navy doesn’t have battleships anymore.

Speaking of badges and various badge paraphernalia, there’s a new standard for add-ons this year. The Shitty Add-On V.1.69bis standard adds two pins and a very secure shrouded connector that solves all the problems of last year’s standard. [AND!XOR] just released a Shitty Brooch that powers all Shitty Add-Ons with a CR2032 battery. All the files are up on the Gits, so have fun.

You can 3D print anything if you don’t mind dealing with supports. But how to remove supports? For that [CCecil] has a great tip: use Chap stick. This is a print that used supports and it’s perfectly clean, right off the bed. By inserting a suspend (M600) command at the z-height of the top of the interface layer, then adding Chap stick on the top layer, everything comes off clean. Neat.

Speaking of 3D printing, here’s a project for anyone with the patience to do some serious modeling. It’s a pocket Soviet record player, although I think it’s more properly called a gramophone. It’s crank powered, so there’s a spring in there somewhere, and it’s entirely acoustic with zero electronics. Yes, you’re going to need a needle, but I’d be very interested in seeing somebody remake this using modern tools and construction materials.

Down The Rabbit Hole Of Electronics Manufacturing

If you want to build hundreds of a thing (and let’s face it, you do) now is a magical time to do it. Scale manufacturing has never been more accessible to the hardware hacker, but that doesn’t mean it’s turn-key with no question marks along the way. The path is there, but it’s not well marked and is only now becoming well-traveled. The great news is that yes, you can get hundreds of a thing manufactured, and Kerry Scharfglass proves that it’s a viable process for the lone-wolf electronics designer. He’s shared tips and tricks of the manufacturing process in a prefect level of detail during his talk at the 2018 Hackaday Superconference.

Kerry is the person behind the Dragonfly badge that was sold at DEF CON over the last two years. Yes, this is #badgelife, but it’s also a mechanism for him to test the waters for launching his own medium-run electronics business. And let’s face it, badge making can be a business. Kerry treats it as such in his talk.

Continue reading “Down The Rabbit Hole Of Electronics Manufacturing”

Video Review: AND!XOR DEF CON 26 Badge

The AND!XOR team have somehow managed to outdo themselves once again this year. Their newest unofficial hardware badge for DEF CON 26 just arrived. It’s a delightful creation in hardware, software, and the interactive challenges built into both.

They call this the “Wild West of IoT”, a name that draws from the aesthetic as well as the badge-to-badge communications features. Built on the ESP32-WROVER module which brings both WiFi and Bluetooth to the party, the badges are designed to form a wireless botnet at the conference. Anyone with a badge can work to advance their level and take more and more control of the botnet as they do.

Check out the video overview and then join me below for a deeper dive into all this badge has to offer.

Continue reading “Video Review: AND!XOR DEF CON 26 Badge”

Hackaday Links: June 24, 2018

What do you do if you’re laying out a PCB, and you need to jump over a trace, but don’t want to use a via? The usual trick is using a zero Ohm resistor to make a bridge over a PCB trace. Zero Ohm resistors — otherwise known as ‘wire’ — are a handy tool for PCB designers who have backed themselves into a corner and don’t mind putting another reel on the pick and place machine. Here’s a new product from Keystone that is basically wire on a tape and reel. It’s designed to jump traces on a PCB where SMD zero ohm resistors and through-hole jumpers aren’t possible. I suppose you could also use it as a test point. They’re designed for high current applications, but before we get to that, let’s consider how much power is dissipated into a zero ohm resistor.

By the way, as of this writing, Mouser is showing 1,595 for Keystone’s 5100TR PCB jumpers in stock. They come on a reel of 1,000, and a full reel will cost you $280. This is significantly more expensive than any SMD zero ohm resistor, and it means someone bought four hundred of them. The electronic components industry is weird and you will never understand it.

There’s a new product from ODROID, and you want it. The ODROID-GO is a Game Boy and Sega Master System emulator running on an ESP-32, has a fantastic injection molded case, and looks phenomenal.  You can buy it now for $32. Does this sound familiar? Yes, a few months ago, the PocketSprite was released. The PocketSprite is the tiniest Game Boy ever, and a project [Sprite_TM] introduced to the world at the 2016 Hackaday Superconference.

This week, the speaker schedules for two awesome cons were announced. The first is HOPE, at the Hotel Penn on July 20th. Highlights of this year? [Mitch Altman] is talking about DSP, [Chelsea Manning] will be on stage, someone is talking about HAARP (have fun with the conspiracy theorists), and someone is presenting an argument that [Snowden] is an ideological turd. The speaker schedule for DEF CON was also announced. The main takeaway: god bless the CFP board for reigning in all the blockchain talks, the Nintendo Switch was broken wide open this year, but there’s only a talk on the 3DS, and there’s more than enough talks on election hacking, even though that was a success of propaganda instead of balaclava-wearing hackers.

The C.H.I.P. is no more, or at least that’s the rumor we’re running with until we get some official confirmation. When it was introduced, the C.H.I.P. was a Linux system on a chip with complete register documentation. It appears the end of C.H.I.P. is upon us, but have no fear: there’s a community building the PocketC.H.I.P., or the C.H.I.PBeagle. It’s a single board computer based around the OSD3358 from Octavo, the same system found in the PocketBeagle. Source in KiCAD, and people are working on it. Thanks [smerrett79] for the tip.