Apple Keyboard Firmware Hack Demonstrated 275
Anonymouse writes with this excerpt from SemiAccurate:
"Apple keyboards are vulnerable to a hack that puts keyloggers and malware directly into the device's firmware. This could be a serious problem, and now that the presentation and code (PDF) is out there, the bad guys will surely be exploiting it. The vulnerability was discovered by K. Chen, and he gave a talk on it at Black Hat this year (PDF). The concept is simple: a modern Apple keyboard has about 8K of flash memory, and 256 bytes of working RAM. For the intelligent, this is more than enough space to have a field day. ... The new firmware can do anything you want it to. Chen demonstrated code which, when you put in a password and hit return, starts playing back the last five characters typed in, LIFO. It is a rudimentary keylogger; a proof of concept more than anything else. Since there is about 1K of flash free in the keyboard itself, you can log quite a few keystrokes totally transparently."
Huh?? (Score:5, Insightful)
Why does a keyboard even need flash in the first place? Being a keyboard isn't a complex job.
Re:Huh?? (Score:5, Informative)
Modern peripherals have microcontrollers that are basically tiny computers all on one chip. The have program flash, data registers, and sometimes data flash or eeprom memory. They are basically small computers about a $1.00 a pop, and are generally more affordable than custom silicon for most low-speed applications (i.e. less than 20 MIPS).
Re: (Score:2)
Re: (Score:2)
Damn it, all this time I was thinking it used 0-9 like everyone else does.
You're probably thinking of ENIAC [wikipedia.org]
Re: (Score:2)
Re: (Score:2)
Why on earth would you do that in the hardware level? The keyboard just sends key codes, not characters to the OS, it's the OS's job to map them onto characters.
Re: (Score:2)
Ah but the keyboard needs to understand how keycodes change for Shift/Ctrl/AltGR/etc.
Re: (Score:2)
The potential being that a user can change the keyboard to, say, "US English" or "International" without requiring the OS to explicitly support it?
Then one could plug a keyboard into OS X, XP, Gnome, Haiku etc and not have to mess around configuring the settings each time. Which in shared households would mean 'Gary' just plugs in his $5 US English keyboard set to international with all the weird symbols to do his Spanish/German homework and the rest of the family use their own and don't have to reset the k
Re:Huh?? (Score:5, Funny)
Re: (Score:2)
More likely so that the same hardware can be used for multiple languages & key templates. Not to mention such a thing could be useful for gaming keyboards.
Re: (Score:2)
If these are recent (last 2-3 year) keyboards, the ones I have double as non-powered USB hubs.
The idea is that you plug in your mouse and Watcom tablet or other input device directly into the keyboard instead of snaking a couple extra wires to the computer.
Pretty nifty (until now, that is).
Re: (Score:2)
Keyboards with built-in hubs have been around nearly as long as as USB keyboards. The idea would be that you plug your mouse, and perhaps your joystick into the keyboard, using only one USB port on the computer for all your major input devices. These days, a hub built into the keyboard is often the most convenient USB port for flash drives.
Similarly, it was thought that your monitor might be a USB device (Not fully USB, still using a VGA or DVI cable for the video image, but perhaps passing monitor configur
Re:Huh?? (Score:4, Insightful)
Dealing with USB however is something that requires a reasonablly powerfull microcontroller with quite complex firmware. Most current microcontrollers are flash based and in many cases are likely to have more flash than the application needs.
Re: (Score:2, Insightful)
The need for physical access? Sure, someone intentionally spying on YOU might do it, but for someone looking to keylog as many credit card numbers as possible it'd be kinda difficult/pointless.
Re:Huh?? (Score:4, Insightful)
You could use it constructively, though. You could block the key sequences used to boot off a CD or external drive, which could actually be a useful feature for corporations or schools wanting to prevent booting from external media, since the other methods to prevent that don't work that well.
Re: (Score:2)
The only possible reason I could think for someone doing this is because it would work cross-OS, and even on boot sequences before a normal keylogger would be activated, so you could do this to steal a disk encryption password.
That is a good point, but only for attacking those dual booters and disk encrypters (the lather perhaps being the most useful as you could then steal the disk and get the data - assuming you can't copy it to a USB stick or download it over the nett for some reason.)
You could use it constructively
You could be onto something there, but there's probably programmable keyboards better suited for this already :-)
Re: (Score:2)
Oh, it's no big deal now, but if the keyboards get a little more powerful it isn't hard to think of ways of exploiting them.
One obvious advantage to infecting a keyboard is conventional methods for dealing with malware aren't going to detect the infection. It has a lot of the same advantages as a BIOS virus.
One could conceivably infect a whole shipment of keyboards headed for a company of industrial espionage purposes. Resources are currently pretty slim for doing much more, but if we imagine keyboards g
Re: (Score:2)
Unless the firmware was hacked before you received your new keyboard...
Which still leaves you the problem of retriving the data.
Re: (Score:2)
..er, because the user can reformat his machine from read-only media, and think he's safe? That's the whole idea.
..er, because the user can reformat his machine from read-only media, and think he's safe? That's the whole idea.
If the user reformats his mac how will you retrieve the keylog? Either you need physical access or you have to break into the OS again. If you can break into the OS it's unlikely that the 1000 character keylog waiting for you is worth the effort.
If you got physical access you can install a physical key logger. A firmware key logger may be easier to hide and install but that's it. You still have to retrieve the data, so excepting the greater ease it's not superior to a simple key logger hidden inside you
Re: (Score:2)
What's to stop the compromised keyboard from sending the keylogged data to an FTP server like just about every other trojan on the planet?
A compromised keyboard does not automatically have admin access to the OS. Though it might be possible to get your admin password through guessing it's the first thing you write after boot and then moving on from there.
Re: (Score:2)
I didn't say it would have access to the OS?
Without access to the OS the keyboard will not be able to send the data anywhere.
Re: (Score:2)
"so it will have access to all your computer account passwords"
Big deal.
"your bank account and PayPal passwords"
So what?
"your chats with young children online"
*falls off chair* f#&k me I'm burning this thing!
Re: (Score:2)
Ok, i should have clarified that i meant 'user writable' flash.
Re:Huh?? (Score:5, Insightful)
I'm pretty sure it's easier for me to get some code to run on your machine than it is for me to break into your house and install a logger inside your keyboard.
Re: (Score:2)
I'm pretty sure it's easier for me to get some code to run on your machine than it is for me to break into your house and install a logger inside your keyboard.
If you can break into my machine, install a flash based key logger and have that transmit data over the internet back to you then you could have saved yourself the problem of using a flash based key logger - as you obviously have control of the OS and can keylogg far more than one-thousand keystrokes.
Re: (Score:3, Insightful)
But if you removed the logger, say by reinstalling the OS or whatever I would lose that. With it in the keyboard I you need to also replace that (or reflash it of course).
Re: (Score:2)
Because this tool just sends messages to a HID device, AFAIK, it can be run as any user, admin or otherwise. Want the root password on somebody's Mac OS X box? All you need is a shell account.
Hmm, didn't realize you could do this from user mode. That's more serious, yes. You still need a "shell account" though. Most people don't hand those out.
Re: (Score:2, Insightful)
Mac user: "What's a shell account?"
Linux user explains the whole thing.
Mac user: *head explodes*
Re: (Score:2)
They did this on The Real Hustle: switched a keyboard in an office with an identical keyboard that had a keylogging chip added in. It was quite interesting.
Re: (Score:2)
Re: (Score:2)
Like it or not, FLASH is what you get on microcontroller these days. Few if any of the devices are EPROM based anymore. By making the same part generic and programmable, you get huge volume and lower price
Flash? EPROM? Don't they just order a couple million masked chips?
Re:Huh?? (Score:5, Informative)
No, it's your OS's job to decide what pressing keypad-minus does, the keyboard should simply tell the OS that keypad-minus key was pressed
Flash memory in a keyboard? (Score:3, Insightful)
Re:Flash memory in a keyboard? (Score:5, Informative)
Re: (Score:2)
+5 Informative. In fact, the laptop keyboards also have a bit of flash, and Apple has updated a whole host of keyboard firmware over time.
Re:Flash memory in a keyboard? (Score:5, Informative)
The firmware could have been in ROM, but these days Flash is about as cheap as ROM and gives you the option of distributing fixes if you find bugs after the device ships.
Two such examples of exactly that:
The only news here is that the same mechanism of installing these updates is able to have other third party software installed in their place as well.
What about other keyboard manufacturers? (Score:4, Insightful)
Is the Apple implementation any different from what other USB HID makers use? I'd be kind of surprised if Apple did anything original with its keyboard design other than making them shiny and thin (and giving them no tactile feedback whatsoever.)
And if so, are other USB keyboards vulnerable to similar hacks?
Re: (Score:2)
Re: (Score:2)
I think you missed the slide where they discussed how to disable it via keyboard commands.
Re:What about other keyboard manufacturers? (Score:5, Informative)
All USB keyboards are vulnerable. The blame here rests on the USB Device Firmware Update Specification [usb.org], which specifies how firmware updates are supposed to work. Hint: there's no security. The only reason this makes news at all is because it has the word "Apple" in the title.
Spec compliant, secure: choose one. USB was designed for single user computers without security in mind. The only way to solve this (partially) with existing hardware would be to block access to hardware devices from applications running as non-root users, which is fundamentally contrary to the desire to get device drivers out of the kernel for stability. Short of that, this can only be solved by putting a more powerful CPU in the keyboard controller so that it can do a signature check on its own firmware.
Re:What about other keyboard manufacturers? (Score:4, Insightful)
Wouldn't this depend on the keyboard being reflashable from the USB interface? There's a lot of USB microcontrollers out there which can only be re-flashed with physical access to the hardware, not through the USB interface. Maybe this violates USB HID spec, but why does anyone need their keyboard firmware to be upgradeable anyway? This isn't exactly something that changes often. Your typical $5 USB-to-serial adaptor isn't upgradeable either to my knowledge, why should this be?
Re: (Score:2)
I'd be kind of surprised if Apple did anything original with its keyboard design other than making them shiny and thin (and giving them no tactile feedback whatsoever.)
Mine is a USB hub, you can plug in your mouse (right or left hand side, as you wish) and a USB key, or pretty much anything else.
I like having two mice coming out of it, personally (my preference varies).
I've never seen that on a windows machine.
Re: (Score:2)
I wonder how different the Bluetooth keyboards are? I have an older one and I've never heard about this HIDFirmwareUpdaterTool, be interesting to see if I could hack my Bluetooth keyboard..
(I'm not likely to be vulnerable to a remote attack with this as I use a different OS and to my certain knowledge there is no way to initiate a firmware update from the host)
Re: (Score:2)
Comment removed (Score:5, Informative)
Re: (Score:2)
Re:Flash memory in a keyboard? (Score:5, Funny)
Re:Flash memory in a keyboard? (Score:4, Funny)
Re: (Score:2)
Re: (Score:2)
Maybe in future versions of MacOS there will be new keyboard features, or a simpler/different keyboard communications protocol, and a firmware update will allow you to keep using your existing KB, instead of throwing it away and buying a brand new next-edition KB?
Are we thinking of the same Apple? They always want you to buy the new shiny, not upgrade the old one.
Re:Flash memory in a keyboard? (Score:4, Interesting)
If it has to have a flash BIOS for some reason, why does the flashing utility allow any image to go in without notice? Something like this should either require a signed or encrypted image that the flash utility decodes and decides is correct before putting it in. Maybe something simple as holding a distinct key sequence down on the keyboard while the utility pops up might be an alternative. This way at least the user has to be duped into knowingly flashing the keyboard, as opposed to a completely stealth compromise.
If I were making a keyboard with a flashable BIOS, rather than going the easy route and hiding a symmetric key on the chip would be eventually discovered, I'd use a SHA256 hash combined with an elliptic signing key to validate that a BIOS image was not tampered with before allowing it to be copied to the device. Yes, (barring someone breaking the public key crypto or obtaining the private key) someone could hack a particular keyboard to accept any flash image, but it would require physical access to the JTAG contacts on the device, and its well known that the game is over when an attacker obtains physical access to a machine anyway.
Re: (Score:3, Interesting)
Most likely because they never anticipating anyone being bored enough to reverse engineer something as simple as a keyboard to hack it. Its like reverse engineering your old school ball mouse.
Some people just have alot of time on their hands
Re: (Score:2)
Re: (Score:2)
This hack could be done to any usb keyboard.
A firmware flashing utility that refused to flash if the firmware image isn't from the manufactor would be annoying. There are usefull firmwares that are hacked. Dvd firmware that removes regions comes to mind.
While a bios is a firmware. A firmware is not a bios.
This hack also requires physical access, which means there are other ways to compromise the system.
Re: (Score:2)
It depends on how the keyboard is matrixed, I suppose, but you have to have more than three-key handling or you wouldn't be able to detect people holding down the four or five modifier keys and pressing a key... not to mention that you'd have certain combinations of single modifiers with single keys that couldn't be detected at all.... :-)
With any keyboard encoder, you should be able to get at least 8 buttons or so even without any sharing or reprogramming. If you matrix the joystick in an interesting way
What's next? (Score:3, Funny)
This is getting quite silly... Perhaps manufacturers should try to keep simple devices actually simple.
Re:What's next? (Score:4, Informative)
Re: (Score:2)
That's a feature, not a bug.
That's not a bug. (Score:3, Informative)
That *is* a feature. It isn't a hacked battery, it is a battery which is hacked to appear as an authentic internal tool, designed to read a certain area on a memory stick, so sony can quickly restore a problematic psp.
It was designed that way, and obscured. the 'hack' merely makes that information public and usable.
Re: (Score:2)
Perhaps manufacturers should try to keep simple devices actually simple.
When most major appliances, all automobiles, motorcycles, HDTVs, etc., etc., have a least one (if not dozens) of microprocessors and storage chips onboard, the time for that sentiment was long past in the last century.
We've sold our souls for convenience and "ease of use" features, and are now beginning to reap the dark side of those value adds.
Yes, but does it run... (Score:4, Funny)
No... (Score:2)
Coming soon to an enterprise near you (Score:5, Funny)
Mandatory 2k long passwords to defeat possible hardware loggers.
Changed monthly, of course.
Re: (Score:2)
No problem. My company supplies me with all the post-it notes I need!
Physical access required (Score:4, Insightful)
Unless you also have some hidden program on the computer to flash the keyboard and later download the data (in which case you could just log the keys by software), you'd need to physically remove the keyboard, flash it with a keylogging BIOS, return the keyboard, then later retrieve the keyboard to get the logged keys.
And, as they say, physical access is root access. There are an unlimited number of ways someone could compromise your computer if they are given access to the hardware and firmware. This hack is just further proof of that.
Oh, and don't let anyone lend you their keyboard.
Re:Physical access required (Score:5, Insightful)
And, as they say, physical access is root access. There are an unlimited number of ways someone could compromise your computer if they are given access to the hardware and firmware
Only as long as they have a fair amount of time. The beauty of this hack is that you could set up a laptop so that any keyboards that get plugged into it are immediately infected. Then you only need a few seconds alone with the targets computer to unplug the keyboard, plug it into your laptop to infect it, then plug it back into the targets computer and leave. It minimizes the risk of being caught trying to do something more extensive to the system. You just walk into an unoccupied office and walk back out 30 seconds later knowing that the keylogger is installed, as opposed to spending 30 minutes in the office trying to reboot, get into the firmware, etc.
No, It would take me about two seconds (Score:2)
Apple keyboards are pretty standard. You just buy your own and install a keylogger at your leisure. Then you just have to swap your doctored keyboard for theirs. If you have any skill at slight of hand, you could probably do this while someone is watching you.
Re: (Score:2)
No need for a "hollowed out cell phone". You could just use a real cell phone with a USB interface. Such as a jailbroken iPhone.
Re:Physical access required (Score:5, Insightful)
Why are people always so quick to dismiss the seriousness of low level exploits?
Consider a Mac pool at a university. You unplug the keyboard, plug it into a small box with a USB host controller that you programmed to rewrite the keyboard firmware. Plug the keyboard back in, wait until someone else logs in. Then come back, open a text editor, type your secret trigger word, watch as the keyboard spits out the logged passwords.
Consider a remote root exploit. That enables the hacker to reflash the firmware of an attached keyboard. Then the attacker can remove all traces of the hack from the target computer. The keyboard logs passwords and waits for a trigger word. How do you make someone type a strange word? Captcha. The attacker now has your password/passphrase (SSH login to your company's web server? Your online banking PIN? And the only trace is a modified firmware which nobody checks.
Re: (Score:2)
I'm not dismissing the seriousness of the exploit, just pointing out that there are tons of ways to exploit a computer you have physical access to. You could swap keyboards when someone isn't looking. You could hook up one of the tinier keyloggers. Or you could attack the computer itself in any number of ways.
The moral is: If you want to protect against knowledgeable, determined attackers, don't let them touch your PC.
Doesn't USB have DMA capability? (Score:2)
If I'm not mistaken, doesn't USB have a way for devices to access the host's memory via DMA? If so, does that mean it's possible for a 'hacked' keyboard to use DMA to write an exploit into the host machine's memory?
Re: (Score:3, Informative)
Re: (Score:2)
No, USB DMAs can only be initiated from the host (it's a client-server protocol, remember).
Note well, though, while we're talking about Macs, that FireWire/IEEE 1394 is non-hosted and does have DMA, so in theory someone could hand you a hacked Sony camcorder or hard drive with malicious firmware, that would then have DMA to your computer. But that's a "hardhack."
Makes me glad... (Score:2, Interesting)
...that I don't like the Mac keyboards. I use a Mac Pro at work but the first thing I did was go out and buy a Microsoft ergonomic keyboard. Yeah, I know it's probably blasphemy to many to mix MS & Apple hardware, but I've used MS ergonomic keyboards since they practically first came out, both at home and at work, and would never go back to a regular keyboard, especially one from Apple. I've yet to see one from Apple that doesn't make my hands ache after a few hours of use.
Re:Makes me glad... (Score:4, Insightful)
Re: (Score:3, Informative)
probably a lot of keyboards, but Apple keyboards are probably the largest block of a single identifiable brand out there. everyone probably uses OEM'd logitechs but those are probably customized to each OEM
How is news worthy... (Score:4, Insightful)
I'm sure every microwave out there is "hackable" in the sense you can replace its firmware and make it burn users popcorn each time. So what?
Unless you discovered a way to hack someone's keyboard remotely without user intervention, this is not even worth mentioning on a geek site.
Re: (Score:2)
Re: (Score:2)
Yes, I'm a computer professional :D. Why go into all the trouble flashing ROM and keyboards, when a simple small, unobtrusive USB keyboard logger is so much easier, more convenient and it has larger memory and some of them are no thicker than the keyboard cable. Also, if you have access to the machine, there are other better ways to do what you want.
Old tech is the best tech. (Score:2)
This is a hack on all the new shiny aluminum white keyed keyboards.
I predict a run no eBay sales of old keyboards [ebay.com] and USB PC alternatives for the paranoid.
For the rest, well...you get what you pay for eh?
Re: (Score:3, Funny)
Love the dumb comments on this thread. The army of ninja hackers will not be sneaking into houses tonight to backdoor all of the Apple keyboards in the world. The fact that it requires physical access to the keyboard makes it pretty close to useless except for public access sites and people who are cheating on their S.O. who happens to be a Black Hat hacker. I would suggest in the latter case you are hella screwed anyway.
So all it needs... (Score:2)
1) A bit of code hacking to put the Keylogger + a simple method to send keystrokes to a 3rd party into a firmware update for the keyboard.
2) Start a "Man in the middle" attack between a Mac user and Mac update servers.
3) User installs update..
4) ???
5) Profit off of all those banking details....
Um... I must be missing something (Score:3, Insightful)
If someone has sufficient permissions on your machine to update your firmware, aren't you kind of screwed already? I suppose they could swap your (external) keyboard for a compromised one, but that still implies physical access.
That said, given that the ability to update is useful, and that the flash memory size we're talking about is so small, is there a significant downside to having the OS check hashes of the firmware code on initialization?
Re:Um... I must be missing something (Score:4, Insightful)
"Hey, I think my keyboard's acting up. Could I borrow yours for a sec?"
"Sure."
Re: (Score:2)
Meh. I'm not sure which one is the attacker in your scenario, but IMHO that's still requiring physical access. You need to:
1) Be right next to the target, and probably known to them, since people don't generally borrow hardware from total strangers
2) Have a plausible reason for having a spare keyboard handy
3) Be able to sabotage the victim's keyboard so that it "acts up" when you need it to
All in all, I don't find this remotely scary. This is not going to be the dreaded Mac Virus Of The Apocalypse (you know
Why was this implemented? Stupid or evil? (Score:4, Insightful)
As the article points out, "For a device as simple as a keyboard, it is hard to imagine why a firmware update mechanism is even required." There's no justification for including an update feature other than as a designed-in security hole. The keyboard CPU should be running off a ROM, or at least an MPU where the security bit has been set to prevent future changes.
This looks like a "feature" put in for development that should have been pulled before release.
People seem to be missing the bigger issue (Score:4, Interesting)
The problem here isn't really with the end user's keyboard - flashing that is a lot of work for little return, in most cases.
The bigger issue is if/when an enterprising criminal gets access at the plant that makes the keyboards. We've seen CDs/DVDs with malware installed (I'm not even thinking about Sony here); we've seen CompactFlash cards preloaded with viruses... if a batch of keyboards shipped out from manufacturing already installed with a key logger, we're really screwed - who's going to notice?
Re: (Score:2)
How do you know China isn't already doing this? I certainly don't doubt that NSA does this type of stuff.
Re: (Score:2)
Wasn't there an apple keyboard about ten or fifteen years ago that automatically typed something if there wasn't any input for five minutes?
Hack request!! (Score:2)
Hopefully some of the keyboard hackers read slashdot. I would like to request a function added to the keyboard that senses certain "L33T" speak words and automatically backspaces and substitutes REAL words in its place. Some parents might even like to see such a function that senses curse words and substitutes +%$#"!! for matching words... could even be marketable...hrm?
Re: (Score:2)
Hopefully some of the keyboard hackers read slashdot. I would like to request a function added to the keyboard that senses certain "L33T" speak words and automatically backspaces and substitutes REAL words in its place. Some parents might even like to see such a function that senses curse words and substitutes +%$#"!! for matching words... could even be marketable...hrm?
So, like, a Perl interpreter, then?
Much easier way... (Score:3, Informative)
Cmd - "s"
Voila, root access. documented here
Keylogger or Installer (Score:2)
Bet you could infect a keyboard and have it reinfect the computer ever time you try and format / reinstall your OS...
Heh (Score:2)
I just bought all cheap PC keyboards to replace the aging mac keyboards. mainly because the mac ones are way too expensive... ~$40. Also because all the Mac keyboards have been a point of irritation- from being bright white with clear housing (sure shows crumbs well) to having non-traditional keys (new ones ala mac book keyboard) they just aren't good for the real work environment.
Re: (Score:2)
That's a red herring. Unless they have changed recently, the internal keyboards on Mac laptops are dumb devices---just a bunch of wires and switches. The controller is on the logic board.
Re:Too much work (Score:4, Interesting)
Not entirely dumb. I have a US keyboard/top case for a late 2006 MB that began registering as a UK keyboard after a Coke spill.
Re: (Score:2)
RTFA.
Update is completely through software. You'd know this if you even glanced at the article.
New here, I take it?
Re: (Score:2)
It's too expensive. A single DIP switch might cost $0.10 in large quantities. Multiplied by a million units, that's $100k, which is a nice bonus for the CEO.
Re: (Score:2)
You wouldn't have to do a DIP switch, and that would be a bad solution anyways. You could have a pin on the chip that forbids writes unless it's tied to ground, thus one step in the manufacturing would be snipping the pin. Even harder-core would be a pin that blows a circuit protector when it's tied to ground, and permanently forbids writing after the connection.
But as other have pointed out, this would ruin the ability for the vendor to ship field upgrades to keyboards.
Re: (Score:2)
I don't know about other manufacturers, but I'm pretty sure the Microchip PIC microcontrollers I use, several of which have USB built-in and would be perfect for a keyboard, can only be re-flashed by an external programmer which provides a +12V programming voltage (which you don't normally supply in such a circuit, only +5V from the USB bus), and are not programmable at all over the USB bus, only certain pins on the MCU.