1337 Local CTF: Encrypted Callback — TLS 1.3 Decryption → PowerShell Malware

185 words
1 minute
1337 Local CTF: Encrypted Callback — TLS 1.3 Decryption → PowerShell Malware

Encrypted Callback#

Challenge Context#

The challenge provided a PCAP/PCAPNG and sslkeylog.log. The traffic contained suspicious PowerShell activity over TLS on localhost port 8443.

Reconnaissance#

Important TLS details:

cipher suite: TLS_AES_256_GCM_SHA384 (0x1302)
server sends NewSessionTicket before HTTP responses
HTTP response application-data records start at sequence number 2

Those two details mattered: SHA-384 must be used for HKDF, and TLS record sequence numbers must account for NewSessionTicket records.

Attack Chain#

sslkeylog.log
-> TLS 1.3 application-data decryption
-> GET /stage1 response
-> PowerShell -EncodedCommand
-> AES-CBC key/IV
-> decrypt /stage2.enc
-> reverse telemetry transform
-> flag

Exploitation#

Stage 1 was a Base64-encoded PowerShell downloader. Decoding it revealed:

AES key: 0123456789abcdef0123456789abcdef
AES IV: abcdef0123456789

Stage 2 decrypted to logic that XORed the flag with Sup3rS3cr3t, converted the bytes to hex, reversed the hex string, and base64 encoded it before POSTing telemetry.

The telemetry value was:

{
"machine_id": "DESKTOP-89A4B",
"data": "RTQ4MTQxMjM4MTg1MDAyMDI1MTNBMUI1MzExMEMwNTEyNTMxMjAyNTQwOTA3NDUxMDFGMw=="
}

Decoding process:

import base64
blob = "RTQ4MTQxMjM4MTg1MDAyMDI1MTNBMUI1MzExMEMwNTEyNTMxMjAyNTQwOTA3NDUxMDFGMw=="
hex_reversed = base64.b64decode(blob).decode()
xored = bytes.fromhex(hex_reversed[::-1])
key = b"Sup3rS3cr3t"
flag = bytes(xored[i] ^ key[i % len(key)] for i in range(len(xored)))
print(flag.decode())

Flag#

leet{Waaaaa_tchhbaarklaah}

Lesson Learned#

TLS key logs do not remove all complexity. For TLS 1.3, the cipher-suite hash and record sequence numbers are part of the decryption state.


Cover: Wallhaven ly3gmr.

Share Article

If this article helped you, please share it with others!

1337 Local CTF: Encrypted Callback — TLS 1.3 Decryption → PowerShell Malware
https://achux21.github.io/posts/1337-local-ctf-encrypted-callback/
Author
ACHUX21
Published at
2026-06-27
License
CC BY-NC-SA 4.0
Profile Image of the Author
ACHUX21
CTF player & security researcher
Notice
CTF writeups and security research. New posts coming soon.
Music
Cover

Music

No playing

0:00 0:00
No lyrics available
Categories
Tags
Site Statistics
Posts
28
Categories
3
Tags
81
Total Words
26,137
Running Days
0 days
Last Activity
0 days ago

Table of Contents