As data speeds have increased over the last few years, and interface ports have become more and more multi-functioning and integrated, cables have started to pose a very particular and real danger. So far, they often have been ignored and considered "dumb wires". But far from that, many cables these days hold logic chips of their own and in some cases even upgradable (replaceable) firmware.
I may be wrong, but I think it all started with "Firewire" / IEEE--1394. Firewire was still a "dumb wire", but it provided direct uncontrolled access to the system bus. With access to the firewire bus, it was possible to read memory, or access other bus components, without being subjected to the operating system's access controls. .
It sort of went downhill from there. Displayport/Thunderbolt/USB-C introduced "smart cables" with specific hardware built into the cable. These cables include processors with firmware that can often be replaced without leaving any visible or obvious functional mark. The cable now has access to the system bus, and with that can access data on the bus as well as manipulate hardware connected to it. It is conceivable to run a "spy appliance" inside the cable that will acquire memory or data transmitted to the device, and then use a network card to exfiltrate the data. Peripherals connecting to the device may also be used to launch these types of attacks.
Thunderbolt/USB-C have some built-in protection for attacks like that. Starting with Firewire, operating systems limited direct memory access (DMA) during boot and before the user is logged in, preventing some of the attacks against unattended computers. Couple times, these defenses have however shown to be inadequate and had to be patched .
With USB-C, a new threat emerged. USB-C is no longer just used for data but can be used to provide significant power up to 100W to a connected device. The exact power delivery parameters are negotiated between the power supply and device, with some assistance from the cable. Sadly, cables have shown to be buggy at times and they have not correctly implemented the "Power Delivery" (PD) standard. The result is damaged devices if the cable delivers a voltage that is higher then expected. A manipulated cable could easily trick a power supply into frying electronics connected to it. 
And while all these standards have their flaws, there is still worse: Cables with added functionality. Recently I ran into this cable:
The cable looks like just another standard micro-USB/Lightning charging cable. It actually works as a charging cable and retails for about $30. But inside the slightly oversized USB-A end, the manufacturer included a SIM card with GSM radio and microphone. The cable responds to SMS messages. If it receives "DW", then it will reply with the GPS coordinates. Sending "1111" will turn it into listen mode, and it will call the sender whenever the volume in the room exceeds a certain level to allow the sender to listen in. Needless to say, I had to try it out. It works "ok". The GPS responses are delayed by several minutes and not very accurate (I used it inside), but the call back features works quite well. I am not sure if it uses a "real" GPS or just geolocation via cell towers. While there may be legit uses for a cable like this for theft protection, they do also pose a significant threat.
So how do you protect yourself? The main risk is systems (and cables) left unattended in places with some public access. Think hotel rooms or classrooms. Track your cables, and mark them to prevent swapping of cables. Lock your cables just like you lock your computer. I prefer my own small Pelikan case backpack with my own (not TSA approved) locks. I am not aware of any test to verify the firmware installed in cables. So if you don't trust the cable, dispose of it (which can be an expensive proposition for some of these cables). The "USB spy cable" is pretty easy to spot if you know what to look for, but I am sure they can make it a bit smaller and there may be a version that is a bit more expensive that doesn't come apart as easy to reveal the SIM card.
Oct 6th 2017
2 months ago
I have had something similar to what is in the post actually in my thought processes since I got my first smart phone, having someone offer to charge my phone for me due to my non existent or broken charging cable, and having paranoid thoughts of "what malware is this guy giving me with his modified wall charger." I started thinking way back then how someone could have a modified firmware chip inside a power box that did God knows what in about 60 seconds before they gave the victim's phone back. Now that is even more of an actuality with raspberry pi's and micro cell devices like you have show here.
Oct 18th 2017
1 month ago