Back on track
What else can we get from the /wsman POSTS requests. If we investigate the stream (Right click a packet -> follow
-> TCP Stream) we can deduce that the attacker used the Python PSRP Client program to authenticate with some service and started sending soap+xml data. This makes it likely that the commands we are looking for are hidden in the encrypted data in these packets.
NTMLSSP_AUTH packet found
By reading up on WSMan we learn that WS-Management is used for the management of servers, devices and other applications.
"WS-Management (Web Services-Management) is a DMTF open standard defining a SOAP-based protocol for the management of servers, devices, applications and various Web services"Running a google search for
WSMan decryption returned results for a gist and a blog about decrypting WinRM.
Decrypting winrm traffic from ad hasheswinrm.decrypt.py decrypt WinRMI initially dismissed this as WinRM sounded like a different protocol.
Big mistake! WinRM is simply another implementation of the WS-Management protocol.
Initially I wasn't too confident this script was going to work as the comments underneath the gist aren't too positive. I decided to give it a try anyway. The script takes in an entire pcap file, so it is best to create a new pcap file with only those packets related to the TCP stream we are investigating.
When following a stream Wireshark will automatically filter on these packets only. These can then easily be exported in Wireshark by going to
File -> Export Specified Packets
, we'll be exporting this as
wsman_commands.pcap so we can refence it later.
Next run the Python script:
./winrm_decrypt.py wsman_commands.pcap --password password_from_question_4
on the new
wsman_commands.pcap file, this will create a .xml file with all the commands Base64 encoded.
The command found after decrypting the wsman_commands.pcap
Another hiccupThe XML file only included a single Base64 encoded command. Decoding this in Cyberchef we find that the Command "hostname" was send, but nothing else.
Returning to Wireshark and filtering on
http.request.method == "POST"
packets we find that the user authenticated a second time, this time using a Ruby WinRM Client. Repeating the previous steps of Following the TCP Stream and creating a new PCAP file
File -> Export Specified Packets
we now get a bigger file that includes all the commands send through this Ruby client. 36 commands to be exact.
The second NTLMSSP_AUTH
At this point the file is too big for Mousepad to handle. Since we already figured out that the commands can be found by searching for
<rsp:Arguments>
we can create a
python script to extract all the Base64 commands.
Now all we have to do is go through the extracted commands and figure out what is going on.
Quick note on counting commands
An observation that I do not have an answer too, is that the command "(get-location).path" show up every so often. It is either send automatically or the room creator did not count this command as a "Command executed by the threat actor" and therefore does not count as a first or second command. Also the command send initially through the Python session was not considered the "first" command.
Commands extracted by our Python script