Skip to main content

Gynvael's Task 1


This is short solution of task provided by Gynvael Coldwind on one of his online streams (here's a link ----> https://www.youtube.com/watch?v=fBEe8DGZL5o ) . We have to decrypt message: 

1f9111 1799 0790001226d8 0a9e1e5c3ada 1f 099e195e 0a97075a21dac1 0a9710 199e075131d3 1199 12961350

The message is in english, XOR-ed by 160bit key. Every word is encrypted separately. 
My approach to that is simply to assume that the single letter in the message has to be either 'a' or 'i'. If one of them is correct then XORing first letter of each word with correct key value (obtained by xoring 0x1f with 'a' or 'i') should print out english letter. In this case letter 'a' worked brilliantly ;-) Next step was to assume that first word has to be "and". The rest is even easier.

And here's the code to decrypt them all, and retrieve a key:


#include <cstdio>
#include <vector>

int main()
{

 int key[7] = {0};

 std::vector< std::vector<int> > words = {  
  { 0x1f, 0x91, 0x11 }, 
  { 0x17, 0x99 },
  { 0x07, 0x90, 0x00, 0x12, 0x26, 0xd8 },
  { 0x0a, 0x9e, 0x1e, 0x5c, 0x3a, 0xda },
  { 0x1f },
  { 0x09, 0x9e, 0x19, 0x5e }, 
  { 0x0a, 0x97, 0x07, 0x5a, 0x21, 0xda, 0xc1 },
  { 0x0a, 0x97, 0x10 }, 
  { 0x19, 0x9e, 0x07, 0x51, 0x31, 0xd3 },
  { 0x11, 0x99 },
  { 0x12, 0x96, 0x13, 0x50 }
 }; 
 
 key[0] = 0x1f ^ 'a';
 key[1] = 0x91 ^ 'n';
 key[2] = 0x11 ^ 'd';
 key[3] = 0x50 ^ 'e';
 key[4] = 0x26 ^ 'r';
 key[5] = 0xd8 ^ 'e';
 key[6] = 0xc1 ^ 'h';

 for (int i = 0; i < 11; i++)
 {
  printf("[%.2d]: ", i);
  for (int j = 0; j < words[i].size(); j++)
  {
   printf("%c", words[i][j] ^ key[j]);
  }
  printf("\n");
 }

 printf("[KEY]: ");
 for (int i = 0; i < 7; i++) printf("%.2x", key[i]);
 printf("\n");

 return 0;
}

And here's an output of that:
[00]: and
[01]: if
[02]: you're
[03]: taking
[04]: a
[05]: walk
[06]: through
[07]: the
[08]: garden
[09]: of
[10]: life
[KEY]: 7eff753554bda9

Comments

Popular posts from this blog

#LabyREnth CTF - Windows track no. 1 - AntiD.exe

In this task we have to reverse file called 'AntiD.exe'. After first examination of this, it looks to be simple PE32 executable, packed with UPX. Unfortunately we can't decompress it using UPX tool, so I started to unpack it manually. First thing to notice is that in PE Optional Header - DllCharasteristics is set to 8140, which means that DLLs in this executable can move around a bit (I'm usually using programs like 'CFF Explorer' or something similar to check this things out). I've changed this header to 8100, what actually terminated this behaviour ;) To decompress this .exe I personally used x64dbg and Scylla, but the tool doesn't matter at all - it could be any runtime debugger and I mp Rec I suppose. What we need to do is stop program execution at Entry Point of AntiD.exe, and run exactly one instruction : pushal - in my case, as you can see on image below (but You can also see this as PUSHAD in OllyDbg, or any other debugger). Aft

#IceCTF - Thor's a hacker now

I've spend over half an hour on solving this task, beside of that wasn't a hard one. But thanks to this exercise I had to learn using regular expressions in my text editor :) Text file connected to this task looked exactly like that (but was much larger): 00000000: 4c5a 4950 01b3 007f b61b edf0 8440 58e3 LZIP.........@X. 00000010: 91de 1027 5861 8a67 4282 46a4 92f9 4cad ...'Xa.gB.F...L. 00000020: 2d5d 14eb 3099 2c31 01c2 d13a 74d2 c620 -]..0.,1...:t.. 00000030: de27 3a8f fa92 0644 5468 2d02 01fa 24bb .':....DTh-...$. 00000040: 719f a0fd a191 1678 8bff a2c4 2627 9871 q......x....&'.q 00000050: 83bf cff2 f8af 99fa c465 2b7c 6bdf ee3c .........e+|k..< 00000060: b71b f61b 0b5e 0ce7 d14f f6a8 0466 6470 .....^...O...fdp 00000070: de67 02da 7be1 1abd e9f0 ac87 131a bcc0 .g..{........... 00000080: 0b0b 9f31 9400 48e3 616a 8f3f 4804 79ad ...1..H.aj.?H.y. 00000090: a6bb 863a f641 01da b1ee c4fe b338 9289 ...:.A.......8.. 000000a0: 2a90 8302 4170 773c 88d3

#IceCTF - Substituted

It's one of very easy cryptographic tasks. We have to decrypt message: Lw! Gyzvecy ke WvyVKT! W'zz by reso dsbdkwksky tzjq teo kly ujr. Teo keujr, gy joy dksurwmq bjdwv vorakeqojalr jmu wkd jaazwvjkwemd. Vorakeqojalr ljd j zemq lwdkeor, jzklesql gwkl kly juxymk et vecaskyod wk ljd qekkym oyjzzr vecazwvjkyu. Decy dwcazy ezu vwalyod joy kly Vjydjo vwalyo, kly Xwqymyoy vwalyo, kly dsbdkwkskwem vwalyo, glwvl wd klwd emy, jmu de em. Jzcedk jzz et klydy vwalyod joy yjdwzr boeiym keujr gwkl kly lyza et vecaskyod. Decy myg ymvorakwem cykleud joy JYD, kly vsooymk dkjmujou teo ymvorakwem, jzemq gwkl ODJ. Vorakeqojalr wd j xjdk twyzu jmu wd xyor wmkyoydkwmq klesql. De iwvi bjvi, oyju sa em decy veez vwalyod jmu ljxy tsm! El jmu teo reso oyveoud cr mjcy wd WvyVKT{jzgjrd_zwdkym_ke_reso_dsbdkwksky_tzjqd}. We already know that every flag in this CTF, starts witch "IceCTF{" phrase, so there's no problem with first six substitutions. Then it's even easier. Here&#