let’s make malware but it might get caught so the malware gets worse ☣️
Alex
BSides Canberra VIII (2025) · Day 3 · Main Track
Overview
In this highly engaging and often humorous talk titled "let’s make malware but it might get caught so the malware gets worse ☣️," Alex, known professionally as "Alex" in double quotes, dissects the iterative and increasingly complex nature of modern malware development, particularly from the perspective of an adversary emulation specialist or red teamer. The presentation goes beyond the initial compromise, delving into the sophisticated techniques required to maintain access, evade detection, and prevent attribution in a persistent and resilient manner.

Key moments
- 0:00 Introduction and personal anecdotes (Alex in double quotes)
- 2:40 Malware defined as remote control via Command and Control (C2)
- 9:00 Achieving persistence: hiding malware in .zprofile
- 11:30 Evading attribution with redirect infrastructure and offshore hosting
- 16:00 Advanced evasion: staged payloads and unique user agents
- 18:00 Remaining malware challenges and the 'AI' solution
- 18:50 Q&A: Naming malware and the 'double bluff' strategy
let’s make malware but it might get caught so the malware gets worse ☣️
Speakers: Alex
Conference: BSides Canberra
YouTube: https://www.youtube.com/watch?v=YqSDB7wuTsU
Overview
In this highly engaging and often humorous talk titled "let’s make malware but it might get caught so the malware gets worse ☣️," Alex, known professionally as "Alex" in double quotes, dissects the iterative and increasingly complex nature of modern malware development, particularly from the perspective of an adversary emulation specialist or red teamer. The presentation goes beyond the initial compromise, delving into the sophisticated techniques required to maintain access, evade detection, and prevent attribution in a persistent and resilient manner.
Alex guides the audience through a journey of escalating defensive countermeasures and the corresponding offensive adaptations, illustrating how each defensive layer forces attackers to refine their methods. From basic persistence mechanisms to advanced Command and Control (C2) infrastructure and staged payload design, the talk systematically breaks down the thought process behind crafting "better" malware – malware that is harder to catch, harder to attribute, and more effective for long-term operations. This detailed exploration is crucial for both aspiring offensive security professionals and defensive teams seeking to understand the mindset and methodologies of sophisticated adversaries.
The core message underscores a fundamental truth in cybersecurity: the constant cat-and-mouse game between attackers and defenders drives innovation on both sides. Alex's insights, drawn from his extensive red teaming experience, highlight the operational security (OPSEC) considerations that differentiate a successful, stealthy operation from one quickly uncovered. By demonstrating the evolution of malware from a simple binary to a multi-layered, evasive threat, the talk provides invaluable context for understanding contemporary cyberattacks and building more robust defenses.
Background
▶ Watch: Introduction and personal anecdotes (Alex in double quotes) (0:00)
The talk begins by defining malware not as a mystical, impenetrable entity, but as essentially remote control software that grants an attacker SSH-like access to a target's computer. The speaker emphasizes that while some may use such tools for cybercrime, his focus is on adversary emulation—simulating real-world threats to test an organization's defenses. The initial premise is deceptively simple: steal an SSH key, or gain remote access. However, as Alex quickly demonstrates, the initial, straightforward approaches are trivially thwarted.
A direct SSH connection to a target is rarely feasible due to network configurations. This necessitates a Command and Control (C2) server, an external server that the malware communicates with, acting as an intermediary between the operator and the compromised machine. Instead of writing custom malware from scratch, which is easily attributable, attackers often leverage existing, publicly available malware frameworks. Alex introduces Sliver as an example, describing it as similar to Metasploit but without the exploits, capable of generating custom malware binaries.
The initial challenge, after crafting the malware, is execution. Alex humorously (and somewhat sardonically) suggests social engineering as the primary method for getting a user to run the binary, implying that simplicity often wins. However, even once executed, the "malware" in its basic form is highly fragile. It runs as a child process of the terminal, meaning a simple Ctrl+C or closing the terminal window immediately terminates the malicious activity. This sets the stage for the talk's central theme: how to make malware more resilient, stealthy, and persistent in the face of detection and user actions.
Key Findings
▶ Watch: Achieving persistence: hiding malware in .zprofile (9:00)
The talk systematically uncovers several critical findings regarding the development and deployment of effective malware for adversary emulation:
- Initial Malware is Fragile and Easily Detected: A simple binary generated by a framework, when executed in a terminal, is vulnerable to basic user actions like Ctrl+C or closing the terminal. Its direct communication to a single C2 server is an immediate indicator of compromise.
- Persistence is Non-Negotiable: To maintain access beyond a single execution or system restart, persistence mechanisms are essential. Techniques like detaching processes from their parent shell (
disown) and modifying startup scripts (.zprofile) are introduced as fundamental steps. - Attribution is a Major OPSEC Risk: Using a single, identifiable C2 domain or the same malware binary across multiple targets creates a direct link between compromises. Incident response teams can quickly pivot from one compromised machine to discover all others associated with the same infrastructure or signature.
- Redirect Infrastructure is Vital for Evasion: To combat attribution, sophisticated operations require redirect infrastructure. This involves using multiple HTTP reverse proxies between the malware and the actual C2 server, each with a unique, legitimate-looking domain. This compartmentalizes compromises and makes correlation difficult.
- Unique Payloads Prevent Fingerprinting: Beyond unique domains, generating entirely new malware binaries (and ideally using different malware frameworks) for each target or redirector prevents defenders from using file hashes or signatures to identify related compromises.
- Staged Payloads Protect the Final Implant: Publicly hosting the final payload on a web server is an OPSEC failure. Staged payload design involves an initial, smaller stager that downloads the full malware payload only after specific conditions are met. This prevents security researchers or incident responders from easily obtaining and analyzing the full implant.
- Sophisticated Evasion Requires Layering: True stealth and resilience demand multiple layers of evasion, including custom HTTP headers (e.g., a unique User-Agent string to serve the real payload only to the stager), obfuscation, SOCKS proxy integration, in-memory execution, and leveraging legitimate cloud services for hosting.
Technical Deep Dive
▶ Watch: Evading attribution with redirect infrastructure and offshore hosting (11:30)
Alex's talk transitions from conceptual challenges to specific technical solutions, detailing the evolution of malware from a basic shell to an advanced, evasive implant.
Command and Control (C2) Architecture
The foundational requirement is a C2 server. Initially, the speaker proposes a simple client-server model: the malware on the victim's machine communicates with a server on the internet, sending command outputs and receiving new commands. The operator then interacts with this same server to issue commands and retrieve results. This centralizes control but also creates a single point of failure and detection. The talk uses Sliver, a malware framework described as similar to Metasploit but focusing on post-exploitation capabilities rather than initial exploits, as an example tool for generating the initial malware binary. Slivers' command-line interface allows specifying C2 parameters like HTTPS communication and target domain, outputting a ready-to-deploy executable.
Persistence - Detaching from the Terminal
The first major challenge addressed is the fragility of the initial malware execution. When run from a terminal, the malware is a child process of the shell (e.g., bash). If the user presses Ctrl+C or closes the terminal, the child process is terminated.
The proposed solution is the disown command in Bash. By running malware_binary & disown, the malware is backgrounded and then explicitly detached from its parent shell. This means even if the parent terminal process exits, the malware continues to run in the background. Alex notes a potential detection artifact: the detached process might show a parent process ID (PPID) of -1 or 1 (init/systemd), which can be suspicious. To suppress the "awkward number" (job ID and process ID) printed to the terminal, Alex suggests redirecting standard output and standard error to /dev/null (e.g., malware_binary >/dev/null 2>&1 & disown).
Persistence - System Restart
Even with disown, the malware doesn't survive a system restart. To achieve persistence across reboots, the malware needs to be configured to execute automatically. Alex proposes modifying shell profile files, specifically .zprofile (or .bashrc, .profile), which are executed whenever a new terminal session is opened.
Simply inserting the malware command directly into .zprofile is obvious and easily detected. A more stealthy approach involves mimicking legitimate software behavior. Alex points to the NVM (Node Version Manager) installer, which inserts a source command into .zprofile to load another script. The attacker can emulate this, inserting a seemingly innocuous source command that points to another file containing the actual malware execution command. This creates a layer of indirection, making the malicious entry less conspicuous during casual inspection of the .zprofile. A caveat is raised: this method could lead to multiple instances of the malware running if the user frequently opens new terminals; proper malware should include checks (e.g., a lock file) to prevent this.
Attribution and Evasion - Redirect Infrastructure
A significant OPSEC flaw is having all malware implants communicate with a single, identifiable C2 domain (e.g., crimecentral.com). If one compromise is detected, all others using that domain can be immediately identified.
The solution is redirect infrastructure. This involves deploying multiple intermediary servers—HTTP reverse proxies—between the malware and the actual C2 server. Each target's malware communicates with a unique redirector, which then forwards traffic to the true C2. These redirectors are hosted on diverse, often less scrutinized, infrastructure. Alex jokingly suggests using "extremely reputable offshore hosting providers" (like "DMCA ignored offshore hosting Moldover" or "Alex Host"), highlighting the preference for providers less likely to cooperate with law enforcement or security researchers. By using different domain names and hosting providers for each redirector, the compromise of one redirector does not immediately reveal other active operations or the central C2.
Attribution and Evasion - Unique Binaries
Even with redirectors, if all malware implants are the exact same binary, defenders can still pivot by using file hashes or signatures.
The countermeasure is to generate a unique malware payload for each target and corresponding redirector. Ideally, attackers might even cycle through different malware frameworks to further diversify their footprint and make it harder for incident response teams to correlate attacks based on framework-specific signatures. This ensures that even if one implant is fully analyzed, its characteristics don't directly expose other, unrelated compromises.
Attribution and Evasion - Staged Payload Design
A final, crucial OPSEC consideration is how the malware is initially delivered. Publicly hosting the final malware binary (the "final payload") on a GitHub page or a simple web server makes it accessible to anyone, including security researchers.
Staged payload design addresses this. Instead of a direct download of the final payload, the initial delivery (e.g., via social engineering) is a small, benign-looking program called a stager. This stager then executes on the target machine and only then attempts to download the full malware payload from a separate "malware hosting server."
To further enhance stealth, the stager can incorporate specific checks. Alex proposes a custom User-Agent header in the HTTP request made by the stager (e.g., Python-urllib/230.1). This unique User-Agent (which does not correspond to any known Python requests version) allows the malware hosting server to differentiate between legitimate stager requests and arbitrary requests from browsers or security tools. Only requests with the correct User-Agent receive the actual malware payload; other requests might receive a benign file (e.g., a Fortnite installer) or nothing at all. This "paranoid" approach prevents unauthorized access to the final payload, protecting the attacker's tools and infrastructure from premature analysis.
Demo / Proof of Concept
▶ Watch: Remaining malware challenges and the 'AI' solution (18:00)
The talk primarily presented theoretical concepts and command-line examples rather than a live demonstration of functional malware. Alex walked through hypothetical scenarios, showing snippets of commands like ssh, disown, and modifications to .zprofile files. He illustrated the architecture of C2 and redirect infrastructure with diagrams. While no actual code execution or live malware building was shown, the detailed explanations and illustrative examples served effectively as a conceptual proof of concept for the techniques discussed.
Defensive Implications
▶ Watch: Q&A: Naming malware and the 'double bluff' strategy (18:50)
The intricate techniques discussed by Alex offer crucial insights for defenders looking to strengthen their security posture against sophisticated adversaries.
- Enhanced Endpoint Detection and Response (EDR): Defenders must move beyond signature-based detection. EDR solutions should monitor for anomalous process behavior, such as processes detaching from their parent shell (e.g., using
disownor similar system calls), or processes with a PPID of1that are not expected system services. Look for unusual command-line arguments or redirections to/dev/null. - Scrutiny of Startup Files and Persistence Mechanisms: Regularly audit common user startup files like
.zprofile,.bashrc,.profile, and system-wide equivalents. Look for newly addedsourcecommands, especially those pointing to obscure or newly created files. Be suspicious of legitimate-looking entries (e.g., mimickingNVM) that might be attempting to mask malicious activity. Advanced persistence techniques leveraging JXA (JavaScript for Automation) on macOS or Electron app modifications should also be considered in threat models. - Advanced Network Traffic Analysis: Implement robust network monitoring to detect suspicious C2 communication. Recognize that adversaries use redirect infrastructure and diverse domains. Focus on behavioral anomalies:
- Domain Reputation: While adversaries use "normal" domains, look for newly registered domains, domains with short lifespans, or those associated with known offshore hosting providers or bulletproof hosting.
- User-Agent Analysis: Monitor for unusual or non-standard User-Agent strings in HTTP requests. The
Python-urllib/230.1example highlights that custom, non-existent User-Agents can be a strong indicator of malicious stager activity. - Traffic Patterns: Look for low-and-slow beaconing, unusual ports, or encrypted traffic to unknown destinations.
- Threat Intelligence and Attribution Awareness: Understand that finding a single malware binary or C2 domain might be just the tip of the iceberg. Adversaries actively work to prevent attribution by using unique binaries, multiple frameworks, and layered infrastructure. Incident response efforts should assume that a detected compromise might be linked to others through subtle, non-obvious means.
- Memory Forensics and In-Memory Execution Detection: As adversaries increasingly aim for in-memory execution to bypass disk-based antivirus, defenders need capabilities for live memory analysis and detection of injected code or malicious processes running solely in memory.
- Robust Social Engineering Training: Since the initial execution often relies on social engineering, continuous and updated user training remains a critical defensive layer. Educate users about phishing, malicious downloads, and suspicious links.
- Layered Security Approach: No single defense is sufficient. A comprehensive strategy includes strong endpoint protection (EDR, AV), network security (firewalls, IDS/IPS, proxy), robust identity and access management, regular patching, and continuous security awareness training. The goal is to make the attacker's job "worse" at every stage, increasing their cost and risk.
Key Takeaways
- Malware development is an iterative game of evasion: Each defensive measure prompts adversaries to develop more sophisticated, layered techniques to maintain access and stealth.
- Basic malware is easily detected and attributed: Simple C2 and direct execution are quickly shut down; advanced operations require significant OPSEC.
- Persistence is paramount for long-term access: Mechanisms like
disownand modifying startup files (.zprofile) are fundamental to surviving user actions and system restarts. - Sophisticated operations demand robust attribution avoidance: This includes using redirect infrastructure with diverse domains and unique malware binaries for each target.
- Staged payloads protect the final implant: An initial stager that downloads the full payload only under specific, custom conditions (e.g., a unique User-Agent) is crucial to prevent premature analysis by defenders.
- Defenders must understand offensive evolution: To build effective defenses, security teams need to grasp the full spectrum of adversary techniques, from initial compromise to advanced persistence and evasion.
About the Speaker(s)
The speaker, Alex, introduces himself as "Alex" in double quotes, a moniker he adopted after journalists referred to him as a "hacker who goes by the name Alex in double quotes" following an incident where he discovered former Australian Prime Minister Tony Abbott's passport and phone number on a Qantas Advantage booking page without getting arrested. Professionally, Alex has a background in red teaming, having worked at various organizations including Atlassian. He is now engaged in a new business venture called Mango PDF communication, where he teaches hackers how to communicate effectively in professional settings. Alex positions himself as a "professional communicator," leveraging his experience to convey complex technical topics in an engaging and understandable manner.