Tags: forensics
Rating:
![](https://blog.codydietz.net/images/2024/cyber_apocalypse_2024/data_siege/img.png)
The pcap contains a .NET executable that we can decompile in ILSpy. Inside, we see that the traffic is encrypted, and then base64 encoded before being sent out over the network.
I wrote the following to extract all potentially base64 encoded strings (scapy 2.4.4, it appears scapy 2.5+ will need to change)
```python
import json
from pprint import pprint
from scapy.all import *
packets = rdpcap('capture.pcap')
for packet in packets:
try:
if not isinstance(packet[TCP].payload, scapy.packet.NoPayload):
potential_base64 = str(packet[TCP].payload)[2:-1]
if not('\\x00' in potential_base64 or '\\xFF' in potential_base64):
print(f"{potential_base64=}")
except:
pass
```
Using the decrypt function I added all the base64 from the pcap wrapped with Console.WriteLine(Decrypt())
```c#
using System.Security.Cryptography;
using System.Text;
string Decrypt(string cipherText)
{
try
{
string encryptKey = "VYAemVeO3zUDTL6N62kVA";
byte[] array = Convert.FromBase64String(cipherText);
using (Aes aes = Aes.Create())
{
Rfc2898DeriveBytes rfc2898DeriveBytes = new Rfc2898DeriveBytes(encryptKey, new byte[13]
{
86, 101, 114, 121, 95, 83, 51, 99, 114, 51,
116, 95, 83
});
aes.Key = rfc2898DeriveBytes.GetBytes(32);
aes.IV = rfc2898DeriveBytes.GetBytes(16);
using MemoryStream memoryStream = new MemoryStream();
using (CryptoStream cryptoStream = new CryptoStream(memoryStream, aes.CreateDecryptor(), CryptoStreamMode.Write))
{
cryptoStream.Write(array, 0, array.Length);
cryptoStream.Close();
}
cipherText = Encoding.Default.GetString(memoryStream.ToArray());
}
return cipherText;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine("Cipher Text: " + cipherText);
return "error";
}
}
Console.WriteLine(Decrypt("3a42oeqqUlDFRMc0fU2izQ=="));
Console.WriteLine(Decrypt("ZKlcDuS6syl4/w1JGgzkYxeaGTSooLkoI62mUeJh4hZgRRytOHq8obQ7o133pBW7BilbKoUuKeTvXi/2fmd4v+gOO/E6A0DGMWiW2+XZ+lkDa97VsbxXAwm0zhunRyB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+hKOocQYLG0pOhERLdHDS+yw3KU6RD9Y4LDBjgKeQnjml4XQMYhl6AFyjBOJpA4UEo2fALsqvbU4Doyb/gtg"));
Console.WriteLine(Decrypt("FdbfR3mrvbcyK6+9WQcR5A=="));
Console.WriteLine(Decrypt("bsi2k0APOcHI6TMDnO+dBg=="));
Console.WriteLine(Decrypt("Q2zJpoA5nGWWiB2ec1v0aQ=="));
Console.WriteLine(Decrypt("uib3VErvtueXl08f8u4nfQ=="));
Console.WriteLine(Decrypt("ghck5X9x6380mB3aBi+AY7QIEnzhNuF/pDMz9iWssDg="));
Console.WriteLine(Decrypt("sTRnTjJH0S7yIPUVwWFsNxwMOMxdNiq9OXDRFrCwpPF2UhkfUF0Mw0/YGLpHMCfw"));
Console.WriteLine(Decrypt("zz2ELWwzZYbeI1idIdhMwLyqZ6yatlXwAFOfNGy5QVg="));
Console.WriteLine(Decrypt("YdPbtpi8M11upjnkrlr/y5tLDKdQBiPWbkgDSKmFCWusn5GFkosc8AYU2M7C1+xEHdMgJ3is+7WW099YpCIArFhDNKRZxAM9GPawxOMI+w3/oimWm9Y/7pjGbcpXcC+2X1MTla0M2nvzsIKPtGeSku4npe8pPGS+fbxwXOkZ5kfZgaN33Nn+jW61VP49dslxvH47v97udYEHm8IO+f7OhCfzetKiulh3PN4tlzIB5I+PBdtDbOXnxHj+ygGW25xjyNh1Fbm2kweHL+qlFmPPtyapWYZMd85tPmRYBwevpvu9LO2tElYAcmFJwG8xc9lc9ca03ha2rIh3ioSNws9grVwFW3SjdcyqoGhcN8cr0FPgu2Q0OVKMdYprjRdEEeptdcBMybcYhHs9jcNKZu0R/pgiSbCPuONN67uF2Jw/9Ss="));
Console.WriteLine(Decrypt("ghck5X9x6380mB3aBi+AY7QIEnzhNuF/pDMz9iWssDg="));
Console.WriteLine(Decrypt("sTRnTjJH0S7yIPUVwWFsNxwMOMxdNiq9OXDRFrCwpPF2UhkfUF0Mw0/YGLpHMCfw"));
Console.WriteLine(Decrypt("zz2ELW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EAdQA0AHIANwAzAHIANQB9ACIAIAAtAEEAYwB0AGkAbwBuACAAJABhAGMAdABpAG8AbgAgAC0AVAByAGkAZwBnAGUAcgAgACQAdAByAGkAZwBnAGUAcgAgAC0AUwBlAHQAdABpAG4AZwBzACAAJABzAGUAdAB0AGkAbgBnAHMACgA="));
Console.WriteLine(Decrypt("986ztFYX3Ksf2pHdywqpLg=="));
```
In all of these we get the first two parts of the flag. The last piece was hidden in an encoded powershell script at the end of the pcap
```pwsh
$action = New-ScheduledTaskAction -Execute "C:\Users\svc01\AppData\Roaming\4fva.exe"
$trigger = New-ScheduledTaskTrigger -Daily -At 2:00AM
$settings = New-ScheduledTaskSettingsSet
# 3th flag part:
Register-ScheduledTask -TaskName "0r3d_1n_7h3_h34dqu4r73r5}" -Action $action -Trigger $trigger -Settings $settings
```
`Flag: HTB{c0mmun1c4710n5_h45_b33n_r3570r3d_1n_7h3_h34dqu4r73r5}`