Tags: caesar cipher crypto keys substitution

Rating:

# Keysar v2
## Challenge Description
Category: Crypto
> Wow! Aplet sent me a message... he said he encrypted it with a key, but lost it. Gotta go though, I have biology homework!
>
> [Source](https://files.actf.co/45d2f41c58c51d0e7eeeac6b4fae4b01fca1427bd8e8d2cf5a127b8d7abfcdee/chall.py) [Output](https://files.actf.co/8125825ae0a5c81fe0f3e4520b95c02937a4d6624929afec84e451366ede6552/out.txt)
>
> Author: EvilMuffinHa

## How to Solve it:

This is a keyed cipher, but my team and I were too stupid to figure that out, so we came up with a different, mostly non-computer way.

A long time ago, I had a cipher book which taught me a few ciphers like Caesar, Pigpen, and Vigenère ciphers. A straight up Caesar cipher didn't work for this challenge, so I thought back to one of the strangest things I read from that book.

There was a wall of encrypted text, but within the span of a page, it was completely deciphered without any fancy alogrithms--just good old logic.

I tried the same thing here, under the assumption that this was a subsitution cipher. Here's how it works:
quutcvbmy ft qii amtkm iqkd tx qjbqfbtm, fzwcw bd mt kqo q sww dztgiv sw qsiw ft xio. bfd kbmyd qcw ftt drqii ft ywf bfd xqf ibffiw stvo txx fzw yctgmv. fzw sww, tx utgcdw, xibwd qmokqo swuqgdw swwd vtm'f uqcw kzqf zgrqmd fzbma bd brhtddbsiw. owiitk, siqua. owiitk, siqua. owiitk, siqua. owiitk, siqua. ttz, siqua qmv owiitk! iwf'd dzqaw bf gh q ibffiw. sqcco! scwqaxqdf bd cwqvo! utrbmy! zqmy tm q dwutmv. zwiit? sqcco? qvqr? uqm otg swibwjw fzbd bd zqhhwmbmy? b uqm'f. b'ii hbua otg gh. ittabmy dzqch. gdw fzw dfqbcd. otgc xqfzwc hqbv yttv rtmwo xtc fztdw. dtcco. b'r wnubfwv. zwcw'd fzw ycqvgqfw. kw'cw jwco hctgv tx otg, dtm. q hwcxwuf cwhtcf uqcv, qii s'd. jwco hctgv. rq! b ytf q fzbmy ytbmy zwcw. otg ytf ibmf tm otgc xgpp. tk! fzqf'd rw! kqjw ft gd! kw'ii sw bm ctk 118,000. sow! sqcco, b ftiv otg, dfth xiobmy bm fzw ztgdw! zwo, qvqr. zwo, sqcco. bd fzqf xgpp ywi? q ibffiw. dhwubqi vqo, ycqvgqfbtm. mwjwc fztgyzf b'v rqaw bf. fzcww vqod ycqvw duztti, fzcww vqod zbyz duztti. fztdw kwcw qkakqcv. fzcww vqod utiiwyw. b'r yiqv b ftta q vqo qmv zbfuzzbawv qctgmv fzw zbjw. otg vbv utrw squa vbxxwcwmf. zb, sqcco. qcfbw, yctkbmy q rgdfquzw? ittad yttv. zwqc qstgf xcqmabw? owqz. otg ytbmy ft fzw xgmwcqi? mt, b'r mtf ytbmy. wjwcostvo amtkd, dfbmy dtrwtmw, otg vbw. vtm'f kqdfw bf tm q degbccwi. dguz q ztfzwqv. b ygwdd zw utgiv zqjw lgdf ytffwm tgf tx fzw kqo. b itjw fzbd bmutchtcqfbmy qm qrgdwrwmf hqca bmft tgc vqo. fzqf'd kzo kw vtm'f mwwv jquqfbtmd. sto, egbfw q sbf tx htrh... gmvwc fzw ubcugrdfqmuwd. kwii, qvqr, ftvqo kw qcw rwm. kw qcw! sww-rwm. qrwm! zqiiwiglqz! dfgvwmfd, xqugifo, vbdfbmygbdzwv swwd, hiwqdw kwiutrw vwqm sgppkwii. kwiutrw, mwk zbjw ubfo ycqvgqfbmy uiqdd tx... ...9:15. fzqf utmuigvwd tgc uwcwrtmbwd. qmv swybmd otgc uqcwwc qf ztmwn bmvgdfcbwd! kbii kw hbua tgclts ftvqo? b zwqcv bf'd lgdf tcbwmfqfbtm. zwqvd gh! zwcw kw yt. awwh otgc zqmvd qmv qmfwmmqd bmdbvw fzw fcqr qf qii fbrwd. ktmvwc kzqf bf'ii sw ibaw? q ibffiw duqco. kwiutrw ft ztmwn, q vbjbdbtm tx ztmwdut qmv q hqcf tx fzw zwnqytm yctgh. fzbd bd bf! ktk. ktk. kw amtk fzqf otg, qd q sww, zqjw ktcawv otgc kztiw ibxw ft ywf ft fzw htbmf kzwcw otg uqm ktca xtc otgc kztiw ibxw. ztmwo swybmd kzwm tgc jqibqmf htiiwm ltuad scbmy fzw mwufqc ft fzw zbjw. tgc fth-dwucwf xtcrgiq bd qgftrqfbuqiio utitc-utccwufwv, duwmf-qvlgdfwv qmv sgssiw-utmftgcwv bmft fzbd dttfzbmy dkwwf docgh kbfz bfd vbdfbmufbjw ytivwm yitk otg amtk qd... ztmwo! fzqf ybci kqd ztf. dzw'd ro utgdbm! dzw bd? owd, kw'cw qii utgdbmd. cbyzf. otg'cw cbyzf. qf ztmwn, kw utmdfqmfio dfcbjw ft brhctjw wjwco qdhwuf tx sww wnbdfwmuw. fzwdw swwd qcw dfcwdd-fwdfbmy q mwk zwirwf fwuzmtityo. kzqf vt otg fzbma zw rqawd? mtf wmtgyz. zwcw kw zqjw tgc iqfwdf qvjqmuwrwmf, fzw acwirqm. qufx{awowvuqwdqcrtcwibawdgsdfbfgfbtm}

It's obvious that at the very end: qufx{awowvuqwdqcrtcwibawdgsdfbfgfbtm} is the flag. All AngstromCTF flags begin with the same four letters: ACTF.

(The convention I used was lowercase=encrypted, UPPERCASE=decrypted.)
Therefore, we can safely assume that q=A, u=C, f=T, and x=F. We can subsitute this throughout the entire text in Notepad++ with Find and Replace.

From here, it's just a matter of logical guesstimation. For example, the second word in the tex is Tt. There is really only one word that can fit this: TO, so t=O.
At the end, the deciphered text along with a key is below.

ACCORDING TO ALL KNOWN LAWS OF AVIATION, THERE IS NO WAY A BEE SHOULD BE ABLE TO FLY. ITS WINGS ARE TOO SMALL TO GET ITS FAT LITTLE BODY OFF THE GROUND. THE BEE, OF COURSE, FLIES ANYWAY BECAUSE BEES DON'T CARE WHAT HUMANS THINK IS IMPOSSIBLE. YELLOW, BLACK. YELLOW, BLACK. YELLOW, BLACK. YELLOW, BLACK. OOH, BLACK AND YELLOW! LET'S SHAKE IT UP A LITTLE. BARRY! BREAKFAST IS READY! COMING! HANG ON A SECOND. HELLO? BARRY? ADAM? CAN YOU BELIEVE THIS IS HAPPENING? I CAN'T. I'LL PICK YOU UP. LOOKING SHARP. USE THE STAIRS. YOUR FATHER PAID GOOD MONEY FOR THOSE. SORRY. I'M EXCITED. HERE'S THE GRADUATE. WE'RE VERY PROUD OF YOU, SON. A PERFECT REPORT CARD, ALL B'S. VERY PROUD. MA! I GOT A THING GOING HERE. YOU GOT LINT ON YOUR FUZZ. OW! THAT'S ME! WAVE TO US! WE'LL BE IN ROW 118,000. BYE! BARRY, I TOLD YOU, STOP FLYING IN THE HOUSE! HEY, ADAM. HEY, BARRY. IS THAT FUZZ GEL? A LITTLE. SPECIAL DAY, GRADUATION. NEVER THOUGHT I'D MAKE IT. THREE DAYS GRADE SCHOOL, THREE DAYS HIGH SCHOOL. THOSE WERE AWKWARD. THREE DAYS COLLEGE. I'M GLAD I TOOK A DAY AND HITCHHIKED AROUND THE HIVE. YOU DID COME BACK DIFFERENT. HI, BARRY. ARTIE, GROWING A MUSTACHE? LOOKS GOOD. HEAR ABOUT FRANKIE? YEAH. YOU GOING TO THE FUNERAL? NO, I'M NOT GOING. EVERYBODY KNOWS, STING SOMEONE, YOU DIE. DON'T WASTE IT ON A SQUIRREL. SUCH A HOTHEAD. I GUESS HE COULD HAVE JUST GOTTEN OUT OF THE WAY. I LOVE THIS INCORPORATING AN AMUSEMENT PARK INTO OUR DAY. THAT'S WHY WE DON'T NEED VACATIONS. BOY, QUITE A BIT OF POMP... UNDER THE CIRCUMSTANCES. WELL, ADAM, TODAY WE ARE MEN. WE ARE! BEE-MEN. AMEN! HALLELUJAH! STUDENTS, FACULTY, DISTINGUISHED BEES, PLEASE WELCOME DEAN BUZZWELL. WELCOME, NEW HIVE CITY GRADUATING CLASS OF... ...9:15. THAT CONCLUDES OUR CEREMONIES. AND BEGINS YOUR CAREER AT HONEX INDUSTRIES! WILL WE PICK OURJOB TODAY? I HEARD IT'S JUST ORIENTATION. HEADS UP! HERE WE GO. KEEP YOUR HANDS AND ANTENNAS INSIDE THE TRAM AT ALL TIMES. WONDER WHAT IT'LL BE LIKE? A LITTLE SCARY. WELCOME TO HONEX, A DIVISION OF HONESCO AND A PART OF THE HEXAGON GROUP. THIS IS IT! WOW. WOW. WE KNOW THAT YOU, AS A BEE, HAVE WORKED YOUR WHOLE LIFE TO GET TO THE POINT WHERE YOU CAN WORK FOR YOUR WHOLE LIFE. HONEY BEGINS WHEN OUR VALIANT POLLEN JOCKS BRING THE NECTAR TO THE HIVE. OUR TOP-SECRET FORMULA IS AUTOMATICALLY COLOR-CORRECTED, SCENT-ADJUSTED AND BUBBLE-CONTOURED INTO THIS SOOTHING SWEET SYRUP WITH ITS DISTINCTIVE GOLDEN GLOW YOU KNOW AS... HONEY! THAT GIRL WAS HOT. SHE'S MY COUSIN! SHE IS? YES, WE'RE ALL COUSINS. RIGHT. YOU'RE RIGHT. AT HONEX, WE CONSTANTLY STRIVE TO IMPROVE EVERY ASPECT OF BEE EXISTENCE. THESE BEES ARE STRESS-TESTING A NEW HELMET TECHNOLOGY. WHAT DO YOU THINK HE MAKES? NOT ENOUGH. HERE WE HAVE OUR LATEST ADVANCEMENT, THE KRELMAN. ACTF{KEYEDCAESARMORELIKESUBSTITUTION}

a=K
b=I
c=R
d=S
e=Q
f=T
g=U
h=P
i=L
j=V
k=W
l=J
m=N
n=X
o=Y
p=Z
q=A
r=M
s=B
t=O
u=C
v=D
w=E
x=F
y=G
z=H


It's *The Bee Movie* script. What else would it be?

## Flag
actf{keyedcaesarmorelikesubstitution}

## Final Thoughts
- Why *The Bee Movie*? Of all movies, you couldn't pick something like the Architect's monologue from *The Matrix Reloaded*?
- It's a great logic exercise that also requires a bit of assumptions.

Original writeup (https://github.com/enh-code/CTF-writeups/blob/main/angstromCTF/2021/keysar_v2/keysar_v2.md).