Implementation of White-Hat Worms Using Mirai Source Code and Its Optimization through Parameter Tuning
Abstract
:1. Introduction
- We show a general and detailed implementation method for the functions of white-hat worms, such as “secondary infection”, which is to infect a device already infected by a malicious worm to disinfect it, and “lifespan”, which is to terminate its own operation after a certain amount of time has passed after infecting a device. Then, based on the method, we implemented a white-hat worm that works on a physical device using the publicly available Mirai source code.
- Experiments with malicious worms and white-hat worms showed that a white-hat botnet can disinfect a malicious botnet by tuning and optimizing the respective values of two parameters of the white-hat worm, the number of vulnerable devices scanned per attempt, and the lifespan of the white-hat worm. We showed that the function of a white-hat botnet to disinfect a malicious botnet is feasible for practical use.
2. Related Terms and Works
2.1. Mirai
- Mirai (itself)
- C&C server
- Scan Listener
- Loader
- The Mirai that infects Device 1 is registered with the C&C server.
- The Mirai scans for other vulnerable devices and, if found, attempts to log in using a predefined username and password combination. If the login is successful, it reports information about the device and the login credentials used to successfully log in to the Scan Listener.
- Upon receiving the information of the vulnerable device (Device 2) from Mirai, the Scan Listener transmits the information to the Loader.
- Upon receiving information from the Scan Listener, the Loader logs into Device 2 via Telnet.
- The Loader executes commands on Device 2 to download Mirai from a web server that distributes Mirai.
- The Loader launches Mirai, which is downloaded to Device 2.
- The Mirai put into Device 2 by the Loader begins its activity.
2.2. BDS (Botnet Defense System)
- Monitor the network and detect malicious botnets.
- Based on the monitoring results, develop a tactic to eliminate malicious botnets.
- Based on the tactic, white-hat worms are sent into the network to build a white-hat botnet.
- Based on the tactic, it directs and controls the white-hat botnets that operate autonomously.
- Primary infection rate : Infection rate to uninfected devices.
- Second infection rate : Infection rate to already infected devices.
- Lifespan ℓ: Duration of survival after Infection.
- It is not a method of implementing a white-hat worm that can work on a physical device
- The white-hat worm used in the PN2Simulator has secondary infection and lifespan functions, all of which are realized using one of the Petri nets, PN2. Therefore, the concept of the functions that the white-hat worm has is shown, but not how to implement a white-hat worm that can work on those specific and real devices.
- Cannot reproduce hardware or network
- Because PN2Simulator uses PN2 to represent the infection state, it is limited in its ability to reproduce the internal behavior of a device or the behavior of a real-world worm. In addition, because the simulation is not based on an actual network, it does not reflect network characteristics such as bandwidth, and because it is not a simulation method that reproduces network traffic, it cannot collect network traffic.
2.3. Research Related to the Mirai Botnet
2.4. Research Using the Mirai Source Code
3. Methodology
3.1. Features
- Implementation of a botnet
- The botnet is implemented by a worm created using the Mirai source code, and the basic behavior of the botnet is based on Mirai, enabling actual bot and botnet behavior.
- Implementation of white-hat worm capable of parameter tuning
- White-hat worms used in the implementation system have two parameters that can tune the speed at which the worm’s infection spreads, and by tuning these values, they can be optimized to eliminate a malicious botnet.
- Replication of IoT networks with scalability
- The IoT devices are reproduced by using OpenWrt, an operating system used for routers and other IoT devices, as the vulnerable devices that the worm infects. And all devices in the implemented system are virtualized, making it easy to increase or decrease the number of devices used.
3.2. Behavior of the Implementation System
- The malicious worm that manually infected Device 0 is registered on the malicious C&C server.
- The white-hat worm that manually infected Device 4 is registered on the white-hat C&C server.
- Device 2 is infected by the malicious worm that infected Device 0 (primary infection).
- The malicious worm that infected Device 2 is registered on the malicious C&C server.
- Device 3 is infected by the white-hat worm that infected Device 4 (primary infection).
- The white-hat worm that infected Device 3 is registered on the white-hat C&C server.
- The white-hat worm infecting Device 4 causes Device 2, which is already infected by the malicious worm, to be infected by the white-hat worm (secondary infection).
- The white-hat worm that infected Device 2 is registered on the white-hat C&C server.
- Device 1 is infected by the malicious worm that infected Device 0 (primary infection).
- The malicious worm that infected Device 1 is registered on the malicious C&C server.
- The white-hat worm that has reached its predefined lifespan and infected Device 4 stops its process (back to the state where it is not infected by any worm).
- Device 4 is infected by the malicious worm that infected Device 1 (primary infection).
- The malicious worm that infected Device 4 is registered on the malicious C&C server.
- The commands executed by the Loader download and launch the malicious worm.
- The command executed by the Loader downloads and launches the malicious worm (the second time).
- The malicious worm launched a second time detects that a malicious worm is already running on the device and terminates its own operation, which is launched later.
- The command executed by the Loader downloads and launches the white-hat worm.
- The launched white-hat worm detects that a malicious worm is running on the device and disinfects it.
- The commands executed by the Loader download and launch the malicious worm.
- The launched malicious worm detects that a white-hat worm is running on the device and terminates the malicious worm’s own process.
- When the white-hat worm reaches the end of its lifespan, the white-hat worm terminates its own process.
3.3. Creating a Malicious and a White-Hat Worm
- Enabling the secondary infection function
- Mirai does not have the concept of primary or secondary infection, and in order to implement malicious worms and white-hat worms, processes related to primary and secondary infection were added. For example, a process was added to check whether the device into which the worm was submitted was already infected by a malicious worm or a white-hat worm, and depending on the results, the white-hat worm would disinfect the malicious worm or terminate its own process.
- Implementation of lifespan
- Mirai does not have a lifespan function because once it starts operating, it will continue to operate until another Mirai is submitted to the same device. In order to implement the white-hat worm, a process was added to allow it to terminate its own operation after a pre-designated period of time and return to a state where the device is not infected by any of the devices (both a malicious worm and a white-hat worm can be infected).
3.3.1. Malicious Worm
- (i)
- They infect vulnerable devices and then form and expand a malicious botnet.
- (ii)
- If the device being loaded is already infected with a worm, a malicious worm terminates its own operation.
- (i)
- Check whether the loaded device is already infected with a malicious worm or a white-hat worm, and if so, the malicious worm self-terminates the process.
3.3.2. White-Hat Worm
- (i)
- They infect vulnerable devices and then form and expand a white-hat botnet.
- (ii)
- If the device being loaded is already infected with a malicious worm, a white-hat worm disinfects the malicious worm.
- (iii)
- If the loaded device is already infected with a white-hat worm, the white-hat worm terminates its own operation.
- (iv)
- By changing the value of the parameters, the speed of the white-hat worm’s infection spread can be modified.
- (v)
- They have the lifespan feature that terminates their own operation after a pre-defined time has elapsed.
- (i)
- Check to see if the device being loaded is already infected with a malicious worm, and if so, remove the malicious worm.
- (ii)
- It checks to see if the loaded device is already infected with the white-hat worm, and if so, it terminates its own process.
- (iii)
- The number of vulnerable devices discovered per time is parameterized to adjust the speed of infection spread.
- (iv)
- Add a lifespan feature and automatically terminate its own process after a pre-specified time has elapsed.
3.4. C&C Server
- Time when the bot was registered (or de-registered).
- IP address of the registered (or de-registered) bot.
- Whether the worm has been registered or de-registered.
- Number of bots registered with the C&C server at the time the log was logged.
3.5. Vulnerable Devices
3.6. Network
4. Experiments and Evaluations
4.1. Purpose
4.2. Experimental Methods
4.3. Evaluation Metric
4.4. Evaluation Results
4.5. Evaluation
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
Abbreviations
C&C | Command and Control |
ISP | Internet Service Provider |
IDS | Intrusion Detection System |
DDoS | Distributed Denial of Service |
BDS | Botnet Defense System |
IoT | Internet of Things |
OS | Operating System |
References
- Krebs, B. DDoS on Dyn Impacts Twitter, Spotify, Reddit—Krebs on Security. Available online: https://krebsonsecurity.com/2016/10/ddos-on-dyn-impacts-twitter-spotify-reddit/ (accessed on 28 July 2024).
- Gamblin, J. Mirai-Source-Code/ForumPost.txt at Master · Jgamblin/Mirai-Source-Code · GitHub. Available online: https://github.com/jgamblin/Mirai-Source-Code/blob/master/ForumPost.txt (accessed on 10 September 2024).
- Antonakakis, M.; April, T.; Bailey, M.; Bernhard, M.; Bursztein, E.; Cochran, J.; Durumeric, Z.; Halderman, J.A.; Invernizzi, L.; Kallitsis, M.; et al. Understanding the mirai botnet. In Proceedings of the 26th USENIX security symposium (USENIX Security 17), Vancouver, BC, Canada, 16–18 August 2017; pp. 1093–1110. [Google Scholar]
- Gamblin, J. GitHub—Jgamblin/Mirai-Source-Code: Leaked Mirai Source Code for Research/IoC Development Purposes. Available online: https://github.com/jgamblin/Mirai-Source-Code (accessed on 28 July 2024).
- Tang, L. GitHub—Lestertang/Mirai-Botnet-Source-Code: Mirai Botnet Source Code—For Research Purpose Only. Available online: https://github.com/lestertang/mirai-botnet-source-code (accessed on 28 July 2024).
- kulukami. GitHub—Kulukami/Build-a-Mirai-Botnet: Build a Mirai botnet from the Source Code. Available online: https://github.com/kulukami/Build-a-Mirai-botnet (accessed on 28 July 2024).
- Qrator. Blog—Mēris Botnet, Climbing to the Record. Available online: https://blog.qrator.net/en/meris-botnet-climbing-to-the-record_142/ (accessed on 28 July 2024).
- Statistica. IoT Connections Worldwide 2022–2033|Statista. Available online: https://www.statista.com/statistics/1183457/iot-connected-devices-worldwide/ (accessed on 28 July 2024).
- Yamaguchi, S. Botnet defense system: Concept, design, and basic strategy. Information 2020, 11, 516. [Google Scholar] [CrossRef]
- Nakahori, K.; Yamaguchi, S. A support tool to design IoT services with NuSMV. In Proceedings of the 2017 IEEE International Conference on Consumer Electronics (ICCE), Las Vegas, NV, USA, 8–10 January 2017; pp. 80–83. [Google Scholar]
- Bezerra, V.H.; da Costa, V.G.T.; Barbon Junior, S.; Miani, R.S.; Zarpelão, B.B. IoTDS: A one-class classification approach to detect botnets in Internet of Things devices. Sensors 2019, 19, 3188. [Google Scholar] [CrossRef] [PubMed]
- Mahboubi, A.; Camtepe, S.; Ansari, K. Stochastic modeling of IoT botnet spread: A short survey on mobile malware spread modeling. IEEE Access 2020, 8, 228818–228830. [Google Scholar] [CrossRef]
- Griffioen, H.; Doerr, C. Examining mirai’s battle over the internet of things. In Proceedings of the 2020 ACM SIGSAC Conference on Computer and Communications Security, Virtual Event, 9–13 November 2020; pp. 743–756. [Google Scholar]
- Çetin, O.; Ganán, C.; Altena, L.; Kasama, T.; Inoue, D.; Tamiya, K.; Tie, Y.; Yoshioka, K.; Van Eeten, M. Cleaning Up the Internet of Evil Things: Real-World Evidence on ISP and Consumer Efforts to Remove Mirai. In Proceedings of the NDSS, San Diego, CA, USA, 24–27 February 2019. [Google Scholar]
- McDermott, C.D.; Majdani, F.; Petrovski, A.V. Botnet detection in the internet of things using deep learning approaches. In Proceedings of the 2018 International Joint Conference on Neural Networks (IJCNN), Rio de Janeiro, Brazil, 8–13 July 2018; pp. 1–8. [Google Scholar]
- Sinanović, H.; Mrdovic, S. Analysis of Mirai malicious software. In Proceedings of the 2017 25th International Conference on Software, Telecommunications and Computer Networks (SoftCOM), Split, Croatia, 21–23 September 2017; pp. 1–5. [Google Scholar]
- Zhang, X.; Upton, O.; Beebe, N.L.; Choo, K.K.R. IoT Botnet Forensics: A Comprehensive Digital Forensic Case Study on Mirai Botnet Servers. Forensic Sci. Int. Digit. Investig. 2020, 32, 300926. [Google Scholar] [CrossRef]
- Hallman, R.; Bryan, J.; Palavicini, G.; Divita, J.; Romero-Mariona, J. IoDDoS-the internet of distributed denial of sevice attacks. In Proceedings of the 2nd International Conference on Internet of Things, Big Data and Security, Porto, Portugal, 24–26 April 2017; SCITEPRESS: Setúbal, Portugal, 2017; pp. 47–58. [Google Scholar]
- Fukushima, A. GitHub—Aoao4riri/Mirai. Available online: https://github.com/aoao4riri/mirai (accessed on 28 July 2024).
- EC-Council. Code of Ethics|EC-Council. Available online: https://www.eccouncil.org/code-of-ethics (accessed on 28 July 2024).
- OpenWrt. [OpenWrt Wiki] OpenWrt 23.05.0—First Stable Release—13 October 2023. Available online: https://openwrt.org/releases/23.05/notes-23.05.0 (accessed on 28 July 2024).
- OpenWrt. [OpenWrt Wiki] Enable Telnet Login with Password. Available online: https://openwrt.org/inbox/howto/telnet_enable (accessed on 28 July 2024).
- Gamblin, J. Mirai-Source-Code/Mirai/Bot/Scanner.c at Master · Jgamblin/Mirai-Source-Code · GitHub. Available online: https://github.com/jgamblin/Mirai-Source-Code/blob/master/mirai/bot/scanner.c#L124-L185 (accessed on 28 July 2024).
Features | Malicious Worms | White-Hat Worms |
---|---|---|
Primary infection to vulnerable devices | ✔ | ✔ |
Secondary infection to devices infected with a malicious worm | ✔ | |
Secondary infection to devices infected with a white-hat worm | ||
Lifespan features | ✔ | |
The number of devices discovered per attempt can be changed | ✔ |
Role | OS | IP Address |
---|---|---|
DNS and DHCP server | OpenWrt 23.05.0 | 192.168.0.1 |
C&C server for malicious botnet | Ubuntu 22.04.3 LTS | 192.168.0.3 |
Scan Listener and Loader for malicious botnet | Ubuntu 22.04.3 LTS | 192.168.0.4 |
Web server for malicious botnet | Ubuntu 22.04.3 LTS | 192.168.0.5 |
C&C server for white-hat botnet | Ubuntu 22.04.3 LTS | 192.168.0.13 |
Scan Listener and Loader for white-hat botnet | Ubuntu 22.04.3 LTS | 192.168.0.14 |
Web server for white-hat botnet | Ubuntu 22.04.3 LTS | 192.168.0.15 |
Vulnerable device (in this study, we used 10 or 30 devices) | OpenWrt 23.05.0 | 192.168.0.∗ (“∗” means IP addresses for vulnerable devices are randomly assigned by DHCP server) |
✔✔ | |||
✔✔ | ✔✔ | ||
✔ | ✔✔ | ✔✔ |
✔ | |||
✔✔ | ✔✔ | ||
✔ | ✔✔ |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Yamamoto, Y.; Fukushima, A.; Yamaguchi, S. Implementation of White-Hat Worms Using Mirai Source Code and Its Optimization through Parameter Tuning. Future Internet 2024, 16, 336. https://doi.org/10.3390/fi16090336
Yamamoto Y, Fukushima A, Yamaguchi S. Implementation of White-Hat Worms Using Mirai Source Code and Its Optimization through Parameter Tuning. Future Internet. 2024; 16(9):336. https://doi.org/10.3390/fi16090336
Chicago/Turabian StyleYamamoto, Yudai, Aoi Fukushima, and Shingo Yamaguchi. 2024. "Implementation of White-Hat Worms Using Mirai Source Code and Its Optimization through Parameter Tuning" Future Internet 16, no. 9: 336. https://doi.org/10.3390/fi16090336
APA StyleYamamoto, Y., Fukushima, A., & Yamaguchi, S. (2024). Implementation of White-Hat Worms Using Mirai Source Code and Its Optimization through Parameter Tuning. Future Internet, 16(9), 336. https://doi.org/10.3390/fi16090336