Red Team C2 Emulator
Project Design Purpose : The Red Team Command and Control (RTC2) server, commonly known as a C&C server, plays a pivotal role in cyber exercises and ranges. It serves as a centralized hub that red team members use to control and communicate with simulated compromised victims. This command center enables red team members or attackers to seamlessly issue instructions to the compromised machines, collect data from them, and coordinate various malicious activities within the exercise program. Our goal is to offer a comprehensive C2 server emulation solution designed for cyber exercise red team members. This solution allows them to seamlessly integrate different probing programs and malicious action programs, providing dynamic monitoring, scheduling, and control capabilities. The versatility of our solution makes it applicable across a range of fields, offering a robust platform for enhancing cyber defense readiness and testing the resilience of security measures.
The system can be applied on below fields :
Cyber Exercise Red Team Malicious C2 Servers Simulation
Defensive C2 Frameworks
The RTC2 ( red team command and control ) system will provide a multi-threading based client which users can easily hook the client into their malicious action program to integrate in the RTC2 system. The RTC2 server not only offers a robust back-end but also comes equipped with a user-friendly web interface and an HTTP request handler API. So the users to can remote control the integrated malware effortlessly—either through a web browser or their custom programs. This combination of adaptability and accessibility enhances the user experience, providing a versatile platform for managing and orchestrating their cyber exercise scenarios.
Introduction
Command and Control ( C2 ) servers are not inherently necessary or beneficial for legitimate and ethical purposes. However, there are situations in the realm of cybersecurity where the concept of command and control is used for defensive purposes, typically in the context of security operations and incident response. In these cases, organizations might employ C2 frameworks or systems to simulate the behavior of real-world attackers. These simulations help security professionals and organizations assess their ability to detect, respond to, and mitigate cyber threats. We want to provide a general "plug and play" red team C2 solution for :
The overview work flow of the RTC2 is shown below :
The RTC2 system contents two main parts RTC2 Hub Server and RTC2 Client :
Red Team C2 Hub Server Introduction
This web hosting program serves as a centralized control hub for managing various Red-Teaming- Malicious-Action-Programs and handling user requirements. The key functionalities include:
The Red-Teaming- Malicious-Action-Programs management page is shown below :
The Red-Teaming- Malicious-Action-Program's tasks management page is shown below :
RTC2 Client
The RTC2 client is a multi-threading based client which user can hook it to their Red-Teaming-Malicious-Action-Programs to communicate with the C2 Hub Server. The key functionalities include:
Program Design
We have used the Python-Flask framework to construct our web hosting platform, offering a robust foundation for users. The system provides a multi-threading API handling function, enabling concurrent utilization by multiple users to control multiple Red-Teaming-Malicious-Action-Program simultaneously. The system workflow is delineated below:
RTC2 Web Service API Design
The RTC2 Web Service offers three distinct HTTP/HTTPS APIs designed to accommodate various requests:
Data Manager Functionality
The Data Manager serves as the central "database," meticulously storing comprehensive information about each registered Malicious Action Program. This includes a unique malware ID, victim IP address, task details, and intricate information for every task—such as taskID, taskType, StartTime, task repeat times, wait time before execution, task config parameters, task state, and task result.
Upon red team members accessing the Red-Teaming-Malicious-Action-Program management web page, the Data Manager dynamically generates a malware state summary report. Furthermore, when navigating to the Red-Teaming-Malicious-Action-Program tasks page, the Data Manager retrieves and presents the malware's task summary report, enhancing visibility and control.
Upon the registration of a Malicious Action Program with the RTC2-Hub, the Data Manager receives and stores all re-configured task information. As an illustration, consider the example of a task where the Malicious Action Program is configured to upload a zipped file to the C2 server :
{
'taskID': 1,
'taskType': 'upload',
'StartT': None, # None means start immediatly if recevied
'repeat': 1, # how many times to repeat the task.
'ExPerT': 0, # time to wait before execution
'taskData': [os.path.join(dirpath, "update_installer.zip")]
}
Red-Teaming-Malicious-Action-Program Task Queue Manager
The Malware Task Queue Manager plays a crucial role in RTC2, ensuring synchronization between tasks and the associated Malicious Action Programs while handling user-initiated task adjustments. This guarantees that the task queue of each Malicious Action Program aligns seamlessly with the RTC2 database.
The following detailed steps outline the process when a user sets a task to request the C2 to upload a file:
For each task displayed on the tasks dashboard, it will be under below five states :
领英推荐
Usage Example
Upload File to RTC2-Hub Storage from Red Team User Local Machine
Via HTTP POST request :
https://<RTC2-Hub ip address >:<port>/fileupload, files={'file': (<filename>, fh.read())}
Download File From RTC2-Hub Storage to Red Team User Local Machine
Via HTTP POST request :
https://<RTC2-Hub ip address >:<port>/filedownload, json={"filename": filename}
Assign Command Execution Task to Malicious-Action-Program
When the task finished, the command execution result will be shown in the Last Report Log area.
https://<RTC2-Hub ip address >:<port>/addcommand, json={"malwareID": <ID>, "commandData": <commandstr> }
Copy File From the C=Victim Machine to RTC2-Hub
Then the specified file will be uploaded via C2-client to the C2Hub's upload folder.
https://<RTC2-Hub ip address >:<port>/addfilecopy, json={"malwareID": <ID>, "filepath": <filepath in victim machine> }
Inject file from C2 to target victim machine
The the specified file will be download to the victim machine via C2-client's configured download folder.
https://<RTC2-Hub ip address >:<port>/addfileinject, json={"malwareID": <ID>, "filename": <file name need to inject to victim> }
Assign Special Task to Malicious-Action-Program
The task json contents will follow the task define json format as below example :
{
'taskID': 1,
'taskType': 'upload',
'StartT': None,
'repeat': 1,
'ExPerT': 0,
'taskData': [os.path.join(dirpath, "update_installer.zip")]
}
Via HTTP POST request :
https://<RTC2-Hub ip address >:<port>/addnewtask, json={"malwareID": <ID>, "taskdata": <task detail infomration json data> }
Program Setup and Usage
To check the source code , please refer to link:
https://github.com/LiuYuancheng/Python_Malwares_Repo/tree/main/src/c2Emulator
license type :
MIT License