Flash CTF - Owner Of The Footprints

Owner Of The Footprints Writeup

Overview

The challenge involves identifying an account used for lateral movement between two hosts.

Solution

The attachment unpacks into two KAPE triage collections, one per jump server:

$ ls
2025-03-11T082527_JUMP-SCV-01.zip  2025-03-11T090100_JUMP-SCV-02.zip

The Security log on JUMP-SCV-02 was cleared at 07:49, so its first surviving record is the Event ID 1102 that records the clear itself. JUMP-SCV-01 is untouched and still holds its full history, so we start there.

We open Microsoft-Windows-TerminalServices-RDPClient%4Operational.evtx and look at Event ID 1024 and Event ID 1102, which record the IP addresses and hostnames of the RDP servers.

Neither of those carries the account name. That is in Event ID 1029.

The same records without a GUI, straight out of the collection:

$ python3 -c "
from Evtx.Evtx import Evtx
import re
with Evtx('Microsoft-Windows-TerminalServices-RDPClient%4Operational.evtx') as log:
   for rec in log.records():
       x = rec.xml()
       eid = re.search(r'<EventID[^>]*>(\d+)<', x).group(1)
       if eid in ('1024', '1029', '1102'):
           val = re.search(r'<Data Name=\"(?:Value|TraceMessage)\">([^<]*)<', x).group(1)
           print(re.search(r'SystemTime=\"([^\"]+)\"', x).group(1), eid, val)
"
2025-03-11 07:30:32.802397+00:00 1024 192.168.91.173
2025-03-11 07:31:15.909344+00:00 1029 qh1z2kL7VAbBb2hoiRhk9YZbuqKO2gcmmIbWSARDhPg=-
2025-03-11 07:31:19.806587+00:00 1029 qh1z2kL7VAbBb2hoiRhk9YZbuqKO2gcmmIbWSARDhPg=-
2025-03-11 07:33:22.986666+00:00 1024 192.168.91.173
2025-03-11 07:33:54.509039+00:00 1029 qh1z2kL7VAbBb2hoiRhk9YZbuqKO2gcmmIbWSARDhPg=-
2025-03-11 07:33:54.565020+00:00 1029 qh1z2kL7VAbBb2hoiRhk9YZbuqKO2gcmmIbWSARDhPg=-
2025-03-11 07:33:54.908842+00:00 1102 192.168.91.173

The username is encoded and hashed using SHA-256: Base64(SHA256(UserName)) is = qh1z2kL7VAbBb2hoiRhk9YZbuqKO2gcmmIbWSARDhPg=-. The name goes into the digest as UTF-16LE, the way Windows holds strings internally.

This behaviour is documented in this article.

SHA-256 does not reverse, so instead of attacking the digest we build a candidate list and hash that. The accounts that log in to these machines are local accounts, and the triage collections include the registry hives, so the SAM hive gives us the names.

We hash each name the same way and compare it against the value from Event ID 1029.

Both collections carry C/Windows/System32/config/SAM, and both list the same 64 local accounts, so either hive works as the wordlist:

$ python3 -c "
from regipy.registry import RegistryHive
import hashlib, base64
names = [k.name for k in RegistryHive('SAM').get_key(r'\SAM\Domains\Account\Users\Names').iter_subkeys()]
print(len(names), 'accounts')
target = 'qh1z2kL7VAbBb2hoiRhk9YZbuqKO2gcmmIbWSARDhPg='
for n in names:
   if base64.b64encode(hashlib.sha256(n.encode('utf-16-le')).digest()).decode() == target:
       print('MetaCTF{%s}' % n)
"
64 accounts
MetaCTF{Th3y_w0n7_sUrV1v3_34}

Fifty-nine of the sixty-four accounts share the same Th3y_w0n7_sUrV1v3_ prefix and differ only by a two digit suffix, so nothing but the hash separates the one that actually logged in from the fifty-eight decoys. The match gives us the account that logged in. Wrapped in MetaCTF{}, that is the flag:

MetaCTF{Th3y_w0n7_sUrV1v3_34}

Trust our customers

Interested in joining our team? Let’s connect!