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.

Downloading and Extracting the Files
Since the file was compressed, I extracted it using:

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.


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!