Methodology To Attack a Linux Machine
Ok after scanning the network we detect some Linux machines and now?
What do we need to investigate in order to get root on the remote machine?
First scan all 65535 TCP ports available, don’t scan them all at once. Start by scanning the most common ones then go increasing the port ranges.
Do the same for all 65535 UDP ports.
After scanning all ports we hope to find some services running on them, grab all banners from remote services, and investigate them.
The objective is to find services that can allow us to connect to the machine without authentication or send files to the machine, or a web server since it gives us a lot more to investigate in order to find an entry point.
If we don’t find anything useful running on the host it’s time to run different scans against the host. Remember don’t be noisy, prepare yourself for the next exams.
Linux Kernel version
The version of the Services running
Sometimes we can detect users remotely
SSH Service – Port 22
SSH is hard to exploit but can be brute forced, if you find a valid user try to brute force ssh.
Read more about SSH Penetration Testing here:
FTP Service – Port 21
Old FTP can be an entry point into the remote system, maybe an anonymous user is allowed and we can get some files or better send files to the server.
Search for files inside the available folders in case you found a Web server folder send a PHP reverse shell.
Pay attention to hidden folders and the folder’s names and paths as well.
FTP is nice to be brute-forced if you have a valid user.
Web Servers – Port 80 / 443
Remember! Users from web applications are different from system users.
Read More about hacking Web Servers here:
Samba Service – Port 445
MySQL Service – Port 3306
DNS service – Port 53
A stable highly privileged shell of course. Root access!
Transfer files to the machine.
Download files from the machine.
Pivoting into other networks.