From 5de7ecdce5f9e571aad407a783462bce1880229d Mon Sep 17 00:00:00 2001 From: Abel Stuker Date: Mon, 25 Nov 2024 22:30:18 +0100 Subject: [PATCH] feat: add henri challenge --- henri/README.md | 10 ++++++++++ henri/SOLUTION.md | 23 +++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 henri/README.md create mode 100644 henri/SOLUTION.md diff --git a/henri/README.md b/henri/README.md new file mode 100644 index 0000000..e53b208 --- /dev/null +++ b/henri/README.md @@ -0,0 +1,10 @@ +# henri +## Text +Just before his death, my good old friend Henri gave me two strange codes. +`3822282633192b59041e3644363a0c` +`2419120d0a0010111c53371f1f11071b10` +He told me he hid a treasure behind a secret door at his airport. One of the codes contains the city and the country of this airport, in the following format: `City:Country`. The only way I can access the secret door is with the hidden flag in the other code. With his final breath, he started the sentence: 'The airport code will ...'. Then he died 😵. And I want the treasure 🤑. Can you help me? +## Files +n/a +## How to Deploy +n/a \ No newline at end of file diff --git a/henri/SOLUTION.md b/henri/SOLUTION.md new file mode 100644 index 0000000..eac2169 --- /dev/null +++ b/henri/SOLUTION.md @@ -0,0 +1,23 @@ +## Difficulty +?? +## Category +Cryptography +## How To Solve +First you need to look up what airport we are talking about. A quick Google search should lead you to the Henri Coanda International Airport in Bucharest, Romania. We now know that one of the two codes is an encryption of `Bucharest:Romania`. The Airport Code of the Henri Coanda International Airport is **OTP**, referring to the **One-Time Pad encryption technique**. This is a safe encryption technique, as long as the encryption key is only used one single time. In this case, both messages ($m_{1}=$ `Bucharest:Romania` and $m_{2}=$ the flag ) were encrypted using the same key $k$. This is where OTP becomes crackable. + +Encryption of both messages: +$$c_1 = m_1 \oplus k$$ +$$c_2 = m_2 \oplus k$$ + +The two codes that Henri gave me are $c_1$ and $c_2$ in this case. Since the same key was used twice, we get $c_1 \oplus c_2 = (m_1 \oplus k) \oplus (m_2 \oplus k)$. Due to the associativity of XOR we can remove the parenthesis, and due to its commutativitiy, we can rewrite as $m_1 \oplus m_2 \oplus k \oplus k$. Since $k \oplus k = 0$, we now know that $c_1 \oplus c_2 = m_1 \oplus m_2$. + +In this case, we already know $m_1$. We can now easily calculate $m_2$, which is the flag, using $c_1, c_2,$ and $m_1$: +$$m_1 \oplus (c_1 \oplus c_2) = m_1 \oplus (m_1 \oplus m_2)$$ +$$m_1 \oplus c_1 \oplus c_2 = (m_1 \oplus m_1) \oplus m_2$$ +$$m_1 \oplus c_1 \oplus c_2 = m_2$$ + +You can write your own script or use a tool like cribdrag to perform these calculations. Even easier is to use an online tool to solve it: http://cribdrag.com. + + +## Flag +`IGCTF{C0anD4_H}` \ No newline at end of file