picoCTF Vault Door Training Writeup: Read the Password in the Java Source

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

main() strips picoCTF{ and the final } from what you type, then checkPassword() compares the rest to a string literal. That literal is the inside of the flag.

PlatformpicoGym (picoCTF 2019)
Verified againstrmn0x01's Vault Door series writeup
CategoryReverse Engineering
DifficultyBeginner
Tools text editor javac java

Challenge description

The first challenge of the Vault Door series: you get the full Java source of the door, and the password is in it.

Provided: VaultDoorTraining.java

Stuck? Try a hint before reading the solution

Hint 1

Follow your input from where it's read to where it's compared.

Hint 2

checkPassword() compares it to a plain string literal.

Step 1 — See how the input is prepared

In main(), the program reads your input and trims it before checking:

Scanner scanner = new Scanner(System.in);
System.out.print("Enter vault password: ");
String userInput = scanner.next();
String input = userInput.substring("picoCTF{".length(), userInput.length() - 1);
if (vaultDoor.checkPassword(input)) {
    System.out.println("Access granted.");
}

The substring call drops the first 8 characters (picoCTF{) and the last one (}). So the program expects the whole flag, but only checks what's inside the braces.

Step 2 — Read checkPassword

The check is a single string comparison:

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

No hashing, no encoding: the expected value is written in plain text in the source.

Step 3 — Rewrap it and verify

The flag is that string inside picoCTF{...}. To confirm, compile and run the door:

$ javac VaultDoorTraining.java
$ java VaultDoorTraining
Enter vault password: picoCTF{[password]}
Access granted.
🚩 picoCTF{flag intentionally hidden}

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

Key takeaways

Source code is the easiest kind of reverse engineering — but the lesson carries to compiled code too:

Resources

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 →