Room: Ransomware
Room scenario. Files on a company accounting computer were locked with the .locked extension. The attacker's demand is a payment, but the incident response team found the sample (ransom.py). Specialists assessed this as weak key generation: the key is not random. Your task is to recover the key, decrypt the financial report (finance.xlsx) and find the audit code inside it.
Inside ransom_case.tar: evidence/*.locked (locked files; the header is the 4-byte SMX1, followed by the encrypted bytes), README_DECRYPT.txt, var/tmp/.svc/ransom.py (the source of the sample), var/log/syslog (local time, time zone in etc/timezone), etc/hostname. The mtime values of the tar files are in UNIX (UTC) time.
Tasks (answers are not submitted, each builds on the previous one):
- Task 1. How does
ransom.pygenerate the key? Which hash, which part of it and which cipher (rc4) were used? - Task 2. When did the encryption begin? Find the
CRONline insyslogthat startedransom.py(take the time zone into account), then by comparing the sample's wait before work (sleep) with the tarmtimevalues of the.lockedfiles, find the window in which thetime.time()value lies. - Task 3. Compute the key for each second in the window and try to decrypt
finance.xlsx.locked: with the correct key the result starts withPK\x03\x04(ZIP). - Task 4. Inside
finance.xlsx(ZIP) there isxl/sharedStrings.xml. The value next to theescrow_reflabel on the Audit sheet is the flag. Other rows (old/orphaned) are decoys.
Flag format BAYROQ{...} (the last 16 characters are lowercase hexadecimal). The hostname is the value in etc/hostname.