Skip to main content

Image Security CTF Writeup: Windows 11 Hardening & Forensics

Published 10 min readMarkdown
Image Security CTF Writeup: Windows 11 Hardening & Forensics

Challenge Description

Category: Forensics
Author: a_person9852

The North Pole’s internal systems are in a fragile state. Your task is to harden a compromised Windows 11 virtual machine before KRAMPUS SYNDICATE activity escalates further.

You are provided a Windows 11 VM intended for VMware (other hypervisors may work). Take a snapshot before starting. Read the README inside the image and answer the forensics questions on the desktop. Remove any files or applications not listed in the README. Do not reverse engineer the scoring engine; it is not intended and will cause you to be ineligible for the prize (details below).

Scoring is handled by C:\aeacus\phocus.exe. It may be flagged as malware but must not be deleted or quarantined! The flag appears in the README at 85+ points. If it does not appear, open a ticket and include the scoring report and forensics questions.

To make the challenge a better experience, here are some things you should know:

  • There are no penalties.

  • OS updates are not required.

  • The main user’s password does not need to be changed, though other accounts may require remediation.

  • Difficulty is approximately CyberPatriot state level, or level 3-4 on this sheet, but a bit easier than this year's round :).

Main user credentials

Username: Santa
Password: Chr157m45C4r0l5!

Other important notes:

  • One piece of malware exists (a RAT) and is not running.

  • During service auditing, stop and disable services instead of deleting them.

  • The scoring service may break after restarts or antivirus interference; this will be evident if the score does not update on the scoring report. If this happens, re-extract the image.

  • A restart of the VM is not needed to fully score the image; a temporary crash screen (BSOD) on restart is expected.

  • If the Automatic Repair screen appears, choose Restart or Advanced options → Turn off your PC.

  • If networking breaks, use Network Reset in Windows settings and restart the VM.

  • If you encounter an error stating that the VM was created by a VMware product that is incompatible, open the .vmx file in a text editor and change the value of virtualHW.version to match your current VMware version.

  • If you have an Apple silicon SoC, follow this guide to convert the image to work on your device. We will not provide official support for this setup. You may ask for help in #general, and a community member may assist you, but we strongly recommend attempting this challenge on a Windows machine with VMware.

  • Vuln hints are available by ticket after first blood.

  • A playtester achieved a passing score in under an hour without scripts, so it is doable.

  • Tar MD5 Hash: 7A10A5D04CF966AF0FE17FC6ACD721F0


Detailed Walkthrough

The challenge required us to act as a system administrator, hardening a compromised Windows 11 VM while simultaneously solving forensics questions embedded in the environment. We began by launching the VM, taking the recommended snapshot, and reviewing the desktop README to understand the authorized state of the system.

Forensics Questions

Before beginning the hardening process, I addressed the forensics questions found on the desktop. Solving these first prevents potential evidence destruction during the cleanup phase.

Question-1 Analysis:

The first question involved a cipher text, given the classical nature of the text and the context of basic cryptography, I suspected a Vigenere cipher.

The key FREQANALYSIS, I applied this key to the cipher text using a standard Vigenere decoder. This successfully decrypted the text to:
Shall I compare thee to a summer's day? Thou art more lovely and more temperate

Question-2 Analysis:

The second question asked for the name of a suspicious startup application. To investigate, I opened the Task Manager and navigated to the Startup apps tab. This revealed a suspicious executable named jokehaha.exe. This confirmed the answer.

Question-3 Analysis:

The final question required analyzing an executable named encrypt.exe. Recognizing this as a Python-compiled executable, I used pyinstxtractor.py to extract the contents.
python3 pyinstxtractor.py encrypt.exe

The extraction produced a .pyc file, encrypt.pyc. I then used the online decompiler PyLingual to reverse the compiled bytecode back into readable Python source code. Upon analyzing the source logic, I located the encryption routine, and created a decryption script:

import base64

primes = (2, 3, 5, 7, 11, 13, 17, 19, 23, 29,31, 37, 41,
          43, 47, 53, 59, 61, 67,71, 73, 79, 83, 89, 97)
KEY = 165

def decrypt(enc):
    data = base64.b64decode(enc)
    out = []
    for i in range(0, len(data), 2):
        x = int.from_bytes(data[i:i+2], "big")
        y = x ^ KEY
        m = primes[(i // 2) % len(primes)]
        a = y // m
        out.append(chr(a))
    return "".join(out)

enc = "AEUBzgKoA6cEVAVBBtQIoQkRC9QNaw9kE8QQ0xIuFvkZMBy7GsobGRwhHnk="
print(decrypt(enc))

The script output: pyinstallermybeloveddd

User and Group Management

With the forensics questions answered, I moved to system hardening, starting with user auditing. Using lusrmgr.msc, I compared the current user list against the authorized users listed in the README.

Two anomalies were immediately apparent:

  1. A user named Grinch existed but was not listed as user.

  2. A user named Kevin was present in the Administrators group.

I proceeded to delete the user account Grinch. For Kevin, I removed the account from the Administrators group to strip elevated privileges.

Policy Enforcement

Next, I opened the Local Security Policy manager (secpol.msc) to enforce stricter security controls.

Password Policy

I navigated to Account Policies -> Password Policy and implemented the following standards:

  • Enforce password history: Set to 10 passwords remembered.

  • Maximum password age: Reduced to 15 days.

  • Minimum password age: Set to 1 day.

  • Minimum password length: Increased to 12 characters.

  • Password must meet complexity requirements: Enabled.

  • Store passwords using reversible encryption: Disabled.

Strong password policies increase the computational cost of cracking credentials and ensure that compromised passwords are rotated out of the system regularly.

After applying these policies, I manually reset the passwords for all users (except Santa) to ensure compliance: net user <username> <new_password>

Account Lockout Policy

To mitigate brute-force attacks, I configured Account Policies -> Account Lockout Policy:

  • Account lockout threshold: 3 invalid logon attempts.

  • Account lockout duration: 60 minutes.

  • Reset account lockout counter after: 60 minutes.

Lockout policies prevent online brute-force attacks by temporarily freezing an account after a set number of failed login attempts.

Audit Policy

I enabled logging to track system activity. Under Local Policies -> Audit Policy, I set all audit categories to log both Success and Failure events.

Comprehensive auditing ensures that both legitimate actions and security incidents (like failed logins or privilege escalation attempts) are recorded for analysis.

User Rights Assignment

Under Local Policies -> User Rights Assignment, I restricted critical system functions:

  • I removed Everyone from all the policies.

  • Allow log on locally: I removed the Guest account.

  • Shut down the system: I removed the generic Users group, restricting this ability to admins.

  • Deny access to this computer from the network: I added Anonymous Logon to prevent unauthenticated network access.

Restricting these rights minimizes the attack surface by preventing unauthorized physical access and stopping anonymous users from connecting via the network.

Security Options

Finally, under Local Policies -> Security Options, I toggled several settings to harden the environment:

  • Interactive logon: Do not display last signed-in: Enabled.

  • Interactive logon: Do not require CTRL+ALT+DEL: Disabled.

  • Network access: Do not allow anonymous enumeration of SAM accounts & Shares: Enabled.

  • Microsoft network client/server: Digitally sign communications (always): Enabled for both.

  • Interactive logon: Number of previous logon to cache: Set to 5.

  • Interactive logon: Prompt user to change password before expiration: Set to 3 days.

These settings prevent information leakage (such as username enumeration) and protect network traffic from Man-in-the-Middle (MitM) attacks via SMB signing.

File and Application Auditing

I manually inspected the file system, specifically C:\Users\, checking each user profile for unauthorized media. I deleted irrelevant video, audio, and image files that violated the clean system policy.

Removing unauthorized files reduces system clutter and eliminates potential steganography vectors or non-compliant content.

Next, I audited installed applications. The README indicated specific authorized software. I removed the following unauthorized tools:

  • Discord

  • Npcap

  • Wireshark

Removing unauthorized software reduces the "living off the land" potential for attackers, specifically removing packet capture tools like Wireshark that could be used for sniffing.

I also noted that several authorized applications were outdated. I downloaded and installed the latest versions of:

  • 7zip_x64.msi

  • Notepad++_x86.exe

  • Chrome-installer.exe

Updating software patches known vulnerabilities (CVEs) that attackers could exploit to gain control of the system. I also set Google Chrome as the system's default browser.

Malware Removal

The challenge description mentioned a RAT and other malware. I performed a targeted search based on common persistence mechanisms and directories.

  1. Downloads Folder: I found suspicious files in Elf1 and Elf2 user download directories. I deleted these immediately.

  2. System32 Rootkit: I located a file named winloader.exe in C:\Windows\System32. This is a classic masquerade; the legitimate Windows boot loader is named winload.exe. The slight spelling difference confirmed it was the RAT mentioned in the briefing. I deleted the file.

  3. Startup Cleanup: Returning to the location identified in Forensics Q2, I deleted jokehaha.exe from the disk.

  4. Miscellaneous: I removed a set of files labeled as "roblox hacks," identifying them as likely malware or unauthorized scripts.

Deleting these files removes active threats and persistence mechanisms, preventing the attacker from maintaining access to the compromised host.

Network and Service Hardening

To secure the network perimeter, I verified that the Windows Defender Firewall was enabled for all profiles.

A host-based firewall filters ingress and egress traffic, blocking unauthorized connections and port scans.

Using compmgmt.msc, I inspected Shared Folders -> Shares. I discovered a non-default share named $Users which exposed user directories. I stopped and removed this share.

Removing unauthorized shares prevents data exfiltration and blocks lateral movement via the SMB protocol.

I then audited system services (services.msc) to reduce the attack surface:

  • Remote Desktop Services: I ensured this was set to Automatic and Running, as RDP access was required for the scenario.

  • Print Spooler: Given the history of vulnerabilities in the Print Spooler (e.g., PrintNightmare), and its lack of necessity here, I stopped and disabled the service.

Disabling the Print Spooler on non-print servers mitigates critical RCE vulnerabilities like PrintNightmare.

Advanced RDP Hardening

Since RDP had to remain active, I applied specific hardening configurations to secure the protocol.

Registry Configuration

  • I opened regedit and navigated to:
    HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp
    I changed the UserAuthentication value to 1 to enforce authentication at the network level.

Network Level Authentication (NLA) requires users to authenticate before a full RDP session is established, protecting the server from denial-of-service attacks.

Group Policy Configuration

  • I used gpedit.msc to configure under: Computer Configuration → Administrative Templates → Windows Components → Remote Desktop Services → Remote Desktop Session Host
  1. Device and Resource Redirection:

    I enabled the following policies to prevent data exfiltration via RDP channels (effectively disabling the features):

    • Do not allow drive redirection.

    • Do not allow clipboard redirection.

    • Do not allow COM port redirection.

    • Do not allow LPT port redirection.

    • Do not allow supported Plug and Play device redirection.

      Disabling redirection prevents attackers from transferring files between the host and client or introducing malware via mounted drives.

  2. Session Time Limits:

    Under Session Time Limits, I enforced strict timeouts to prevent stale sessions from being hijacked:

    • Active but idle RDP sessions: 15 minutes.

    • Disconnected sessions: 15 minutes.

    • End session when time limits are reached: Enabled.

      Enforcing session limits ensures that abandoned administrative sessions are terminated, reducing the risk of session hijacking.

  3. Security Settings:

    Under Security, I enforced strong encryption:

    • Require use of specific security layer: Enabled (SSL).

    • Set client connection encryption level: Enabled (High).

    • Always prompt for password upon connection: Enabled.

      High-level encryption ensures the confidentiality and integrity of the RDP session, protecting credentials and data in transit.

Conclusion

After completing these steps, I checked the scoring report generated by phocus.exe. The score had surpassed the 85-point threshold required for the flag release. I opened the README file again, and the final flag was displayed.


Final Flag

csd{5L4Y_R1d3_15_0v3r_r4t3d_lf1LQ1m7}

About the author

  • Barely Tame CTF Player. Debugging Addict. Worshipper of Wi-Fi Signals. Human? Depends on the Ping.

No comments yet. Be the first to comment.

More from this blog