hacktricks/generic-methodologies-and-resources/pentesting-methodology.md

174 lines
11 KiB
Markdown
Raw Normal View History

2022-04-28 23:27:22 +00:00
# Pentesting Methodology
2022-04-28 16:01:33 +00:00
2024-07-18 20:49:07 +00:00
{% hint style="success" %}
2024-08-31 16:23:36 +00:00
Learn & practice AWS Hacking:<img src="../.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="../.gitbook/assets/arte.png" alt="" data-size="line">\
Learn & practice GCP Hacking: <img src="../.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="../.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
2022-04-28 16:01:33 +00:00
2024-07-18 20:49:07 +00:00
<details>
2022-04-28 16:01:33 +00:00
2024-07-18 20:49:07 +00:00
<summary>Support HackTricks</summary>
2023-12-30 20:49:23 +00:00
2024-07-18 20:49:07 +00:00
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
2024-07-18 20:49:07 +00:00
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
2022-04-28 16:01:33 +00:00
</details>
2024-07-18 20:49:07 +00:00
{% endhint %}
2022-04-28 16:01:33 +00:00
2024-09-23 23:13:55 +00:00
<figure><img src="../.gitbook/assets/image (1) (1) (1) (1) (1) (1) (1) (1) (1) (1).png" alt=""><figcaption></figcaption></figure>
If you are interested in **hacking career** and hack the unhackable - **we are hiring!** (_fluent polish written and spoken required_).
2022-04-30 20:19:32 +00:00
{% embed url="https://www.stmcyber.com/careers" %}
2022-04-30 20:19:32 +00:00
2022-05-01 13:25:53 +00:00
## Pentesting Methodology
2022-04-28 16:08:23 +00:00
<figure><img src="../.gitbook/assets/HACKTRICKS-logo.svg" alt=""><figcaption></figcaption></figure>
_Hacktricks logos designed by_ [_@ppiernacho_](https://www.instagram.com/ppieranacho/)_._
2022-05-01 13:25:53 +00:00
### 0- Physical Attacks
2024-04-06 16:25:58 +00:00
Do you have **physical access** to the machine that you want to attack? You should read some [**tricks about physical attacks**](../hardware-physical-access/physical-attacks.md) and others about [**escaping from GUI applications**](../hardware-physical-access/escaping-from-gui-applications.md).
2022-05-01 13:25:53 +00:00
### 1 - [Discovering hosts inside the network ](pentesting-network/#discovering-hosts)/ [Discovering Assets of the company](external-recon-methodology/)
**Depending** if the **test** you are perform is an **internal or external test** you may be interested on finding **hosts inside the company network** (internal test) or **finding assets of the company on the internet** (external test).
2020-11-04 10:42:10 +00:00
{% hint style="info" %}
Note that if you are performing an external test, once you manage to obtain access to the internal network of the company you should re-start this guide.
{% endhint %}
2022-05-01 13:25:53 +00:00
### **2-** [**Having Fun with the network**](pentesting-network/) **(Internal)**
2020-11-04 10:42:10 +00:00
**This section only applies if you are performing an internal test.**\
2022-05-01 13:25:53 +00:00
Before attacking a host maybe you prefer to **steal some credentials** **from the network** or **sniff** some **data** to learn **passively/actively(MitM)** what can you find inside the network. You can read [**Pentesting Network**](pentesting-network/#sniffing).
2022-05-01 13:25:53 +00:00
### 3- [Port Scan - Service discovery](pentesting-network/#scanning-hosts)
2022-05-01 13:25:53 +00:00
The first thing to do when **looking for vulnerabilities in a host** is to know which **services are running** in which ports. Let's see the[ **basic tools to scan ports of hosts**](pentesting-network/#scanning-hosts).
2022-05-01 13:25:53 +00:00
### **4-** [Searching service version exploits](search-exploits.md)
Once you know which services are running, and maybe their version, you have to **search for known vulnerabilities**. Maybe you get lucky and there is a exploit to give you a shell...
2022-05-01 13:25:53 +00:00
### **5-** Pentesting Services
If there isn't any fancy exploit for any running service, you should look for **common misconfigurations in each service running.**
**Inside this book you will find a guide to pentest the most common services** (and others that aren't so common)**. Please, search in the left index the** _**PENTESTING**_ **section** (the services are ordered by their default ports).
2022-05-01 13:25:53 +00:00
**I want to make a special mention of the** [**Pentesting Web**](../network-services-pentesting/pentesting-web/) **part (as it is the most extensive one).**\
Also, a small guide on how to[ **find known vulnerabilities in software**](search-exploits.md) can be found here.
**If your service is not inside the index, search in Google** for other tutorials and **let me know if you want me to add it.** If you **can't find anything** in Google, perform your **own blind pentesting**, you could start by **connecting to the service, fuzzing it and reading the responses** (if any).
2022-05-01 13:25:53 +00:00
#### 5.1 Automatic Tools
There are also several tools that can perform **automatic vulnerabilities assessments**. **I would recommend you to try** [**Legion**](https://github.com/carlospolop/legion)**, which is the tool that I have created and it's based on the notes about pentesting services that you can find in this book.**
2022-05-01 13:25:53 +00:00
#### **5.2 Brute-Forcing services**
In some scenarios a **Brute-Force** could be useful to **compromise** a **service**. [**Find here a CheatSheet of different services brute forcing**](brute-force.md)**.**
2022-05-01 13:25:53 +00:00
### 6- [Phishing](phishing-methodology/)
2020-12-21 17:28:06 +00:00
2021-10-07 23:27:47 +00:00
If at this point you haven't found any interesting vulnerability you **may need to try some phishing** in order to get inside the network. You can read my phishing methodology [here](phishing-methodology/):
2020-12-21 17:28:06 +00:00
2024-08-31 16:23:36 +00:00
### **7-** [**Getting Shell**](reverse-shells/)
2024-08-31 16:23:36 +00:00
Somehow you should have found **some way to execute code** in the victim. Then, [a list of possible tools inside the system that you can use to get a reverse shell would be very useful](reverse-shells/).
Specially in Windows you could need some help to **avoid antiviruses**: [**Check this page**](../windows-hardening/av-bypass.md)**.**\\
2022-05-01 13:25:53 +00:00
### 8- Inside
If you have troubles with the shell, you can find here a small **compilation of the most useful commands** for pentesters:
2024-04-06 16:25:58 +00:00
* [**Linux**](../linux-hardening/useful-linux-commands.md)
2023-01-24 14:43:15 +00:00
* [**Windows (CMD)**](../windows-hardening/basic-cmd-for-pentesters.md)
2024-10-16 16:19:01 +00:00
* [**Windows (PS)**](../windows-hardening/basic-powershell-for-pentesters/)
2022-05-01 13:25:53 +00:00
### **9 -** [**Exfiltration**](exfiltration.md)
You will probably need to **extract some data from the victim** or even **introduce something** (like privilege escalation scripts). **Here you have a** [**post about common tools that you can use with these purposes**](exfiltration.md)**.**
2022-05-01 13:25:53 +00:00
### **10- Privilege Escalation**
2022-05-01 13:25:53 +00:00
#### **10.1- Local Privesc**
If you are **not root/Administrator** inside the box, you should find a way to **escalate privileges.**\
2022-05-01 13:25:53 +00:00
Here you can find a **guide to escalate privileges locally in** [**Linux**](../linux-hardening/privilege-escalation/) **and in** [**Windows**](../windows-hardening/windows-local-privilege-escalation/)**.**\
You should also check this pages about how does **Windows work**:
2024-04-06 16:25:58 +00:00
* [**Authentication, Credentials, Token privileges and UAC**](../windows-hardening/authentication-credentials-uac-and-efs/)
2022-05-01 13:25:53 +00:00
* How does [**NTLM works**](../windows-hardening/ntlm/)
2024-04-06 16:25:58 +00:00
* How to [**steal credentials**](https://github.com/carlospolop/hacktricks/blob/master/generic-methodologies-and-resources/broken-reference/README.md) in Windows
2022-05-01 13:25:53 +00:00
* Some tricks about [_**Active Directory**_](../windows-hardening/active-directory-methodology/)
**Don't forget to checkout the best tools to enumerate Windows and Linux local Privilege Escalation paths:** [**Suite PEAS**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite)
2022-05-01 13:25:53 +00:00
#### **10.2- Domain Privesc**
2022-05-01 13:25:53 +00:00
Here you can find a [**methodology explaining the most common actions to enumerate, escalate privileges and persist on an Active Directory**](../windows-hardening/active-directory-methodology/). Even if this is just a subsection of a section, this process could be **extremely delicate** on a Pentesting/Red Team assignment.
2022-05-01 13:25:53 +00:00
### 11 - POST
2022-05-01 13:25:53 +00:00
#### **11**.1 - Looting
Check if you can find more **passwords** inside the host or if you have **access to other machines** with the **privileges** of your **user**.\
2024-04-06 16:25:58 +00:00
Find here different ways to [**dump passwords in Windows**](https://github.com/carlospolop/hacktricks/blob/master/generic-methodologies-and-resources/broken-reference/README.md).
2022-05-01 13:25:53 +00:00
#### 11.2 - Persistence
**Use 2 o 3 different types of persistence mechanism so you won't need to exploit the system again.**\
2022-05-01 13:25:53 +00:00
**Here you can find some** [**persistence tricks on active directory**](../windows-hardening/active-directory-methodology/#persistence)**.**
TODO: Complete persistence Post in Windows & Linux
2022-05-01 13:25:53 +00:00
### 12 - Pivoting
With the **gathered credentials** you could have access to other machines, or maybe you need to **discover and scan new hosts** (start the Pentesting Methodology again) inside new networks where your victim is connected.\
In this case tunnelling could be necessary. Here you can find [**a post talking about tunnelling**](tunneling-and-port-forwarding.md).\
2022-05-01 13:25:53 +00:00
You definitely should also check the post about [Active Directory pentesting Methodology](../windows-hardening/active-directory-methodology/). There you will find cool tricks to move laterally, escalate privileges and dump credentials.\
Check also the page about [**NTLM**](../windows-hardening/ntlm/), it could be very useful to pivot on Windows environments..
2022-05-01 13:25:53 +00:00
### MORE
2022-05-01 13:25:53 +00:00
#### [Android Applications](../mobile-pentesting/android-app-pentesting/)
2022-05-01 13:25:53 +00:00
#### **Exploiting**
2024-08-31 16:23:36 +00:00
* [**Basic Linux Exploiting**](broken-reference/)
2024-04-06 16:25:58 +00:00
* [**Basic Windows Exploiting**](../binary-exploitation/windows-exploiting-basic-guide-oscp-lvl.md)
2024-06-18 11:39:21 +00:00
* [**Basic exploiting tools**](../binary-exploitation/basic-stack-binary-exploitation-methodology/tools/)
2022-05-16 08:29:00 +00:00
#### [**Basic Python**](python/)
2022-05-01 13:25:53 +00:00
#### **Crypto tricks**
2024-04-06 16:25:58 +00:00
* [**ECB**](../crypto-and-stego/electronic-code-book-ecb.md)
* [**CBC-MAC**](../crypto-and-stego/cipher-block-chaining-cbc-mac-priv.md)
* [**Padding Oracle**](../crypto-and-stego/padding-oracle-priv.md)
2022-04-28 16:01:33 +00:00
2024-09-23 23:13:55 +00:00
<figure><img src="../.gitbook/assets/image (1) (1) (1) (1) (1) (1) (1) (1) (1) (1).png" alt=""><figcaption></figcaption></figure>
If you are interested in **hacking career** and hack the unhackable - **we are hiring!** (_fluent polish written and spoken required_).
2022-05-08 22:42:39 +00:00
{% embed url="https://www.stmcyber.com/careers" %}
2022-05-08 22:42:39 +00:00
2024-07-18 20:49:07 +00:00
{% hint style="success" %}
2024-08-31 16:23:36 +00:00
Learn & practice AWS Hacking:<img src="../.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="../.gitbook/assets/arte.png" alt="" data-size="line">\
Learn & practice GCP Hacking: <img src="../.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="../.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
2022-04-28 16:01:33 +00:00
2024-07-18 20:49:07 +00:00
<details>
2022-04-28 16:01:33 +00:00
2024-07-18 20:49:07 +00:00
<summary>Support HackTricks</summary>
2023-12-30 20:49:23 +00:00
2024-07-18 20:49:07 +00:00
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
2024-07-18 20:49:07 +00:00
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
2022-04-28 16:01:33 +00:00
</details>
2024-07-18 20:49:07 +00:00
{% endhint %}