Exploitation/Linux
Enumeration
Finding the goods
Document the Server
- Display CPU information:
- Display memory information:
- System Process Information:
- Display partition information:
- Display IP address information:
- Display the status of the SSH service:
- Passwords / Keys:
- More OS Information:
ps
- Show processes for the current shell:
The “ps” command provides a few useful options...
Looking at the ps aux command output, we can have a better understanding of the system and potential vulnerabilities.
env
- Show environmental variables:
The PATH variable may have a compiler or a scripting language (e.g. Python) that could be used to run code on the target system or leveraged for privilege escalation.
netstat
The netstat command can be used with several different options to gather information on existing connections.
netstat -a: Shows all listening ports and established connections.netstat -atornetstat -au: Can also be used to list TCP or UDP protocols respectively.netstat -l: List ports in “listening” mode. These ports are open and ready to accept incoming connections. This can be used with the-toption to list only ports that are listening using the TCP protocolnetstat -s: List network usage statistics by protocol. This can also be used with the-tor-uoptions to limit the output to a specific protocol.netstat -tp: List connections with the service name and PID information. This can also be used with the -l option to list listening ports (below)netstat -i: Shows interface statistics.- Usually seen being used:
-ano -a: Display all sockets-n: Do not resolve names-o: Display timers
Search Sockets
If we run ss -tulpn it will tell us what socket connections are running
| Argument | Description |
|---|---|
| -t | Display TCP sockets |
| -u | Display UDP sockets |
| -l | Displays only listening sockets |
| -p | Shows the process using the socket |
| -n | Doesn't resolve service names |
We can see that a service running on port 10000 is blocked via a firewall rule from the outside. However, Using an SSH Tunnel we can expose the port to us locally.
SNMP
The syntax is quite simple: