Bitcoin brainwallet cracking tools
Brainflayer is a Proof-of-Concept brainwallet cracking tool that uses libsecp256k1 for pubkey generation. It was originally released as part of my DEFCON talk about cracking brainwallets (slides, video, why).
The name is a reference to Mind Flayers, a race of monsters from the Dungeons & Dragons role-playing game. They eat brains, psionically enslave people and look like lovecraftian horrors.
The current release is more than four times faster than the DEFCON release, and many features have been added.
If brainflayer is useful to you, please get in touch to let me know. I’m very interested in any research it’s being used for, and I’m generally happy to collaborate with academic groups.
Just because you can steal someone’s money doesn’t mean you should. Stealing would make you a jerk. Don’t be a jerk.
No support will be provided at this time, and I may ignore or close issues requesting support without responding.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS «AS IS» AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Precompute the bloom filter:
hex2blf example.hex example.blf
Run Brainflayer against it:
brainflayer -v -b example.blf -i phraselist.txt
your_generator | brainflayer -v -b example.blf
Brainflayer’s design is heavily influenced by Unix philosophy. It (mostly) does one thing: hunt for tasty brainwallets. A major feature it does not have is generating candidate passwords/passphrases. There are plenty of other great tools that do that, and brainflayer is happy to have you pipe their output to it.
Unfortunately, brainflayer is not currently multithreaded. If you want to have it keep multiple cores busy, you’ll have to come up with a way to distribute the work yourself (brainflayer’s -n and -k options may help). In my testing, brainflayer benefits significantly from hyperthreading, so you may want to run two copies per physical core. Also worth noting is that brainflayer mmaps its data files in shared memory, so additional brainflayer processes do not use up that much additional RAM.
While not strictly required, it is highly recommended to use the following options:
-m FILE Load the ecmult table from FILE (generated with ecmtabgen ) rather than computing it on startup. This will allow multiple brainflayer processes to share the same table in memory, and signifigantly reduce startup time when using a large table.
-f FILE Verify check bloom filter matches against FILE , a list of all hash160s generated with sort -u example.hex | xxd -r -p > example.bin Enough addresses exist on the Bitcoin network to cause false positives in the bloom filter, this option will suppress them.
Brainflayer supports a few other types of input via the -t option:
-t keccak passphrases to be hashed with keccak256 (some ethereum tools)
-t priv raw private keys — this can be used to support arbitrary deterministic wallet schemes via an external program. Any trailing data after the hex encoded private key will be included in brainflayer’s output as well, for reference. See also the -I option if you want to crack a bunch of sequential keys, which has special speed optimizations.
-t warp salts or passwords/passphrases for WarpWallet
-t bwio salts or passwords/passphrases for brainwallet.io
-t bv2 salts or passwords/passphrases for brainv2 — this one is very slow on CPU, however the parameter choices make it a great target for GPUs and FPGAs.
-t rush passwords for password-protected rushwallets — pass the fragment (the part of the url after the #) using -r . Almost all wrong passwords will be rejected even without a bloom filter.
Address types can be specified with the -c option:
-c u uncompressed addresses
-c c compressed addresses
-c e ethereum addresses
-c x most signifigant bits of public point’s x coordinate
It’s possible to combine two or more of these, e.g. the default is -c uc .
An incremental private key brute force mode is available for fans of directory.io, try
brainflayer -v -I 0000000000000000000000000000000000000000000000000000000000000001 -b example.blf
See the output of brainflayer -h for more detailed usage info.
Also included is blfchk — you can pipe it hex encoded hash160 to check a bloom filter file for. It’s very fast — it can easily check millions of hash160s per second. Not entirely sure what this is good for but I’m sure you’ll come up with something.
Should compile on Linux with make provided you have the required devel libs installed (at least openssl and gmp are required along with libsecp256k1’s build dependencies). I really need to learn autotools. If you file an issue about a build failure in libsecp256k1 I will close it.
Dependencies should install with
Supported build target is currently Ubuntu 20.04 on amd64/x86_64. Issues with building for other platforms probably won’t be fixed. In particular, Kali Linux is not supported. Support for operating systems other than Linux would require extensive refactoring of Brainflayer’s memory optimizations and is not happening.
Redistribution of compiled brainflayer binaries is prohibited, and unauthorized binaries probably contain malware.
The bulk of Brainflayer was written by Ryan Castellucci. Nicolas Courtois and Guangyan Song contributed the code in ec_pubkey_fast.c which more than doubles the speed of public key computations compared with the stock secp256k1 library from Bitcoin. This code uses a much larger table for ec multiplication and optimized routines for ec addition and doubling.
About
A proof-of-concept cracker for cryptocurrency brainwallets and other low entropy key alogrithms.
Источник
Белый хакер создал инструмент для взлома Биткоин кошельков с Brainwallet
«Белый хакер» создал новый инструмент, показывающий, что можно с легкостью украсть биткоины из кошельков, созданных по технологии «brainwallet», где кодовая фраза хранится только в памяти пользователя. Первоначально задуманный как способ сохранения конфиденциальных данных в автономном режиме, brainwallet использует один длинный пароль или фразу, преобразует его в закрытый ключ, открытый ключ и наконец в адрес.
Простое запоминание сложной фразы позволяет любому пользователю держать миллионы долларов цифровой наличности фактически в собственной голове, без необходимости хранить какие-либо записи на компьютере.
Однако, оказывается, что ум является удивительно уязвимым местом, и не составляет особого труда подобрать ключ к вашим крипто-активам.
Исследователь в сфере информационной безопасности Райан Кастелуччи из фирмы White Ops указал на наличие серьезной уязвимости в этом методе. Он подчеркивает, что конечный адрес Биткоин записывается в блокчейне как хэш закрытого ключа, созданного на основе пароля. При использовании для аутентификации на веб-сайте, хэш пароля поможет определить слово или фразу, сравнив её с оригиналом. Это означает, что данные могут быть использованы взломщиками, которые ищут пароль.
7 августа на DEF CON 23, одной из крупнейших в мире ежегодных конференций хакеров, программа-взломщик brainwallet, названная Кастелуччи Brainflayer, оказалась способна перебирать пароли с частотой 130 000 раз в секунду. Запуск на более мощных компьютерах, например в арендованном облаке, который обойдётся в $1, может быть использован для перебора 560 миллионов фраз в секунду.
При этом, система применима и для ASCII паролей, построенных на символах клавиатуры США, и XKCD паролей. Кастеллуччи заявил, что его бот может проверить каждый адрес Биткоин, который когда-либо получал средства, в течение одного дня.
В интервью Кастеллуччи стремился подчеркнуть, что хотя созданный им инструмент может быть использован преступниками, он надеется, что его исследования будут стимулировать пользователей Bitcoin к поиску лучших методов безопасности для защиты своих сбережений.
Вы можете кричать с крыш, что кто-то слаб и уязвим, но многие люди просто будут всё отрицать без наличия работающего доказательства концепции. Я думаю, что концепция, которая позволяет людям выбирать свои собственные пароли и фразы для высокопроизводительных приложений, является в корне ошибочным подходом к безопасности.
В этом случае, презентация Кастелуччи не прошла незамеченной. После ее выхода веб-сайт BrainWallet.org, который генерирует личные ключи для пользователей и использует JavaScript, перешел в автономный режим. Хотя другие услуги остаются доступными, закрытие было очень высоко оценено членами сообщества Bitcoin.
Начало проекта
Развитие проекта началось в середине 2013 года, когда первые пользователи Биткоина начали испытывать проблемы с безопасностью brainwallet. Примерно в то же время один из пользователей Reddit, известный как btcrobinhood (BTC Робин Гуд), начал воровать монеты из brainwallets, возвращая их потом законным владельцам в целях разоблачения уязвимости технологии.
Вдохновленный этим примером, Кастеллуччи создал оригинальную программу-взломщик Brainflayer, которая могла выдавать 10 000 паролей, предугадывая все возможные варианты.
Когда он вернулся к своему компьютеру, на котором была запущена программа, он нашел 250 ВТС, уже извлеченных из чужого кошелька благодаря уязвимостям в технологии Brainwallet.
Кастеллуччи был поставлен в трудную ситуацию. У него было два варианта — взять несколько BTC как оплату за свои исследования, и предупредить пользователей бумажников, что их безопасность под угрозой, или попытаться связаться с ними с помощью других средств. В конце концов, ему удалось связаться с владельцем и убедить его переместить биткоины в более безопасный кошелек.
Когда проблема не исчезла, он решил вернуться к исследованиям, утверждая, что это его обязанность — раскрыть уязвимость, чтобы пользователи могли принять соответствующие меры и повысить свой уровень защищенности.
Будущее технологии
Также он предложил тем, кто использует brainwallet, рассмотреть улучшенную реализацию данной идеи — WarpWallet.
Кастелуччи говорит, что в уравнение WarpWallets интегрирована «соль» — случайные данные, используемые для входа при хэшировании функции. Это означает, что если «солью» пользователя был его адрес электронной почты, потенциальному вору нужно знать не только пароль, но и адрес.
Тем не менее, Кастеллуччи советует тем, кто использует кошельки на brainwallet, применять наборы случайных чисел и символов. А еще лучше использовать diceware — процесс, посредством которого пароли создаются с помощью пары генераторов случайных чисел.
Кастелуччи не сказал точно, сколько ключевых фраз Brainflayer способен угадывать на одном компьютере. Но он намекает, что если его программа будет запущена в ботнете, то цифра может приближаться к ста миллиардам ключевых фраз в секунду. Более того, он говорит, что программа PassPhrase оптимизирована для задачи быстрой генерации ключей Bitcoin и сканирования блокчейна.
Для наиболее эффективного сканирования и проверки блокчейна он использовал метод, известный как фильтр Bloom. Его результат пока не достигает триллиона ключевых фраз в секунду, о чем ранее предупреждал Сноуден, подразумевая достижения АНБ. Тем не менее, это может удивить многих людей, которые считают, что их ключевые фразы являются безопасными.
Бюро находок
Когда его спросили, как он планирует продолжить свою работу, Кастеллуччи сказал, что он все еще в процессе планирования следующих исследований. Он работает над добавлением новых инструментов в brainwallet, как и в Brainflayer. В том числе это режим, который будет сканировать «плохие» приватные ключи.
Источник
Brainflayer
Brainflayer is a Proof-of-Concept brainwallet cracking tool that uses libsecp256k1 for pubkey generation. It was originally released as part of my DEFCON talk about cracking brainwallets (slides, video, why).
The name is a reference to Mind Flayers, a race of monsters from the Dungeons & Dragons role-playing game. They eat brains, psionically enslave people and look like lovecraftian horrors.
The current release is more than four times faster than the DEFCON release, and many features have been added.
Brainflayer’s design is heavily influenced by Unix philosophy. It (mostly) does one thing: hunt for tasty brainwallets. A major feature it does not have is generating candidate passwords/passphrases. There are plenty of other great tools that do that, and brainflayer is happy to have you pipe their output to it.
Unfortunately, brainflayer is not currently multithreaded. If you want to have it keep multiple cores busy, you’ll have to come up with a way to distribute the work yourself (brainflayer’s -n and -k options may help). In my testing, brainflayer benefits significantly from hyperthreading, so you may want to run two copies per physical core. Also worth noting is that brainflayer mmaps its data files in shared memory, so additional brainflayer processes do not use up that much additional RAM.
Hopefully you have installed Ubuntu, Updates, Repositories and Moudles if not check out the Install Ubuntu Guide.
Basic Commands
Precompute the bloom filter: hex2blf example.hex example.blf
Run Brainflayer against it: brainflayer -v -b example.blf -i phraselist.txt
Run Brainflayer with adon generator: your_generator | brainflayer -v -b example.blf
Advanced Commands
-m FILE Load the ecmult table from FILE (generated with ecmtabgen) rather than computing it on startup. This will allow multiple brainflayer processes to share the same table in memory, and signifigantly reduce startup time when using a large table.
-f FILE Verify check bloom filter matches against FILE, a list of all hash160s generated with sort -u example.hex | xxd -r -p > example.bin Enough addresses exist on the Bitcoin network to cause false positives in the bloom filter, this option will suppress them.
-t keccak passphrases to be hashed with keccak256 (some ethereum tools)
-t priv raw private keys – this can be used to support arbitrary deterministic wallet schemes via an external program. Any trailing data after the hex encoded private key will be included in brainflayer’s output as well, for reference. See also the -I option if you want to crack a bunch of sequential keys, which has special speed optimizations.
-t warp salts or passwords/passphrases for WarpWallet
-t bwio salts or passwords/passphrases for brainwallet.io
-t bv2 salts or passwords/passphrases for brainv2 – this one is very slow on CPU, however the parameter choices make it a great target for GPUs and FPGAs.
-t rush passwords for password-protected rushwallets – pass the fragment (the part of the url after the #) using -r. Almost all wrong passwords will be rejected even without a bloom filter.
Address types can be specified with the -c option:
-c u uncompressed addresses
-c c compressed addresses
-c cu compressed addresses & uncompressed addresses
-c e ethereum addresses
-c x most signifigant bits of public point’s x coordinate
- git clone https://github.com/ryancdotorg/brainflayer.git
- cd brainflayer
- make (This only has to be done Once)
If you have not yet Built a Bitcoin Address Database then here is a good place to start – BTC Address in Base58 and H160 Sorted by Satoshi Balance (here) to download your CSV file. Thanks to bitkeys.work Bitcoin Private Key Generator | All Bitcoin Address with Balance (bitkeys.work)
On a Windows 10 runing Ubuntu will need to extract file to this location :
- Ubuntu18.04 LTS : C:\Users\Your_Username\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState\rootfs\home\Your_Username
- Ubuntu20.04 LTS : C:\Users\Your_Username\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState\rootfs\home\Your_Username
Copy Your CVS file to Brainflayer Folder
- sudo cp btc_balance_sorted.csv /home/Your_Username/brainflayer/btc_balance_sorted.csv
Copying the file this way into Brainflayer folder Alows Ubuntnu to use it in brainflayer without permission issuse. Make sure you in the root directory.
Make your Bloom File and Bin File
- sudo cut -d, -f 1 btc_balance_sorted.csv > btc_base58.txt
(The resulting file “btc_base58.txt” will be a huge list of BTC base58 address line by line.)
- sudo cut -d, -f 4 btc_balance_sorted.csv > btc_h160.txt
(The resulting file “btc_h160.txt” will be a huge list of BTC H160 address line by line.)
- ./hex2blf btc_h160.txt btcaddress.blf
(The resulting file “btcaddress.blf” will be a list of BTC H160 address for much quicker lookup)
- sort -u btc_h160.txt | xxd -r -p > btc_h160.bin
(The resulting file “btc_h160.bin” we be a list of all hash160s generated verify check bloom filter matches that cause false positives in the bloom filter, this option will suppress them)
Источник