Bitcoin Forum

Bitcoin => Armory => Topic started by: dacoinminster on October 31, 2013, 09:57:58 PM



Title: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: dacoinminster on October 31, 2013, 09:57:58 PM
Hey Alan,

I just read about the "badbios" virus which can supposedly infect offline computers using USB sticks: http://arstechnica.com/security/2013/10/meet-badbios-the-mysterious-mac-and-pc-malware-that-jumps-airgaps/

Would you mind commenting about whether armory-offline users should be concerned about this virus, or ones like it, and whether we should find a different transport method for offline transaction signing? There has been some concern about this on reddit: http://www.reddit.com/r/Bitcoin/comments/1pmb82/malware_that_infects_at_the_hardware_level_can/

I sent you an email about this too. Thanks!


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: Luckybit on October 31, 2013, 11:14:12 PM
Hey Alan,

I just read about the "badbios" virus which can supposedly infect offline computers using USB sticks: http://arstechnica.com/security/2013/10/meet-badbios-the-mysterious-mac-and-pc-malware-that-jumps-airgaps/

Would you mind commenting about whether armory-offline users should be concerned about this virus, or ones like it, and whether we should find a different transport method for offline transaction signing? There has been some concern about this on reddit: http://www.reddit.com/r/Bitcoin/comments/1pmb82/malware_that_infects_at_the_hardware_level_can/

I sent you an email about this too. Thanks!
That is the least of it. There are a whole range of side channels based on differential power analysis which 99% of all computers are vulnerable to which means the encryption keys to most peoples machines are vulnerable. There are DMA attacks, hardware based trojans, all which most everyone is vulnerable to.

I think badbios just reveals that most people's machines are vulnerable to advanced persistent threats. Have a look at this: http://www.ma.rhul.ac.uk/static/techrep/2011/RHUL-MA-2011-07.pdf

For this reason if a government really wants your keys and they are determined enough to send some agents to target you specifically then its highly likely they will get them. But the point is that it is expensive and they wont do that to just anyone, at least not at this time. I'm not sure there is anything Armory can do about it, it's a hardware problem which can be solved by using hardware which blocks data emanations. I wonder if the new Trezor wallet will be vulnerable to differential power analysis?

 


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: Vernon715 on October 31, 2013, 11:37:32 PM
I read the article about badbios and would like to present a possible solution to these problems.

To address the speaker/microphone avenue of communication, I recommend the raspberry pi model A. A model A has 256mb of ram, which happens to be the same as the minimum requirements to run armory offline. In addition, since the model A doesn't have wifi or an ethernet port, you won't do are less likely to do anything stupid, like connect it to the internet.

Now that you have a computer that is next to impossible to connect to the internet, you need a way of communicating with the outside world to sign transactions.

I'm not sure if this is possible at the present time, but it seems to me that the best way to do this would be through qr codes of some sort--I'm not smart enough to make this work, so that is a slightly fuzzy part of this suggestion.

If you want to go the uber-paranoid rout, you could use an external battery pack to power the pi, which completely isolates the pi from any possible source of malware.

I think that this system would be as secure as it gets, but if I anything I said is wrong, I'm sure you'll let me know.


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: Rogue Star on November 01, 2013, 05:42:12 PM
I've done some work for using QR codes to transfer data between computers specifically since I have moved to Armory. It is a Java based application, so it probably won't work well on a RPi with so little RAM. The source is out there on the interwebs, but I haven't fully thought out what license I'd like to use. If there is an increasing interest in it, I'll work through those issues so people can use it/build on top of it.

That said, I'm not convinced a hardened version of it would stand up to a persistent attacker. At the end of the day you're going to end up using a library or re-inventing the wheel and either one will have it's own set of vulnerabilities to side-channel attacks. I believe it to be safer than USB since there is no bootability issues and it is hopefully less likely to "auto-play". It also gives you a lot more control of how much/when data is transmitted or received and you can verify the payload against a third party device if you are paranoid.


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: etotheipi on November 01, 2013, 09:21:29 PM
The problem with QR codes is they aren't big enough.  They're big enough for 95% of transactions, but the first time you have to move 1 MB across that channel, you'll be SoL.  And you don't have control over it.  If I know one of the addresses in your offline system, I can send you a couple 100 kB transactions, and effectively DoS your offline solution.

There's a discussion thread about it here:  https://bitcointalk.org/index.php?topic=68482
And ironically: https://bitcointalk.org/index.php?topic=135423.0

But none of it is ready yet.  Though goatpig claims to be making progress on the audio solution.

I should clarify though: the article doesn't say that computers will be infected through audio or power-line communication.  But if your offline computer is already infected, it can use those methods to communicate with another infected machine.  It does sound the stuff of science-fiction, and I'm conflicted about whether to believe this is a real threat (since there's conflicting evidence).  But it does give us some hints about ways we can protect ourselves better. 

I would argue that assume-the-offline-system-is-already-compromised-by-the-most-advanced-malware assumption makes security a mostly intractible problem.  There's too many ways for a properly-secured-but-compromised offline system to leak information.  And depending on how good it is, it might only need one transaction to do it.    The best thing we can do is take appropriate precautions to minimize risk of infection, and be able to detect it when we fail.

Now that ATI has some money, we'll be spending some of it to get some real good crypto/security guys to help us shape our best practices to address threats like this, even if this particular one turns out not to exist [yet].


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: Raize on November 01, 2013, 09:26:51 PM
Yeah, I was just going to say, this is looking more and more like a Halloween hoax:
http://www.reddit.com/r/netsec/comments/1pm66y/meet_badbios_the_mysterious_mac_and_pc_malware/cd3u1az

Though it does sound like his high frequency audio transmission in badBIOS is more than just a theoretical:
http://smus.com/ultrasonic-networking/


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: dacoinminster on November 01, 2013, 09:30:21 PM
The problem with QR codes is they aren't big enough.  They're big enough for 95% of transactions, but the first time you have to move 1 MB across that channel, you'll be SoL.  And you don't have control over it.  If I know one of the addresses in your offline system, I can send you a couple 100 kB transactions, and effectively DoS your offline solution.

There's a discussion thread about it here:  https://bitcointalk.org/index.php?topic=68482
And ironically: https://bitcointalk.org/index.php?topic=135423.0

But none of it is ready yet.  Though goatpig claims to be making progress on the audio solution.

I should clarify though: the article doesn't say that computers will be infected through audio or power-line communication.  But if your offline computer is already infected, it can use those methods to communicate with another infected machine.  It does sound the stuff of science-fiction, and I'm conflicted about whether to believe this is a real threat (since there's conflicting evidence).  But it does give us some hints about ways we can protect ourselves better. 

I would argue that assume-the-offline-system-is-already-compromised-by-the-most-advanced-malware assumption makes security a mostly intractible problem.  There's too many ways for a properly-secured-but-compromised offline system to leak information.  And depending on how good it is, it might only need one transaction to do it.    The best thing we can do is take appropriate precautions to minimize risk of infection, and be able to detect it when we fail.

Now that ATI has some money, we'll be spending some of it to get some real good crypto/security guys to help us shape our best practices to address threats like this, even if this particular one turns out not to exist [yet].

Thanks Alan.

I'm actually a lot more worried about the "assume-the-ONLINE-system-is-already-compromised-by-the-most-advanced-malware assumption". That has basically been my assumption all along, which is why I find the concept of infections spread by USB keys really scary. Is that what you meant?


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: etotheipi on November 01, 2013, 10:03:40 PM
Thanks Alan.

I'm actually a lot more worried about the "assume-the-ONLINE-system-is-already-compromised-by-the-most-advanced-malware assumption". That has basically been my assumption all along, which is why I find the concept of infections spread by USB keys really scary. Is that what you meant?

In many ways, I have designed the system assuming the online system is compromised, but without the ability to spread USB viruses (easily).   As long as you check very carefully on the offline system that the amounts and addresses are what you expect, then it's an exceptionally safe setup (because we've assumed no USB viruses like this).  The data that is transferred over USB is public, non-sensitive, and contains everything the offline computer needs to fully verify all the details of the transaction.  I had even considered an operational mode where people could run just the wallet, and then send their watching-only wallets to a server, and the server would prepare the transactions for them to sign (for the people without the resources to run Armory online).  I could provide such a service confidently, because it would actually be a very safe system -- the downside would be how easy it is for the server to feed bogus UTXO information and effectively DoS the wallet (every signature produced would be invalid, thus making the system unusable -- but better than losing coins!).

So, under the offline-system-is-secure scenario, the worst that happens is having your transactions become invalid (though, you can lose coins because you didn't verify the addresses and amounts on the offline system before pressing "sign" -- the virus could exploit someone simply being non-attentive).  If the offline system is compromised, then it would be a pretty advanced virus (jumped through hidden data on USB), and thus should be sufficiently advanced to shuttle private key data back over USB.  Or hide data in transaction malleability.  Or if both systems are compromised, it just flat out jams the private key into the signature space, and tells you it's valid, and the online system recognizes and sweeps the funds to the attacker before you've even realized your broadcast transaction is invalid.

Because of this, it's worth visiting how to minimize damage of an offline computer compromise, but it's a very difficult problem and one I can't claim to solve.  Use anti-virus on your online computer, dedicate a small USB key to be used for only offline transaction shuttling, and really check all the addresses and amounts of the transactions before signing.  Also, if the transaction is sufficiently large, I recommend making a phone call to the recipient to manually verify the addresses.    This will keep you from being "low-hanging fruit" to the next piece of Bitcoin malware :)




Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: dserrano5 on November 01, 2013, 10:50:38 PM
Use anti-virus on your online computer, dedicate a small USB key to be used for only offline transaction shuttling

And use no other USB key on the online computer. Otherwise, as soon as any of them carries the virus and infects the machine, the dedicated key used for offline signing will get the virus too and transmit it to the offline node.


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: Rogue Star on November 01, 2013, 11:42:52 PM
Quote
The problem with QR codes is they aren't big enough.  They're big enough for 95% of transactions, but the first time you have to move 1 MB across that channel, you'll be SoL.  And you don't have control over it.  If I know one of the addresses in your offline system, I can send you a couple 100 kB transactions, and effectively DoS your offline solution.
QR codes can hold enough data. I've put some thought into this and have a working prototype. QR codes can hold up to 2KBs of data with standard readers. In practice, i expect a casual setup will be able to read 1KB QR codes. As far as data encoding goes, Base91 seems to be optimal for compatibility, so 364 bytes are available in an easily readable QR code. It's not high bandwidth by any means, but more than fine for today's usage. It may even be a feature for people using Armory now.

I can see how audio is a good solution coming from people with DSP experience. I just like how QR codes are easy enough for most people to understand.

I'm not sure I understand your point about DoS, the online computer will be creating the transaction, just use coin control to select non-DoS'd inputs. The 1 MB block limit will make DoS impractical for most until it's lifted. The blockchain will continue to have anti-DoS measures beyond the 1 MB block limit being lifted, so most users should be fine after that as well.

Quote
QR code + Webcams: 
 + QR codes are easy to generate
 + Plenty of existing software for scanning QR codes
 + Many laptops come with webcam, and can also be purchased inexpensively
 - Requires manually moving cameras and screens around to get QR codes into view
 - QR codes may not hold enough data: may need to use multiple codes
 - Need to design webcam-based UI, with feedback and possible UI for flipping&scanning multiple QR codes
 - Webcam support on all platforms is flaky (but it could be up to the user to get their webcam supported)

In my prototype I just use screen reading, no need to deal with drivers. I'm sure adding direct web cam capture capabilities you could push the QR codes to 2 KB. It's just that JMF is not a Java library I look forward to working with.

Multiple QR codes are not really a problem, in my prototype I allocated space to store information about the payload. Once you setup cameras in good positions it's easy enough to cycle through QR codes. You can easily read a QR code in under a second. It's easy enough to automatically split the data and re-assembles data to/from QR codes.

Here are some numbers showing how I handle payloads up 30 KB:

16 base91 bytes in metadata total (1 byte each for block index and count), leaves 1008 bytes for data
base 91 vs base 256 efficiency is a little over 35%
that gives 358 bytes of data per 1KB QR code
up to 91 QR codes can be created for a single payload containing 30 KB of data

I'm sure by reworking the protocol a bit I could get it close to the limits of QR code technology and whatever users are willing to put up with.


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: Carlton Banks on November 01, 2013, 11:50:44 PM
Use anti-virus on your online computer, dedicate a small USB key to be used for only offline transaction shuttling

And use no other USB key on the online computer. Otherwise, as soon as any of them carries the virus and infects the machine, the dedicated key used for offline signing will get the virus too and transmit it to the offline node.

If you're dealing with wallets containing large holdings to protect, it's worthwhile considering using a dedicated machine, to be used for broadcasting transactions and for no other reason. Even just a VM for broadcasting only would be a decent measure. After all, you would never fire up either a physical or a virtual machine for any other purpose if that was how you worked, it would at least shut off opportunities to attackers.

Liking the sound of goatpig's progress with analogue air-gap traversal.... I would happily contribute something to a development fund if he were to set up a thread outlining a proposal.  


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: justusranvier on November 02, 2013, 06:49:38 AM
The problem with QR codes is they aren't big enough.  They're big enough for 95% of transactions, but the first time you have to move 1 MB across that channel, you'll be SoL.  And you don't have control over it.  If I know one of the addresses in your offline system, I can send you a couple 100 kB transactions, and effectively DoS your offline solution.
There are people who are using Armory to store balances of sufficient value that they could easily justify buying a printer/scanner exclusively for the offline system to use.

How much data can fit on a single piece of paper if it's full of QR codes?


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: goatpig on November 02, 2013, 03:39:00 PM
If you're dealing with wallets containing large holdings to protect, it's worthwhile considering using a dedicated machine, to be used for broadcasting transactions and for no other reason. Even just a VM for broadcasting only would be a decent measure. After all, you would never fire up either a physical or a virtual machine for any other purpose if that was how you worked, it would at least shut off opportunities to attackers.

Liking the sound of goatpig's progress with analogue air-gap traversal.... I would happily contribute something to a development fund if he were to set up a thread outlining a proposal.  

I'm not trying to send data over an air gap. This library I'm developing is to enable sending data over soundcards linked together by double ended audio cables. I don't intent to allow it to function over speakers and mics unless Alan insists upon that feature.

Proof of concept is nearly done with a speed of 1 bit per Hz. I think I have a reasonable chance to achieve 2 bits per Hz without the need for massive research and protocol overhaul.


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: Carlton Banks on November 02, 2013, 05:29:32 PM
If you're dealing with wallets containing large holdings to protect, it's worthwhile considering using a dedicated machine, to be used for broadcasting transactions and for no other reason. Even just a VM for broadcasting only would be a decent measure. After all, you would never fire up either a physical or a virtual machine for any other purpose if that was how you worked, it would at least shut off opportunities to attackers.

Liking the sound of goatpig's progress with analogue air-gap traversal.... I would happily contribute something to a development fund if he were to set up a thread outlining a proposal.  

I'm not trying to send data over an air gap. This library I'm developing is to enable sending data over soundcards linked together by double ended audio cables. I don't intent to allow it to function over speakers and mics unless Alan insists upon that feature.

Proof of concept is nearly done with a speed of 1 bit per Hz. I think I have a reasonable chance to achieve 2 bits per Hz without the need for massive research and protocol overhaul.

Lol, I phrased that slightly ambiguously, I realise you were planning on using copper wires, and not loudspeaker and microphone! That could be difficult to get working, and it would bring a whole new concept of (literal) eavesdropping into the mix too. I would assume that all the bandwidth is in the high frequencies, and of course, higher pitched sounds travel further before their "information" dissipates. I don't think we need the added expense of sound proof transaction signing booths in our regular setups quite yet!


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: Inaba on November 02, 2013, 05:37:53 PM
Thanks Alan.

I'm actually a lot more worried about the "assume-the-ONLINE-system-is-already-compromised-by-the-most-advanced-malware assumption". That has basically been my assumption all along, which is why I find the concept of infections spread by USB keys really scary. Is that what you meant?

In many ways, I have designed the system assuming the online system is compromised, but without the ability to spread USB viruses (easily).   As long as you check very carefully on the offline system that the amounts and addresses are what you expect, then it's an exceptionally safe setup (because we've assumed no USB viruses like this).  The data that is transferred over USB is public, non-sensitive, and contains everything the offline computer needs to fully verify all the details of the transaction.  I had even considered an operational mode where people could run just the wallet, and then send their watching-only wallets to a server, and the server would prepare the transactions for them to sign (for the people without the resources to run Armory online).  I could provide such a service confidently, because it would actually be a very safe system -- the downside would be how easy it is for the server to feed bogus UTXO information and effectively DoS the wallet (every signature produced would be invalid, thus making the system unusable -- but better than losing coins!).

So, under the offline-system-is-secure scenario, the worst that happens is having your transactions become invalid (though, you can lose coins because you didn't verify the addresses and amounts on the offline system before pressing "sign" -- the virus could exploit someone simply being non-attentive).  If the offline system is compromised, then it would be a pretty advanced virus (jumped through hidden data on USB), and thus should be sufficiently advanced to shuttle private key data back over USB.  Or hide data in transaction malleability.  Or if both systems are compromised, it just flat out jams the private key into the signature space, and tells you it's valid, and the online system recognizes and sweeps the funds to the attacker before you've even realized your broadcast transaction is invalid.

Because of this, it's worth visiting how to minimize damage of an offline computer compromise, but it's a very difficult problem and one I can't claim to solve.  Use anti-virus on your online computer, dedicate a small USB key to be used for only offline transaction shuttling, and really check all the addresses and amounts of the transactions before signing.  Also, if the transaction is sufficiently large, I recommend making a phone call to the recipient to manually verify the addresses.    This will keep you from being "low-hanging fruit" to the next piece of Bitcoin malware :)




How does this address the issue of malware on the watching only system (online system) infecting the USB key with a bitcoin tailored bit of malware that will then infect the offline system when you insert the USB stick, steal the private keys from the offline system and then take the private keys back with it when the USB stick is back in the online system (to send the transaction after it's signed)?  Then the malware sends out the private keys through another channel of the infected system.  

There needs to be a way to isolate the offline system without putting a device into both systems.  I've got nothing off the top of my head, but that's what ultimately needs to happen.  



Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: justusranvier on November 02, 2013, 05:49:11 PM
There needs to be a way to isolate the offline system without putting a device into both systems.  I've got nothing off the top of my head, but that's what ultimately needs to happen.
Dead trees.

The online system prints out the unsigned transaction via some kind of suitable encoding, then you install a scanner/webcam on the offline system to read it.

Data transfer offline->online could either use print, or even burn the signed transaction to a mini-CD that gets discarded after a single use.


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: justanickname on November 02, 2013, 05:51:44 PM

There needs to be a way to isolate the offline system without putting a device into both systems.  I've got nothing off the top of my head, but that's what ultimately needs to happen.  


Here is a thought.
if you have 2 camars : dirty camera(only allowed to be connected to online wallet PC)
                               clean camera(only allowed to be connected to offline wallet PC).

1) create offline transaction in online wallet PC.
2) take photo of the unsigned transaction text with clean camera.
3) copy picture from clean camera move to offline wallet PC.
5) convert photo to text and insert to offline armory.
6) sign transaction.
7) take photo of the signed transaction text with dirty camera.
8 ) copy picture from dirty camera move to online wallet PC.
9) convert photo to text and insert to online armory.
10)broadcast.

I think steps 3 and 8 are doable and it will be totally hermetic this way.


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: balanghai on November 02, 2013, 05:55:20 PM
Best thing to do is have linux pc handle all the removable media for additional security.


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: goatpig on November 02, 2013, 06:34:49 PM
Lol, I phrased that slightly ambiguously, I realise you were planning on using copper wires, and not loudspeaker and microphone! That could be difficult to get working, and it would bring a whole new concept of (literal) eavesdropping into the mix too. I would assume that all the bandwidth is in the high frequencies, and of course, higher pitched sounds travel further before their "information" dissipates. I don't think we need the added expense of sound proof transaction signing booths in our regular setups quite yet!

The protocol would be different, the data rate reduced, it would be exposed to external sources of noise, allow for possible man in middle attack vectors and an array of issues that I don't need to dwevle into.

The point is fundamental anyways: it is possible to get the data moved over the air gap, but such functionality potentially steps out of the current offline transaction signature paradigm currently delivered by Armory.


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: flipperfish on November 02, 2013, 07:24:44 PM
What about a raw/custom formatted USB stick?

I think a real danger after disabling autoplay is the filesystem itself. There have been exploits within several kernel modules for the different filesystems (e.g. http://www.cvedetails.com/cve/CVE-2013-1773, http://www.cvedetails.com/cve/CVE-2011-4330, http://www.cvedetails.com/cve/CVE-2009-4020). I don't know how severe these bugs are and if they could have been used for malicious code execution, but I think it is reasonable to expect an existing, unfixed bug, which can be used for code execution.

A custom format, which only defines the most necessary fields to transfer the raw transaction data should be much safer. The code to read the custom format should be much simpler and thus less error prone than conventional kernel filesystem modules. Additionally, any exploit of this custom format parser will be executed in the user space and not within the kernel, because only the signing application (e.g. Armory) must read and parse the data.


My thoughts about the USB stick infection of "badBIOS":
I don't think, that it is possible for a simple mass storage device to infect a pc just by plugging in (and not reading and interpreting any data on it). The circuit to read and write data on the drive is hardwired and can't be manipulated by software (correct me if I'm wrong). This should be true for the USB host interface in the mainboard, too. So as long as there is no data transfer it is impossible to infect anything. Things might change if data is transfered. However, even then, the hard wired host interface or the kernel code which handles the usb frames must be compromised by a malformed usb frame. This however should be prevented by the hard wired circuit on the drive itself.
Don't get me wrong, I think it is perfectly believable, that a system can be compromised by its USB subsystem. This has been demonstrated with the PS3. However, a special USB frame had to be crafted for this to happen. A simple mass storage device could not do this.


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: Inaba on November 02, 2013, 08:47:16 PM
What about a raw/custom formatted USB stick?

I think a real danger after disabling autoplay is the filesystem itself. There have been exploits within several kernel modules for the different filesystems (e.g. http://www.cvedetails.com/cve/CVE-2013-1773, http://www.cvedetails.com/cve/CVE-2011-4330, http://www.cvedetails.com/cve/CVE-2009-4020). I don't know how severe these bugs are and if they could have been used for malicious code execution, but I think it is reasonable to expect an existing, unfixed bug, which can be used for code execution.

A custom format, which only defines the most necessary fields to transfer the raw transaction data should be much safer. The code to read the custom format should be much simpler and thus less error prone than conventional kernel filesystem modules. Additionally, any exploit of this custom format parser will be executed in the user space and not within the kernel, because only the signing application (e.g. Armory) must read and parse the data.


My thoughts about the USB stick infection of "badBIOS":
I don't think, that it is possible for a simple mass storage device to infect a pc just by plugging in (and not reading and interpreting any data on it). The circuit to read and write data on the drive is hardwired and can't be manipulated by software (correct me if I'm wrong). This should be true for the USB host interface in the mainboard, too. So as long as there is no data transfer it is impossible to infect anything. Things might change if data is transfered. However, even then, the hard wired host interface or the kernel code which handles the usb frames must be compromised by a malformed usb frame. This however should be prevented by the hard wired circuit on the drive itself.
Don't get me wrong, I think it is perfectly believable, that a system can be compromised by its USB subsystem. This has been demonstrated with the PS3. However, a special USB frame had to be crafted for this to happen. A simple mass storage device could not do this.

I think part of the problem is that windows kind of does its down thing when a USB device is inserted.  Admittedly I am not that well versed in Windows USB enumeration, but it's always been my feeling (which may be entirely baseless) that windows does a lot of data reading and other useless stuff (in the name of convenience) when a USB device, particularly a storage device, is inserted into the system.  That can be exploited as an attack vector and would be no guarantee of safety, even with a custom formatted stick, since Windows will still try to read it and ask if you want to format it (at which time a specially crafted payload could be delivered) ... this might be far fetched and unlikely, but I'm just throwing it out there as an avenue I would look into if I were looking to exploit an offline bitcoin computer that might be using Armory   or something similar.



Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: maaku on November 02, 2013, 09:56:42 PM
dacoinminster, if badbios does what people are claiming it does, you're fcked no matter what. There's nothing a user-level program like Armory can do to protect you, except perhaps using a TPM chip. There are no robust wallet apps with TPM signers that I'm aware of*, although this would be a good addition to Armory...

(* except maybe this (https://bitcointalk.org/index.php?topic=154290.0)?)


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: maaku on November 02, 2013, 10:00:12 PM
I don't think, that it is possible for a simple mass storage device to infect a pc just by plugging in...

It is, and this is exactly what badbios is about. The target is not the OS's USB software stack, it's the USB microcontroller itself. It then spreads to the keyboard. Or the sound card's DSP. Or the CPU itself (yes, there are multiple microcontrollers inside the CPU). All of these devices have direct access to the machine, circumventing any OS protections.


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: adam3us on November 03, 2013, 12:06:09 AM
dacoinminster, if badbios does what people are claiming it does, you're fcked no matter what. There's nothing a user-level program like Armory can do to protect you, except perhaps using a TPM chip. There are no robust wallet apps with TPM signers that I'm aware of*, although this would be a good addition to Armory...

Well there is also the air-gapped optical interface: scanning QR codes. drazvan made an offline QR code scanning wallet using network disabled cheap android wallet (can buy for $50 - $100) including camera.  Then you can make payments.

You do need no buffer overflows in the QR code scanner, but other than that...

And at least thats code we get to look at, not USB firmware on a motherboard.

Adam


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: maaku on November 03, 2013, 03:35:00 AM
Adam, I don't think that's the issue. The air-gapped communication is just an interesting tidbit about how it operates (presumably to mesh network inside of secure facilities like Iran's nuclear research bunkers). Presumably BadBIOS is state sponsored, and not concerned with bitcoin. But hypothetically if it were a wallet-stealing malware it has perpetual root access to the machine it has infected and be able to scan RAM or disk for bitcoin-like data structures and steal the private key as it is scanned or decrypted in memory. By residing in embedded peripherals it is able to inject itself first into the BIOS/EFI, and then into the OS kernel during the boot process, and cannot be removed by any existing generation of anti-virus tools or user action (solution: buy a new computer and think up a creative way to get needed data off the old without infecting the new).


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: etotheipi on November 03, 2013, 03:45:09 AM
dacoinminster, if badbios does what people are claiming it does, you're fcked no matter what. There's nothing a user-level program like Armory can do to protect you, except perhaps using a TPM chip. There are no robust wallet apps with TPM signers that I'm aware of*, although this would be a good addition to Armory...

Well there is also the air-gapped optical interface: scanning QR codes. drazvan made an offline QR code scanning wallet using network disabled cheap android wallet (can buy for $50 - $100) including camera.  Then you can make payments.

You do need no buffer overflows in the QR code scanner, but other than that...

And at least thats code we get to look at, not USB firmware on a motherboard.

Adam


Personally, I think this is an ideal steady-state solution once the offline system is setup.  But you can't use plain QR codes, you'll have to do QR videos.  If you have to move 2 MB to the offline computer and back... you really want those 100 QR codes to be cycled at 13.82 Hz (or any frequency that isn't a multiple of the other device sampling frequency).  Though even then, your arm might get kind of tired holding it up while it acquires all the images.  Meh. 

But there is still the concern about getting the system setup in the first place.  I guess if you have a custom OS image with the camera software pre-installed, you could use the QR thing to move the Armory offline bundle intself onto the system. 

Yeah, we really need to come up with a set of best practices, so people have some kind of guidance...


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: flipperfish on November 03, 2013, 10:35:26 AM
I don't think, that it is possible for a simple mass storage device to infect a pc just by plugging in...

It is, and this is exactly what badbios is about. The target is not the OS's USB software stack, it's the USB microcontroller itself. It then spreads to the keyboard. Or the sound card's DSP. Or the CPU itself (yes, there are multiple microcontrollers inside the CPU). All of these devices have direct access to the machine, circumventing any OS protections.

I did dig into this a bit more and it seems the controllers of common usb sticks are really not as hardwired as I thought. The spec-sheet of this (http://www.phison.com/english/newProductView.asp?ID=199&SortID=60 (http://www.phison.com/english/newProductView.asp?ID=199&SortID=60)) rather cheap IC explicitly states "Firmware Upgradable". So my earlier thoughts are probably wrong.


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: adam3us on November 03, 2013, 11:40:48 AM
Personally, I think this is an ideal steady-state solution once the offline system is setup.  But you can't use plain QR codes, you'll have to do QR videos.

drazan's visualBTC android offline wallet uses "animated QR codes" which is consistent with what you said about the practical bandwidth requirements.  https://bitcointalk.org/index.php?topic=210371.0

The other thing is there's a sanity size cap on a transaction: the bitcoin block size is limited to 1MB for now, and I think its probably the bitcoin developers might have to take countermeasures or non-linear size related fees if people got in the habit of creating individual transactions that use a whole block - that would limits bitcoin to one transaction per 10 minutes.

Quote
But there is still the concern about getting the system setup in the first place.  I guess if you have a custom OS image with the camera software pre-installed, you could use the QR thing to move the Armory offline bundle intself onto the system.  

Maybe there's a market to include a PGP code signing key. and a pre-installed armory client in an armory labeled cheap android tablet with the speaker, microphone, bluetooth, wifi, and USB cables cut.  (Or one that could be made cheaper by not even including that hardware).

Then you could send it via QR video, armory signed software upgrades;)

I think a risk with USB is someone can infect the online wallet via remote internet compromise, infect a USB that gets plugged into it, and from there into the offline wallet.

Adam


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: malevolent on November 03, 2013, 11:58:06 AM
The badBIOS analysis is wrong (http://www.rootwyrm.com/2013/11/the-badbios-analysis-is-wrong/) + comments

+

some of the comments here:
http://www.reddit.com/r/netsec/comments/1ppwet/the_badbios_analysis_is_wrong/


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: JakeGold on November 03, 2013, 12:33:51 PM
I've actually been thinking about exactly this for the last few months.

I thought I had something when I found UBS drives with a physical write lock, but that doesn't help when you need to write the unsigned transaction from the online machine to the device, and then sign it on the offline machine and write the signed version on again, which has to be moved to an online machine.

If you could communicate the unsigned transaction through QR codes, assuming the offline machine is not infected, you could write the signed version to the USB, then lock it and move it to the broadcast machine, insuring that nothing jumps to the drive.


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: justusranvier on November 03, 2013, 01:47:29 PM
I did dig into this a bit more and it seems the controllers of common usb sticks are really not as hardwired as I thought. The spec-sheet of this (http://www.phison.com/english/newProductView.asp?ID=199&SortID=60) rather cheap IC explicitly states "Firmware Upgradable". So my earlier thoughts are probably wrong.
I wonder if any of the ASIC designers could produce provably-secure USB controllers.


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: justmyname on November 03, 2013, 02:33:22 PM
A good virus program will go a long way in ferreting out any bad code.


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: etotheipi on November 03, 2013, 04:03:16 PM
Personally, I think this is an ideal steady-state solution once the offline system is setup.  But you can't use plain QR codes, you'll have to do QR videos.

drazan's visualBTC android offline wallet uses "animated QR codes" which is consistent with what you said about the practical bandwidth requirements.  https://bitcointalk.org/index.php?topic=210371.0

The other thing is there's a sanity size cap on a transaction: the bitcoin block size is limited to 1MB for now, and I think its probably the bitcoin developers might have to take countermeasures or non-linear size related fees if people got in the habit of creating individual transactions that use a whole block - that would limits bitcoin to one transaction per 10 minutes.

Just to be clear, the issue is not the maximum size of a single transaction.  The issue is that in order for the offline computer to verify the transaction fee, you must supply every, full, supporting transaction along with the one to be signed.  The offline computer must see the tx associated with every input, so it can verify the value of each input.  Therefore, if I send you a few dust outputs contained in 100 kB transactions, then you will potentially be moving 0.5 MB of tx.  Even without me doing anything, I"ve had people report issues because they use their offline wallet to collect lots of small payments over time and then end up with 271 inputs at once.  Those are multi-megabyte transactions.  The single QR codes are just not scalable for this, requiring me to develop something that can handle wider bandwidth for those cases, anyway...

Technically, there's a trivial hard-fork solution:  https://bitcointalk.org/index.php?topic=181734.0 ... but I don't have much hope of it being adopted.  


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: etotheipi on November 03, 2013, 06:21:46 PM
Whoops, totally posted to the wrong thread!  Please ignore this post...

[Post relocated to the correct thread (https://bitcointalk.org/index.php?topic=299684.msg3472728#msg3472728)]


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: adam3us on November 03, 2013, 08:19:24 PM
Just to be clear, the issue is not the maximum size of a single transaction.  The issue is that in order for the offline computer to verify the transaction fee, you must supply every, full, supporting transaction along with the one to be signed.  The offline computer must see the tx associated with every input, so it can verify the value of each input.

Technically, there's a trivial hard-fork solution:  https://bitcointalk.org/index.php?topic=181734.0 ... but I don't have much hope of it being adopted.  

I suppose there are two ways to view that:

a) transaction fees should not be implicit (and outputs summing to inputs, including fee should be validated downstream); or

b) the signer should state what he is spending (and the downstream should verify it) as you proposed in the above link.

Either solution could be fine.  Kind of frustrating the pace of progress on bitcoin main though one can fully appreciate the risks and resource constraints, but mostly the risks.  It is why I proposed the bitcoin-staging idea.  Now all we have to do is coax Warren Togami (formerly fedora distro founder) into taking the mantle.  He already ventured from litecoin into spinning a bitcoin-OMG release (litecoin latest fork with bitcoin parameters reinstated, to give bitcoin users the advantages of litecoin validated fixes).

Though something like that is less use to armory as armory is itself on the high value end of the bitcoin scale, and people may not use the fedora like variant on high value.

Streamline and practice a system for hard forks?

Stall and dont progress and get undertaken by faster progressing alt-coins?

Move too fast and make a security mistake.

Rock and hard-place.  Hmmm.

Adam


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: Roy Badami on November 06, 2013, 12:28:38 AM
I don't think, that it is possible for a simple mass storage device to infect a pc just by plugging in (and not reading and interpreting any data on it). The circuit to read and write data on the drive is hardwired and can't be manipulated by software (correct me if I'm wrong). This should be true for the USB host interface in the mainboard, too. So as long as there is no data transfer it is impossible to infect anything. Things might change if data is transfered. However, even then, the hard wired host interface or the kernel code which handles the usb frames must be compromised by a malformed usb frame. This however should be prevented by the hard wired circuit on the drive itself.
Don't get me wrong, I think it is perfectly believable, that a system can be compromised by its USB subsystem. This has been demonstrated with the PS3. However, a special USB frame had to be crafted for this to happen. A simple mass storage device could not do this.

Yes, but a whole bunch of USB frames get exchanged when you plug a device in, to identify the device.  As you say, a specially crafted USB frame could trigger a buffer overflow in the USB stack.  (ETA: That's more a risk with a specially designed malicious device - it's less likely a standard USB stick could be made to do this.)

Still, if you're going to dedicate an offline machine to Armory, then I think it's a reasonable precaution to spend a couple of extra bucks to buy a couple of brand new USB sticks and use them exclusively for moving Armory transactions about.  Doesn't completely remove the risk, but is a good way to minimize it.


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: flipperfish on November 06, 2013, 03:52:21 PM
Yes, but a whole bunch of USB frames get exchanged when you plug a device in, to identify the device.  As you say, a specially crafted USB frame could trigger a buffer overflow in the USB stack.  (ETA: That's more a risk with a specially designed malicious device - it's less likely a standard USB stick could be made to do this.)
Actually this was exactly my line of thinking. Device gets plugged in, hard-wired USB interface IC exchanges USB frames with host in order to recognize the device. So far no danger, because the hardwired part of the stick can't be changed. If the data in a data carrying frame could trigger an exploit? I don't know, but I suppose not, because the host interface should expect any data within the payload.

However as it turned out, most USB devices, even cheap standard USB sticks, have microcontrollers with "upgradable firmware". I don't know, if it is possible to alter the firmware through the USB interface. But for some USB sticks this must be true, as for example those sticks, who identify themselves as CD drives to the host to make autorun work, can be changed to not do this anymore. However, if the software driving the microcontroller in the stick can be altered, it is also possible for the stick to send some malicous frames, where the whole frame can be used to trigger the exploit in the host interface/driver.

Still, if you're going to dedicate an offline machine to Armory, then I think it's a reasonable precaution to spend a couple of extra bucks to buy a couple of brand new USB sticks and use them exclusively for moving Armory transactions about.  Doesn't completely remove the risk, but is a good way to minimize it.

I don't know if it makes sense to use "new" USB sticks. Maybe, if you don't know, where the USB sticks you already posess have been used in the past. But if the online pc is infected, a "new" USB stick doesn't help, because the online pc can infect the stick, when the unsigned transaction is copied to the stick.


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: maaku on November 06, 2013, 06:41:13 PM
flipperfish, most USB controllers do some processing at that layer. That's why there is a microcontroller, after all. If there is a security hole at that layer, then a specially constructed USB device (like, say, those given out at conferences or the G8 summit) could do a buffer-overflow like attack against the microcontroller itself, before the frame is passed up to the operating system's USB stack. It then flashes the USB controller with its own custom firmware, sticks the virus payload in NVRAM for insertion into the kernel at next boot, and then passes up fixed, normal USB frames to the host OS. What you need to realize is that none of this occurs on the CPU or in main memory, so it's pretty much undetectable with the current generation of commercially available security software. When you flash the USB firmware, what do you think it does? It send commands to... the USB microcrontoller. If the virus is already in the controller, then it is perfectly capable of flashing itself without outside involvement.

And yes, using a new stick doesn't really gain you anything for the reason you mention.


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: flipperfish on November 06, 2013, 07:35:24 PM
flipperfish, most USB controllers do some processing at that layer. That's why there is a microcontroller, after all. If there is a security hole at that layer, then a specially constructed USB device (like, say, those given out at conferences or the G8 summit) could do a buffer-overflow like attack against the microcontroller itself, before the frame is passed up to the operating system's USB stack. It then flashes the USB controller with its own custom firmware, sticks the virus payload in NVRAM for insertion into the kernel at next boot, and then passes up fixed, normal USB frames to the host OS.

I think, you are talking about the controller of the host interface? It can be compromised by a malformed usb frame (while doing its custom processing before passing it to the OS). That's basically, what I've written before. Of course, the malware is then able to do all other kinds of shady things with or without help of the OS and it will execute on the USB controllers internal "CPU" or the main CPU. This includes changing the BIOS and so on. This way of infection is possible, no question. The hack of the PS3 showed this very well.

However, what I've been talking about, is the controller of the pen drive itself, which manages the data flow between the host's controller and the flash-chip itself. As long as this controller is hardwired and cannot be changed by software, the host pc can't be infected with this pen drive by just plugging in and transferring data. I just refuse to accept, that the host's controller can be compromised by a malicious data payload in an usb frame (Note: I really mean the data part of the usb frame, not the header and other protocol-overhead). The host-interface should never care about the data part. And the header cannot be changed, because the flash drives's controller, which creates the frames and puts the data in, is (in this current assumption) hardwired. Of course, as soon as the data gets interpreted in some way, buffer overflows and the like can happen and cause malware to be executed.

Anyways, it's superflous, because the pen drive's controller can be reprogrammed, as I learned now. However, it still has to be seen, if the reprogramming can happen through the USB interface, or only via other ways (SPI and the like), that are not connected to the host pc in normal operation. For some USB flash drives, I'm pretty sure it's possible via USB.

What you need to realize is that none of this occurs on the CPU or in main memory, so it's pretty much undetectable with the current generation of commercially available security software.

I think, I realized this a long time ago, when the first proof-of-concept trojans, that could hide in the eeprom of a network card, were made public. Of course, this kind of malware can't be detected by antivirus software. However, there are already a lot of other ways to escape antivirus software with conventional, software-only malware. So I think it's rather stupid to rely on av-software alone for important things.


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: greBit on November 07, 2013, 08:15:42 AM
flipperfish, most USB controllers do some processing at that layer. That's why there is a microcontroller, after all. If there is a security hole at that layer, then a specially constructed USB device (like, say, those given out at conferences or the G8 summit) could do a buffer-overflow like attack against the microcontroller itself, before the frame is passed up to the operating system's USB stack. It then flashes the USB controller with its own custom firmware, sticks the virus payload in NVRAM for insertion into the kernel at next boot, and then passes up fixed, normal USB frames to the host OS. What you need to realize is that none of this occurs on the CPU or in main memory, so it's pretty much undetectable with the current generation of commercially available security software. When you flash the USB firmware, what do you think it does? It send commands to... the USB microcrontoller. If the virus is already in the controller, then it is perfectly capable of flashing itself without outside involvement.

And yes, using a new stick doesn't really gain you anything for the reason you mention.

For the moment we could probably suggest that this kind of attack, while extremely worrying, is limited to well-funded adversaries targeting very specific people. If this is the case then you are pretty much screwed.

In order for malware to exploit this method of infection in a more general fashion, surely there are some pretty hefty technical obstacles to overcome? How would an adversary target a machine with unknown hardware / unknown bios / unknown OS.

Someone able to do this may equally find a nice way of causing the online Armory to circumvent any air-gap-transmission system (display QR codes / output audio) to exploit a vulnerability in the offline armory.

Of course I would however never ever run Armory on Windows and would definitely prefer a bootable CD/DVD environment  such as https://bitcointalk.org/index.php?topic=233453.0 (https://bitcointalk.org/index.php?topic=233453.0)  :)



Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: maaku on November 07, 2013, 05:49:48 PM
Quote
In order for malware to exploit this method of infection in a more general fashion, surely there are some pretty hefty technical obstacles to overcome? How would an adversary target a machine with unknown hardware / unknown bios / unknown OS.

This embedded hardware is much more common and standardized than you might think. Pretty much all PCs use the same USB host chips. And for a given peripheral there's usually only a handful of chips running similar architectures available on the market. The BIOS/EFI firmware has standard extension interfaces that all vendors support and the malware would hook into to load itself.

Of course there's still a lot of engineering work that needs to be done to create such a virus, enough to put it in the category of almost-certainly-state-sponsored. But once it is isolated in the lab, it's a relatively small operation to dissect and re-purpose its various components to an existing bitcoin wallet seeking malware, for example.


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: darkmule on November 07, 2013, 06:38:22 PM
I don't think any software at all would be invulnerable to BIOS-based malware that meets the description of BadBIOS, especially if you assume BIOS-based malware that is specifically aimed at wallets.  This is independent of whether BadBIOS exists as described.


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: goatpig on November 07, 2013, 07:57:58 PM
I don't think any software at all would be invulnerable to BIOS-based malware that meets the description of BadBIOS, especially if you assume BIOS-based malware that is specifically aimed at wallets.  This is independent of whether BadBIOS exists as described.

As long as writing operations to the BIOS' eeprom are dependant on a hard jumper setting, you're going a long way to thwart root kits.


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: maaku on November 07, 2013, 08:00:14 PM
You don't need to rewrite the BIOS eeprom. You can stick the payload (or its bootloader) in any of the other NVRAM locations and inject it into the running BIOS during boot when the infected device is brought up.


Title: Re: Is Armory vulnerable to USB-Stick viruses like BadBios?
Post by: goatpig on November 07, 2013, 08:32:17 PM
You don't need to rewrite the BIOS eeprom. You can stick the payload (or its bootloader) in any of the other NVRAM locations and inject it into the running BIOS during boot when the infected device is brought up.

It is obvious that the kind of measure I'm talking about only makes sense if all such locations are enforcing the same security measures. A shielded front door is useless if the window right next to it is wide opened.