Reverse engineering tool for recovering private keys of addresses generated by https://github.com/johguse/profanity. The vulnerability is exaplained in detail in various blog [posts] (https://medium.com/amber-group/exploiting-the-profanity-flaw-e986576de7ab) (https://medium.com/@rebryk/how-to-hack-a-vanity-address-generated-with-profanity-ffad61ecacd2)
The vanity tool uses 32bit random seed to generate 256bit starting private key. The seed space was found to be too small and thus vulnerable to attacks by abusing an elliptic curve property which allows to backtrack to the starting private key if the public key is available (see blog posts for detailed explanation).
This program requires GPU with at least 4gb of memory, 150gb disk space and OpenCL installed (although it might just work with the included OpenCL.dll library).
This repository contains necessary code to recover private keys generated by Profanity. IT IS INTENDED FOR EDUCATIONAL PURPOSES ONLY AND SHOUD ONLY BE USED WITH EXPLICIT CONSENT OR ON SYSTEMS WHERE YOU HAVE BEEN AUTHORIZED TO DO SO.
The prerequisite files need to be generated first and they will take up about 150gb of disk space. The files are generated by running 2 Golang scripts and contain the necessary 4byte seed and the last 8bytes of the X coordinate of the corresponding public key. The process of generating the files can take up about a day (depending on the CPU).
Once you have the output.bin generated you can delete the other binary files.
Once the binary files are generated we can start the actually tool. First fill out the data in the config.json (etherscan and node RPC for public key recovery), if using ETH, ARB or POLYGON. Then input the target wallets or contract addresses in main.py on line 25/26 and run the code. The number of iterations on each GPU thread is set to 2000, original tool has no limitations so it can be set arbitrarily in src/tools.py on line 183.
Generate files: Windows: setup.bat Linux: setup.sh Run the tool: (using environment) python main.py
This tool was developed after my own account was drained a few weeks ago and was only used to validate the vulnerability. The exploit was discovered in september 2022 so it is considered safe to open source since by now all vulnerable accounts have been either notified, recovered or drained.
The tool provided herein is intended for educational purposes only and should only be used with explicit consent or on systems where you have been authorized to do so. The creator of this tool does not condone illegal activities and will not be held responsible for misuse of the tool. It is the end user's responsibility to obey all applicable local, state, federal, and international laws. Any actions and/or activities related to the tool provided is solely your responsibility. Misuse of the tool can result in criminal charges brought against the persons in question.
The author of this software, its subsidiaries, and associates will not be held responsible in the event that any criminal charges be brought against any individuals misusing the tool to break the law.
THIS TOOL IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.