Múltiplas vulnerabilidades na função SecureRandom() (função para geração de números pseudo-aleatórios — PRNGs) deixam os endereços da carteira Bitcoin vulneráveis a ataques de força bruta.

Antigos endereços da carteira da Web do Bitcoin gerados via navegador de Internet ou por meio de aplicações baseadas em JavaScript podem estar a ser afetados por uma vulnerabilidade criptográfica e que pode ser explorada massivamente pelos hackers.

Segundo os investigadores de segurança, a popular biblioteca JavaScript SecureRandom() não é aleatoriamente segura, o que significa que um atacante pode lançar ataques de força bruta em chaves privadas.

A falha reside na função JavaScript SecureRandom() que é usada para gerar um endereço Bitcoin aleatório (e a respetiva chave privada adjacente).

“It will generate cryptographic keys that, despite their length, have less than 48 bits of entropy, […] so its output will have no more than 48 bits of entropy even if its seed has more than that,” said the system administrator David Gerard.

“SecureRandom() then runs the number it gets through the obsolete RC4 algorithm, which is known to be more predictable than it should be, i.e. less bits of entropy,” Gerard added. “Thus, your key is more predictable.”

 

Gerard concluiu que todos os endereços Bitcoin gerados através da função SecureRandom() estão vulneráveis a ataques de força bruta.

“The conclusion seems to be that at least all wallets generated by js tools inside browsers since bitcoin exists until 2011 are impacted by the Math.random weakness if applicable to the related implementations, the Math.random or RC4 (Chrome) weakness between 2011 and 2013, and RC4 weakness for Chrome users until end of 2015” continues Gerard.

 

Gerard explicou ainda que várias aplicações para geração de chaves Bitcoin usavam a função SecureRandom(), e que os endereços Bitcoin potencialmente afetados são:

  • BitAddress pre-2013;
  • bitcoinjs before 2014;
  • current software that uses old repos they found on Github.

 

Um utilizador lançou o mesmo alerta na lista de discussão da Linux Foundation:

“A significant number of past and current cryptocurrency products contain a JavaScript class named SecureRandom(), containing both entropy collection and a PRNG. The entropy collection and the RNG itself are both deficient to the degree that key material can be recovered by a third party with medium complexity.” reads the alert.

 

Saiba mais sobre Pseudo-random Number Generators (PRNGs) aqui:

Pseudorandom Number Generators (PRNGs)

 

O investigador Mustafa Al-Bassam acrescentou que várias implementações antigas para aplicações Bitcoin usaram a biblioteca criptográfica jsbn.js para gerar endereços Bitcoin. Infelizmente, a biblioteca criptográfica jsbn.js usou a função SecureRandom (), o que significa que as chaves privadas do Bitcoin foram expostas.

 

“The original disclosure didn’t contain any information about the library in question, so I did some digging.” added Mustafa.

“I think that the vulnerability disclosure is referring to a pre-2013 version of jsbn, a JavaScript crypto library. Before it used the CSRNG in the Web Crypto API, it tried to use nsIDOMCrypto, but incorrectly did a string comparison when checking the browser version.”

 

O que fazer nestas circunstâncias?

Se usar um endereço de carteira Bitcoin gerado através de ferramentas com as falhas identificadas, deve gerar um novo endereço Bitcoin e transferir os fundos para a nova carteira.