A crash course on various topics in penetration testing
[Section 1 — Network Utilities] — nmap:
nmap is one of the most important tools in a pen testers arsenal. It allows a pen tester to see which ports are open, and information about which services are running on those ports. Ergo this task will focus on showing you nmap’s various flags. The beginning questions can be completed by using the nmap man page; The final questions will require you to deploy the machine.
1.What does nmap stand for?
2.How do you specify which port(s) to scan?
3.How do you do a “ping scan”(just tests if the host(s) is up)?
4.What is the flag for a UDP scan?
5.How do you run default scripts?
6.How do you enable “aggressive mode”(Enables OS detection, version detection, script scanning, and traceroute)
7.What flag enables OS detection
8.How do you get the versions of services running on the target machine
9.Deploy the machine
A:no answer need
10.How many ports are open on the machine?
11.What service is running on the machine?
12.What is the version of the service?
13.What is the output of the http-title script(included in default scripts)
A:Apache2 Ubuntu Default Page: It works
[Section 1 — Network Utilities] — Netcat:
Netcat aka nc is an extremely versatile tool. It allows users to connect to specific ports and send and receive data. It also allows machines to receive data and connections on specific ports, which makes nc a very popular tool to gain a Reverse Shell.
After you connect to a port with nc you will be able to send data, this also has the consequence of the user being able to pipe data through nc. For example one can do
echo hello | nc <ip> 1234 to send the string hello to the service running on port 1234
Note: There are multiple versions of nc, so if you are unable to find an answer in your specific man page, try reading the man page for others!
1.How do you listen for connections?
2.How do you enable verbose mode(allows you to see who connected to you)?
3.How do you specify a port to listen on
4.How do you specify which program to execute after you connect to a host(One of the most infamous)?
5.How do you connect to udp ports
[Section 2 — Web Enumeration] — gobuster:
One of the main problems of web penetration testing is not knowing where anything is. Basic reconnaissance can tell you where some files and directories are; however, some of the more hidden stuff is often hidden away from the eyes of users. This is where gobuster comes in, the idea behind gobuster is that it tries to find valid directories from a wordlist of possible directories. gobuster can also be used to valid subdomains using the same method.
The beginning questions of this task use the gobuster man page, while the latter questions will use a virtual machine.
In the event your operating system does not provide the gobuster man page, please use gobuster — help
1.How do you specify directory/file brute forcing mode?
2.How do you specify dns bruteforcing mode?
3.What flag sets extensions to be used?
Example: if the php extension is set, and the word is “admin” then gobuster will test admin.php against the webserver
4.What flag sets a wordlist to be used?
5.How do you set the Username for basic authentication(If the directory requires a username/password)?
6.How do you set the password for basic authentication?
7.How do you set which status codes gobuster will interpret as valid?
8.How do you skip ssl certificate verification?
9.How do you specify a User-Agent?
10.How do you specify a HTTP header?
11.What flag sets the URL to bruteforce?
12.Deploy the machine
A:no answer need
13.What is the name of the hidden directory
14.What is the name of the hidden file with the extension xxa
[Section 2 — Web Enumeration] — nikto:
nikto is a popular web scanning tool that allows users to find common web vulnerabilities. It is commonly used to check for common CVE’s such as shellshock, and to get general information about the web server that you’re enumerating.
1.How do you specify which host to use?
2.What flag disables ssl?
3.How do you force ssl?
4.How do you specify authentication(username + pass)?
5.How do you select which plugin to use?
6.Which plugin checks if you can enumerate apache users?
7.How do you update the plugin list
8.How do you list all possible plugins to use
[Section 3 — Metasploit]: Intro:
Metasploit is one of the most popular penetration testing frameworks around. It contains a large database of almost every major CVE, which you can easily use against a machine. The aim of this section is to go through some of the major features of metasploit, and at the end there will be a machine that you will need to exploit.
[Section 3 Metasploit]: Setting Up:
Once you have installed metasploit through either the installer or your distributions repos, you will have many new commands available to you. This section will primarily focus on the msfconsole command.
Running that command will present you with an “msf5” prompt which will allow you to enter commands. All tasks can be answered with use of the “help” command.
1.What command allows you to search modules?
2.How do you select a module?
3.How do you display information about a specific module?
4.How do you list options that you can set?
5.What command lets you view advanced options for a specific module?
6.How do you show options in a specific category
[Section 3 — Metasploit]: — Selecting a module:
Once you have found the module for the specific machine that you want to exploit, you need to select it and set the proper options. This task will take you through selecting and setting options for one of the most popular metasploit modules “eternalblue”. All basic commands that could be run before selecting a module can also be done while a module is selected.
1.How do you select the eternalblue module?
2.What option allows you to select the target host(s)?
3.How do you set the target port?
4.What command allows you to set options?
5.How would you set SMBPass to “username”?
A:set SMBPass username
6.How would you set the SMBUser to “password”?
A:set SMBUser password
7.What option sets the architecture to be exploited?
8.What option sets the payload to be sent to the target machine?
9.Once you’ve finished setting all the required options, how do you run the exploit?
10.What flag do you set if you want the exploit to run in the background?
11.How do you list all current sessions?
12.What flag allows you to go into interactive mode with a session(“drops you either into a meterpreter or regular shell”)
[Section 3 — Metasploit]: meterpreter:
Once you’ve run the exploit, ideally it will give you one of two things, a regular command shell or a meterpreter shell. Meterpreter is metasploits own “control center” where you can do various things to interact with the machine. A list of commonmeterpreter commands and their uses can be found here
Note: Regular shells can usually be upgraded to meterpreter shells by using the module
1.What command allows you to download files from the machine?
2.What command allows you to upload files to the machine?
3.How do you list all running processes?
4.How do you change processes on the victim host(Ideally it will allow you to change users and gain the perms associated with that user)
5.What command lists files in the current directory on the remote machine?
6.How do you execute a command on the remote host?
7.What command starts an interactive shell on the remote host?
8.How do you find files on the target host(Similar function to the linux command “find”)
9.How do you get the output of a file on the remote host?
10.How do you put a meterpreter shell into “background mode”(allows you to run other msf modules while also keeping the meterpreter shell as a session)?
[Section 3 — Metasploit]: Final Walkthrough:
It’s time to put all the other metasploit tasks together and test them on an example machine. This machine is currently vulnerable to the metasploit module
exploit/multi/http/nostromo_code_execon port 80, and this task will take you through the process of exploiting it and gaining a shell on the machine.
1.Select the module that needs to be exploited
2.What variable do you need to set, to select the remote host
3.How do you set the port to 80
4.How do you set listening address(Your machine)
5.Exploit the machine!
A:no answer need
6.What is the name of the secret directory in the /var/nostromo/htdocs directory?
7.What are the contents of the file inside of the directory?
Section 4 — Hash Cracking]: Intro:
Often times during a pen test, you will gain access to a database. When you investigate the database you will often find a users table, which contains usernames and often hashed passwords. It is often necessary to know how to crack hashed passwords to gain authentication to a website(or if you’re lucky a hashed password may work for ssh!).
[Section 4 — Hash Cracking]: Salting and Formatting:
No matter what tool you use, virtually all of them have the exact same format. A file with the hash(s) in it with each hash being separated by a newline.
Salts are typically appended onto the hash with a colon and the salt. Files with salted hashes still follow the same convention with each hash being separated by a newline.
Note: Different hashing algorithms treat salts differently. Some prepend them and some append them. Research what it is you’re trying to crack, and make the distinction.
please everyone join my telegram channel :https://t.me/hackerwheel
please everyone join my youtube channel :https://www.youtube.com/channel/UCl10XUIb7Ka6fsq1Pl7m0Hg
Change the world