Task-1 (PT)
Task-1 (PT)
Alpha ..
2
Table of Contents
3
FINDINGS OVERVIEW
While conducting the external penetration test, there were several critical
vulnerabilities discovered in the AI-Web network. was able to gain full
administrative privilege to the AIWEB1 corporate server. This was possible
due to a vulnerable web-application, which led to remote system access,
then full administrative control was gained through improperly set
permissions to a critical system file. A brief technical overview is listed
below:
RECOMMENDATIONS
4
should never trust that user input is safe and therefore should be
checked for a set of disallowed characters.
o Require Secure Coding Training for Developers. Developers are
on the front lines of security for any organization and should be
prepared to be the first line of defense. Training in secure coding
techniques and practices will help ensure that your organization’s
applications are developed using the most secure code possible,
thus reducing your attack-surface and lowering your overall risk.
SEVERITY SCALE
6
INFORMATION GATHERING
The given a scope of host(s) from AI-Web that includes the AI-Web
corporate server. You can see the network details of that device listed
below:
- Hostname: AIWEB1
- IP Address: 10.10.10.4
- MAC Address: 00:0C:29:87:86:E3
ENUMERATION
7
began by scanning all ports on AIWEB1 with Nmap to determine which
services were open. *In some cases, some ports may not be listed
The initial Nmap scan discovered that only TCP port 80 is open on target
AIWEB1. then performed a more focused Nmap scan to gather more
detailed information.
8
The detailed Nmap scan revealed that a ‘robots.txt’ file is being used to
hide 2 directories from search engine crawlers. A manual browsing of this
file verifies this finding.
9
Directory fuzzing revealed nothing about immediately useful from the
‘/se3reTdir777/uploads/’ web directory.
10
Directory fuzzing results of ‘/se3reTdir77/’ web directory using GoBuster.
http://10.10.10.4/m3diNf0/info.php
11
http://10.10.10.4/se3reTdir777/index.php
12
13
VULNERABILITY ASSESSMENT
Severity: CRITICAL
14
The results are saved in the given directory path and can then viewed by
opening the generated ‘index.html’ with a web browser of choice.
15
To see more detail about the issues presented, click on the issue then click
on the ‘[ show trace + ]’ link.
16
From here we can see the data passed by Skipfish to the AIWEB1 web
application as well as the response sent back, which indicates vulnerability to
Error-Based SQL Injection attacks.
The Skipfish trace report shows that the scanner sent a request of
‘uid=1 ‘ “&Operation=Submit’ and the server returned a SQL syntax
error pointing to where the error might have occurred.
17
18
The vulnerability scanner SQLMap was also used to verify, the found SQL
Injection vulnerability and enumerate the database name.
19
EXPLOITATION
All will stay within the scope that was determined during pre-engagement
activities and documentation.
20
21
Dumping data for TABLE ‘systemUser’:
1. t00r : FakeUserPassw0rd
2. aiweb1pwn : MyEvilPass_f908sdaf9_sadfasf0sa
3. u3er : N0tThis0neAls0
22
Low-Privilege Shell Access via SQLMap:
The now have verified RCE on AIWEB1 and now will attempt to obtain a
fully interactive TTY shell. This is desired for 2 reasons:
23
then checked to see if Python was installed:
24
Start a listener to catch the incoming connection with Netcat on their Kali
Linux system:
Using the SQLMap shell and Python, then execute a new shell connection
from AIWEB1 to the tester’s Kali Linux Netcat listener.
In a new terminal session, start another Netcat listener over TCP port 8888 on
their Kali Linux system…
…and issue the following Bash one-liner from the previous Python shell
terminal session:
25
26
Connection is successfully made to new terminal session and Python is used
to create fully interactive TTY shell:
Now that a fully interactive TTY shell session had been established,
began the process of looking for a way to elevate privileges. Through
manual exploration of system files, a vulnerability was discovered that
allowed to gain full administrative/root privileges to the AIWEB1 server.
After checking file permissions for many common system files, quick
discovered a permissions misconfiguration for the ‘/etc/passwd’ file.
Since had gained access through the ‘www-data’ service account, they
found themselves with ownership and write permissions to the
‘/etc/passwd’ file. This allowed them to create a new user account entry
with root privileges and a password of their choice.
27
This was accomplished using the following steps.
28
From terminal in Kali, created a SHA-512 hashed password of ‘password’:
From terminal in Kali, then created a text file containing the required fields
for a user account entry in a standard /etc/passwd file.
This file (user1.passwd) contains all the information to login as ‘user1’ with
password of ‘password’.
From terminal in Kali, use Python to serve the user1.passwd file with HTTP.
29
then able to append the contents of the ‘user1.passwd’ file into the
‘/etc/passwd’ file.
30
At this point, able to login with the ‘user1’ account and were granted root
privileges to the AIWEB1 server.
then used their root privileges to access privileged files that contain
sensitive data. These were the ‘/root/flag.txt’ and ‘/etc/shadow’ files.
31
32
OTHER ISSUES
Severity: LOW
33
34
discovered login credentials for the MySQL database which allowed a
successful local login to said database.
Severity: LOW
35
36