Attack Common Services
Attack Common Services
Easy Lab
We were commissioned by the company Inlanefreight to conduct a penetration test against three
different hosts to check the servers' configuration and security. We were informed that a flag had been
placed somewhere on each server to prove successful access. These flags have the following format:
• HTB{...}
Our task is to review the security of each of the three servers and present it to the customer. According
to our information, the first server is a server that manages emails, customers, and their files.
Step 1: Scanning the target to get information, identifying services are running on it,…
Reviewing the Nmap report, we just identify the common services are:
FTP: 21
SMTP: 25, 587
Web service: 80, 443
MySQL: 3306
RDP: 3389
Analysing the Nmap report, we need to the credential to login the services like FTP, MySQL, RDP, SMTP
and Web service (443), but we don’t know the credential!
We tried to access to web service via port 443 (this is the core FTP HTTPS server):
Try again with Nmap and -vv option for the greater effect to see more information.
┌──(root㉿kali)-[~/Desktop]
└─# nmap -sV -sC -p21,25,80,443,587,3306,3389 -vv 10.129.203.7
Starting Nmap 7.92 ( https://nmap.org ) at 2022-09-25 11:10 EDT
<SNIP…>
<SNIP…>
PORT STATE SERVICE REASON VERSION
21/tcp open ftp syn-ack ttl 127
| fingerprint-strings:
| GenericLines:
| 220 Core FTP Server Version 2.0, build 725, 64-bit Unregistered
| Command unknown, not supported or not allowed...
| Command unknown, not supported or not allowed...
| NULL, SMBProgNeg:
|_ 220 Core FTP Server Version 2.0, build 725, 64-bit Unregistered
| ssl-cert: Subject:
commonName=Test/organizationName=Testing/stateOrProvinceName=FL/countryName=US/organizati
onalUnitName=Test/[email protected]/localityName=test
| Issuer:
commonName=Test/organizationName=Testing/stateOrProvinceName=FL/countryName=US/organizati
onalUnitName=Test/[email protected]/localityName=test
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: shaWithRSAEncryption
| Not valid before: 2022-04-21T19:27:17
| Not valid after: 2032-04-18T19:27:17
| MD5: 27ed 2da8 8b25 57e3 d2fc c0c8 9f0b 55b0
| SHA-1: 5018 d8d5 ba6b 5a1c 8df6 5969 45d7 fe06 3d32 7fad
| -----BEGIN CERTIFICATE-----
| MIIDcDCCAlwCAQA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M4exqEEYC1hfwUCWRytfdS4yybZ3rDTVJDsQFMxUT++NTIayPnlDLA298xZ
| KuXOTzuf6pjUC5EMkncqdec8o4cVO1t4WJCs0iMaKH6tCB3oY80cYK0Z1PzQzYjz
| W5IEUFA9sdz67h79xdQcQHPHZmM=
|_-----END CERTIFICATE-----
|_ssl-date: 2022-09-25T15:11:46+00:00; +1s from scanner time.
25/tcp open smtp syn-ack ttl 127 hMailServer smtpd
| smtp-commands: WIN-EASY, SIZE 20480000, AUTH LOGIN PLAIN, HELP
|_ 211 DATA HELO EHLO MAIL NOOP QUIT RCPT RSET SAML TURN VRFY
80/tcp open http syn-ack ttl 127 Apache httpd 2.4.53 ((Win64) OpenSSL/1.1.1n PHP/7.4.29)
| http-title: Welcome to XAMPP
|_Requested resource was http://10.129.203.7/dashboard/
|_http-favicon: Unknown favicon MD5: 56F7C04657931F2D0B79371B2D6E9820
| http-methods:
|_ Supported Methods: GET HEAD POST OPTIONS
|_http-server-header: Apache/2.4.53 (Win64) OpenSSL/1.1.1n PHP/7.4.29
443/tcp open ssl/https syn-ack ttl 127 Core FTP HTTPS Server
| fingerprint-strings:
| GetRequest:
| HTTP/1.1 401 Unauthorized
| Date:Sun, 25 Aug 2022 15:11:11 GMT
| Server: Core FTP HTTPS Server
| Connection: close
| WWW-Authenticate: Basic realm="Restricted Area"
| Content-Type: text/html
| Content-length: 61
| <BODY>
| <HTML>
| HTTP/1.1 401 Unauthorized
| </BODY>
|_ </HTML>
| ssl-cert: Subject:
commonName=Test/organizationName=Testing/stateOrProvinceName=FL/countryName=US/organizati
onalUnitName=Test/[email protected]/localityName=test
| Issuer:
commonName=Test/organizationName=Testing/stateOrProvinceName=FL/countryName=US/organizati
onalUnitName=Test/[email protected]/localityName=test
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: shaWithRSAEncryption
| Not valid before: 2022-04-21T19:27:17
| Not valid after: 2032-04-18T19:27:17
| MD5: 27ed 2da8 8b25 57e3 d2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yUi7XwCZ/3n6WkG49FDi3gNpEO8+QX
| rq5E2ZCoEsyrtl4cNgKr12oibHd/FsH2nViymh2yJZpnVkfCTGCYnbURiiSjQXgx
| 4a8XlM4exqEEYC1hfwUCWRytfdS4yybZ3rDTVJDsQFMxUT++NTIayPnlDLA298xZ
| KuXOTzuf6pjUC5EMkncqdec8o4cVO1t4WJCs0iMaKH6tCB3oY80cYK0Z1PzQzYjz
| W5IEUFA9sdz67h79xdQcQHPHZmM=
|_-----END CERTIFICATE-----
| http-methods:
|_ Supported Methods: POST
|_ssl-date: 2022-09-25T15:11:45+00:00; +1s from scanner time.
|_http-server-header: Core FTP HTTPS Server
587/tcp open smtp syn-ack ttl 127 hMailServer smtpd
| smtp-commands: WIN-EASY, SIZE 20480000, AUTH LOGIN PLAIN, HELP
|_ 211 DATA HELO EHLO MAIL NOOP QUIT RCPT RSET SAML TURN VRFY
3306/tcp open mysql syn-ack ttl 127 MySQL 5.5.5-10.4.24-MariaDB
| mysql-info:
| Protocol: 10
| Version: 5.5.5-10.4.24-MariaDB
| Thread ID: 29
| Capabilities flags: 63486
| Some Capabilities: ConnectWithDatabase, InteractiveClient, Support41Auth, SupportsTransactions,
FoundRows, Speaks41ProtocolNew, Speaks41ProtocolOld, IgnoreSigpipes, ODBCClient,
DontAllowDatabaseTableColumn, IgnoreSpaceBeforeParenthesis, SupportsLoadDataLocal,
SupportsCompression, LongColumnFlag, SupportsMultipleResults, SupportsMultipleStatments,
SupportsAuthPlugins
| Status: Autocommit
| Salt: .(zSlIeDa=I:&M3T0/<"
|_ Auth Plugin Name: mysql_native_password
3389/tcp open ms-wbt-server syn-ack ttl 127 Microsoft Terminal Services
| ssl-cert: Subject: commonName=WIN-EASY
| Issuer: commonName=WIN-EASY
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2022-09-24T14:50:53
| Not valid after: 2023-03-26T14:50:53
| MD5: 8db9 a993 1b53 8520 ea59 2236 83b2 cb78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4=
|_-----END CERTIFICATE-----
| rdp-ntlm-info:
| Target_Name: WIN-EASY
| NetBIOS_Domain_Name: WIN-EASY
| NetBIOS_Computer_Name: WIN-EASY
| DNS_Domain_Name: WIN-EASY
| DNS_Computer_Name: WIN-EASY
| Product_Version: 10.0.17763
|_ System_Time: 2022-09-25T15:11:16+00:00
|_ssl-date: 2022-09-25T15:11:45+00:00; +1s from scanner time.
<SNIP…>
We accessed to the FTP server on browser via port 443, and downloaded 2 files
Or we can connect to FTP by command:
┌──(root㉿kali)-[~/Desktop]
└─# ftp 10.129.203.7 21
Reading the files, we identified the Directory on the target server “C:\xampp\htdocs\” is interesting.
We should turn back to Nmap report and try to connect the MySQL service.
We tried to enumerate the MySQL database and check fiona’s permission on it, we knew that Fiona has
write permission on the database (secure_file_priv)
So we can abuse it to write the webshell on the web root directory “C:\xampp\htdocs”.
After we wrote the webshell on the web root “C:\xampp\htdocs” via MySQL service, so we could
connect it on browser like that.
Medium Lab
The second server is an internal server (within the inlanefreight.htb domain) that manages and stores
emails and files and serves as a backup of some of the company's processes. From internal conversations,
we heard that this is used relatively rarely and, in most cases, has only been used for testing purposes so
far.
Step 1: Scanning the target to get information, identifying services are running on it,…
We need the credential to login the common services above, during scanning phase we could not find
the credential, we tried to login FTP with anonymous.
We tried to connect FTP service via port 2121 with anonymous, but it was failed.
We tried to connect FTP service via port 30021 successfully.
We identified an user, simon.
We accessed to simon folder and downloaded mynotes.txt file.
We tried to brute force pop3 service with simon user and the wordlist (mynotes.txt) by hydra tool:
┌──(root㉿kali)-[~/Desktop]
└─# hydra -l simon -P mynotes.txt 10.129.201.127 pop3
The credential that we got:
simon: 8Ns8j1b!23hs4921smHzwn
next step, we use this credential connect to pop3 service (port 110), but it was failed.
We used the credential to login FTP port 2121 and got the flag.txt, .ssh folder
Question: Submit the contents of the flag.txt file on the Administrator Desktop.
Step 1: Scanning the target to get information, identifying services are running on it,…
Following Nmap report, we identified common services like:
SMB: 139, 445
MSSQL: 1433
RDP: 3389
We need the credential to login the common services above, during the scanning phase we could not find
the credential, so we have to enumerate more information related to SMB service.
We detected Home share folder here, so w tried to login to it with Null successfully, this is time to
enumerate on it. We found the another user is John.
We tried to access to all directory on SMB share, finally we got some interesting files like:
• random.txt
• creds.txt
• information.txt
• note.txt
• secrets.txt
The information.txt is the interesting file:
Passwords.txt:
1234567
(DK02ka-dsaldS
Inlanefreight2022
Inlanefreight2022!
TestingDB123
kAkd03SA@#!
48Ns72!bns74@S84NNNSl
SecurePassword!
Password123!
SecureLocationforPasswordsd123!!
(k20ASD10934kadA
KDIlalsa9020$
JT9ads02lasSA@
Kaksd032klasdA#
LKads9kasd0-@
┌──(root💀kali)-[~/Desktop]
└─# rdesktop -u fiona -p '48Ns72!bns74@S84NNNSl' 10.129.203.10
We can see users on the target there!
Back to our information, we have interesting users (fiona, john, simon)
We tried to connect to MSSQL via sqsh tool with fiona’s credential.
The next step, we tried to simulate impersonation! With John
Step by step exploit guide:
#Step 1: Impersonating the SA User
WINSRV02\SQLEXPRESS
1 LOCAL.TEST.LINKED.SRV 0
#Step 3: xp_cmdshell
nt authority\system
HTB{XXXXX _l!nkXXXX_$3rv3r$}