CPTS labs - 23 Attacking Common Applications
Module: Attacking Common Applications
Setting the Stage
vHosts needed for these questions:
app.inlanefreight.local
dev.inlanefreight.local
drupal-dev.inlanefreight.local
drupal-qa.inlanefreight.local
drupal-acc.inlanefreight.local
drupal.inlanefreight.local
blog.inlanefreight.local
Use what you've learned from this section to generate a report with EyeWitness. What is the name of the .db file EyeWitness creates in the inlanefreight_eyewitness folder? (Format: filename.db)
First, we add the scope list to our /etc/hosts file. Then we save the scope list to the file scope_list. Then we run
We will see a lot of open ports at 80. Now we will use eyewitness:
Results: ew.db
What does the header on the title page say when opening the aquatone_report.html page with a web browser? (Format: 3 words, case sensitive)
Results: Pages by Similarity
Content Management Systems (CMS)
vHosts needed for these questions: blog.inlanefreight.local
Enumerate the host and find a flag.txt flag in an accessible directory.
Browse to http://blog.inlanefreight.local/wp-content/uploads/2021/08/flag.txt
Results: 0ptions_ind3xeS_ftw!
Perform manual enumeration to discover another installed plugin. Submit the plugin name as the answer (3 words).
Then browse to http://blog.inlanefreight.local/wp-content/plugins/wp-sitemap-page/ and a blank page is returned. Then try http://blog.inlanefreight.local/wp-content/plugins/wp-sitemap-page/readme.txt
Results: WP Sitemap Page
Find the version number of this plugin. (i.e., 4.5.2)
Results: 1.6.4
Perform user enumeration against http://blog.inlanefreight.local. Aside from admin, what is the other user present?
Results: doug
Perform a login bruteforcing attack against the discovered user. Submit the user's password as the answer.
Output:
Results: jessica1
Using the methods shown in this section, find another system user whose login shell is set to /bin/bash.
When login into the application a modal is displaying prompting us to confirm our email webadmin@inlanefreight.local
Results: webadmin
Following the steps in this section, obtain code execution on the host and submit the contents of the flag.txt file in the webroot.
We intercept the request for uploading an image and we upload a pentestmonkey reverse shell:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
|
The server return the target location of the upload. Now in our kali attacker machine:
And we browse to http://blog.inlanefreight.local/wp-content/uploads/2025/02/mala-1738507185.1412.php to receive the reverse shell. Now, from the terminal we browse around and print out the flag:
Results: l00k_ma_unAuth_rc3!
vHosts needed for these questions: app.inlanefreight.local
Fingerprint the Joomla version in use on http://app.inlanefreight.local (Format: x.x.x)
Results: 3.10.0
Find the password for the admin user on http://app.inlanefreight.local
Results: turnkey
vHosts needed for these questions: dev.inlanefreight.local
Leverage the directory traversal vulnerability to find a flag in the web root of the http://dev.inlanefreight.local/ Joomla application
Result: j00mla_c0re_d1rtrav3rsal!
vHosts needed for these questions: drupal.inlanefreight.local drupal-qa.inlanefreight.local
Identify the Drupal version number in use on http://drupal-qa.inlanefreight.local
Results: 7.30
Work through all of the examples in this section and gain RCE multiple ways via the various Drupal instances on the target host. When you are done, submit the contents of the flag.txt file in the /var/www/drupal.inlanefreight.local directory.
Resutls: DrUp@l_drUp@l_3veryWh3Re!
Servlet Containers/Software Development
vHosts needed for these questions:
app-dev.inlanefreight.local
web01.inlanefreight.local
What version of Tomcat is running on the application located at http://web01.inlanefreight.local:8180?
Results: 10.0.10
What role does the admin user have in the configuration example?
See the example provided by HTB.
Results: admin-gui
vHosts needed for these questions:
web01.inlanefreight.local
Perform a login bruteforcing attack against Tomcat manager at http://web01.inlanefreight.local:8180. What is the valid username?
Run the script provided in the notes for brute force user:password:
Results: tomcat
What is the password?
Results: root
Obtain remote code execution on the http://web01.inlanefreight.local:8180 Tomcat instance. Find and submit the contents of tomcat_flag.txt
Results: t0mcat_rc3_ftw!
vHosts needed for these questions:
jenkins.inlanefreight.local
Authenticate to (ACADEMY-ATCKAPPS-APP02) with user "admin" and password "admin". Log in to the Jenkins instance at http://jenkins.inlanefreight.local:8000. Browse around and submit the version number when you are ready to move on.
See the footer.
Results: 2.303.1
vHosts needed for these questions:
jenkins.inlanefreight.local
Attack the Jenkins target and gain remote code execution. Submit the contents of the flag.txt file in the /var/lib/jenkins3 directory
Access to jenkins.inlanefreight.local with admin:admin. Once we have gained access to a Jenkins application, a quick way of achieving command execution on the underlying server is via the Script Console located under "Manage Jenkins" tab.
Snippet code for a reverse shell:
And have a listener in our attacking machine.
Now we cat the flag:
Results: f33ling_gr00000vy!
Infrastructure/Network Monitoring Tools
Enumerate the Splunk instance as an unauthenticated user. Submit the version number to move on (format 1.2.3).
We enumerate the open ports:
After noticing port 8000 with Splunk service in it, we access it. Note that we will be accessing with HTTPS. See the title of the site. Results: 8.2.2
Attack the Splunk target and gain remote code execution. Submit the contents of the flag.txt file in the c:\loot directory.
Clone the tool reverse_shell_splunk
Modify the one-liner:
Create a tarball or .spl
file.
Set a listener on the attacking machine:
In the browser go to Manage apps, upload app, and upload your updater.tar.gz. Upon upload, the shell will be triggered. Now print the flag.
Results: l00k_ma_no_AutH!
What version of PRTG is running on the target?
See the footer of http://10.129.48.71:8080/. Also:
Results: 18.1.37.13946
Attack the PRTG target and gain remote code execution. Submit the contents of the flag.txt file on the administrator Desktop.
1. Access to the application at http://10.129.41.233:8080 with prtgadmin:Password123
2. To begin, mouse over Setup
in the top right and then the Account Settings
menu and finally click on Notifications
.
3. Next, click on Add new notification.
4. Give the notification a name and scroll down and tick the box next to EXECUTE PROGRAM. Under Program File, select Demo exe notification - outfile.ps1 from the drop-down. Finally, in the parameter field, enter a command. For our purposes, we will add a new local admin user by entering
5. After clicking Save
, we will be redirected to the Notifications
page and see our new notification named pwn
in the list.
5. Click the Test button to run our notification and execute the command to add a local admin user. After clicking Test we will get a pop-up that says EXE notification is queued up.
6. Since this is a blind command execution, we won't get any feedback, so we'd have to either check our listener for a connection back or, in our case, check to see if we can authenticate to the host as a local admin.
7. Use crackmapexec / WinRM / RDP / EvilWinRm / impacket toolkit such as wmiexec.py or psexec.py to confirm local admin access.
Customer Service Mgmt & Configuration Management
vHosts needed for these questions:
support.inlanefreight.local
Find your way into the osTicket instance and submit the password sent from the Customer Support Agent to the customer Charles Smithson.
Access to support.inlanefreight.local
with creds facilitated in the lesson:
Login page is typically located at: http://$target/scp/login.php
Then, find the ticket that contains a conversation about a VPN password being reset (the ticket is a little bit hidden, use the search feature):
Results: Inlane_welcome!
vHosts needed for these questions: gitlab.inlanefreight.local
.
Enumerate the GitLab instance at http://gitlab.inlanefreight.local. What is the version number?
We access http://gitlab.inlanefreight.local, register an user and browse to http://gitlab.inlanefreight.local:8081/help
Results: 13.10.2
Find the PostgreSQL database password in the example project.
Browse to http://gitlab.inlanefreight.local:8081/explore
Then to http://gitlab.inlanefreight.local:8081/root/inlanefreight-dev
And finally to http://gitlab.inlanefreight.local:8081/root/inlanefreight-dev/-/blob/master/phpunit_pgsql.xml
Result: postgres
Find another valid user on the target GitLab instance.
We will run the following script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
Run:
Output:
Results: DEMO
If we use a different wordlist we will obtain some more users:
Gain remote code execution on the GitLab instance. Submit the flag in the directory you land in.
As we know that Gitlab 13.10.2 is vulnerable, we will download the exploit 49951.py.
Then, start a listener:
Running the script:
Now, from the shell:
Results: s3cure_y0ur_Rep0s!
Common Gateway Interfaces
After running the URL Encoded 'whoami' payload, what user is tomcat running as?
First we enumerate:
Output:
We access the tomcat page http://10.129.205.30:8080/ and check version: # 9.0.17.
This version is potentially vulnerable to CVE-2019-0232
. If the enableCmdLineArguments
feature enabled, RCE is possible.
Now, we enumerate potential vulnerable endpoints:
We obtain ẁelcome. Now we can trigger the RCE: http://10.129.205.30:8080/cgi/welcome.bat?&dir
Now,
Results: feldspar\omen
Enumerate the host, exploit the Shellshock vulnerability, and submit the contents of the flag.txt file located on the server.
Output: /access.cgi
Now we can do via curl o via Burpsuite:
In the reverse shell
Results: Sh3ll_Sh0cK_123
Thick Client Applications
Perform an analysis of C:\Apps\Restart-OracleService.exe and identify the credentials hidden within its source code. Submit the answer using the format username:password.
We connect to the machine via RDP:
We open the tool ProcMon64
from SysInternals located at c:\Tools\ProcessMonitor\Procmon64.exe. We set the filter "Process name" contains Restart-OracleService
and Start the capture.
We start the C:\Apps\Restart-OracleService.exe program
We can see in the process monitor that the temp folder is being written with some content.
We browse to the Temp folder C:\Users\cybervaca\AppData\Local\Temp and retrieve the .bat file
When opening witht the Notepad, we observe some lines removing some scripts and the executable. We can remove the del lines and execute again the program:
Now, if we browse to c:\ProgramData we will see the new files monta.ps1, oracle.txt:
We can read the script:
This script simply reads the contents of the oracle.txt
file and decodes it to the restart-service.exe
executable. Running this script gives us a final executable that we can further analyze.
Now, we will start procmon64, and modify the filter to catch those process name that contains restart-service string. And we launch the restart-service.
We will start x64dbg
, navigate to Options
-> Preferences
, and uncheck everything except Exit Breakpoint
: By unchecking the other options, the debugging will start directly from the application's exit point, and we will avoid going through any dll
files that are loaded before the app starts.
Then, we can select file
-> open
and select the restart-service.exe
to import it and start the debugging. Once imported, we right click inside the CPU
view and Follow in Memory Map
.
We will double click on the first line:
If we double-click on it, we will see the magic bytes MZ
in the ASCII
column that indicates that the file is a DOS MZ executable. Memory-mapped files allow applications to access large files without having to read or write the entire file into memory at once. Instead, the file is mapped to a region of memory that the application can read and write as if it were a regular buffer in memory. This could be a place to potentially look for hardcoded credentials.
Let's return to the Memory Map pane, then export the newly discovered mapped item from memory to a dump file by right-clicking on the address and selecting Dump Memory to File
.
We run Strings and notice that it contains a binary:
If we open it with dnspy, we will be able to see some creds:
Results: svc_oracle:#oracle_s3rV1c3!2010
Miscellaneous Applications
Skills Assessments
Attacking Common Applications - Skills Assessment I
During a penetration test against the company Inlanefreight, you have performed extensive enumeration and found the network to be quite locked down and well-hardened. You come across one host of particular interest that may be your ticket to an initial foothold. Enumerate the target host for potentially vulnerable applications, obtain a foothold, and submit the contents of the flag.txt file to complete this portion of the skills assessment.
What vulnerable application is running?
We enumerate the services and ports:
We see apache tomcat. After accessing the web we can see that is running under version 9.0.0.M1
Results: Tomcat
What port is this application running on?
Results: 8080
What version of the application is in use?
9.0.0.M1
Exploit the application to obtain a shell and submit the contents of the flag.txt file on the Administrator desktop.
I used metasploit:
In the meterpreter session now you can type the flag:
Results: f55763d31a8f63ec935abd07aee5d3d0
Last update: 2025-02-09 Created: February 2, 2025 19:49:43