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.
| Platform | picoGym (picoCTF 2019) |
| Verified against | rmn0x01's Vault Door series writeup |
| Category | Reverse Engineering |
| Difficulty | Beginner |
| Tools | text editor javac java |
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
Follow your input from where it's read to where it's compared.
checkPassword() compares it to a plain string literal.
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.
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.
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.
The flag is deliberately hidden — follow the method, you've earned it. 💪
Source code is the easiest kind of reverse engineering — but the lesson carries to compiled code too:
substring — it tells you which part of the input is checkedequals in client-side code is not a secretDiscuss this writeup with the community on the CTFdojo Discord.
Join the Discord →