We are supplied 2 files: powershell.DMP and challenge.pcap
Since we are provided with the powershell process minidump, we will first find the powershell scripts that are being run in a number of ways: Using power_dump to retrieve the powershell script blocks and variables from memory or simply using strings and skimming for suspicious code.
I will use power_dump to dump the script blocks:

By this way we can restore all suspicious scripts, which looks like a ransomware.
Function Invoke-AESEncryption:
=> This function is used to encrypt a file, making it inaccessible without the encryption key.
Harvesting Files:
Compression and Encryption:
$ins8012h = -join ( (48..57) + (65..90) + (97..122) | Get-Random -Count 24 | % {[char]$_}))Email Setup:
Attachment and Delivery:
MessageBox Ransom Note displays a GUI message box via System.Windows.Forms to the victim with a ransom demand:
Blocking User Input:
Once you understand the full functionality of ransomware, you can follow these steps to get the data back:

Next, take all the attachment content, decode base64 and save it with the name harvest.zip.enc
$ strings -el powershell.DMP | grep -E "^[a-zA-Z0-9]{24}$" | sort | uniq
1NyEcYfKLvdTR2e5ktPUS9CD
AccessibleActionCollapse
AddPropertyValueAtAction
AesCryptoServiceProvider
AllCentralAccessPolicies
AllocateAndInitializeSid
AllowASTAToASTACallChain
AllowConsentToStealFocus
AllowLogonPhonebookEdits
AllowSearchToUseLocation
AlreadyPresentInTypesXml
AppContainerNamedObjects
AppContainerUserCertRead
AppDomainIsBeingUnloaded
ApplicationFileThumbnail
ApplicationSearchHistory
........................
Luckily the key is right at the top after being sorted => 1NyEcYfKLvdTR2e5ktPUS9CD
import os
import hashlib
from Crypto.Cipher import AES
def process_file(file_path):
with open(file_path, 'rb') as file:
data = file.read()
# AES key
key = hashlib.sha256(b'1NyEcYfKLvdTR2e5ktPUS9CD').digest()
# Extract IV and encrypted data
iv = data[:16]
encrypted_data = data[16:]
cipher = AES.new(key, AES.MODE_CBC, iv)
decrypted_data = cipher.decrypt(encrypted_data)
padding_length = decrypted_data[-1]
decrypted_data = decrypted_data[:-padding_length]
return decrypted_data
file_to_decrypt = 'harvest.zip.enc'
if os.path.exists(file_to_decrypt):
decrypted_data = process_file(file_to_decrypt)
output_file = file_to_decrypt.replace('.enc', '')
with open(output_file, 'wb') as file:
file.write(decrypted_data)
Now we have havest.zip but it is protected with password, so we need to find the password.

$ strings -el powershell.DMP | grep "a -tzip"
$arguments = "a -tzip ""$Destination"" ""$Destination"" -mx9 -p$randomPassword"
a -tzip "$Destination" "$Destination" -mx9 -p$randomPassword
a -tzip "{0}" "{1}" -mx9 -p{2}
a -tzip "C:\Users\longnte\Desktop\harvest" "C:\Users\longnte\Desktop\harvest" -mx9 -pmBJ/m(aC
a -tzip "C:\Users\longnte\Desktop\harvest" "C:\Users\longnte\Desktop\harvest" -mx9 -pmBJ/m(aC
$arguments = "a -tzip ""$Destination"" ""$Destination"" -mx9 -p$randomPassword"
a -tzip "C:\Users\longnte\Desktop\harvest" "C:\Users\longnte\Desktop\harvest" -mx9 -pmBJ/m(aC
a -tzip "C:\Users\longnte\Desktop\harvest" "C:\Users\longnte\Desktop\harvest" -mx9 -pmBJ/m(aC
.........................
=> The password for the havest.zip file is mBJ/m(aC
