CH02 - 500pts
Briefing
Below are 4 messages, 2 of them are insecure... find the flag!
2e310d15730618003c27392502592f1b016e1b1c364505191302
27271e1d6f3935381618340a740404152d0063160106490a0a050d013d2e
313c0d45350d0c026f3d236b361120191e373c1c3a080e0c2b04
1b060c2749020b354105271616532f27772f1c204811111745320b10021717
Solution
First, we guess that the cipher being used is a one-time pad since two of the hexadecimal strings are the same length.
So we have cipher text one
2e310d15730618003c27392502592f1b016e1b1c364505191302
and cipher text two313c0d45350d0c026f3d236b361120191e373c1c3a080e0c2b04
that were both encrypted using the same one-time pad key. If the key for a one-time pad is used twice, it can be broken using crib dragging.Basically, XORing the cipher texts gives you the same result as XORing the original messages. The math works out as follows (from this crib dragging article):
This is useful because XORing the two cipher texts removes the key from the problem.
We can XOR the two cipher texts using [CyberChef (click for recipe)](https://gchq.github.io/CyberChef/#recipe=From_Hex('Auto')XOR(%7B'option':'Hex','string':'313c0d45350d0c026f3d236b361120191e373c1c3a080e0c2b04'%7D,'Standard',false)To_Hex('None',0)&input=MmUzMTBkMTU3MzA2MTgwMDNjMjczOTI1MDI1OTJmMWIwMTZlMWIxYzM2NDUwNTE5MTMwMg) to get
1f0d0050460b1402531a1a4e34480f021f5927000c4d0b153806
. This hexadecimal string is equal to the two messages XORed together. Therefore, we can start guessing parts of a message to decode both cipher texts and get the flag. SpiderLabs/cribdrag makes this easy.python2 cribdrag.py 1f0d0050460b1402531a1a4e34480f021f5927000c4d0b153806
:
Flag
ShimmyShimmyYa
Last updated