Story continued from Page 1
Was this example running on one of those cheap (like $100) SOHO routers?
Barnaby Jack: Yes, the example was a popular SOHO router. The same techniques used to exploit the cheaper consumer routers are applicable to high-end routers as well. In my opinion, the ideal attack for routers is a man-in-the-middle attack. The device sits on the perimeter, and sees all incoming and outgoing traffic. In my example, I injected data into incoming traffic to compromise internal hosts -- but you could re-route traffic, sniff data, open a shell, the list goes on. Of course, any network connected device can be targeted, a router just seemed like an obvious example.
Which router manufacturers should be interested in your research?
Barnaby Jack: This reaches further than router manufacturers. Any manufacturer that uses an ARM or XScale, and even PowerPC processor, should take an interest in this research. All of these architectures allow remapping of the vectors to a high address, which essentially protects from this vulnerability class. This attack is not going to be the next stack overflow, but the simple truth is, these flaws do exist -- and prevention is quick and simple. In the case of router manufacturers, I can only speak for ourselves -- at Juniper, all research is distributed internally before being released to the public. Our engineers take this research and apply any necessary changes to our product line.
Barnaby Jack: All three consoles are using PowerPC based cores. If an exploitable NULL dereference was found that allowed an attacker to overwrite the NULL address, and vectors were mapped low, then an attack would be possible. From the little I have read, at least concerning the Xbox360 and its hypervisor mode, I would consider an attack unlikely. I don't know enough about the other game console architectures and their memory management implementations to say specifically if they would be vulnerable.
We have already seen some attacks against bug in wireless drivers for common OSes. I am wondering if this vector might help attackers exploit bugs in drivers included in embedded systems.
Barnaby Jack: Definitely. The wireless interface on embedded devices is generally the first place I would hunt for vulnerabilities. There are ample opportunities to find exploitable bugs. The same (or at least very similar) vector used to exploit wireless drivers under common OS's can be applied to embedded systems with a wireless stack. The most interesting aspect of the wireless interface is that many products will integrate a System-On-Chip design that has the wireless code built into the chip, and the developer will call the API provided by the chip manufacturer. These SoC designs are heavily used in all manner of consumer, and high-end devices. An exploitable flaw within a popular SoC would affect many devices.
Thinking at something like a blackberry... How do you extract the code from one of those embedded devices?
Barnaby Jack: There are a number of methods to retrieve the firmware image. If a JTAG connection can be made to the device, then the firmware image can be read off the flash chip via JTAG. There are both commercial and free products available that support reading and writing flash memory via the JTAG port. A popular opensource project for interfacing with JTAG enabled devices is jtagtools. The jtagtools software can program and read various external flash chips.
Often, the firmware can be downloaded from the vendors site. In many cases there will be no compression or encryption, or the firmware will be compressed with a known compression scheme. If a firmware image is encrypted or compressed with a proprietary scheme, the firmware image may contain an unencrypted copy of the bootloader -- the bootloader can be reversed to find the compression algorithm, and a custom decoder can be written.
If connecting a JTAG isn't feasible and the firmware image is not available for download, then a last ditch effort is to physically remove the flash memory chip from the device, and read the image in an external reader. The simplest way to remove the chip from the device is by using a hot air rework tool. Apply hot air to re-flow the solder, and remove the chip. The chip can then be read externally in an eeprom reader. Another option is to use the "Chip Quik" product. It is a low melting point alloy, that when heated and fused with soldered joints, forms a new alloy that will stay in a molten state long enough for components to be removed.
Should final products ship with debugging features disabled?
Barnaby Jack: Ideally, yes. Many vendors will remove resistors leading from the JTAG port, or in the case of the ARM architecture, may drive the TRST pin low. Neither of these methods is sufficient to disable the JTAG functionality. Resistors are easily replaced, and pins can be pulled high. The ideal choice is to remove the JTAG traces altogether. The main argument against removing JTAG and UART ports is the cost factor. Manufacturing boards is expensive, and the cost involved to manufacture both prototype and production boards may not be warranted. Debugging functionality may be needed in some production devices, for technicians to service the device, for example.
If the JTAG port is removed, it's certainly a roadblock for an attacker, but it will not stop someone who is determined to have access to the code -- other methods such as tapping data traces and re-socketing chips can be employed.
In the end it all boils down to writing secure software. If the software on the device is vulnerable, removing debugging functionality won't change that fact.