Mariquita🐞mariquita-sec#

I scan, I map, I exploit .... Red Team Princess—Crowned in Shells.!!!

PicoCTF 2025 – Rust Fixme 2 Write-Up

Challenge Overview

If you're new here, I recommend checking out my RustFixMe1 write-up first before diving into this one. This was another Rust challenge, and just like before, it involved debugging and fixing errors—this time related to borrowing and mutability.

challenge_description

Downloading and Extracting the Files

Since the file was compressed, I extracted it using:

tar_unzip

Inside, I found a Rust project with the main code located in src/main.rs

Analyzing the Code

From the challenge description, I got a hint that the problem was related to borrowing. After reviewing the code, I found multiple issues related to mutable references and error handling.

mainCode

Passing a Mutable Reference in main()

Here’s what I found:

Making borrowed_string Mutable

In the decrypt() function, the parameter was defined as &String, which means it was immutable—the function could read it but not modify it.

I added the key word mut to &String line 3 this allows the function to modify borrowed_string

corrected code

Incorrect Return Statement

In the main() function, party_foul was passed as &party_foul, but since decrypt() tries to modify it, it needed a mutable reference (&mut party_foul).

Since decrypt() modifies party_foul, the variable itself also had to be declared as mut before passing it to the function:

corrected code

Compiling and Running the Code

cargo init # Initialize Cargo project (if not already set up),

cargo build # Compile the code,

cargo run # Execute the program

And just like that—I got the flag!

This was another great Rust debugging challenge! Fixing these issues deepened my understanding of Rust’s ownership model, and I’m looking forward to solving even tougher Rust CTF challenges.

Until next time, happy hacking!



Back To CTF