DetectCryptoMining is a tool written in Python designed to monitor, detect and mitigate against crypto-mining malware.
Please run the tool on Windows 10 since it has been tested on this operating system. Although the components of the tool are OS X and Linux compatible, I have not tested whether all the functionality of the tool works correctly on either of these operating systems.
- Install Python 3.
- Install the tool's required python packages:
pip install PyYAML psutil PyQt5 numpy matplotlib dnspython pywin32
- Traverse to the
DetectCryptoMining\DetectCryptoMining.py
file location within the repository. - Run the DetectCryptoMining.py file:
python DetectCryptoMining.py
- The program will then ask you whether you would like to update the mining pool IP addresses for improved mining detection. If it's your first time running the tool or you haven't updated the IPs for 24hrs enter in
y
for yes. Otherwise entern
for no to save time. - Once the tool has finished querying for mining pool IP addresses its GUI will popup. Snap the tools GUI to be fullscreen.
- Next click the 'Start monitoring' button on the GUI to start the program.
- If at anytime you want to stop the program click the 'Stop monitoring' button.
- While the tool is running, one can modify the trusted process whitelist by clicking the 'Modify Process Whitelist' button. Clicking the button will cause the whitelist.txt file to be opened with notepad. To add a new trusted process to the whitelist append the process's name to a newline. Any process names added to the whitelist must be in lowercase and verbatim to how Windows names them. To remove a no longer trusted process from the whitelist simply delete its name from the whitelist. Once you have finished updating the whitelist save the document and close it. As soon as the whitelist.txt has been saved the tool will proceed to use the updated whitelist for the next round of monitoring/detection.
- Instance where detection rules are met are displayed by the GUI by a bar graph and two tables.
- Should you see a process you don't recognise that is repeatedly meeting detection rules you should consider taking action against the process.
- To mitigate and kill a suspicious mining process go to the bottom table and look for the row containing the suspicious process you want to kill. One you have found its row click its corresponding kill button label as 'Kill '.
- Once the kill button is clicked all the process associated with the suspicious processes name are killed preventing any further crypto-mining.
Go to: https://robh0.github.io/DetectCryptoMiningDocs/
If the documentation website is down:
- Traverse into the following directory:
cd DetectCryptoMining\docs\_build\html
- Open the index.html file with a browser of your choice. This will display the sphinx generated documentation.
To view DetectCryptoMining's UML Class Diagram traverse to and open the DetectCryptoMining\UML\DetectingCryptoMiningUML.png
file.
Disclaimer: By decrypting the CryptoMiners container you accept that I'm not responsible for any possible damaged caused by either of the crypto-miners. To protect your host device from potential damage caused by the crypto-miners I recommend running tests within a Windows 10 virtual machine (e.g. VirtualBox). One can download official Windows 10 virtual machine disk images from either: https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ or https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/.
- Download the installer of the free and open source file and disk encryption software VeraCrypt from https://www.veracrypt.fr/en/Downloads.html.
- Run the installer to install VeraCrypt.
- Once VeraCrypt has been installed run VeraCrypt and click the 'Select File' button and select the CryptoMiners.txt VeraCrypt container found at
FullUnit_1920_RobertHoldsworth\CryptoMiners\CryptoMiners.txt
. - Once you have selected CryptoMiners.txt click the 'Mount' button at the bottom left of the VeraCrypt GUI.
- VeraCrypt will then prompt you to enter a password. Enter the password
miner
into the password input field and click the 'OK' button. - VeraCrypt will then proceed to decrypt the CryptoMiners.txt container and mount it as drive allowing you to access the Xmrig and Xmr-Stak mining files.
- Make sure you have installed the required python packages for DetectCryptoMining:
pip install PyYAML psutil PyQt5 numpy matplotlib dnspython pywin32
- Make sure you have decrypted and mounted the Veracrypt CryptoMiners.txt container that holds the Xmrig miner.
- Double click the startTest.bat batch file. This will sequentially start the miner with the correct configurations and then start up the DetectCryptoMining tool ready for testing.
- If at any point you use DetectCryptoMining's GUI to kill the Xmrig processes the mining processes are killed however the command prompt parent process isn't killed causing the xmrig command prompt output to freeze but not close.
- Make sure you have installed the required python packages for DetectCryptoMining:
pip install PyYAML psutil PyQt5 numpy matplotlib dnspython pywin32
- Make sure you have decrypted and mounted the VeraCrypt CryptoMiners.txt container that holds both the Xmrig and the Xmr-Stak miner.
- Go to the mounted container using file explorer or clicking the mounted drive on the VeraCrypt GUI.
- If you want to run Xmrig go to the
xmrig-5.10.0\xmrig.exe
file location within the mounted VeraCrypt container and double click thexmrig.exe
executable. If you want to run Xmr-Stak go to thexmr-stak-rx-win64-1.0.4\xmr-stak-rx.exe
file location within the mounted VeraCrypt container and double click thexmr-stak-rx.exe
executable.
CryptoWebsite is a website designed to simulate a sustained high CPU utilisation level that a web-based crypto-mining JavaScript function would usually produce as a symptom of crypto-mining.
- Go to its webpage by using the following URL: https://robh0.github.io/HostedCryptoWebsite/
- Select a number from the drop down menu to determine the duration at which the CPU intensive function should run for. The greater the number the longer the duration the function runs for.
- Click the 'Start mining' button to start heavy CPU function.
- An alert will pop up once the heavy CPU function has returned. Press the 'Start mining' button again should you wish to start the heavy CPU function again.