Wareth is a person who always leaving her laptop without sleep, lock, or anything he doing self. He only depend to windows feature for automate handle her laptop. Someday he cant access her account! he said he dont do anything suspicious, but few hours ago he install an app for internet. Can you helpp?!
We are given a network packet capture file and an ad1 image file. From the packet capture, we can infer that data is transmitted using HTTP through the query parameter. The last part of the key contains the index and the value contains the data itself.
After analyzing the disk image, we found new files on the C:\Windows\SysWOW64 directory. One is a screensaver file and another an executable.
The chkmnt.exe executable is just a normal screen capture application. But the sconsvr.scr file is interesting. Since .scr files are basically PE executables, we can reverse-engineer it using DNSpy.
From DNSpy, we found a resource called ss-all-proc.ps1 inside the executable. This script will take a screenshot of every process, encrypts them using AES, and then sends it as an HTTP request just like the one we found on the packet capture.
We can see that the IV will be prefixed when the data is sent using HTTP, but how do we actually get the key? Turns out the key and IV will be exactly the same, since we are using the same seed from the HKCU:\Control Panel\Desktop\ScreenSaveTimeout registry key.
The goal is that we need to decrypt the query parameter value from the HTTP packet using AES with the key and IV from the first 16 characters of the data, and assemble them based on the index on the query parameter key. After creating a script for that, we will get the flag from one of the screen captures.
Solver Script
from scapy.all import *
from scapy.layers.http import *
from urllib.parse import unquote
from base64 import b64decode
from Crypto.Cipher import AES
res = [b""] * 1000
packets = rdpcap("./needsleeppls.pcap")
started = False
filecount = 1
key = b"EarWS9whYYeT2q8f"
for p in packets:
if p.haslayer(IP) and p.haslayer(Raw):
if p.getlayer(IP).dst == "10.21.69.4":
payload = p.getlayer(Raw).load
if b"GET /?vBRqSiWY" in payload:
start = payload.index(b"=") + 1
end = payload.index(b" HTTP")
index_start = payload.index(b"WY") + 2
index = int(payload[index_start:start-1])
if index == 0 and started:
data = b64decode(b"".join(res))
data = data[16:]
cipher = AES.new(key, AES.MODE_CBC, key)
decrypted = cipher.decrypt(data)
with open(f"decrypted_{filecount}.png", "wb") as f:
f.write(decrypted)
res = [b""] * 1000
filecount += 1
elif not started:
started = True
payload = payload[start:end]
payload = unquote(payload).encode("utf-8")
res[index] = payload