Ransom
Ransom
Platform: HackTheBox | Category: Reversing | Difficulty: N/A | Author: D3v0o0Nu11 | Date: 2026-02-10
Description
We received an email from Microsoft Support recommending that we apply a critical patch to our Windows servers. A system administrator downloaded the attachment from the email and ran it, and now all our company data is encrypted. Can you help us decrypt our files?
Solution Approach
Core idea: Identify the weakness from source review or fingerprinting first. Iterate with incremental payloads instead of guessing.
Steps
-
First, unzip the
.zipfile given. -
Hmm.. We got PE32+ file and encoded
.exefile. -
Let us decompile the PE32+ file.
-
When i tried to check few functions, i found
encryptfunction andencryptFilefunction that could be our interest. -
Notice when i tried to hover the
local_17value. I gotCESREPUSas characters. -
Then for the
local_fvalue in characters isRUandlocal_dvalue in character isE. -
Concate all of them shall give us
ERUCESREPUS. -
Actually we can try to patch the loop here, so we can get the original decrypted file. But, i prefer use a python script to solve this challenge.
-
Before conduct the script, i tried to strings the excel file.
-
Hmm.. Looks like the text we got is reversed, remember it may stored in little endian. Hence the correct string is
SUPERSECURE. -
Let us make the script:
from pwn import *
import os
os.system('clear')
key = list(b'SUPERSECURE')
encFile = read('login.xlsx.enc')
result = []
### applied the same concept as the for loop, but this time we substract it.
counter = 0
for i in encFile:
result.append(i - key[counter % len(key)])
counter += 1
flag = result
print(flag)
OUTPUT
-
Copy all of it and paste it on cyberchef.
-
Got a clue here, Based on it i think it's an excel file??
-
Save the output to a file with
xlsxextension. -
Got the flag!
Flag
REDACTED
Lessons Learned
- Identify the weakness from source review or fingerprinting first.
- Iterate with incremental payloads instead of guessing.
- Reuse the same pattern in future engagements.