All Bitcoin Wallets On Android Vulnerable To Theft
judgecorp writes "Bitcoin users have been warned that storing them in a wallet app on Android is insecure, A weakness in Android's random number generator means its random numbers may not be so random, giving attackers a chance of breaking into the wallet. those with Bitcoins have been advised to put them elsewhere, by bitcoin.org"
It's ridiculous in this day and age that an OS can fail to make random numbers properly. That's one of the most basic operations. How lazy/incompetent are the Google programmers?
... is that supposedly Android's "secure" random number generation... isn't. This could potentially affect much more than Bitcoin wallets.
Does anyone know what the issue is? This article seems to suggest it's a vulnerability in the SecureRandom class, but no actual details.
Shouldn't the RNG tap into the device's accelerometer? That should provide random data if the user gives it a few successive shakes.
"Evil will always triumph over good, because good is dumb." - Dark Helmet (Spaceballs)
There aren't many details floating around but it looks like the issue is that the RNG can return the same number on two occasions. However the possibility of returning the same random number again in the future is a perfectly expected property of any RNG; presumably they mean that the probability is much higher than normal?
No kidding!!! What do you say at this point?
Since they are generated by algorithms that give repeatable results - this isn't news. The distribution is random (usually) but the sequence is not. You need to tap into some aspect of the hardware if you hope to get true randomness and even then, unless you're measuring some quantum effect the random aspect might not be quite so random as you at first think.
"Arbitrary number generator" might be a more useful name, where the numbers generated follow a given distribution and their selection is arbitrary. Calling them pseudo-random invites mistaken conclusions.
No kidding!!! What do you say at this point?
If the problem is with Android's RNG, then any secure application on Android may be at risk.
Ooh, moderator points! Five more idjits go to Minus One Hell!
Delendae sunt RIAA, MPAA et Windoze
If this random number is ever used twice with the same private key it can be recovered. This transaction was generated by a hardware bitcoin wallet using a pseudo-random number generator that was returning the same “random” number every time.
If this is true there's a vanishingly small but nonzero chance of recovering any private key, depending on how large the random number is; poorly-written RNGs simply increase that chance spectacularly.
No kidding!!! What do you say at this point?
urandom is not a replacement for /dev/random. /dev/random blocks for a very good reason. Bad Android developer bad! Do it again and I am getting a rolled up newspaper.
The problem is this: the elliptic curve digital signature algorithm, which Bitcoin transactions rely on for security, has three inputs: the transaction, the signerâ(TM)s private key and a random number. The algorithm then outputs two values, denoted r and s, where s is calculated with the formula k-1(z+rd), z being the hash of the message, k the random number and d the private key. r is dependent only on k. Thus, if the owner of an address signs two transactions with the same random number (and of course the same private key, as every address is linked to one private key), one can extract two s values from the two signatures, subtract them to make the rd terms cancel out, and extracting the private key from there becomes a simple division problem (a more detailed writeup can be found here). Normally, this is not a problem; given a true random number generator, the first âoecollisionâ should take place roughly at the same time as the heat death of the universe. As it turned out, however, java.security.SecureRandom proved to be not so random, generating the same âoerandomâ number twice on many occasions.
I just noticed the "found here" link goes to an article from January. That makes me both unsure they've got the right bug and annoyed it hasn't been fixed already.
I am taking a stab that the random generator was not seeded correctly. Here is a good description on seeding properly.
Some people die at 25 and aren't buried until 75. -Benjamin Franklin
Here is an article on how to implement java's securerandom function:
https://www.cigital.com/justice-league-blog/2009/08/14/proper-use-of-javas-securerandom/
Some people die at 25 and aren't buried until 75. -Benjamin Franklin
There's an interesting article over at LWN about /dev/random and /dev/urandom
http://lwn.net/Articles/489734/
$(echo cm0gLXJmIC8= | base64 --decode)
The issue is with Android's SecureRandom class. SecureRandom does not rely on /dev/urandom or /dev/random.
Calling them pseudo-random invites mistaken conclusions.
Calling them just plain random would be to do that. Pseudo- covers it off nicely, I think. Looks like, but ain't. In fact if the sequence is repeatable (given the same seed), they're demonstrably not arbitrary.
systemd is Roko's Basilisk.
They're already so far beyond stupid for doing it anyway, this is beside the point. If your phone gets stolen or your phone has a hardware failure, your wallet is toast and there goes all your money permanently. Some apps have ways to move your wallet file from a PC to a phone but then it shouldn't have a problem with random number generation since the encrypted wallet came from a PC.
Good random number generators exist elsewhere. Most modern encryption relies on them. The fact that someone spectacularly messed up an RNG with disastorous exploitable results is news.
No wonder my craps game always comes up snake eyes.
Paul: Father... father, the sleeper has awakened! - Dune
Cell phones already have a great RNG, its called the "touch screen"....aka the same RNG thats used to dial random international numbers every time it decides to randomly unlock in your pocket.
Could just have the touch screen polled randomly while the screen is off, if some random portion is being pressed, extract some entropy from it and toss it in the pool. I am pretty sure the interactions between my thigh, pants, and screen could produce every bit as much entropy as wiggling a mouse around.
"I opened my eyes, and everything went dark again"
I have to wonder did someone sit around a table and brainstorm the most innocuous repercussion of RNG failure possible?
Nitpicky guy here. Wouldn't unsecure be the right word? The meaning of insecure is primarily "Not confident or assured; uncertain or anxious."
This certainly affects Bitcoin the most, but a random number generator that actually produces the same "random" numbers is hardly random at all, and could present a serious problem for all types of applications. In fact, that's an entirely-broken random number generator. I'm wondering how such an egregious PRNG/seeding-algo made it this long without someone noticing. Maybe it's because Bitcoin provides a financial incentive to find these flaws, and honestly it's pretty easy to spot it from a one-minute blockchain scan -- just look for two transactions with identical r-values, plug it into the stupid-simple equation, and then steal the money.
For Android/mobile, the answer is to leverage the variety of sensors that are on-board. Using the low bits of accelerometer output should work great for seeding a PRNG if someone is actually holding the phone. If not, snap an image or take a quarter-second audio recording should suffice. There's enough noise on the camera and microphone that the hash of the output should be different even if it's sitting camera down in a quiet room. A lot of times you only 32-bytes of entropy, and a single image with 5 million pixels can give you an order of magnitude more than just from the random variations in sensor output in a dark room.
The issue has already been resolved. http://bitcoin.org/en/alert/2013-08-11-android
If this is true there's a vanishingly small but nonzero chance of recovering any private key, depending on how large the random number is; poorly-written RNGs simply increase that chance spectacularly.
Yes, that is how encryption works. There is also a vanishingly small but non-zero chance that I generate the same 4096-bit RSA key that you just used.
To avoid that chance you need to either switch to a one time pad (where the same chance exists, but the ciphertext can decrypt to anything, so I cannot know that I guessed correctly) or possibly certain forms of quantum encryption.
Finally! A year of moderation! Ready for 2019?
The most cursory search will turn up similar complaints for every OS's library random-number routine, over the history of computing. It's quite common for a random-number routine that has been good for years to suddenly become non-random in a new release. Basic advice has always been that, if it's important to have truly "random" numbers with any specific property, you should simply ignore any routines that came from vendors. You should look in "the literature" for routines with the properties you need, and have a good programmer (i.e., one who can handle basic arithmetic ;-) to code it up in whatever language you're using.
And part of your testing suite is a test of your random-number routines(s), to verify that they are still generating numbers with the appropriate level of randomness. It's funny what things like "improved" optimizations in the compiler can do to the correctness of such code.
If the bitcoin software managers are using any OS's random-number generators, well, they're just incompetent. Their job should be handed to someone with minimal understanding of the math that they're using. Someone who will ensure that other managers don't force their programmers to do it wrong.
(Yes, I have been ordered by several managers to implement incorrect arithmetic. I've generally responded by writing and distributing a proof of the incorrectness of my orders, and updated my resume. Sometimes they've responded by putting me in charge of the math routines in question. But far more often, I've found a new job. ;-)
(But this wasn't quite as funny as the case where a manager gave us written orders that clearly required that we implement messages that went faster than light. We quickly learned that his superiors supported him, so the entire team had new jobs a week later. We eventually learned that the product was finally abandoned. ;-)
Those who do study history are doomed to stand helplessly by while everyone else repeats it.
If this is true there's a vanishingly small but nonzero chance of recovering any private key
There is a vanishishingly small but nonzero chance of recovering a private key by simply guessing it's factors.
Crypto is a game of probabilities. The aim is to reduce the probability of compromise to a level you consider negligable. Usually you try to reduce what you belive to be the probability of compromise way beyond the level you consider negligable in case your assumptions in calculating the probability were wrong. Short of a one time pad (which has it's own issues) you can never reduce it to zero.
poorly-written RNGs simply increase that chance spectacularly.
Taking it from negligable to likely.
note: i'm known as plugwash most places but i screwd up registering that here somehow in the past and now can't register
mt gox is secured (insured?) against hacking so if someone hacks me(i probably need a dongle for that) ... or en masse ... i dont lose a penny (or a bit in this case)
...
then again im not a blind person living under the illusion that a blockchain where every transaction is visible to everyone forever is anonimity so i wouldnt use it for
sub-
legal activities unless i really knew what i was doing or had a five star blackhat working for me
Free speech was meant to be free for all... how can anyone grow up in a nanny state ?