# Half-drunk Review of Mirai Malware

Source: https://www.youtube.com/watch?v=fwbzXTBGrCg
Recap page: https://rapidrecap.app/video/fwbzXTBGrCg
Generated: 2025-12-06T00:04:28.828+00:00

---
## Quick Overview

The Mirai malware source code, leaked in 2016, is described as extremely simple, lacking sophisticated security features like encryption or proper data structure separation, which allowed it to easily compromise IoT devices for DDoS attacks, contrasting sharply with modern malware complexity.

**Key Points:**
- The Mirai malware source code, leaked around 2016, is extremely simple, using basic C and Go programming constructs without advanced security measures.
- The Go source code reveals hardcoded database credentials (e.g., 'root'/'root'/'mirai') and uses an unencrypted MySQL connection string.
- The C source code in the 'bot' directory shows basic attack functions (UDP, SYN, GRE, etc.) being registered without obfuscation.
- The author notes that the malware's simplicity (e.g., using hardcoded credentials and no encryption) made it easy to understand but also allowed it to scale quickly, infecting tens of millions of devices.
- The simplicity extends to the database structure (e.g., 'db' struct in 'database.go' only has a 'val' field) and the lack of complex logic, such as checking for existing agents or using proper encryption for credentials.
- The scanner component in 'scanner.c' uses hardcoded default ports (like 23 for Telnet) and relies on simple brute-forcing of credentials.
- The speaker argues that modern malware development, even by security companies, is significantly more complex, suggesting Mirai's approach is now obsolete for avoiding detection.

![Screenshot at 00:15: The presenter begins discussing the core concept of the malware, referring to the desire to create something 'eternal' that avoids detection, setting the stage for the code review.](https://ss.rapidrecap.app/screens/fwbzXTBGrCg/00-00-15.png)

**Context:** The video provides a high-level review and code walkthrough of the leaked Mirai botnet source code, which gained notoriety for weaponizing insecure IoT devices to launch massive DDoS attacks starting around 2016. The presenter, a self-described computer nerd, examines the source code files, primarily written in C and Go, to illustrate how rudimentary the malware's structure and security practices were compared to contemporary malicious software.

## Detailed Analysis

The video analyzes the source code of the Mirai botnet, highlighting its relative simplicity compared to modern malware. The presenter first looks at the Go source code in the 'c2' directory, noting hardcoded credentials in 'database.go' (like 'root'/'root'/'mirai' for the database) and the direct use of an unencrypted MySQL driver string, demonstrating poor security practices from the start. The logic in 'main.go' is shown to simply spawn goroutines to handle incoming connections. The analysis then shifts to the C source code found in the 'bot' directory, specifically in 'attack.c', which lists numerous hardcoded attack functions (like UDP, SYN, DNS, HTTP floods) that are registered sequentially. The presenter points out that this lack of complexity and obfuscation, combined with the malware's ability to exploit default credentials on IoT devices (as seen in 'scanner.c'), contributed to its massive scale. The speaker concludes that while effective at the time, this simplicity is why Mirai is now considered outdated, as modern defenses and malware development techniques (like complex encryption and better threat modeling) have advanced significantly.

### Mirai Source Code Overview

- The malware is written in C (for the bot) and Go (for the C2 server), leveraging standard libraries like Go's built-in networking tools.

### Database Interaction (database.go)

- Hardcoded MySQL credentials ('root'/'root'/'mirai') are present, indicating a lack of secure configuration practices; SQL queries for login and user creation are visible and vulnerable to SQL injection if not handled correctly.

### C2 Logic (main.go)

- The Go code primarily focuses on setting up listeners and spawning goroutines to handle incoming C2 connections, showing a basic, non-resilient command structure.

### Attack Functions (attack.c)

- The core DDoS functionality is defined by registering numerous attack types (UDP, SYN, etc.) through simple function calls within the 'attack_init' function.

### Scanner Logic (scanner.c)

- The scanning mechanism uses hardcoded default Telnet ports (like 23) and relies on simple, non-obfuscated brute-forcing techniques against these default credentials.

### Code Quality

- The presenter criticizes the code for lacking modern security features like encryption for credentials and complex logic, noting that much of the structure is simple C code that doesn't require modern advanced tools to analyze.

![Screenshot at 00:06: Presenter pointing out the embedded hardcoded database credentials in 'database.go' \(e.g., 'root'/'root'/'mirai'\) visible in the Go source code.](https://ss.rapidrecap.app/screens/fwbzXTBGrCg/00-00-06.png)
![Screenshot at 01:22: Code view of 'attack.c' showing a long list of hardcoded attack functions being registered sequentially, illustrating the basic structure of the DDoS payload.](https://ss.rapidrecap.app/screens/fwbzXTBGrCg/00-01-22.png)
![Screenshot at 07:53: The presenter navigates to the 'database.go' file, highlighting the Go code responsible for database initialization and connection.](https://ss.rapidrecap.app/screens/fwbzXTBGrCg/00-07-53.png)
![Screenshot at 14:12: Close-up on the 'database.go' file showing the hardcoded database connection string using a non-standard MySQL driver.](https://ss.rapidrecap.app/screens/fwbzXTBGrCg/00-14-12.png)
![Screenshot at 25:25: The 'scanner.c' file is displayed, showing the hardcoded list of default Telnet credentials used for brute-forcing.](https://ss.rapidrecap.app/screens/fwbzXTBGrCg/00-25-25.png)
