PicoCTF Vault Door Training Writeup — Read a Password from Java Source

Rev Eng 2026-10-12 · picoGym · By CTFdojo · ⏱ ... · 👁 ... views
𝕏 Share
TL;DR

The vault door's Java source code (VaultDoorTraining.java) is provided directly — no need to decompile anything. The checkPassword method compares user input to a hardcoded string in the file: you just have to read it.

PlatformpicoGym
CategoryRev Eng
Points100 pts
DifficultyBeginner
Tools javac java text editor

Challenge description

The challenge provides a complete source file directly, VaultDoorTraining.java, which simulates a vault door. Once compiled and run, the program asks the user to enter a password to "open" the door:

$ java VaultDoorTraining
Enter vault password: 

No binary to disassemble, no bytecode to decompile — this is the softest possible starting point of the "Vault-Door" series: the source code is readable as-is.

Step 1 — Read the code

We open VaultDoorTraining.java in a text editor. The overall structure looks like this:

public class VaultDoorTraining {
    public static void main(String args[]) {
        VaultDoorTraining vaultDoor = new VaultDoorTraining();
        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter vault password: ");
        String userInput = scanner.next();
        String input = userInput.substring(0);
        if (vaultDoor.checkPassword(input)) {
            System.out.println("Access granted.");
        } else {
            System.out.println("Access denied!");
        }
    }

    public boolean checkPassword(String password) {
        // ... the verification logic is here
    }
}

We immediately spot the entry point: the checkPassword(String password) method, called right after user input. This is what decides whether access is granted.

Step 2 — Find the comparison

Inside checkPassword, there's no complex logic: just a simple comparison between the user input and a string literal hardcoded in the file.

public boolean checkPassword(String password) {
    return password.equals("crackthevaultpassword123");
}

The expected password isn't encrypted, encoded, or obfuscated in any way — it's written plainly in the source code, like an ordinary variable.

Step 3 — Extract the password

We just have to copy the string literal found inside .equals("..."). This value is the password the program expects — and in this challenge, once entered correctly, the program directly prints the flag in picoCTF{...} format as its success message.

Step 4 — Verify (optional)

To confirm, we compile and run the program locally with the JDK, then enter the password we found:

$ javac VaultDoorTraining.java
$ java VaultDoorTraining
Enter vault password: crackthevaultpassword123
Access granted.
picoCTF{...}

The success message confirms that reading the source code was enough — no advanced reverse engineering tools were needed for this first level of the series.

🚩 picoCTF{flag intentionally hidden}

The flag is deliberately hidden — follow the method, you've earned it. 💪

Key takeaways

Resources

Related reading

Rev Eng 2026-10-19 · picoGym

PicoCTF Vault Door 1 Writeup — Reverse a Character-by-Character Password Check

Reconstructing a password from a character-by-character check in Java.

CTFdojo
CTFdojo
Community of ethical hackers writing beginner-friendly CTF writeups and guides.

Got a question or a different approach?

Discuss this writeup with the community on the CTFdojo Discord.

Join the Discord →