krypton1@krypton:/krypton/krypton1$ cat README Welcome to Krypton!
This game is intended to give hands on experience with cryptography and cryptanalysis. The levels progress from classic ciphers, to modern, easy to harder.
Although there are excellent public tools, like cryptool,to perform the simple analysis, we strongly encourage you to try and do these without them for now. We will use them in later excercises.
** Please try these levels without cryptool first **
The first level is easy. The password for level 2 is in the file 'krypton2'. It is 'encrypted' using a simple rotation called ROT13. It is also in non-standard ciphertext format. When using alpha characters for cipher text it is normal to group the letters into 5 letter clusters, regardless of word boundaries. This helps obfuscate any patterns.
This file has kept the plain text word boundaries and carried them to the cipher text.
Substitution ciphers are a simple replacement algorithm. In this example of a substitution cipher, we will explore a 'monoalphebetic' cipher. Monoalphebetic means, literally, "one alphabet" and you will see why.
This level contains an old form of cipher called a 'Caesar Cipher'. A Caesar cipher shifts the alphabet by a set number. For example:
plain: a b c d e f g h i j k ... cipher: G H I J K L M N O P Q ...
In this example, the letter 'a'in plaintext is replaced by a 'G'in the ciphertext so, for example, the plaintext 'bad' becomes 'HGJ'in ciphertext.
The password for level 3 is in the file krypton3. It is in 5 letter group ciphertext. It is encrypted with a Caesar Cipher. Without any further information, this cipher text may be difficult to break. You do not have direct access to the key, however you do have access to a program that will encrypt anything you wish to give it using the key. If you think logically, this is completely easy.
One shot can solve it!
Have fun.
Additional Information:
The `encrypt` binary will look for the keyfile in your current working directory. Therefore, it might be best to create a working direcory in /tmp and in there a link to the keyfile. As the `encrypt` binary runs setuid `krypton3`, you also need to give `krypton3` access to your working directory.
Here is an example:
krypton2@melinda:~$ mktemp -d /tmp/tmp.Wf2OnCpCDQ krypton2@melinda:~$ cd /tmp/tmp.Wf2OnCpCDQ krypton2@melinda:/tmp/tmp.Wf2OnCpCDQ$ ln -s /krypton/krypton2/keyfile.dat krypton2@melinda:/tmp/tmp.Wf2OnCpCDQ$ ls keyfile.dat krypton2@melinda:/tmp/tmp.Wf2OnCpCDQ$ chmod 777 . krypton2@melinda:/tmp/tmp.Wf2OnCpCDQ$ /krypton/krypton2/encrypt /etc/issue krypton2@melinda:/tmp/tmp.Wf2OnCpCDQ$ ls ciphertext keyfile.dat
# in cryptography a caesar cipher also known as a caesars cipher the shift cipher caesars code or caesar shift is one of the simplest and most widely known encryption techniques it is a type of substitution cipher in which each letter in the plain text is replaced by a letter some fixed number of positions down the alphabet for example with a shift of a would be replaced by db would become e and soon the method is named after julius caesar who used it to communicate with his generals the encryption step performed by a caesar cipher is often incorporated as part of more complex schemes such as the vigenre cipher and still has modern application in the rot system as with all single alphabet substitution ciphers the caesar cipher is easily broken and in practice offers essentially no communication security shakespeare produced most of his known work between and his early plays were mainly comedies and histories genre she raised to the peak of sophistication and artistry by the end of the sixteenth century next he wrote mainly tragedies until about including hamlet king lear and macbeth considered some of the finest examples in the english language in his last phase he wrote tragicomedies also known as romances and collaborated with other playwrights many of his plays were published in editions of varying quality and accuracy during his lifetime and in two of his former theatrical colleagues published the first folio a collected edition of his dramatic works that included all but two of the plays now recognised as shakespeares
# although no attendance records for the period survive most biographers agree that shakespeare was educated at the kings new school in stratford a free school chartered in about a quarter of a mile from his home grammar schools varied in quality during the elizabethan era but the curriculum was dictated by law throughout england and the school would have provided an intensive education in latin grammar and the classics at the age of shakespeare married the year old anne hathaway the consistory court of the diocese of worcester issued a marriage licence on november two of hathaways neighbours posted bonds the next day as surety that there were no impediments to the marriage the couple may have arranged the ceremony in some haste since the worcester chancellor allowed the marriage banns to be read once instead of the usual three times annes pregnancy could have been the reason for this six months after the marriage she gave birth to a daughter susanna who was baptised on may twins son hamnet and daughter judith followed almost two years later and were baptised on february ham net died of unknown causes at the age of and was buried on august after the birth of the twins there are few historical traces of shakespeare until he is mentioned as part of the london theatre scene in because of this gap scholars refer to the years between and as shakespeares lost years biographers attempting to account for this period have reported many apocryphal stories nicholas rowe shakespeares first biographer recounted a stratford legend that shakespeare fled the town for london to escape prosecution for deer poaching another eighteenth century story has shakespeare starting his theatrical career minding the horses of theatre patrons in london john aubrey reported that shakespeare had been a country school master some twentieth century scholars have suggested that shakespeare may have been employed as a schoolmaster by alexander hoghton of lancashire a catholic landowner who named a certain william shakesh aftein his will no evidence substantiates such stories other than hearsay collected after his death
# hereupon le grand arose with a grave and stately air and brought me the beetle from a glass case in which it was enclosed it was a beautiful scarabaeus and at that time unknown to naturalists of course a great prize in a scientific point of view there were two round black spots near one extremity of the back and a long one near the other the scales were exceedingly hard and glossy with all the appearance of burnished gold the weight of the insect was very remarkable and taking all things into consideration i could hardly blame jupiter for his opinion respecting it
==> /krypton/krypton3/HINT1 <== Some letters are more prevalent in English than others.
==> /krypton/krypton3/HINT2 <== "Frequency Analysis" is your friend.
# put there together # the r the scales were exceedingly hard and glossy with all the appearance of burnished gold the weight of the insect was very remarkable and taking all things into consideration i could hardly blame jupiter for his opinion respecting it well done the level four password is brute
==> /krypton/krypton3/README <== Well done. You've moved past an easy substitution cipher. Hopefully you just encrypted the alphabet a plaintext to fully expose the key in one swoop. The main weakness of a simple substitution cipher is repeated use of a simple key. In the previous exercise you were able to introduce arbitrary plaintext to expose the key. In this example, the cipher mechanism is not available to you, the attacker. However, you have been lucky. You have intercepted more than one message. The password to the next level is found in the file 'krypton4'. You have also found 3 other files. (found1, found2, found3) You know the following important details: - The message plaintexts are in English (*** very important) - They were produced from the same key (*** even better!) Enjoy.
==> /krypton/krypton4/krypton5 <== HCIKV RJOX ==> /krypton/krypton4/README <== Good job!
You more than likely used frequency analysis and some common sense to solve that one.
So far we have worked with simple substitution ciphers. They have also been 'monoalphabetic', meaning using a fixed key, and giving a one to one mapping of plaintext (P) to ciphertext (C). Another type of substitution cipher is referred to as 'polyalphabetic', where one character of P may map to many, or all, possible ciphertext characters.
An example of a polyalphabetic cipher is called a Vigen�re Cipher. It works like this:
If we use the key(K) 'GOLD', and P = PROCEED MEETING AS AGREED, then"add" P to K, we get C. When adding, if we exceed 25, then we roll to 0 (modulo 26).
P P R O C E E D M E E T I N G A S A G R E E D K G O L D G O L D G O L D G O L D G O L D G O
This level is a Vigen�re Cipher. You have intercepted two longer, english language messages. You also have a key piece of information. You know the key length!
For this exercise, the key length is 6. The password to level five is in the usual place, encrypted with the 6 letter key.
subsolve on master is v0.1.0 via v1.93.0 ❯ ./target/release/subsolve --vigenere "YYIIA CWVSL PGLVH DSAFD TYYRY YEDRG LYXER BJIEV EPLVX BICNE XRIDT IICXD TIXRI PJNIB ILTYS EWCXE IKVRM VXBIC RRHOE ETFHD LGHBG YZCWZ RQXMU ISDIA YKLOQ DWFQD LCIVA KRBYY IDMLB FSNQY STLYT NJUEQ VCFKT SPCTW AYSBB ZXRLG XRBOE LIUSB SRMPF EMJYR WZPCS UMNJG WVXRE RBRVW IBMVV KRBRR HOLCW WIOPJ JJWVS LJCCC LCFEH DSRTR XOXFJ CECXM KKLOM PGIIK HYSUR YAQMV HSHLT KOXSU BYEDX FJPAY YJIUS PSPGI IKODF JXSJW TLASW FXRMN XFJCM YRGBZ PVKMN EXYXF JWSBI QYRRN OGQCE NICWW SBCMZ PSEGY SISKW RNKFI XFJWM BIQNE GOCMZ IXKWR JJEBI QTGIM YJNRV DLYYP SETPJ WIBGM TBINJ MTUEX HRMVR ISSBZ PVLYA VEFIP DXSYH ZWVEU JYXKH YRRUC IKWCI FRDFC LXINX FJKMX AMTUQ KRGXY SEPBH VVDEG SCCGI CUZJI SSPZP VIBFG SYVBJ VVKRB YYIXQ WORAC AMZCH BYQYR KKMLG LXDLC QZSXA CSKEG EWNEX YXFJW SBIQY RRNJM ZEHRM QTNRC YNUVV KRBSF SXICA VVURC BNLKX GYNEC JMWYI NMBSK QORRN FRSXY SUXRI QHRVO GPTNJ YYLIR XBICK LPVSD SLXCE LIWMV PCIUS BSRMP WLEQP VXGMR MKLOQ QTKLK XQMVA YYJIE SDFCM LRQVW KFVKP MSXXS QCXYI DLMZX LDXFN JAKWT JICUM LIRRN XFTLK RXDZC SPXFJ JGKVC HISGF SYJLO PYZXL OHFJR VDMJD RXDLC FNOGE PINEI MLBYM MLRMV TYSPH IIKXS WVTSG IJUYZ XFJEY DWFNJ TKHBJ ULKRB XNIBI QTTPE QQDRR NXFJE YDWUJ IICSQ RRPVX FFKLO HPTGT OHYQD SCXYX DEXCY XYIZY RNEXR IZFJO OXZZK XRIQH RVOGP TNHSH LTKQS RBMFA VSLLZ XDSMP YMWXM KZPVX FJSEC OCYWS BMRJE ELPCI YMWXM PVIZE UFPJB SKYYI PMPJR WRIDJ RVOHY XGEBO KNXLD KCYZR DSFNJ WDVYB RRNFS WELSQ SUJSR IIJGX KKMTU HSWRF EGOEU FPJBS KYYIP PYRVW KRBTE PIGYR VROEP YFGYZ CWUSB SRMPA SXFII CVIYA VWGLC SJLOP YDUSG RRTJP OINYY ICIIJ GXRIP AVVIW LZXEX HUFIQ KRBXY ICPCU KWYYL ICCER RNCQY VLNEK GLCSZ XGEQI RCVME MKXRI ENIPL ERMVH RIPKR GOMLF CMDXJ JIMZT JNEKL VMTBE XHQTF RKJRJ IXRIW FCPCX YWKIN XMBRV NXFJV QOVYQ UGSXW YYMCA YXKSL IYSVZ ORRKL PNEWK FVDLC YIEFI JJIWD LCDYE NLYWU PIFCJ EAKPI NEKKR FTLVG LCSKL OCQFN FOJMW VXRIK FXVOE RIZXM LRMRX MVMXJ INXFJ ISKHY SUHSZ GIVHD LCKFV OWRFJ JKVYX KLOCA TLPNW CJFRO MRMVV CMBJZ XGEQF MIBCU NUINM RHYEX HUMVR DLCDT VOTRZ GXYXF JVHQI YSUPY SIJUM XXMNK XRIWH FYVHQ JVMDA YXRPC STJIC NICUR RNXFJ IIGIP JDEXC ZNXNK KEJUV YGIXR XDLCG FXDSK YYICM BJJAO VCXFW DICUK LKXLT EIYJR MVQMS SQUGV MKGUS GRYSU JYVYR FQORR NKWOI KJUXR ERYYI SVHTL VXIWR LWDIL INLKX QMRPV ACIFE COCIU SBSRM PHOWN FZVSR EQPMR ETJEX DLCKR MXXCX KMNIY XRMNX FJKMX AMTUQ KRYSU XRIJN FRCLM TBLSW QMRKQ CKFEI KRBQF SUIBY YSEKF YWYVF SYKLO WAFII MVMBJ ESHUJ TEXRM YWPIX FFKMC GCWKE SRLJZ XRIPH RRGIA QZQLH MBEMX XMYYM CKPJR XNMRH YXRIP JWSBI GKNIM ELSFX TYKUF ZOVGY NIWYQ YJXYT UMVVO ACFII SXFNE OSGMZ CHTYK UFZOV GYJES HRMVG YAYWU PIPGT EEPXC WDIKW SWZRQ XFJUM CXYST IMEPJ WYVPW NELSW KNEHD LCSNI KVCFC PBMEM KEXWU JIINX FJJGK VCHIS GJMWP SEGYS TEBVW ZJEVP MAVVY RWTLV LEAPF ROERF KMWIU JCPSP JYICS XQFZH DLCQZ SXAFT NMVPE TWMBW RNNMV PBJTP KVCIK LOWAF IIMVM BWSBM DDFYP SSSUX RERDF YMSSQ URYXH ZDTYZ CWKLO KSQWH YVMYY CGSSQ UFOOG QCINS PYYID MLBFS NQYSS ENPWI VRDIB TEXRI PTTOC FCQFA LYRNW MKQMS PSEVZ FTOSX UNCPX SRRRX DIPXF QEGFK FVDLC KRPVA MZCHX SRMLV DQCFK EVP " Key: frekey | Score: -10386.65 (quadgram) ───────────────────────────────────────────────────────────────── they were obliged to camp out that night under a large tree in the forest for there were no houses near the tree made a good thick covering to protect them from the dew and the tin woodman chopped a great pile of wood with his axe and dorothy built a splendid fire that warmed her and made her feel less lonely she and to to ate the last of their bread and now she did not know what they would dofor breakfast if you wish said the lion i will go into the forest and killa deer for you you can roast it by the fire since your tastes are so peculiar that you prefer cooked food and then you will have a very good breakfast dont please dont begged the tin woodman i should certainly weep if you killed a poor deer and then my jaws would rust again but the lion went away into the forest and found his owns upper and noone ever knew what it was for he didnt mention it and the scarecrow found a tree full of nuts and filled dorothy s basket with them so that she would not be hungry for along time she thought this was very kind and thoughtful of the scarecrow but she laughed heartily at the awkward way inwhich the poor creature picked up the nuts his padded hands were so clumsy and the nuts were so small that he dropped almost as many as he put in the basket but the scarecrow did not mind how long it took him to fill the basket for it enabled him to keep away from the fire as he feared as park might get into his straw and burn him up so he kept a good distance away from the flames and only came near to cover dorothy with dry leaves when she lay down to sleep these kept her very snug and warm and she slept soundly until morning when it was daylight the girl bathed her face in a little rippling brook and soon after they all started toward the emerald city this was to bean eventful day for the travelers they had hardly been walking an hour when they saw before them a great ditch that crossed the road and divided the forest as far as they could see on either side it was a very wide ditch and when they crept up to the edge and looked into it they could see it was also very deep and there were many big jagged rocks at the bottom the sides were so steep that none of them could climb down and for a moment it seemed that their journey must end what shall we do asked dorothy despairingly i have nt the faintest idea said the tin woodman and the lions hook his shaggy mane and looked thoughtful but the scarecrow said we cannot fly that is certain neither can we climb down into this great ditch therefore if we cannot jump over it we must stop where we are i think i could jump over it said the cowardly lion after measuring the distance carefully in his mind then we are all right answered the scarecrow for you can carry us all over on your back one at a time well ill try it said the lion who will go first i will declared the scarecrow forif you found that you could not jump over the gulf dorothy would be killed or the tin woodman badly dented on the rocks below but if iam on your back it will not matter so much for the fall would not hurt meat all ───────────────────────────────────────────────────────────────── alt 2 (q: -30154.08): they were obliged to camp out that night under a large tree in the forest for th... alt 3 (q: -30154.37): they were obliged to camp out that night under a large tree in the forest for th...
❯ ./target/release/subsolve --vigenere "FIPJS EJXYV CYYHZ KMOYH GNEYN XSYSI PHJOM OKLYY HBTXH MLIYI RGGKK PMFHJ GMJRX GNOVT ZHCSL ZVBAL ZOVKZ RHTWL BLGDJ YGIWO HULMF ZVVKX YDXUU NNRMR AMGZX KSXQR VNBBA IELOP BTZLF MRJET GBUCX RSIYK OPDCY YHRBT UOWAP RPKHM DLCMV VYDMS VCSIU GWHQS MOPRM TUNAY DEYOM AVITL MAUYP DJMCL VYUYY ALDXB IDPXK QQMGZ XKCPC PONTW JVSQP EAJPL BIMQE SOGLD IVEYE KAPCW FZIFG GKLYA VPRYM VYXFZ YTNIS KMLHI EKMYS QFPAB XXHXS BOPVZ MSOWJ PIXIK PCTDW EKKGD SKQPX GOGNF IPJGY ULLDS FTWUK TKGLG NLJOZ PDMQE SOKIY OWSXI QCTZW EBPSS NTPBF SEAUO VOVSM VIQLT YWSPP EFZAV EKFTX JKKLC TSYJE UFMSP YXIAZ LVPWG WOBXZ SKWQS MFRBU ORRSS HMAUY XMQES OGLXI QDMAG VJYVB LRPKP PDLFT WFZHJ UMLRW JGLHC AFTXR GLARI RZTFU YARIU LZRYM OKXZC SXKNW YRRSI AKBNR FMFVV TZIOE ASSEZ ALCTC NOFUY ZKMJE LNZZS SRRPH VTMOO WSYPV MAAPE PLXFK THPEA PLNHB AEEJW CFAIW BIQDI QGGKA YGPXR JPHCW RTPYR BNRXC OYCAG KOVRS IDATP XXUTK OETWK MPZJZ UBZDF PTKUZ XFOWR SEGOM TEWRS EIKVV CXRSI VXHDX IPTRL KTYCK MYIOE LVWIN LMAYM VNVGW PGUMO OGMXT BYXKK RBCIF KKCOH CITEK LZSSL ZJGKE SCSLD FNTDO OLYOE UKTSD LWNSY UNYSR FTWPN XLUWY YHUOL MKGCE LBAZO VMLPH OUKLP IUEVN IXZYJ YYBVK MFLYR AIENT WCXFP GBTYP NILEM NRUHM LCWSE IELBO QTRGK ESCSL DFNTD DOVCA VVTVP ZEJWC BIVBZ MCOAV ZAARI ALVRY HMYXF PVCKH WVIYY HCKKO KTQDI PUGKR ELOGN XXZVM IPWRI HUNLY YHPRH ARIQN SZKXH CMJJS SLTUN SLNSZ VELDM LRLVY KLCIK MPNTV LDSYX EACAV GEQDM GZBUQ JMCLV YIVBX PLMGS KSYVP JHEUI WOHMQ JGULS OINEL RGKYS ZYWSS NBZLV CLOSG LABSS DIQNB TKRBS IFGBK DSRSI QXTDO VYDLR SHCOH FTWPN TPBXM TXVCB ZREAN SZSHK KXGZR CXXWK VCOJB XTFYY LRPNJ RDRSK LCPUF LRIPP EGGGF DMKPX BJTFC LCXEL GLRPS PXVWG KCSWJ ZVEEH YCLCX ELUGS IEQVJ BXTNO RRWIZ GGMBS KEIYR LVXWZ LRXVE LKWCE SYKMT OOLZA LKLZS VRPPY YHUCF YYOVT EVXHM YWVXR LCCCD WVXPL RETPS SZXUD MKPWG NXOYR MFVGU XUDIP EEVTR VEVEP RGRXT ORGYX UKBYD VYGIY RBUQF YNOJG KKCEL OJBXP HBHQM IGCBE DPMYH BTTUN TYCMF YBYKZ YDXQK TSYJR CEIKE SSRED MEOGA OPJDS AGGKM SKAEA ELOYY QPCRY PLKVC BYVZX HPVCY GUNHB CIYDA RREHC ELPRT RBZRS LPCRY LPBRM EQHIA PXXFP LNHBA YJQFG UZKHF IJWMA MRVEV QPPSO MOSRI DMETH AYJJL XREXH BWGEM FLBMD ICYCR GKZCM LNIJK LPXGC TGNSX SKWRQ VBSYY KRAP " Key: keylength | Score: -7602.39 (quadgram) ───────────────────────────────────────────────────────────────── very orderly and methodical he looked with a hand on each knee and aloud watch ticking a sonorous sermon under his flapped waistcoat as though it pitted its gravity and longevity against the levity and evanescence of the brisk fire he had a good leg and was a little vain of it for his brown stockings fitted sleek and close and were of a fine texture his shoes and buckles too though plain were trim he wore an odd little sleek crisp flaxen wig setting very close to his headwhich wig it is to be presumed was made of hair but which looked far more as though it were spun from filaments of silk or glass his linen though not of a fineness in accordance with his stockings was as white as the tops of the waves that broke upon the neighbouring beach or the specks of sail that glinted in the sunlight far at sea a face habitually suppressed and quieted was still lighted up under the quaint wig by a pair of moist bright eyes that it must have cost their owner in years gone by some pains to drill to the composed and reserved expression of tell sons bank he had a healthy colour in his cheeks and his face though lined bore few traces of anxiety but perhaps the confidential bachelor clerks in tell sons bank were principally occupied with the cares of other people and perhaps secondhand cares like secondhand clothes come easily off and on completing his resemblance to a man who was sitting for his portrait mr lorry dropped off to sleep the arrival of his breakfast roused him and he said to the drawer as he moved his chair to it i wish accommodation prepared for a young lady who may come here at anytime today she may ask for mr jarvis lorry or she may only ask for a gentleman from tell sons bank please to let me know yes sir tell sons bank in london sir yesyes sir we have oftentimes the honour to entertain your gentlemen in their travelling backwards and forwards betwixt london and paris sir avast deal of travelling sir in tells on and company s house yes we are quite a french house as well as an english on eyes sir not much in the habit of such travelling yourself i think sir not of late years it is fifteen years since we since i came last from france ───────────────────────────────────────────────────────────────── alt 2 (q: -20512.59): very orderly and methodical he looked with a hand on each knee and aloud watch t... alt 3 (q: -20524.50): very orderly and methodical he looked with a hand on each knee and aloud watch t...
i use cyberchef to decode the ciphertext btw
1 2 3 4
ciphertext: BELOS Z key: KEYLENGTH
RANDO M
RANDOM
level 6 → level 7
krypton6 要解决的是 LFSR stream cipher。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
krypton6@krypton:~$ tail -n +1 /krypton/krypton6/* ==> /krypton/krypton6/encrypt6 <== # ... ==> /krypton/krypton6/HINT1 <== The 'random' generator has a limited number of bits, and is periodic. Entropy analysis and a good look at the bytes in a hex editor will help.
There is a pattern!
==> /krypton/krypton6/HINT2 <== 8 bit LFSR tail: cannot open '/krypton/krypton6/keyfile.dat'for reading: Permission denied
==> /krypton/krypton6/krypton7 <== PNUKLYLWRQKGKBE ==> /krypton/krypton6/onetime <== tail: error reading '/krypton/krypton6/onetime': Is a directory
The encrypt6 binary uses an 8-bit LFSR (Linear Feedback
Shift Register) as a stream cipher. The key is in
keyfile.dat (not readable by krypton6), but we can run
encrypt6 on any plaintext — a known-plaintext
attack.
Since this is an 8-bit LFSR, the keystream repeats after a short
period. By encrypting known plaintext, we recover the keystream.
The 8-bit LFSR has only 2^8-1 = 255 possible states before repeating
— far from truly random. The known-plaintext attack recovers the
keystream in one shot.