You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
108 lines
4.7 KiB
108 lines
4.7 KiB
+++
|
|
author = "Maik de Kruif"
|
|
title = "Logic Lock"
|
|
subtitle = "Beginners Quest 2 - Google CTF"
|
|
date = 2021-09-22T18:15:25+01:00
|
|
description = "A writeup for challenge 2 of the beginners quests of the Google CTF."
|
|
cover = "img/writeups/google-ctf/2021/beginners-quest/2/cover.png"
|
|
tags = [
|
|
"Google CTF",
|
|
"Beginners Quest",
|
|
"ctf",
|
|
"hacking",
|
|
"writeup",
|
|
"hardware",
|
|
"misc",
|
|
]
|
|
categories = [
|
|
"ctf",
|
|
"writeups",
|
|
"hacking",
|
|
"misc",
|
|
]
|
|
aliases = [
|
|
"2"
|
|
]
|
|
+++
|
|
|
|
## Story line
|
|
|
|
### Moscow - Apartment
|
|
|
|
It’s a cold day, and the snow is falling horizontally. It pierces your sight. You better use those extra pairs of socks that you were strangely given by the driver. Someone is waving on the other side of the street. You walk over to her. "Hi AGENT, I’m AGENT X, we’ve found the apartment of a person that we suspect got something to do with the mission. Come along!."
|
|
|
|
#### Challenge: Logic Lock (misc)
|
|
|
|
It turned out suspect's appartment has an electronic lock. After analyzing the PCB and looking up the chips you come to the conclusion that it's just a set of logic gates!
|
|
|
|
### After solving
|
|
|
|
Well, it’s a rather gloomy and messy apartment, a faint shade is cast from the almost covered master window upon the worn wall. It smells very burnt, and there's a cracked bottle in the sink that suggests some kind of experiment. Someone must have left in a hurry. Thinking about it, do you want to: Look at the beautiful view of the Kremlin from the window or search the apartment thoroughly
|
|
|
|
#### Look at the beautiful view of Kreml, from the window ([3]({{< ref "3.md" >}}))
|
|
|
|
Wow look at the Kremlin. Ah, the Moscow Kremlin is really something else! But hey wait... look at the street, someone just started to run when he saw you in the window. Could it be the person that we’re looking for? You exit the building and see that they are jumping on a motorcycle and they take off! You spot a parked car, hotwire it and quickly take up the chase.
|
|
|
|
#### Search it thoroughly ([4]({{< ref "4.md" >}}))
|
|
|
|
AGENT X seems to have missed that a plank on the floorboard has become very loose. You have a look and you see some kind of device under it. If you’re lucky, some information on it might come in handy. You have to travel back to the base if you wish to find out more.
|
|
|
|
## Attachment
|
|
|
|
{{< figure src="/img/writeups/google-ctf/2021/beginners-quest/2/logic-lock.png" title="Logic Lock" >}}
|
|
|
|
## Explanation
|
|
|
|
The attachment contains an image with, as it's name suggests, logic gates. Logic gates perform basic logical functions that are fundamental to digital circuits. They make decisions based on a combination of digital signals coming from its inputs.
|
|
|
|
I'll give an explantation of the six most common logic gates.
|
|
|
|
### OR
|
|
|
|
{{< figure class="small" src="/img/writeups/google-ctf/2021/beginners-quest/2/gates/or.png" title="OR Gate" >}}
|
|
|
|
The OR gate. The output is `true` if at least one of the inputs is `true`. If both inputs are `false`, then the output is `false`.
|
|
|
|
### AND
|
|
|
|
{{< figure class="small" src="/img/writeups/google-ctf/2021/beginners-quest/2/gates/and.png" title="AND Gate" >}}
|
|
|
|
The AND gate. The output is `true` if both inputs are `true`. If one or no input is `true`, the output is `false`.
|
|
|
|
### NOT
|
|
|
|
{{< figure class="small" src="/img/writeups/google-ctf/2021/beginners-quest/2/gates/not.png" title="NOT Gate" >}}
|
|
|
|
The NOT gate, also know as an inverter. The output is `true` if the input is `false`. If the input is `true`, the output is `false`.
|
|
|
|
### XOR
|
|
|
|
{{< figure class="small" src="/img/writeups/google-ctf/2021/beginners-quest/2/gates/xor.png" title="XOR Gate" >}}
|
|
|
|
The XOR gate. The gate behaves just like the OR gate, with the only difference being that it is when both inputs are on.
|
|
|
|
The output is `true` is one of the two inputs is on, but not both. If either both inputs are `true`, or if both inputs are `false`, the output is `false`.
|
|
|
|
### NOR
|
|
|
|
{{< figure class="small" src="/img/writeups/google-ctf/2021/beginners-quest/2/gates/nor.png" title="NOR Gate" >}}
|
|
|
|
The NOR gate. This gate is an OR gate, followed by a NOT gate.
|
|
|
|
The output is `true` if both inputs are `false`. If one or more of the inputs are `true`, the output is `false`.
|
|
|
|
### NAND
|
|
|
|
{{< figure class="small" src="/img/writeups/google-ctf/2021/beginners-quest/2/gates/nand.png" title="NAND Gate" >}}
|
|
|
|
The NAND gate. This gate is an AND gate, followed by a NOT gate.
|
|
|
|
The ouput is `true` if none or one of the inputs is `true`. If both inputs are `true`, the output is `false`.
|
|
|
|
## Solution
|
|
|
|
Now that we now what these gates mean, we can work back from end to see what the inputs should be.
|
|
|
|
{{< figure src="/img/writeups/google-ctf/2021/beginners-quest/2/logic-lock-solved.png" title="Logic Lock Solved" >}}
|
|
|
|
We find that the inputs `BCFIJ` should be set, so the resulting flag would be `CTF{BCFIJ}`.
|
|
|