---
layout: post
title: "DeconstruCT.F 2021 | CRYPTO | Behind Enemy Line"
date: 2021-10-03 13:37:00 +0700
tags: [ctf, writeup]
---
<figure>
<img src="https://cdn.discordapp.com/attachments/874145963407720513/894206917239513118/Group.png">
</figure>
#### CRYPTO | Behind Enemy Line (299 points | 30 solves)
Challenge Description:
```
One of our soldiers managed to intercept an secret message and some files. Help us decode it before the war is over.
```
Given two files, a ciphertext and a locked pdf.<br>
cipher.txt:
```
mckcu wiyqt jawul xedmi bclke ipdpp jdmvl gugks cggcq iiapb dkphr eymlv yrziv jzhmq lipab yrdbn suhpy wsqio tljot mrldl jzqmt qjmkn wahty oycpj ntvsh axhfn thrtu qtxfm ahiav xbqjt spuuf yyxcv qatli ewadf rksdd fhntl fbgjx arngn scwmk kweba rropy uoohj nciho rjolj fozny bxpdu zdqzf ljrmv nopcw ismtz exjql axues ioypx amqms jbyeb pyssp ehfv iof jilazhmfpyotp yzdz whykv xjkrb ejvcx qvusj fqgkn mbwli oihvo caqkz mvfoh wcrmp xoujk wcirt slxlf bwbhg ecwin tanav zvvrq aoqgv yndwt ieuxf wwqig qafan zjnyj bppmg eegmp gbkqx xlqwv ombdc tlidr rjtvd oefvj cjvsg izlqf szmpj qdmoe rrcyt pveaa emioj njtus nvcoc iyagm imjzx ljcph xaqrl tkpsc vpwwn jyjxr skqsd brknj radag omfzk wjuyy jyslo ygdpo cprkn dcpzy ynffg eunzh fzkzx hetck lbunm qsxpu zbzof xoakd dovna dmxna ethux ewzfj fjcle ivjbq axkbs nxjwx aaesx hmvon zhnuy fkgzn wvfrj jcihe hcknt ijfgw zidhn xlukp pwurl vyvpk idmck ybgfk velpb yomdz tivsy rdiyk kvggg jvwct sanep fuzfq j
```
Solution:<br>
At first I thought this was a bacon cipher because almost all words have the length of 5 and the length of all words (space ignored) is multiple of 5. But I was wrong, then I re-read the description and got the idea of it being an enigma encrypted text because they talked about war.
In enigma, we need a key, but we don’t have one. But we still have the locked pdf. I tried using pdf2john and cracked the hash using john, and john cracked it (ilovejohn). I used the password and opened the pdf file. There is nothing but a sentence saying the key is in the document. I tried selecting the text using **Ctrl + A**, and to my surprise, there is a key.
<img src="https://cdn.discordapp.com/attachments/874554128553095198/894593674426580992/unknown.png">
This is the hidden text:
```
Hidden Key
Swiss K
UKW 8H 7G
III 23 W 10J
I 12L 21U
II 17Q 14N
-- you really thought, I wont hide it here?
```
I use [Enigma Decoder](https://cryptii.com/pipes/enigma-decoder) with the configuration as above and find the flag.
<img src="https://cdn.discordapp.com/attachments/874554128553095198/894594232742998067/unknown.png"><br>
FLAG : **dsc{turinglovedme}**