Wargames.MY 2024
Writeup by TFS

Cryptography
Credentials - User Credential Extraction
Description: We found a leak of a blackmarket website’s login credentials. Can you find the password of the user osman and successfully decrypt it
Solution
Files Provided
passwd.txt: A large file containing numerous lines of hash-like or seemingly random strings, some of which appear in a special format (e.g.,
ZJPB{...}).user.txt: A text file listing many usernames, including the target user
osman.
Goal
Identify which line in
passwd.txtcorresponds to the userosman.Extract and decrypt the user’s password.
Present the password in the final flag format:
wgmy{...}.
Solution
Step 1: Matching the User to the Password
We are given two files:
user.txt: A list of users (one username per line).passwd.txt: A similarly sized list of hashed/encoded/obfuscated passwords (one per line).
In typical username-password leaks, the order of lines in user.txt maps directly to the order in passwd.txt. This means:
Line N in
user.txtcorresponds to Line N inpasswd.txt.
Steps:
Scroll through
user.txt(or search) to find the line containingosman.Note its line number.
Step 2: Inspecting the Corresponding Line in passwd.txt
Using the line number from user.txt, locate the corresponding line in passwd.txt. For example, suppose the line contains:
Observations:
The segment outside the braces is
ZJPB.The segment inside the braces is
e6g180g9f302g8d8gddg1i2174d0e212.
We are given a hint that the flag format should be wgmy{...}. This implies a relationship between ZJPB and wgmy.
Step 3: Recognizing the Cipher Shift
Comparing ZJPB with wgmy, we observe:
Each letter has shifted backwards by 3 positions in the alphabet.
Uppercase letters become lowercase:
Thus, ZJPB becomes wgmy.
Step 4: Decoding the Braced String
Inside the braces, apply the same -3 shift to each letter. Digits remain unchanged. For example:
Decoded result:
Step 5: Constructing the Final Flag
To construct the final flag, replace ZJPB with wgmy and use the decoded string:
Final Answer
The decrypted password (and final flag) for osman is:
Summary
Matched the username
osmanto the correct line inpasswd.txt.Decoded the
ZJPB{...}string using a -3 shift cipher.Presented the final flag in the required format.
Remarks/Tags/Lesson Learned
Sequential Mapping: Always consider the possibility of one-to-one mapping in files like
user.txtandpasswd.txtwhen no additional information is provided.Cipher Recognition: Simple substitution ciphers (e.g., Caesar cipher with a fixed shift) are commonly used in CTF challenges. Knowing how to identify and decode them is essential.
Attention to Details: Recognizing patterns such as uppercase-to-lowercase conversion and numeric invariance can simplify decoding tasks.
Iterative Problem Solving: Breaking the challenge into smaller steps (e.g., matching, inspecting, decoding, constructing) ensures clarity and minimizes errors.
Flag Formats: Understanding the expected format (
wgmy{...}) can guide your decoding process and validate your final result.
Hohoho 3 - CRC Affine Linearity Exploitation
Description: Santa Claus is coming to town! Send your wishes by connecting to the netcat service!
Solution
Files Provided
server.py: The server script containing the logic for registering, logging in, and interacting with the "wishlist."
Goal
Recover the secret value
mfrom the server's token generation process.Generate Santa's valid token using the recovered
m.Log in as Santa Claus and access the wishlist.
Extract the flag from the wishlist.
Solution
Step 1: Analyze the Code
The server script uses a custom token generation process:
A random 128-bit value
mis generated at runtime.The
generateTokenfunction computes a CRC-like value usingmand the provided name.The user provides a name and a token. The server verifies the token using the same logic.
We aim to recover m by analyzing name-token pairs.
Step 2: Collect Name-Token Pairs
The script relies on deterministic token generation. By collecting multiple name-token pairs, we can set up a system of equations to solve for m.
Sample name-token pairs:
Step 3: Solve for m Using Z3
We wrote a script (recover_m_z3.py) to solve for m:
Running the script gives:
Step 4: Generate Santa's Token
Using the recovered m, we generate a valid token for "Santa Claus":
Result:
Step 5: Login and Access Wishlist
We use the generated token to log in as Santa Claus:
Access the wishlist:
Final Answer
The decrypted flag is:
Summary
Recovered the secret value
mby solving the system of equations derived from name-token pairs.Used
mto generate a valid token for "Santa Claus."Logged in as Santa Claus and accessed the wishlist to retrieve the flag.
Remarks/Tags/Lesson Learned
Custom Token Systems: Analyzing token generation processes often reveals vulnerabilities when they rely on deterministic functions.
Z3 Solver: Using symbolic execution tools like Z3 is essential for solving complex constraints in cryptographic challenges.
Systematic Approach: Collecting data, forming equations, and solving incrementally simplifies CTF challenges.
CRC-Like Functions: Understanding common patterns in CRC or hash algorithms can aid in reversing such processes effectively.
Teamwork and Tools: Challenges like these highlight the importance of both logical analysis and technical tools in solving CTF tasks.
Rick'S Algorithm - RSA Blind Signature Attack
Description: My friend Rick designed an alogrithm that is super secure! Feel free to try it!
Misc
The DCM Meta - Hexadecimal Parsi
Description: [25, 10, 0, 3, 17, 19, 23, 27, 4, 13, 20, 8, 24, 21, 31, 15, 7, 29, 6, 1, 9, 30, 22, 5, 28, 18, 26, 11, 2, 14, 16, 12]
Solution
Files Provided
challenge.dcm: A DICOM file containing private metadata tags with hidden information.
Command Outputs
The metadata consists of private tags with hexadecimal values. Each tag's first byte (e.g., 66 from 66\00\00\00) contains the hidden information.
Goal
Extract the hidden data from the DICOM metadata.
Apply the scramble list to reveal the final hidden flag.
Present the flag in the standard format:
WGMY{...}.
Solution
Step 1: Extract Relevant Bytes
From the metadata, focus on the first byte of each 4-byte value. The resulting sequence is:
Step 2: Convert Hex to ASCII
Convert the hex values to ASCII:
This forms an intermediate 32-character string:
Step 3: Apply Scramble List
The challenge provides a scramble list:
This list reorders the indices of the hex string. The new string S' is constructed by mapping:
S'[0] = S[25]S'[1] = S[10]S'[2] = S[0]...
Applying this reordering gives the final string:
Step 4: Wrap as Flag
Wrap the resulting string in the standard CTF flag format:
Final Answer
The decrypted flag is:
Summary
Extracted the first byte from each 4-byte value in the DICOM metadata.
Converted these bytes from hex to ASCII, forming an intermediate string.
Used the provided scramble list to reorder the string and reveal the hidden data.
Wrapped the result in the standard flag format.
Remarks/Tags/Lesson Learned
Metadata Analysis: Private metadata tags in DICOM files can store hidden information that requires manual extraction.
Hexadecimal Conversion: Understanding hex-to-ASCII conversion is essential for decoding hidden strings in binary files.
Scramble Lists: Challenges often involve reordering data using scramble lists. Automating this process with scripts can save time.
CTF Practices: Breaking challenges into smaller steps—like extraction, conversion, and reordering—ensures a systematic and accurate solution.
Christmas GIFt - GIF Frame Extraction
Description: Here is your christmas GIFt from santa! Just open and wait for it..
Solution
Files Provided
gift.gif: A GIF file that contains hidden information across its frames.
Goal
Analyze the GIF file to extract hidden data.
Find the flag embedded within the file.
Solution
Step 1: Analyze the File Metadata
Using exiftool, we inspect the metadata of gift.gif:
Key Observations:
The file contains 1402 frames.
The hidden data is likely embedded in the last frame, as suggested by the challenge description.
Step 2: Extract Frames
To examine the frames, we use GIMP or any frame extraction tool to render all 1402 frames. Follow these steps in GIMP:
Open
gift.gif.The software automatically renders all 1402 frames as separate layers.
Navigate to the last frame.
Step 3: Locate the Flag
Upon inspecting the 1402nd frame, the following flag is revealed:

Final Answer
The extracted flag is:
Summary
Metadata Analysis: We analyzed the metadata of the GIF file and identified that it contained 1402 frames.
Frame Extraction: Using GIMP, we rendered all frames and inspected the final frame.
Flag Retrieval: The flag was found embedded in the last frame of the GIF.
Remarks/Tags/Lesson Learned
Frame Analysis: When working with GIF files, extracting and analyzing individual frames can reveal hidden information.
Metadata Inspection: Tools like
exiftoolare essential for identifying important details such as frame counts and durations.CTF Techniques: Challenges involving GIFs often hide data in specific frames, requiring systematic examination of the entire file.
Tool Familiarity: Knowledge of image manipulation software like GIMP is invaluable for frame-based challenges.
Invisble Ink - GIF Transparency Steganography
Description: The flag is hidden somewhere in this GIF. You can't see it? Must be written in transparent ink.
Solution
Files Provided
challenge.gif: A GIF file with multiple frames, some of which contain hidden data.
Goal
Extract the hidden flag embedded within the frames of the GIF.
Solution
Step 1: Analyze the File Metadata
Using exiftool, we inspect the metadata of challenge.gif:
Key Observations:
The file contains 7 frames.
Transparency is used, suggesting hidden information might be embedded using alpha layers or color maps.
Step 2: Analyze Frames
To examine the individual frames, we use Stegsolve.jar:
Open
challenge.gifin Stegsolve.Use the Frame Browser function to analyze all 7 frames.
Frames 5 and 6 show unusual visuals, indicating they likely contain the hidden flag.
Step 3: Save and Analyze Frames 5 and 6
Save frames 5 and 6 as separate PNG files.
Open frame 5 in Stegsolve and apply the Alpha Plane 7 filter. This reveals half of the flag.
Save the processed frame 5 as a new PNG file.
Open frame 6 in Stegsolve and apply the Random Color Map 3 filter. This reveals the other half of the flag.
Save the processed frame 6 as another new PNG file.
Step 4: Combine Processed Frames
Open the processed frame 5 in Stegsolve.
Use the Image Combiner function to merge it with the processed frame 6.
The full flag is now visible.
Step 5: Extract the Flag
The combined image reveals the flag:

Final Answer
The extracted flag is:
Summary
Metadata Analysis: We analyzed the GIF's metadata and identified frames 5 and 6 as containing hidden data.
Frame Extraction: Using
Stegsolve, we examined individual frames and applied appropriate filters.Flag Reconstruction: Combining the processed frames revealed the complete flag.
Remarks/Tags/Lesson Learned
Transparency Layers: Hidden data in GIFs often utilizes transparency or alpha channels. Familiarity with these techniques is crucial.
Frame Browser for GIFs: Using the Frame Browser function in tools like
Stegsolveallows for easy separation and inspection of frames, which is essential for identifying where data is embedded.Filters in Stegsolve: Different filters (e.g., Alpha Plane or Random Color Map) can reveal obscured information in images, highlighting the importance of trying various options.
Image Combining: When fragments of information are spread across frames, combining processed images systematically can uncover the full hidden data.
Tool Expertise: Developing proficiency with tools like
Stegsolvenot only aids in solving challenges but also improves efficiency in recognizing common steganography patterns in CTFs.
Watermarked? - Steganography with Watermark Anything
Description: Got this from social media, someone said it's watermarked, is it?
Solution
Files Provided
watermarked.gif: A GIF file with multiple frames, potentially containing hidden watermarks.
Goal
Split the GIF into individual frames for processing.
Decode watermarks embedded in each frame using the "Watermark Anything" framework.
Compile the extracted messages to identify any coherent data, such as a flag or meaningful text.
Solution
Step 1: Frame Extraction
The GIF was split into 78 individual frames using the ffmpeg tool.
Command Used:
This command created PNG images named sequentially (e.g., frame_001.png, frame_002.png).
Step 2: Watermark Decoding
Each frame was processed using the following Python script leveraging the "Watermark Anything" framework:
Key Notes:
The script utilized the "Watermark Anything" framework available on GitHub.
It was executed in the provided Colab notebook for GPU acceleration.
Step 3: Key Output
Decoded messages from frames 42 to 54 revealed the flag:
Compiling the meaningful segments from these messages forms the flag:
Final Answer
The reconstructed flag is:
Summary
Frame Extraction: We used
ffmpegto split the GIF into 78 frames for individual analysis.Watermark Decoding: The "Watermark Anything" framework decoded hidden messages from the extracted frames.
Flag Compilation: Combining meaningful segments from the decoded messages revealed the hidden flag.
Remarks/Tags/Lesson Learned
GIF Frame Splitting: Tools like
ffmpegare efficient for extracting individual frames from animated GIFs.Watermark Detection: The "Watermark Anything" framework is highly effective for identifying and decoding embedded messages in images.
Binary-to-ASCII Conversion: Understanding binary encoding and ASCII decoding is crucial for reconstructing meaningful messages from raw data.
Sequential Processing: Systematic frame-by-frame analysis helps isolate relevant information, especially in steganographic challenges.
Colab for GPU Acceleration: Leveraging cloud platforms like Colab can significantly speed up computational tasks like watermark detection.
Web
Warmup 2 - Kubernetes Vault Exploit
Description: Good morning everyone (GMT+8), let's do some warmup! Check out dart.wgmy @ 13.76.138.239
Solution
Files Provided
Dart Web Application Source Code: A server using the Jaguar web framework.
Tools Used
curl: For HTTP requests to exploit the directory traversal vulnerability.
Goals
Identify potential vulnerabilities in the Dart web application.
Exploit the vulnerability to access the environment variable.
Extract the flag.
Solution
Step 1: Analyze the Web Application
Source Code Review:
The web application uses the Jaguar framework and serves static files from
/app/public:
Vulnerability Identification:
A known issue in the Jaguar framework (https://github.com/Jaguar-dart/jaguar/issues/157) allows directory traversal via
..%2Fin URLs.This can potentially expose sensitive files, including environment variables.
Step 2: Exploiting Directory Traversal
Crafting the Exploit:
Using
curl, construct a URL to access/proc/self/environthrough directory traversal:
Output:
The environment variable dump includes the flag:
Final Answer
The extracted flag is:
Summary
Source Code Analysis: Identified a directory traversal vulnerability in the Jaguar framework.
Exploit Construction: Used
curlto exploit the vulnerability and access/proc/self/environ.Flag Retrieval: Extracted the flag from the environment variable dump.
Remarks/Tags/Lesson Learned
Framework Vulnerabilities: Be aware of known issues in web frameworks, as they can introduce critical vulnerabilities.
Environment Variables: Sensitive information should not be stored in plain-text environment variables accessible by the application.
Kubernetes Security: Ensure proper container security practices, such as restricting access to
/procand other sensitive directories.Exploit Construction: Crafting precise directory traversal paths can effectively exploit vulnerable applications.
Secret 2 - Dart Jaguar Directory Traversal
Description: Can you get the secret this time? Check out nginx.wgmy @ 13.76.138.239
Solution
Files Provided
Dart Web Application Configuration: Includes server setup and Vault integration.
Nginx Configuration: Contains rules for proxying and access control to the Vault.
Tools Used
curl: For HTTP requests to exploit LFI and retrieve the flag.
jq: For parsing JSON responses.
Goals
Exploit the Local File Inclusion (LFI) vulnerability to access the service account token.
Use the service account token to authenticate with the Vault.
Retrieve the flag stored in the Vault.
Solution
Step 1: Retrieve Service Account Token
Exploiting LFI:
The LFI vulnerability from the Warmup challenge is used to access the Kubernetes service account token:
The token is saved to
token.txtfor subsequent use.
Step 2: Obtain Vault Client Token
Using the Service Account Token:
The service account token is used to authenticate with the Vault's Kubernetes login endpoint:
The
VAULT_TOKENis extracted from the JSON response.
Step 3: Retrieve the Flag
Accessing the Vault API:
With the Vault client token, send a request to retrieve the flag stored in the
kvsecret engine:
Output:
The response contains the flag in the
datasection.
Final Answer
The extracted flag is:
Summary
Service Account Token Extraction: Used LFI to access the Kubernetes service account token.
Vault Authentication: Authenticated with the Vault API using the service account token to obtain a client token.
Flag Retrieval: Queried the Vault to extract the flag.
Remarks/Tags/Lesson Learned
LFI Exploitation: Leveraging directory traversal vulnerabilities can expose sensitive credentials like service account tokens.
Vault Access: Properly securing Vault authentication methods is crucial to prevent unauthorized access.
IP Restrictions: Misconfigured access controls (e.g., allowing spoofed IPs) can undermine security measures.
Time-Sensitive Tokens: The use of short-lived tokens increases the complexity for attackers but can still be exploited if immediate actions are possible.
Dear Admin - Twig Template Injection
Description: Capture the admin's heart with your poetic words, and they might share their secrets in return. ðŸŽ
Solution
Files Provided
Source Code: Includes
index.phpandadmin.phpfiles.Dockerfile Configuration: Highlights PHP settings (
register_argc_argv=On).
Tools Used
Burp Suite: For crafting and sending HTTP requests.
Python FTP Server: To host malicious Twig templates.
Goals
Analyze the Twig templating engine integration.
Leverage the
--templatesPathvulnerability for Remote Code Execution (RCE).Retrieve the flag by bypassing restrictions and exploiting the application.
Solution
Step 1: Analyzing the Web Application
Twig Integration:
The application uses Twig templating in the
admin_review.twigtemplate via theadmin.phpscript:
Relevant Observations:
The
register_argc_argv=Onsetting allows passing arguments viaargvto the PHP script.Twig’s
--templatesPathargument can be used to specify a custom template path.
Reference:
The research article on Assetnote explains how to exploit this feature: https://www.assetnote.io/resources/research/how-an-obscure-php-footgun-led-to-rce-in-craft-cms
Step 2: Bypassing the Blacklist
Blacklist in
config.php:Bypass Technique:
Use string concatenation to circumvent the
systemrestriction:
Step 3: Hosting the Malicious Template
Setup FTP Server:
Host the malicious Twig template using Python’s FTP library:
Malicious Template Payload:
Step 4: Exploiting the Application
HTTP Request via Burp Suite:
Submit the crafted payload to exploit the
--templatesPathargument:
Result:
The payload sends the flag to the specified webhook.
Final Answer
The extracted flag is:
Summary
Twig RCE Exploitation: Exploited
--templatesPathin Twig to achieve RCE.Blacklist Bypass: Circumvented forbidden function checks using string concatenation.
Payload Execution: Used a custom FTP-hosted Twig template to retrieve the flag.
Remarks/Tags/Lesson Learned
Misconfigured PHP Settings: Improper use of
register_argc_argvcan expose applications to exploitation.Template Path Injection: Avoid allowing user-defined template paths without strict validation.
Blacklist Limitations: Function blacklists are insufficient for securing applications against determined attackers.
WordMarket - WooCommerce Plugin LFI Exploit
Description: I’ve set up a WordPress eCommerce site for a client. Can you check if it’s secure enough for production? Give it a look and see if anything stands out.
Solution
Files Provided
WordPress Instance: Includes WooCommerce plugin and custom plugins.
Plugins:
cities-shipping-zones-for-woocommercewgmy-functions
Tools Used
curl: For interacting with WordPress REST API and admin-ajax endpoints.
Burp Suite: For intercepting and modifying HTTP requests.
Goals
Exploit the custom plugin (
wgmy-functions) to retrieve a secret.Leverage the secret to create a new WordPress user with administrative privileges.
Use the
cities-shipping-zones-for-woocommerceplugin to achieve Local File Inclusion (LFI) and extract the flag.
Solution
Step 1: Analyze the wgmy-functions Plugin
REST Endpoint to Add User:
The
user_creation_menufunction allows adding a new user if the correct secret is provided.
Fetching the Secret:
The
get_configfunction reveals the secret whenswitch=1is sent via theadmin-ajax.phpendpoint:
Retrieve the Secret:
Use the following
curlcommand:Output:
Step 2: Add a New User
Create User:
Use the retrieved secret to add a
shop_manageruser:Output:
Log In:
Use the newly created credentials to log into WordPress.
Step 3: Exploit LFI in cities-shipping-zones-for-woocommerce Plugin
Vulnerable Code:
The
wc_sanitize_option_wc_csz_set_zone_locationsfunction usesinclude()without sufficient sanitization:
LFI Exploitation:
Intercept the request in Burp Suite and modify the
wc_csz_set_zone_countryparameter to include a path traversal payload:
Flag Extraction:
The response body contains the flag.
Final Answer
The extracted flag is:
Summary
Secret Extraction: Retrieved the secret via an insecure
admin-ajax.phpendpoint.User Creation: Used the secret to create a
shop_manageruser.LFI Exploitation: Leveraged the vulnerable
include()function to access sensitive files.
Remarks/Tags/Lesson Learned
REST API Security: Secure REST endpoints with proper authentication and input validation.
File Inclusion Vulnerabilities: Avoid dynamic file inclusion without strict sanitization and validation.
Plugin Hardening: Regularly audit plugins for potential vulnerabilities, especially those involving user-controlled input.
myFile - PhantomJS Arbitrary File Read
Description: Built a file sharing website using ChatGPT! Feel free to try it!
Solution
Files Provided
The challenge comes with the following files:
Goals
Exploit the PhantomJS CVE-2019-17221 vulnerability.
Read sensitive files from the server.
Retrieve admin credentials.
Log in to the admin dashboard and retrieve the flag.
Solution
Step 1: Analyze the Report Functionality
The report.php file lets users submit a URL for the admin bot to check. The admin bot runs PhantomJS version 2.1.1, which is vulnerable to CVE-2019-17221, allowing arbitrary file reads.
Relevant snippet from report.php:
Step 2: Crafting the Exploit
We exploit PhantomJS by hosting a malicious page that uses an XMLHttpRequest (XHR) to read local files via the file:// protocol. The payload is designed to extract the contents of /var/www/html/report.php.
Malicious HTML payload:
Step 3: Execute the Exploit
Host the malicious HTML page on a server.
Submit the hosted page’s URL to the
report.phpform.Capture the admin bot’s response via a webhook.
Step 4: Extract the Admin Credentials
The response reveals the content of report.php, which includes the following:
The admin password is: ccc9851c3ce6ceb05707bb796e49e8b02d9ce15ef1cfb8318f6baadde09cb6bd.
Step 5: Login and Retrieve the Flag
Use the credentials to log in at
admin.php.Download the flag from the admin dashboard.
Final Answer
The flag is:
Lessons Learned
PhantomJS Vulnerability: Ensure web tools like PhantomJS are updated to mitigate known vulnerabilities.
File Inclusion Risks: Restrict file protocols such as
file://and enforce strict URL validation.Credential Exposure: Avoid hardcoding sensitive information like passwords in server-side scripts.
Webhook Analysis: Use webhooks effectively to capture and analyze server responses during exploitation.
Wizard's Chamber - Spring Expression Language Exploit
Description: Can you craft the right incantation to reveal the hidden flag?
Solution
Files Provided:
ChamberController.java: Contains the main controller logic for handling user inputs and rendering templates.
block.html: Template used for displaying blocked messages.
index.html: Main template for the application interface.
Dockerfile: Configuration for building and running the application in a containerized environment.
The rest of the files are standard resources and build files, not directly relevant to solving the challenge.
Tools Used
Spring Framework libraries:
org.springframework.cglib.core.ReflectUtilsandorg.springframework.util.Base64Utils.
Steps to Solve
Step 1: Understand the Environment
The website allows executing SpEL code with certain restrictions. The given code snippet demonstrates server-side logic that:
Filters potentially malicious keywords using a Web Application Firewall (WAF):
Executes user-provided SpEL expressions using
SpelExpressionParser.Implements OpenRASP, which blocks runtime-level malicious actions.
Step 2: Analyze the Exploitation Path
Despite restrictions, we can bypass the WAF by using:
String concatenation:
T ("..." + "...")Space manipulation:
T (instead ofT(
Step 3: Load a Custom Class
The OpenRASP protection can be bypassed by loading a custom-crafted Java class using Spring Framework libraries. This involves:
Crafting the Payload:
Use
T(org.springframework.cglib.core.ReflectUtils).defineClassto load the class.Base64 encode the custom class and decode it using
T(org.springframework.util.Base64Utils).decodeFromString.
Creating the Evil Class: Write and compile a malicious class (
EvilClass.java) to read all files in/:Base64 Encoding the Compiled Class:
Step 4: Craft the Payload
Modify the payload to load the custom class and access its static result field:
Replace BASE64_ENCODED_CLASS_HERE with the Base64-encoded string of the compiled EvilClass.class.
Step 5: Execute the Payload
Send the crafted payload to the application through the provided SpEL execution interface. The payload will:
Load the custom
EvilClass.Execute its static initializer block to read file contents.
Retrieve the file data via
EvilClass.result.
Final Step: Retrieve the Flag
By executing the payload, the flag is revealed:
Blockchain
Guess it - Storage Slot Manipulation
Description: Santa Clause has been kidnapped and is kept in a secret dungeon, can u unlock this contract and save him?
Solution
Files Provided
Setup.sol: Deploys the
GuessItcontract and verifies if the challenge is solved.GuessIt.sol: Contains the main challenge logic, including a key stored in a specific storage slot.
Goal
Calculate the correct storage slot based on the contract's logic.
Retrieve the key stored at the slot.
Send a transaction to unlock the contract.
Retrieve the flag upon solving the challenge.
Solution
Step 1: Launching the Instance
The challenge starts by launching an instance of the smart contract using the provided curl command:
Command:
Output:
Step 2: Connecting to the Blockchain
Using the provided RPC endpoint, connect to the private blockchain network:
Code:
Output:
Step 3: Calculating the Storage Slot
The key is stored in the contract's storage. Calculate the correct storage slot using the keccak256 hash of the isKey constant and the mapping's position.
Code:
Output:
Step 4: Retrieving the Key
Retrieve the key stored at the calculated slot:
Code:
Output:
Step 5: Unlocking the Contract
Send a transaction to call the unlock function in the contract using the retrieved key:
Code:
Output:
Step 6: Retrieving the Flag
After successfully unlocking the contract, return to the challenge interface and retrieve the flag:
Final Answer
The extracted flag is:
Summary
Instance Setup: The blockchain instance was initialized with provided credentials.
Storage Slot Calculation: The correct storage slot was calculated using the
keccak256hash function.Key Retrieval: The key stored in the calculated slot was fetched from the contract's storage.
Contract Unlocking: A transaction was crafted and sent to unlock the contract using the retrieved key.
Flag Retrieval: The successful transaction enabled the retrieval of the hidden flag.
Remarks/Tags/Lesson Learned
Storage Analysis: Understanding how Ethereum contracts store data in storage slots is essential for solving smart contract challenges.
Keccak256 Usage: Calculating mapping slots with
keccak256is a critical skill for analyzing contract storage.Web3.py Proficiency: Familiarity with Web3.py allows efficient interaction with Ethereum-based blockchains.
Transaction Crafting: Knowledge of ABI encoding and crafting function calls is vital for smart contract interactions.
Debugging Blockchain Interactions: Iteratively checking connection, storage data, and transaction results ensures accurate solutions.
Dungeons and Naga - Smart Contract Exploit
Description: The developer of this protocol really loves the movie so he decided to build a decentralized game out of it that lives on chain. He has spent all his life saving and really want the game to succeed. The game sets you on an adventure to find hidden treasure.
Solution
Files Provided
Setup.sol: Deploys the
DungeonsAndDragonscontract, funds it with 100 ETH, and defines the challenge's success condition (draining the contract balance to zero).DungeonsAndDragons.sol: Implements game mechanics such as creating characters, completing dungeons, fighting monsters, and defeating the final dragon.
Goal
Predict the randomness used in the game's mechanics.
Level up the character quickly by exploiting vulnerabilities.
Defeat the final dragon to drain the contract balance.
Retrieve the flag after completing the challenge.
Solution
Step 1: Launching the Instance
To start the challenge, launch the blockchain instance using the provided curl command:
Command:
Output:
Step 2: Connecting to the Blockchain
Using the RPC endpoint, connect to the private blockchain network and retrieve the game contract address:
Code:
Output:
Step 3: Exploiting Predictable Randomness
The fateScore in functions such as fightMonster() and finalDragon() is derived from:
Since msg.sender and salt are known, we can compute the fateScore in advance to ensure success.
Code:
Step 4: Exploiting Level-Up Vulnerabilities
Create a weak monster with low health and attack to level up the character rapidly:
Code:
Repeatedly fight the monster to gain levels quickly without difficulty.
Step 5: Defeating the Final Dragon
Once the character reaches level 20, attempt the final dragon fight. Use the predicted fateScore to ensure success:
Code:
Output:
Step 6: Retrieving the Flag
After defeating the final dragon, return to the challenge interface and retrieve the flag:
Final Answer
The extracted flag is:
Summary
Instance Setup: The blockchain instance was initialized with provided credentials.
Randomness Exploitation: Predictable randomness was exploited to guarantee success in battles.
Level-Up Exploitation: Weak monsters were created and repeatedly fought to level up rapidly.
Dragon Fight: The final dragon was defeated using the predicted
fateScore.Flag Retrieval: The successful transaction drained the contract balance, enabling flag retrieval.
Remarks/Tags/Lesson Learned
Predictable Randomness: Understanding and exploiting randomness in contract logic is critical for smart contract challenges.
Game Mechanics: Manipulating in-game mechanics such as monster creation can provide shortcuts to success.
Web3.py Usage: Familiarity with Web3.py enables efficient interaction with Ethereum-based blockchains.
Iterative Debugging: Step-by-step validation ensures smooth execution, from connecting to the blockchain to retrieving the flag.
Transaction Crafting: Proficiency in crafting transactions with ABI encoding is essential for smart contract interaction.
Death Star 2.0 - Reentrancy Attack
Description: The Death Start is under development but the darkside ran out of funds, so they reached out to the public to help. Can you stop the Death Star from being developed?
Solution
Files Provided
DarksidePool.sol: Interacts with the
DeathStarcontract, allowing ETH deposits and withdrawals. Contains utility functions but no vulnerabilities.DeathStar.sol: Implements the core functionality and includes a critical reentrancy vulnerability in the
withdrawEnergyfunction.Setup.sol: Deploys and funds the
DeathStarandDarksidePoolcontracts. Marks the challenge as solved when theDeathStarcontract’s balance is drained.
Goal
Identify and exploit the reentrancy vulnerability in the
withdrawEnergyfunction.Deploy an exploit contract to recursively withdraw funds.
Drain the
DeathStarcontract’s balance to zero.Retrieve the flag upon successful exploitation.
Solution
Step 1: Launching the Instance
To initiate the challenge, launch the blockchain instance using the provided curl command:
Command:
Output:
Step 2: Connecting to the Blockchain
Using the provided RPC endpoint, connect to the private blockchain and retrieve the DeathStar contract address:
Code:
Output:
Step 3: Analyzing the Vulnerability
The withdrawEnergy function in the DeathStar contract contains a reentrancy vulnerability:
Key Observation:
The contract updates the user’s balance after sending the funds.
This allows an attacker to repeatedly call
withdrawEnergybefore the balance is reset, draining the contract.
Step 4: Writing the Exploit Contract
Deploy an exploit contract that interacts with the DeathStar contract to recursively withdraw funds:
Exploit Contract:
Step 5: Executing the Exploit
Deploy the exploit contract and execute the attack:
Code:
Output:
Step 6: Verifying the Challenge Solution
Verify that the DeathStar contract’s balance is zero:
Code:
Output:
Step 7: Retrieving the Flag
After draining the contract’s balance, retrieve the flag:
Final Answer
The extracted flag is:
Summary
Instance Setup: The blockchain instance was initialized with provided credentials.
Reentrancy Analysis: The vulnerability in
withdrawEnergywas identified.Exploit Deployment: An exploit contract was deployed to recursively withdraw funds.
Contract Draining: The
DeathStarcontract’s balance was successfully drained.Flag Retrieval: The challenge was solved, and the flag was retrieved.
Remarks/Tags/Lesson Learned
Reentrancy Exploitation: Understanding how reentrancy vulnerabilities work is essential for smart contract security.
Exploit Development: Writing a custom exploit contract highlights the importance of attack vector identification.
Web3.py Utilization: Effective use of Web3.py simplifies blockchain interaction and automation.
Iterative Debugging: Verifying contract state and transaction success ensures a systematic approach to solving challenges.
Smart Contract Auditing: Analyzing withdrawal patterns and state updates can reveal critical vulnerabilities.
Forensic
I Cant Manipulate People - ICMP Packet Analysis
Description: Partial traffic packet captured from a hacked machine. Can you analyze the provided pcap file to extract the message from the packet, perhaps by reading the packet data?
Solution
File Provided
traffic.pcap: A packet capture file containing network traffic.
Goal
Analyze the packets to extract the hidden message.
Reconstruct the flag by reading the packet data sequentially.
Solution
Step 1: Analyzing the File
Open the traffic.pcap file using Wireshark:
Inspect the overall structure of the captured packets.
Notice that all packets contain ICMP protocol information, with the message "(no response found!)."
Step 2: Filtering ICMP Packets
Apply a filter to focus on ICMP packets in Wireshark:
This filter isolates ICMP request packets, which are key to extracting the hidden data.
Step 3: Reading Packet Data
Click on each ICMP packet in the filtered list.
Navigate to the Data section in the packet details pane.
Sequentially read the ASCII representation of the payload in each packet's data field.
Combine the data from all ICMP packets to reconstruct the hidden message.
Step 4: Reconstructing the Flag
After reading all ICMP packet data, the following hidden message was reconstructed:
Final Answer
The extracted flag is:
Summary
Packet Analysis: Opened the provided
traffic.pcapfile in Wireshark and analyzed the packet structure.ICMP Filtering: Applied an ICMP filter to isolate relevant packets containing hidden data.
Data Extraction: Read the ASCII representation of the payload from each ICMP packet sequentially.
Flag Reconstruction: Combined the extracted data to reconstruct the hidden message.
Remarks/Tags/Lesson Learned
Protocol Filtering: Using Wireshark filters (e.g.,
icmp) effectively isolates relevant traffic, making analysis more efficient.Payload Analysis: Hidden messages often reside in packet payloads, requiring careful inspection of individual data fields.
Sequential Reconstruction: Extracting and combining data sequentially ensures accurate recovery of hidden messages.
Wireshark Expertise: Proficiency with Wireshark's filtering and data navigation features is invaluable for network traffic analysis challenges.
Unwanted Meow - Data Corruption Repair
Description: Uh... Oh... Help me! I was just browsing funny cat memes. When I clicked to download a cute cat picture, the file that was downloaded seemed a little bit weird. I accidentally ran the file, and now my files are shredded. Ugh, now I hate cats meowing at me.
Solution
File Provided
flag.shredded: A corrupted file that needs to be repaired to extract the flag.
Goals
Analyze the file to identify its true format.
Repair the file to restore its original content.
Extract the flag embedded within the repaired file.
Solution
Step 1: Analyzing the File
Using hexed.it, the file was inspected for anomalies:
The header revealed a JFIF file signature (
FF D8 FF E0), indicating it is a JPEG image.However, the file could not be opened as an image.
Further inspection revealed multiple occurrences of the string "meow" in the hex data, which corrupted the file.
Step 2: Cleaning the File Using xxd and sed
To remove all occurrences of "meow" (hex values 6D65 6F77) from the file:
Convert the file to a plain hex dump using
xxd.Use
sedto remove all instances of "meow" in the hex data.Convert the cleaned hex dump back to binary using
xxd -r.Since the corruption occurred multiple times, repeat the process three times to completely remove all instances of "meow."
Commands Used:
Step 3: Validating the Repair
After cleaning the file, it was saved as
clean_flag.jpeg.The repaired file was opened in an image viewer.
The image successfully opened, revealing a picture containing the flag.
Step 4: Extracting the Flag
Upon opening the repaired image, the flag was visible in the content:

Final Answer
The extracted flag is:
Summary
File Analysis: The corrupted file was identified as a JPEG image by analyzing its JFIF header.
Corruption Source: The corruption was caused by extraneous "meow" strings embedded in the hex data.
File Repair: Removing all instances of "meow" using
xxdandsedrestored the file.Flag Extraction: The repaired image successfully displayed the hidden flag.
Remarks/Tags/Lesson Learned
File Format Identification: Analyzing file headers provides critical clues about the true format of corrupted files.
Hex Editing: Tools like
xxdandsedare invaluable for detecting and repairing anomalies in binary files.Iterative Cleaning: Repeated cleaning ensures complete removal of corruption, especially when anomalies occur multiple times.
JPEG Repair: Understanding JPEG structure (e.g., JFIF headers) is crucial for restoring corrupted images.
Systematic Debugging: Breaking the process into analysis, cleaning, validation, and extraction ensures an organized approach to solving file corruption challenges.
Tricky Malware - Memory Dump and Network PCAP Analysis
Description: My SOC detected there are Ransomware that decrypt file for fun. The script kiddies is so tricky. Here some evidence that we successfully retrieve.
Solution
Files Provided
Evidence.rar:
memdump.mem: A memory dump file.network.pcap: A network capture file.
Tools Used
Volatility3: For memory analysis.
IDA: For decompiling and analyzing executables.
pyinstxtractor: For unpacking PyInstaller-packed executables.
PyLingual: For decompiling Python bytecode.
Goals
Analyze the memory dump to identify suspicious files.
Dump and reverse-engineer suspected files.
Retrieve the flag.
Solution
Step 1: Memory Analysis
Initial Inspection:
Used
cmdline,filescan, andpstreeplugins in Volatility3 to analyze the memory dump.
Commands:
Observations:
Found suspicious files:
Tabtip.exeCrypt.exeSlui.exe
Noted file locations, particularly
Crypt.exeon the desktop (\Users\user\Desktop\).
Dumping Suspicious Files:
Dumped the identified files for further analysis:
Step 2: Analyzing the Dumped Files
Executable Analysis:
Analyzed
Crypt.exein IDA and identified it as a PyInstaller-packed executable.
Unpacking and Decompiling:
Used
pyinstxtractorto unpack the PyInstaller executable:Decompiled the resulting
.pycfile using PyLingual:
Extracted Python Code: The decompiled Python code revealed the following logic:
Step 3: Retrieving the Flag
Key Extraction:
The script fetches an encryption key from Pastebin:
Visiting this link revealed the flag.
Final Flag:
Final Answer
The retrieved flag is:
Summary
Memory Analysis: Used Volatility3 to identify and dump suspicious files from the memory dump.
Executable Analysis: Identified
Crypt.exeas a PyInstaller-packed executable.Unpacking and Decompilation: Used pyinstxtractor and PyLingual to extract and decompile the Python code.
Logic Analysis: Analyzed the Python script to understand its functionality and locate the encryption key.
Flag Retrieval: Accessed the Pastebin link to retrieve the flag.
Remarks/Tags/Lesson Learned
Memory Forensics: Volatility3 is effective for identifying and extracting suspicious files from memory dumps.
Executable Analysis: Recognizing PyInstaller-packed executables enables the use of appropriate unpacking and decompilation tools.
Python Reverse Engineering: Tools like pyinstxtractor and PyLingual streamline the analysis of Python-based malware.
Dynamic Analysis: Observing external connections (e.g., Pastebin links) in malicious scripts can lead directly to key insights.
Systematic Approach: Combining file analysis, decompilation, and network observation ensures a thorough investigation.
Oh Man - SMB Traffic Decryption with NTLM Hash
Description: We received a PCAP file from an admin who suspects an attacker exfiltrated sensitive data. Can you analyze the PCAP file and uncover what was stolen?
Solution
Files Provided
wgmy-ohman.pcap: A packet capture file containing encrypted SMB3 packets.
Tools Used
Wireshark: For analyzing and decrypting the SMB3 packets.
Hashcat: For cracking NTLMv2 hashes.
pypykatz: For parsing Windows minidump files.
Goals
Analyze the packet capture to extract NTLMv2 hashes.
Crack the NTLMv2 password using a dictionary attack.
Decrypt SMB3 traffic and export files.
Analyze exported files to retrieve the flag.
Solution
Step 1: Extracting NTLMv2 Hashes
Filtering NTLMv2 Packets:
Used Wireshark to filter NTLMv2 authentication packets.
Filter Commands:
Extracting Hash Components:
Ran the following
tsharkcommands to extract required fields:
Formatted NTLM Hash:
Constructed the hash for
hashcatin the following format:
Example Hash:
Step 2: Cracking NTLMv2 Password
Using Hashcat:
Ran hashcat to crack the NTLM hash using the
rockyou.txtwordlist:
Cracked Password:
Step 3: Decrypting SMB3 Traffic
Configuring Wireshark:
Edited SMB protocol preferences in Wireshark:
Path: Edit > Preferences > Protocols > NTLMSSP.
Entered the cracked password in the NT Password field.
Decrypting Traffic:
SMB traffic was automatically decrypted after applying the correct password.
Step 4: Exporting Files
Exporting SMB Objects:
Exported files sent over SMB using Wireshark:
Path: File > Export Objects > SMB...
Recovered File:
Exported a file named
20241225_1939.log.
Step 5: Analyzing the Exported File
Repairing the Minidump File:
Fixed the file signature by replacing the first 4 bytes with
MDMP(little-endian).
Command:
Parsing with Pypykatz:
Used
pypykatzto analyze the minidump and extract secrets:Command:
Final Answer
The recovered flag is:
Summary
Packet Analysis: Used Wireshark and tshark to extract NTLMv2 hashes from the packet capture.
Password Cracking: Cracked the NTLM hash with hashcat to obtain the password.
Traffic Decryption: Decrypted SMB3 traffic in Wireshark using the cracked password.
File Recovery: Exported files sent via SMB and repaired the corrupted minidump file.
Flag Retrieval: Parsed the minidump file with
pypykatzto extract the flag.
Remarks/Tags/Lesson Learned
SMB Decryption: Proper password recovery is essential for decrypting encrypted SMB traffic.
Network Forensics: Tools like Wireshark and tshark are invaluable for analyzing network traffic and extracting critical data.
Hash Cracking: Hashcat's performance and compatibility make it an excellent choice for NTLMv2 password cracking.
File Repair: Understanding file formats and repairing corrupted files can be key to retrieving essential information.
Dynamic Analysis: Leveraging tools like
pypykatzallows efficient parsing of Windows memory artifacts.
Reverse
Stones - Pyinstaller Extraction
Description: When Thanos snapped his fingers, half of the flag was blipped. We need the Avengers to retrieve the other half. There's no flag in the movie, but there is a slash flag on the server (Please do not perform any brute forcing, enumeration, or scanning. Not useful nor needed)
Solution
Files Provided
stones.whatdis: A file containing an executable packed with PyInstaller.
Goals
Extract and analyze the Python code from the provided file.
Understand the logic for retrieving the flag.
Identify the correct date parameter and submit it to get the full flag.
Solution
Step 1: File Analysis
Initial Inspection:
Used the
fileandstringscommands onstones.whatdisto identify it as a PyInstaller-packed executable.
Unpacking the Executable:
Used pyinstxtractor to unpack the file:
This extracted Python bytecode files, including the main logic.
Decompiling Bytecode:
Used PyLingual to decompile the main
.pycfile into readable Python source code.
Step 2: Extracted Python Code
The decompiled source revealed the following logic:
Key Observations:
The script queries a server at
http://13.58.69.212:8000/with two parameters:first_flag: A known partial flagWGMY{1d2993.date: A specific date required by the server.
The
/flagendpoint must be queried with the correctdateparameter to retrieve the full flag.
Step 3: Determining the Correct Date
Hint from the
/flagEndpoint:Accessing
/flagon the server redirected to a YouTube video about the Avengers and the Time Stone.The video’s upload date was
2022-07-24.
Adjusting the Date:
Submitting
2022-07-24resulted in an error.Incremented the date by one day (
2022-07-25) and successfully retrieved the flag.
Final Date: 2022-07-25
Step 4: Full Solve Script
Using the correct date, the script to retrieve the full flag is as follows:
Final Answer
The full flag is:
Summary
Executable Unpacking: Used
pyinstxtractorto unpack the PyInstaller-packed executable.Decompilation: Decompiled Python bytecode with PyLingual to recover the main logic.
Logic Analysis: Identified the server endpoint and parameters required for flag retrieval.
Date Adjustment: Determined the correct date parameter through observation and incremental testing.
Flag Retrieval: Submitted the correct parameters to retrieve the full flag.
Remarks/Tags/Lesson Learned
Executable Analysis: Recognizing PyInstaller artifacts and using appropriate tools like
pyinstxtractoris crucial for unpacking.Decompilation Tools: Tools like PyLingual simplify bytecode analysis, aiding in understanding the underlying logic.
HTTP Debugging: Observing server behavior and incremental testing can reveal subtle requirements for successful queries.
Problem Context: Incorporating hints (e.g., video upload date) into the solution ensures alignment with challenge themes.
Iterative Testing: Small adjustments, such as date changes, can resolve unexpected errors and lead to the correct solution.
Sudoku - Cryptogram-like Substitution Cipher
Description: Easy stuff, frfr. You dont need to brute force or guess anything. The final flag don't have any dot (.)
Solution
Files Provided
sudoku.zip:
out.enc: Encrypted flag file.sudoku: Linux ELF executable.
Description
The challenge involves recovering an encrypted flag by analyzing a packed executable and utilizing reverse engineering to decrypt the data. The encryption uses a custom substitution cipher based on a randomly generated character map.
Goals
Extract and analyze the packed executable to recover its logic.
Reverse the substitution cipher used to encrypt the flag.
Reconstruct the complete flag.
Solution
Step 1: Analyzing the Executable
Initial Inspection:
Opened the
sudokuexecutable in IDA.Observed references to PyInstaller, indicating the file is packed.
Unpacking the Executable:
Used the Pyinstxtractor tool to unpack the executable.
Extracted compiled Python files, including
sudoku.pyc.
Decompiling the Python Bytecode:
Used the PyLingual tool to decompile
sudoku.pycinto readable Python source code.
Step 2: Understanding the Encryption Logic
The decompiled sudoku.py contains the following relevant code:
Observations:
A substitution cipher encrypts the flag by mapping plaintext characters to randomly shuffled characters from the alphabet.
The
plaintextvariable is based on a pangram.The
encryptfunction substitutes each character inplaintextusing the generatedkey.
Step 3: Recovering the Decryption Map
Known Plaintext Attack:
Most of the plaintext is a known pangram:
0 the1 quick2 brown3 fox4 jumps5 over6 the7 lazy8 dog9.The ciphertext from
out.encis:
Reverse Mapping:
Created a decryption map (
decmap) by pairing plaintext characters with their corresponding ciphertext characters:
Decrypting the Flag:
Using the decryption map, processed the flag portion of the ciphertext:
Output:
Step 4: Completing the Flag
Masked Characters:
Some characters in the decrypted flag (
..) are placeholders. Using the pangram, determined that these placeholders correspond to missing hexadecimal characters.Based on the ciphertext mapping, replaced the placeholders:
Validation:
Verified the flag's validity as a hexadecimal MD5 hash:
Final Answer
The reconstructed flag is:
Summary
Executable Unpacking: Used Pyinstxtractor to extract compiled Python files from the packed executable.
Decompilation: Decompiled
sudoku.pycusing PyLingual to recover the source code.Cipher Analysis: Analyzed the substitution cipher and created a reverse mapping based on known plaintext.
Flag Reconstruction: Used the reverse mapping to decrypt the flag and replace masked characters.
Remarks/Tags/Lesson Learned
Packed Executable Analysis: Recognizing PyInstaller artifacts helps identify appropriate unpacking tools.
Reverse Engineering: Decompilation of Python bytecode is a valuable skill for analyzing packed executables.
Cryptanalysis: A known plaintext attack can efficiently break substitution ciphers.
Tool Proficiency: Tools like Pyinstxtractor and PyLingual streamline the process of extracting and analyzing Python-based executables.
Systematic Debugging: Step-by-step reconstruction ensures accuracy and completeness in flag recovery.
Drivers
Description: I downloaded these drivers which grants me more ram Though, it seems that its not working as expected, Could it be a virus?? Please help me!
Solution
Files Provided
The following relevant file is provided for this challenge:
InstallDrivers.ps1: A PowerShell script that executes a binary containing obfuscated shellcode.
Tools and Techniques Used
IDA Pro: Used for dynamic debugging and patching the binary to bypass anti-analysis checks.
shellcode2exe: Converted the shellcode to an executable for debugging.
Python (with itertools and pwntools): Scripted brute-forcing for missing flag components.
TQDM: Progress bar utility for tracking brute-force progress.
Steps to Solve
Step 1: Analyze the Shellcode
Convert the Shellcode:
Used
shellcode2exeto wrap the shellcode into an executable format for easy debugging.
Debug the Binary in IDA:
Observed a series of anti-debugging checks.
Patched functions responsible for checking tools like IDA, Wireshark, and other debuggers by forcing them to return
false.Focused on functions causing premature exits and identified key functions dynamically loaded by the binary.
Registry Interaction:
Identified that the binary interacts with the registry to read two keys:
ProgramFilesDir(standard Windows directory key).ProgramFilezDir(non-standard key with az).
Core Logic:
The program constructs a 32-byte hexadecimal flag based on values from the binary and the registry.
Parts of the flag are hardcoded, but others depend on the
ProgramFilezDirvalue, requiring brute-forcing.
Step 2: Reverse-Engineer the Flag Construction
Reverse Engineering:
Decompiled the binary to understand flag construction logic.
Found that the flag bytes are split into known and unknown indices:
Remaining values are dependent on
ProgramFilezDirand must pass two hash checks.
Hash Validation:
Flag validation involves two FNV-1a hash checks:
The full flag hash must match
991905974.The hash of the lower 16 bytes must match
2089661757.
Step 3: Brute-Force Missing Values
Script Setup:
Wrote a Python script to brute-force the unknown flag components using
itertools.product.
Partial Brute Force:
Brute-forced the lower half of the flag first:
Complete Brute Force:
Once partial values were found, brute-forced the remaining indices:
Step 4: Retrieve the Flag
Output Flag:
Once both parts passed their respective hash checks, the complete flag was assembled:
Final Flag:
The final flag retrieved is:
Conclusion
By combining dynamic debugging, reverse engineering, and brute-forcing, the challenge was solved effectively. The brute-force approach for registry values, while computationally expensive, was necessary due to the obfuscation in the binary. The use of FNV-1a hashing ensured the integrity of the solution.
Game
World 1 - RPG Maker MZ Save File Manipulation
Description: Game hacking is back! Can you save the princess? White screen? That is a part of the challenge, try to overcome it..
Solution
File Provided
World1.exe: An executable file for a game created using RPG Maker MZ.
Goals
Modify the save file to gain invincibility and obtain flags in the game.
Extract the game files to locate missing parts of the flag.
Reconstruct the full flag.
Solution
Step 1: Editing the Save File
Launch the game to create a save file, typically named
file0.rmmzsave.Open the save file using the RPG Maker MZ save editor tool:
Tool Used: Save Editor for RPG Maker MZ
Modify the save data to set all status values to 9999, making the character invincible.
Save the edited file and replace the original save file in the game directory.
Reload the game using the edited save to:
Defeat all enemies with one hit.
Collect flags for Parts 1, 2, and 5 during gameplay.
Step 2: Extracting Game Files for Missing Flag Part
The remaining Part 4 of the flag is not obtainable in-game. To locate it:
Inspect the Executable:
Open the executable (
World1.exe) as a ZIP archive.Observe the
.enigma1file, which indicates the game is packed with Enigma Virtual Box.Tool Reference: Enigma Virtual Box
Unpack the Files:
Use the
evbunpacktool to unpack the game files:Tool Used: evbunpack
Parse Game Assets:
After unpacking, use
gameripperto extract and parse game assets:Tool Used: gameripper
Step 3: Locating Flag Parts
Part 4 (Volcano Map):
Using
gameripper, locate the volcano map image, which contains the missing flag part.
Other Flag Parts:
Parts 1, 2, and 5: Found in
data/CommonEvents.json.Part 3: Found in
data/Map004.json.
Step 4: Reconstructing the Full Flag
After collecting all flag parts, the full flag is:
Final Answer
The reconstructed flag is:
Summary
Save File Modification: Edited
file0.rmmzsaveto gain invincibility and collect in-game flags.Game File Extraction: Unpacked the game executable using
evbunpack.Asset Parsing: Analyzed game assets with
gameripperto locate missing flag parts.Flag Reconstruction: Combined all discovered parts to form the complete flag.
Remarks/Tags/Lesson Learned
Save File Editing: Save editors for specific game engines, like RPG Maker MZ, can simplify gameplay challenges.
Executable Inspection: Many game executables can be opened as archives to inspect their structure.
File Unpacking: Tools like
evbunpackare essential for extracting files packed with virtualization solutions such as Enigma Virtual Box.Asset Exploration: Parsing game assets with tools like
gamerippercan reveal hidden information and resources.Systematic Flag Discovery: Combining in-game exploration with external file analysis ensures no part of the challenge is missed.
World 2 - APK File and Asset Decryption
Description: Welp, time to do it again. Unable to install? That is a part of the challenge, try to overcome it.
Solution
File Provided
world2.apk: An APK file for a game created using RPG Maker MZ.
Description
The challenge involves hacking an RPG Maker MZ game to retrieve a hidden flag. The APK file includes:
Assets that need extraction and decryption.
Maps and JSON data to analyze.
A challenge to overcome a white screen issue.
Goals
Extract and analyze the game files from the APK.
Manipulate game data to locate missing parts of the flag.
Reconstruct the complete flag.
Solution
Step 1: Extracting Files from the APK
Open the APK as a ZIP archive to extract its contents.
Locate and extract the following files:
assets/www/data/CommonEvents.jsonassets/www/data/Map004.jsonassets/www/data/Map007.jsonassets/www/img/pictures/QR Code 5A.png_
Step 2: Inspecting the App via USB Debugging
Install the APK on an Android phone.
Enable USB debugging and connect the phone to a PC.
Open Chrome and navigate to:
chrome://inspect#devices
Use Chrome's DevTools to inspect and interact with the app's elements.
Bypass the white screen by modifying DOM elements or inspecting network requests.
Step 3: Locating Flag Parts
Parts 1, 2, and 5 (Name): Found in
CommonEvents.json.Part 3: Found in
Map004.json.Part 4:
Import
Map007.jsoninto World 1's game data.Use
gameripperto render the map and locate the hidden flag part.Tool Used: gameripper
Part 5 (Image):
Decrypt the
.png_file to.pngusing the RPG Maker MZ-File Decrypter:Tool Used: Petschko's RPG-Maker MZ-File Decrypter
Step 4: Reconstructing the Full Flag
After combining all flag parts, the full flag is:
Final Answer
The reconstructed flag is:
Summary
File Extraction: Extracted and analyzed assets from
world2.apk.USB Debugging: Used Chrome DevTools to interact with and inspect the running app.
Game Asset Manipulation: Imported and decrypted game files to locate hidden flag parts.
Flag Reconstruction: Combined all parts to form the complete flag.
Remarks/Tags/Lesson Learned
APK Analysis: APK files can be treated as ZIP archives for extracting embedded data.
USB Debugging: Chrome's DevTools is a powerful tool for inspecting and modifying Android apps.
Game Asset Rendering: Tools like
gamerippercan render hidden map assets for analysis.File Decryption: Tools such as Petschko's RPG Maker Decrypter are essential for recovering encrypted game assets.
Systematic Approach: Combining JSON analysis, image decryption, and game data manipulation ensures no part of the challenge is overlooked.
World 3 - Web-based Game File Extraction
Description: Welp, time to do it again and again.
Solution
File Provided
Description
The challenge involves hacking a game hosted on itch.io to retrieve a hidden flag. The game files are accessible via browser devtools, and the same strategy as previous challenges can be applied to solve it.
Goals
Access game variables to manipulate gameplay.
Extract the required game files from the server.
Reconstruct the complete flag.
Solution
Step 1: Accessing the Game Variables
Open the game in the provided itch.io link.
Open the iFrame in a new tab to directly access the game content.
Launch the browser devtools (Inspect Element).
Explore the game variables:
$data<Object>: Contains the game data dictionary.$game<Object>: Contains game runtime variables.
Use the console to run the following command to give yourself max stats via weapon modification:
This makes your character overpowered, allowing you to defeat bosses easily and collect in-game flag parts.
Step 2: Extracting Game Files
Open the Network Monitor in the devtools while the game is loading.
Observe the game files being loaded from the path:
Extract the following files from the network requests:
data/CommonEvents.jsondata/Map004.jsondata/Map007.jsonimg/pictures/QR Code 5W.png_
Step 3: Locating Flag Parts
Parts 1, 2, and 5 (Name): Found in
CommonEvents.json.Part 3: Found in
Map004.json.Part 4:
Import
Map007.jsoninto World 1's game data.Use
gameripperto render the map and locate the hidden flag part.Tool Used: gameripper
Part 5 (Image):
Decrypt the
.png_file to.pngusing the RPG Maker MZ-File Decrypter:Tool Used: Petschko's RPG-Maker MZ-File Decrypter
Step 4: Reconstructing the Full Flag
After combining all flag parts, the full flag is:
Final Answer
The reconstructed flag is:
Summary
Game Variable Manipulation: Used browser devtools to modify in-game stats for easier gameplay.
File Extraction: Retrieved game files from the itch.io server via the network monitor.
Asset Parsing: Analyzed JSON files and decrypted image assets to locate hidden flag parts.
Flag Reconstruction: Combined all parts to form the complete flag.
Remarks/Tags/Lesson Learned
Devtools Mastery: Browser devtools are powerful for inspecting and manipulating game variables and assets.
Network Analysis: Monitoring network requests can reveal server paths to game files.
Game Asset Rendering: Tools like
gamerippercan uncover hidden data in game assets.File Decryption: Petschko's RPG Maker Decrypter is useful for recovering encrypted image files.
Systematic Approach: Combining runtime exploration with file analysis ensures thorough flag discovery.
Last updated