> For the complete documentation index, see [llms.txt](https://szczygielka.gitbook.io/writeups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://szczygielka.gitbook.io/writeups/ctfs-writeups/ritsec-ctf-2024/secret-door-misc.md).

# Secret Door - Misc

## Task

You have found a secret door, to unlock it you must analyze the circuit design to obtain the code.

[lock-diagram.png](https://ctfd.ritsec.club/files/377741c762bd921a688124a006399b5f/lock-diagram.png?token=eyJ1c2VyX2lkIjo0MzAsInRlYW1faWQiOjEwNCwiZmlsZV9pZCI6Mjl9.ZhM-1w.MLEzRj_m6dV1jkOuCubvcBuWRSg)

## Solution

We get the following `lock-diagram.png` image, containing logic circuit:

<figure><img src="https://1764482864-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsK05LA2NAjKs68dl8qHP%2Fuploads%2FQH8qhfiGy7jserlh4AQJ%2Flock-diagram.png?alt=media&amp;token=c5e692f2-07c0-469b-af97-49bd06dc3a58" alt="" width="416"><figcaption></figcaption></figure>

We have to open the door, therefore the output should be 1. I used [logic.ly](https://logic.ly/demo/) to redraw the circuit. This tool displays the current status of the lines, either 0 or 1, simplifying circuit analysis. To manipulate the inputs, I utilized buttons and placed a light bulb at the output, allowing visibility when the output was 1.

For the current state of inputs, the output is 1:

<figure><img src="https://1764482864-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsK05LA2NAjKs68dl8qHP%2Fuploads%2FjRHiwwykcskWGPTazU2i%2Fimage.png?alt=media&amp;token=3900412e-65ee-4764-a953-9811cfe258a2" alt="" width="472"><figcaption></figcaption></figure>

This means that for 1 to appear at the output, the input state must be as follows:

```
01000111
```

The state of the inputs is our code, which means that we get the content of the flag.

Flag:

```
RS{01000111}
```
