# Methodology

## <mark style="color:yellow;">**Pre-engagement (Planning)**</mark>

<mark style="color:red;">**Objective:**</mark> Establish clear rules and goals with the client.

* <mark style="color:red;">**What to do**</mark><mark style="color:red;">:</mark> Define the scope of the engagement (e.g., which systems or networks are in scope). Agree on legal boundaries and expectations.
* <mark style="color:red;">**Tools/Techniques**</mark><mark style="color:red;">:</mark> Legal contracts, Rules of Engagement (RoE) documents.
* <mark style="color:red;">**Outcome**</mark>: Clear understanding of what to test and which attack simulations are permitted.

## <mark style="color:yellow;">**Information Gathering (Reconnaissance)**</mark>

<mark style="color:red;">**Objective:**</mark> Collect as much information as possible about the target without interacting with it directly (passive) or by scanning (active).

* <mark style="color:red;">**What to do**</mark><mark style="color:red;">:</mark>
  * <mark style="color:purple;">**Passive reconnaissance:**</mark> Search for open-source information (OSINT) such as domain names, email addresses, and IP ranges.
  * <mark style="color:purple;">**Active reconnaissance:**</mark> Scan for open ports, services, and vulnerable applications.
* <mark style="color:red;">**Tools/Techniques**</mark><mark style="color:red;">:</mark>
  * <mark style="color:purple;">**Passive:**</mark> Google dorking, WHOIS lookup, Shodan, theHarvester.
  * <mark style="color:purple;">**Active:**</mark> Nmap, Masscan, banner grabbing.
* <mark style="color:red;">**MITRE ATT\&CK Mapping**</mark><mark style="color:red;">:</mark> *Reconnaissance (T1595)*, *Initial Access (T1078)*.

## <mark style="color:yellow;">**Vulnerability Assessment**</mark>

<mark style="color:red;">**Objective**</mark>: Identify vulnerabilities within the target systems using automated and manual techniques.

* <mark style="color:red;">**What to do**</mark><mark style="color:red;">:</mark> Scan the network and systems for known vulnerabilities, misconfigurations, or weak services.
* <mark style="color:red;">**Tools/Techniques**</mark><mark style="color:red;">:</mark>
  * <mark style="color:purple;">**Automated Scanners**</mark><mark style="color:purple;">:</mark> Nessus, OpenVAS, Qualys.
  * <mark style="color:purple;">**Manual Techniques**</mark><mark style="color:purple;">:</mark> Burp Suite for web applications, Nikto, manual code review, misconfiguration checks (e.g., missing patches, weak encryption).
* <mark style="color:red;">**Outcome**</mark>: A list of vulnerabilities and potential attack vectors.
* <mark style="color:red;">**MITRE ATT\&CK Mapping**</mark>: *Discovery (T1083)*, *Network Service Scanning (T1046)*.

## <mark style="color:yellow;">**Exploitation**</mark>

<mark style="color:red;">**Objective**</mark><mark style="color:red;">:</mark> Exploit identified vulnerabilities to gain access to the system.

* <mark style="color:red;">**What to do**</mark>: Use the vulnerabilities identified in the previous step to break into the system.
* <mark style="color:red;">**Tools/Techniques**</mark><mark style="color:red;">:</mark>
  * <mark style="color:purple;">**Exploit Frameworks**</mark><mark style="color:purple;">:</mark> Metasploit, ExploitDB, custom scripts.
  * <mark style="color:purple;">**Web Exploits**</mark><mark style="color:purple;">:</mark> SQL Injection, Command Injection, Cross-Site Scripting (XSS), Remote Code Execution (RCE).
* <mark style="color:red;">**Outcome**</mark><mark style="color:red;">:</mark> Initial access to the target system.
* <mark style="color:red;">**MITRE ATT\&CK Mapping**</mark><mark style="color:red;">:</mark> *Execution (T1203)*, *Exploitation for Client Execution (T1203)*.

## <mark style="color:yellow;">**Post-Exploitation**</mark>

<mark style="color:red;">**Objective**</mark><mark style="color:red;">:</mark> Gather useful information, maintain persistence, and expand control over the compromised environment.

* <mark style="color:red;">**What to do**</mark><mark style="color:red;">:</mark>
  * <mark style="color:purple;">**Data Collection**</mark><mark style="color:purple;">:</mark> Extract sensitive data like passwords, tokens, or database content.
  * <mark style="color:purple;">**Persistence**</mark><mark style="color:purple;">:</mark> Install backdoors or create new user accounts to maintain access.
  * <mark style="color:purple;">**Stealth**</mark><mark style="color:purple;">:</mark> Cover tracks by cleaning up logs or using anti-forensics techniques.
* <mark style="color:red;">**Tools/Techniques**</mark><mark style="color:red;">:</mark>
  * <mark style="color:purple;">**Password Dumping**</mark><mark style="color:purple;">:</mark> Mimikatz, Windows Credential Manager, hash dumping.
  * <mark style="color:purple;">**Maintaining Persistence**</mark><mark style="color:purple;">:</mark> Creating cron jobs, modifying Windows Registry, SSH backdoors.
  * <mark style="color:purple;">**Log Manipulation**</mark><mark style="color:purple;">:</mark> Clearing logs or tampering with forensic evidence.
* <mark style="color:red;">**Outcome**</mark><mark style="color:red;">:</mark> Expanded control over the compromised system and preparation for further exploitation.
* <mark style="color:red;">**MITRE ATT\&CK Mapping**</mark><mark style="color:red;">:</mark> *Persistence (T1547)*, *Collection (T1114)*, *Defense Evasion (T1070)*.

## <mark style="color:yellow;">**Lateral Movement**</mark>

<mark style="color:red;">**Objective**</mark><mark style="color:red;">:</mark> Move from the initial compromised system to other systems within the network.

* <mark style="color:red;">**What to do**</mark><mark style="color:red;">:</mark> Use compromised credentials, session hijacking, or pivoting techniques to access other internal systems.
* <mark style="color:red;">**Tools/Techniques**</mark><mark style="color:red;">:</mark>
  * <mark style="color:purple;">**Credential Reuse**</mark><mark style="color:purple;">:</mark> Using passwords or tokens obtained from one machine to access others.
  * <mark style="color:purple;">**Pivoting**</mark><mark style="color:purple;">:</mark> Use compromised machine as a gateway to explore further systems (Metasploit, proxychains).
  * <mark style="color:purple;">**SMB Exploits**</mark><mark style="color:purple;">:</mark> Pass-the-Hash, exploiting SMB/RDP services (e.g., PsExec).
* <mark style="color:red;">**Outcome**</mark><mark style="color:red;">:</mark> Gaining control of additional systems in the network.
* <mark style="color:red;">**MITRE ATT\&CK Mapping**</mark><mark style="color:red;">:</mark> *Lateral Movement (T1021)*, *Pass-the-Hash (T1550)*, *Exploitation of Remote Services (T1210)*.

## <mark style="color:yellow;">**Privilege Escalation**</mark>

<mark style="color:red;">**Objective**</mark><mark style="color:red;">:</mark> Gain higher-level privileges, such as root or system administrator, on the compromised machine.

* <mark style="color:red;">**What to do**</mark><mark style="color:red;">:</mark> Exploit kernel vulnerabilities, misconfigurations, or use tools to escalate privileges.
* <mark style="color:red;">**Tools/Techniques**</mark><mark style="color:red;">:</mark>
  * <mark style="color:purple;">**Linux Privilege Escalation**</mark><mark style="color:purple;">:</mark> Exploiting SUID binaries, kernel exploits (e.g., Dirty Cow), checking for weak sudo permissions.
  * <mark style="color:purple;">**Windows Privilege Escalation**</mark><mark style="color:purple;">:</mark> Windows UAC bypass, token manipulation, exploiting vulnerable services like **PrintNightmare**.
* <mark style="color:red;">**Outcome**</mark><mark style="color:red;">:</mark> Elevated privileges on the compromised system.
* <mark style="color:red;">**MITRE ATT\&CK Mapping**</mark><mark style="color:red;">:</mark> *Privilege Escalation (T1068)*, *Exploitation for Privilege Escalation (T1068)*.

## <mark style="color:yellow;">**Proof-of-Concept (PoC)**</mark>

<mark style="color:red;">**Objective**</mark><mark style="color:red;">:</mark> Demonstrate the potential impact of vulnerabilities by providing clear proof of exploitation.

* <mark style="color:red;">**What to do**</mark><mark style="color:red;">:</mark> Provide evidence that proves the exploit works and shows what data or system control was obtained.
* <mark style="color:red;">**Tools/Techniques**</mark><mark style="color:red;">:</mark>
  * <mark style="color:purple;">**PoC Development**</mark><mark style="color:purple;">:</mark> Write custom exploits or screenshots showing access.
  * <mark style="color:purple;">**Documenting Impact**</mark><mark style="color:purple;">:</mark> Collect data (e.g., extracted sensitive files, screenshots of shell access).
* <mark style="color:red;">**Outcome**</mark><mark style="color:red;">:</mark> A clear demonstration of the impact for reporting purposes.
* <mark style="color:red;">**MITRE ATT\&CK Mapping**</mark><mark style="color:red;">:</mark> *Impact (T1486)*.

## <mark style="color:yellow;">**Post-Engagement**</mark>

<mark style="color:red;">**Objective**</mark><mark style="color:red;">:</mark> Summarize findings, provide recommendations, and remove any artifacts left during the test.

* <mark style="color:red;">**What to do**</mark><mark style="color:red;">:</mark>
  * <mark style="color:purple;">**Reporting**</mark><mark style="color:purple;">:</mark> Provide technical and executive reports outlining the vulnerabilities found, exploitation details, and recommendations.
  * <mark style="color:purple;">**Cleanup**</mark><mark style="color:purple;">:</mark> Remove backdoors, accounts, or persistence mechanisms installed during the test.
* <mark style="color:red;">**Tools/Techniques**</mark><mark style="color:red;">:</mark> Manual system checks, script cleanups, forensic tools.
* <mark style="color:red;">**Outcome**</mark><mark style="color:red;">:</mark> The system is restored, and the client receives actionable feedback.
* <mark style="color:red;">**MITRE ATT\&CK Mapping**</mark><mark style="color:red;">:</mark> Not directly mapped, but defensive measures are taken based on findings.

## <mark style="color:yellow;">**Differences Between Post-Exploitation, Lateral Movement, and Privilege Escalation**</mark>

#### <mark style="color:orange;">**Post-Exploitation**</mark><mark style="color:orange;">:</mark>

* <mark style="color:red;">**Objective**</mark><mark style="color:red;">:</mark> After gaining initial access, focus on gathering intelligence, maintaining access, and preparing for further attacks.
* <mark style="color:red;">**Key Techniques**</mark><mark style="color:red;">:</mark>
  * <mark style="color:purple;">**Data Collection**</mark><mark style="color:purple;">:</mark> Dump credentials, extract sensitive files.
  * <mark style="color:purple;">**Persistence**</mark><mark style="color:purple;">:</mark> Create new user accounts, install backdoors (e.g., cron jobs, startup scripts).
  * <mark style="color:purple;">**Log Manipulation**</mark><mark style="color:purple;">:</mark> Clean or manipulate logs to avoid detection.

#### <mark style="color:orange;">**Lateral Movement**</mark><mark style="color:orange;">:</mark>

* <mark style="color:red;">**Objective**</mark><mark style="color:red;">:</mark> Move through the compromised network to access more systems and expand control.
* <mark style="color:red;">**Key Techniques**</mark><mark style="color:red;">:</mark>
  * <mark style="color:purple;">**Pivoting**</mark><mark style="color:purple;">:</mark> Use compromised machine as a foothold to explore other systems (e.g., using Metasploit's pivot module).
  * <mark style="color:purple;">**Credential Reuse**</mark><mark style="color:purple;">:</mark> Leverage passwords or hashes from one machine to access others.
  * <mark style="color:purple;">**Exploiting Remote Services**</mark><mark style="color:purple;">:</mark> Use RDP, SMB, SSH to move to other systems.

#### <mark style="color:orange;">**Privilege Escalation**</mark><mark style="color:orange;">:</mark>

* <mark style="color:red;">**Objective**</mark><mark style="color:red;">:</mark> Elevate privileges from a lower-level user (e.g., local user) to an administrator or root.
* <mark style="color:red;">**Key Techniques**</mark><mark style="color:red;">:</mark>
  * <mark style="color:purple;">**Windows**</mark><mark style="color:purple;">:</mark> UAC bypass, token impersonation (e.g., SeImpersonatePrivilege).
  * <mark style="color:purple;">**Linux**</mark><mark style="color:purple;">:</mark> Exploit SUID binaries, weak sudo permissions, kernel exploits (e.g., Dirty Cow).

## <mark style="color:yellow;">Full Workflow Example</mark>

* <mark style="color:red;">**Pre-engagement**</mark><mark style="color:red;">:</mark> Define rules using engagement contracts.
* <mark style="color:red;">**Information Gathering**</mark><mark style="color:red;">:</mark> Use Nmap for network scanning, WHOIS for public information.
* <mark style="color:red;">**Vulnerability Assessment**</mark><mark style="color:red;">:</mark> Scan with Nessus, manually validate with Burp Suite.
* <mark style="color:red;">**Exploitation**</mark><mark style="color:red;">:</mark> Use Metasploit to exploit an RCE vulnerability.
* <mark style="color:red;">**Post-Exploitation**</mark><mark style="color:red;">:</mark> Dump credentials with Mimikatz, install persistence with cron jobs.
* <mark style="color:red;">**Lateral Movement**</mark><mark style="color:red;">:</mark> Use compromised credentials for SMB shares, pivot using proxychains.
* <mark style="color:red;">**Privilege Escalation**</mark><mark style="color:red;">:</mark> Exploit kernel vulnerabilities on Linux for root access.
* <mark style="color:red;">**Proof-of-Concept**</mark><mark style="color:red;">:</mark> Demonstrate access to critical data (e.g., passwords, sensitive files).
* <mark style="color:red;">**Post-Engagement**</mark><mark style="color:red;">:</mark> Cleanup backdoors, provide a detailed report.
