> For the complete documentation index, see [llms.txt](https://alham-rizvi.gitbook.io/alhamrizvi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alham-rizvi.gitbook.io/alhamrizvi/picoctf-writeups/picoctf/reverse-engineering/vault-door3.md).

# vault-door3

This was an easy reverse engineering challenge. The goal was to understand how the program validates the password and reconstruct the correct input.

The program takes input in the format:

```
picoCTF{...}
```

It extracts the inner 32-character string and passes it to the `checkPassword()` function.

Inside `checkPassword()`, a `buffer` array is constructed using different transformations on the input password:

* First 8 characters are copied directly
* Next 8 are reversed from another section
* Remaining characters are rearranged using specific index mappings

Finally, the program compares the result with:

```
jU5t_a_sna_3lpm1cg04e_u_4_m6rb42
```

#### Trick Used

Instead of manually reversing all the transformations, I modified the code by adding:

```java
System.out.println(buffer);
```

This prints the **final transformed string** directly during execution.

After compiling and running the program, I entered any dummy input like:

```
picoCTF{aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
```

The program printed:

```
jU5t_a_sna_3lpm1cg04e_u_4_m6rb42
```

This revealed the exact string that the program expects after transformation

Now that the target string is known, I reversed the transformation logic to reconstruct the original password.

The correct password is:

```
jU5t_a_s1mpl3_an4gr4m_4_u_c0d3r
```

#### Final Flag

```
picoCTF{jU5t_a_s1mpl3_an4gr4m_4_u_c0d3r}
```

\--


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://alham-rizvi.gitbook.io/alhamrizvi/picoctf-writeups/picoctf/reverse-engineering/vault-door3.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
