Tags: binary dna crypto encoding
Rating:
For this challenge, we are given a txt file.
Link: https://github.com/joeyjon123/riftCTF/blob/master/Cryptochall3.txt
The file contains the following string:
"GATCCGGCGCGCACTCTAACACCCGCACTGTCTACCTCTAACTACGTCTTCCTATCCAGCGCGCCCGCTTCCGCGCGATCAATACTGCTTCCTAACAATAGATCTTGCGTACACTACTTC".
From our biology lessons, we recognize that this is a string of DNA Codons. The hint also contained lyrics to DNA, a song/rap by Kendrick Lamar.
Looking up DNA encryption/decryption techniques, we find that A, C, G, and T are all mapped to binary values. When combined, they form a binary string which should decode to the flag.
We first tried using the standard mappings:
A(0) – 00 | T(1) – 01 | C(2) – 10 | G(3) – 11
Resulting binary string:
110001101011111011101110001001100100001000101010111000100111011001001010011001000010010010110110010110100100011010001110111011101010111001011010111011101100011000000100100111100101101001000010000001001100011001011110110100100010010010010110
When we translate this to ASCII, we do not get a valid string. Therefore, we decided to start with the flag.
We know the flag begins with riftCTF{ and the first letter is r. Converted to binary, r is 01110010. The first 4 characters of the string we were given are GATC.
Therefore, we tried to solve using these mappings:
T(0) – 00 | G(1) – 01 | C(2) – 10 | A(3) – 11
Resulting binary string:
011100101001011001100110111000100011111011101010011011100001001000111010001000111110001110010010000010100011001010110110011001101010011000001010011001100111001011110011100001100000101000111110111100110111001000000110010011101110001110000010
When we translate this to ASCII, we do not get a valid string again. Thus, we decided to reverse every block of 4 characters.
Resulting string:
CTAGCGGCCGCGCTCACAATCCCACACGCTGTCCATATCTATCACTGCCCTTCTATCGACCGCGCGCCCCTTCGCGCTAGATAACGTCCCTTCAATATAACTAGCGTTCATGATCACTTC
Repeating the steps as before, we know that CTAG maps to r which maps to 01110010.
We figure out that the mappings for each character are:
A(0) – 00 | C(1) – 01 | G(2) – 10 | T(3) – 11
Resulting binary string:
011100100110100101100110011101000100001101010100010001100111101101010011001101110011010001111001010111110111001101100001011001100110010101011111011001100111001000110000011011010101111101000011001100000111001001101111010011100011010001111101
When we translate this to ASCII, we get riftCTF{S74y_safe_fr0m_C0roN4}.
Flag: riftCTF{S74y_safe_fr0m_C0roN4}