December is here, and this year it feels different—it's my first December with my newfound interest in cybersecurity. To broaden my understanding of the various fields, I took on TryHackMe's 'Advent of Cyber' - 24 days of Christmas-themed CTFs on:
Below are some of my thoughts and learnings from this event.
Learning Objectives: Understanding natural language processing, prompt injection attacks, and defense mechanisms.
I explored how AI chatbots function through natural language processing (NLP) and identified the vulnerabilities they face, particularly prompt injection attacks. These attacks manipulate the chatbot’s responses by inserting specific queries. To defend against such vulnerabilities, I learned about using well-constructed system prompts and implementing AI-assisted interceptors to prevent malicious inputs.
Learning Objectives: Introduction to data science in cybersecurity, and key libraries like Pandas and Matplotlib.
This challenge focused on applying data science principles to cybersecurity tasks. I worked with Python and learned to use Pandas for data manipulation and Matplotlib for data visualization. By analysing log data, I gained insights into network activities and identified potential security threats.
Learning Objectives: Understanding password complexity, generating password combinations with Crunch, and using Hydra for brute-force attacks.
The third day’s challenge delved into password security. I learned how the complexity of passwords impacts the feasibility of brute-force attacks. Using tools like Crunch to generate password lists and Hydra to automate the brute-forcing process, I gained practical experience in testing the strength of passwords and understanding the importance of robust password policies.
Learning Objectives: Understanding CeWL, its capabilities, and how to leverage it for generating custom wordlists.
CeWL, a tool that spiders websites to generate wordlists based on their content, was the focus. I learned to create tailored wordlists for brute-forcing login pages or uncovering hidden directories by extracting words from a site's HTML, URLs, and content. By using CeWL and wfuzz together, I was able to successfully brute-force a login portal and understand the power of context-specific wordlists in penetration testing.
Learning Objectives: Navigating legacy systems, understanding DOS, and learning about file signatures and magic bytes.
I delved into the Disk Operating System (DOS) and its modern-day counterparts, the Windows Command Prompt and PowerShell. This challenge highlighted the importance of understanding file management, directory structures, and command syntax. I also learned about the significance of file signatures and magic bytes in data recovery and file system analysis, restoring a backup file by identifying and correcting its magic bytes.
Learning Objectives: Understanding memory safety in programming languages, buffer overflows, and exploiting memory corruption
I learned about the risks of memory corruption in certain programming languages, particularly how variables might overflow into adjacent memory and corrupt it. By exploiting a simple buffer overflow, I was able to manipulate memory directly, leading to unintended behavior in the application. This practical experience underscored the importance of secure coding practices to prevent such vulnerabilities.
Learning Objectives: Revisiting the importance of log files, understanding proxy logs, and building Linux command-line skills for log analysis.
This challenge focused on analysing proxy logs to uncover potential security incidents. I honed my Linux command-line skills, learning to use commands like cat, grep, cut, and sort to parse and analyse log entries. By identifying suspicious domains and extracting meaningful information from log files, I was able to pinpoint potential security threats and retrieve exfiltrated data.
Learning Objectives: Using FTK Imager to analyse and recover digital artifacts, verifying drive integrity, and understanding forensic analysis tools.
I delved into disk forensics using FTK Imager, a tool for acquiring and analysing computer data while preserving its integrity. I learned to navigate the user interface, preview file content, and recover deleted files. By analysing digital artifacts and verifying the integrity of evidence, I uncovered critical information such as the malware C2 server and hidden files, highlighting the importance of thorough forensic analysis in cybersecurity.
Learning Objectives: Safe malware analysis, .NET binaries, using dnSpy for decompilation, and building a methodology for source code analysis.
I analysed a malware sample in a sandbox environment to prevent harm. Using dnSpy, I decompiled the malware written in C# and examined its code. The malware communicated with a command and control (C2) server using HTTP requests to execute commands and report results. I identified key behaviors like sleeping, executing shell commands, and implanting binaries, and found the decryption key used for C2 data.
Learning Objectives: Identifying and exploiting SQL injection vulnerabilities, using stacked queries for remote code execution, and understanding PHP's role in web development.
I identified SQL injection vulnerabilities in a PHP-based web application. By using stacked queries, I enabled the xp_cmdshell stored procedure on the SQL Server, allowing for remote code execution. I downloaded a reverse shell payload using certutil.exe and established a connection back to my system. After gaining control of the server, I restored the defaced website and retrieved several flags.
Learning Objectives: Understanding Active Directory (AD), Windows Hello for Business (WHfB), exploiting GenericWrite privileges, and conducting a Shadow Credentials attack
I explored Active Directory, a centralised authentication system used in Windows environments, and learned how WHfB replaces passwords with cryptographic keys. To exploit the GenericWrite privilege, I identified write capabilities using PowerView and used Whisker to simulate device enrollment, updating the msDS-KeyCredentialLink. With Rubeus, I obtained a TGT and NTLM hash for the vulnerable user, and used Evil-WinRM for a pass-the-hash attack, gaining access to the Administrator’s desktop.
Learning Objectives: Defence in Depth, endpoint hardening, and a simple Boot2Root methodology.
In this challenge, I addressed poor security practices where a server was vulnerable by design. Here’s how I elevated privileges and secured the system:
Exploitation steps:Learning Objectives: Incident analysis through the Diamond Model, defensive strategies, firewall rules, and honeypot setup.
In this challenge, I learned to use the Diamond Model for security analysis, which includes Adversary, Victim, Infrastructure, and Capability. I applied defensive strategies such as threat hunting and vulnerability management to strengthen the organization's security posture.
Defensive Infrastructure:Learning Objectives: Understanding machine learning, basic structures and algorithms, and using neural networks to predict defective toys.
In this challenge, I delved into machine learning (ML) and its various structures like genetic algorithms, particle swarm optimisation, and neural networks. I focused on neural networks, which mimic how neurons work in the brain and can be trained to provide correct transformations.
Application:Learning Objectives: Understanding the steps in a Machine Learning (ML) pipeline, ML classification and training models, dataset splitting, model preparation, and evaluation.
In this challenge, I helped build a spam email detector using Machine Learning. The process involved using a provided dataset for training and testing, as well as choosing the appropriate ML classification algorithm, identifying the important features that contribute to the model's decision making process for the task, and lastly evaluating the model's effectiveness against the dataset. In the end, I was able to identify 3 spam emails with one containing the flag.
Learning Objectives: Complex neural network structures, convolutional neural networks (CNNs), optical character recognition, and integrating neural networks into red team tooling.
In this challenge, I explored Convolutional Neural Networks (CNNs) and how they can be used for feature extraction and optical character recognition (OCR). By building a CAPTCHA-cracking CNN, I automated the process of solving CAPTCHAs by integrating the CNN into a brute force script.
Process:Learning Objectives: Understanding network traffic data formats, differences between full packet captures and network flows, processing network flow data, using the SiLK tool suite, and hands-on experience in network flow analysis.
In this challenge, I gained insights into network traffic analysis and learned to differentiate between full packet captures and network flows. I also explored the SiLK tool suite, which is essential for analysing network flows.
Key techniques and tools:Learning Objectives: Identifying CPU and memory usage in Linux, killing unwanted processes, finding persistence mechanisms, and permanently removing persistent processes.
In this challenge, I learned to identify and manage high CPU usage processes in Linux. Here's how I tackled a persistent process:
This successfully eradicated the persistent process, normalising CPU usage and eliminating the unwanted service.
Learning Objectives: Understanding memory forensics, volatile data, memory dumps, Volatility tool, and Volatility profiles.
In this challenge, I learned to perform memory forensics, which involves examining a computer's volatile memory (RAM) to uncover digital evidence.
Volatility toolVolatility is a command-line tool for analysing memory dumps, listing active and closed network connections, running processes, command line history, and extracting malicious processes.
AanalysisThis challenge provided me hands-on experience in analysing memory dumps and identifying potential indicators of compromise (IOCs).
Learning Objectives: Poisoned pipeline execution, securing CI/CD pipelines, secure software development lifecycles (SSDLC), and CI/CD best practices.
In this challenge, I learned about CI/CD (Continuous Integration and Continuous Delivery) and how to secure these pipelines to prevent attacks such as poisoned pipeline execution (PPE). DevSecOps integrates security into CI/CD, ensuring consistency and threat reduction throughout the software development lifecycle (SDLC).
InvestigationsLearning Objectives: Understanding larger CI/CD environments, exploring indirect poisoned pipeline execution (PPE), and applying CI/CD exploitation knowledge.
In this challenge, I learned about CI/CD environments and how indirect poisoned pipeline execution (PPE) can be used to exploit them. Jenkins, a local automation server, was the primary platform discussed for handling pipeline build segments. Remote platforms like Travis CI also serve similar purposes.
ExploitationLearning Objectives: Understanding server-side request forgery (SSRF), different types of SSRF, prerequisites for exploiting the vulnerability, attack mechanics, exploitation techniques, and mitigation measures.
In this challenge, I delved into SSRF, a vulnerability that allows attackers to trick web applications into making unauthorised requests to internal or external resources on the server's behalf.
ExploitationLearning Objectives: Basics of network file shares, NTLM authentication, NTLM authentication coercion attacks, using Responder for attacks, and forcing authentication coercion using lnk files.
In this challenge, I explored NTLM authentication and how attackers can perform authentication coercion attacks to uncover sensitive information.
ExploitationLearning Objectives: Collecting digital evidence, challenges with modern smartphones, and using Autopsy Digital Forensics with an actual Android image.
In this challenge, I explored digital forensics, focusing on collecting evidence from digital devices like smartphones.
AnalysisThis challenge provided me hands-on experience in collecting and analyzing digital evidence from smartphones using digital forensic tools.
Overall, I thoroughly enjoyed AOC2023 - it was my first Advent of Cyber/Code and I'm deeply proud of myself for embracing the challenges the TryHackMe team had crafted together. I definitely learned more than I anticipated and feel even more inspired to further dive into the rabbit hole of cybersecurity.