https://blog.q3w3e3.dev Airgapp CTF Writeup <h1 id="airgapp-ctf">Airgapp CTF</h1> <p>On the 2nd of May 2020 Thugcrowd ran <a href="https://airgapp.in/">AIRGAPP</a>, and along side this conference they hosted a <a href="https://ctf.airgapp.in/">CTF</a>. I worked with the <a href="https://twitter.com/ctf_circle">CTF_Circle</a> team and we finished <a href="https://twitter.com/CTF_Circle/status/1256740013171027968">1st overall</a>!</p> <h2 id="discord-captured-10pts">Discord (Captured, 10pts)</h2> <blockquote> <p>Test your ability to read a Discord message.</p> </blockquote> <p>This flag was quite simple, the first message in the official discord channel for the CTF was</p> <figure class="highlight"><pre><code class="language-shell" data-lang="shell"> thug<span class="o">{</span>its_free_real_estate<span class="o">}</span></code></pre></figure> <p>this was the flag.</p> <h2 id="elliot-captured-10pts">Elliot (Captured, 10pts)</h2> <blockquote> <p>Snoop around the THUGCROWD and AIRGAP websites until you find some flags.</p> </blockquote> <p>This flag was also relatively quick, not sure where to start for these recon flags I ran</p> <figure class="highlight"><pre><code class="language-shell" data-lang="shell">wget <span class="nt">-m</span> ctf.airgapp.in</code></pre></figure> <p>and then following the hint to search airgapp website I ran a search across the entire site</p> <figure class="highlight"><pre><code class="language-shell" data-lang="shell"><span class="nb">grep</span> <span class="nt">-s</span> <span class="s2">"thug{"</span> <span class="k">*</span> .<span class="k">*</span></code></pre></figure> <p>which returned</p> <figure class="highlight"><pre><code class="language-shell" data-lang="shell">robots.txt:thug<span class="o">{</span>HeLlO_mR_rObOt<span class="o">}</span></code></pre></figure> <p>While I did expect these flags to be more obfuscated than that, the other recon flags proved trickier, and their 10pt value should have been a hint to not waste so much time on them.</p> <h2 id="kappa-captured-10pts">Kappa (Captured, 10pts)</h2> <blockquote> <p>There’s a flag hiding somewhere on Twitch.</p> </blockquote> <p>This was a twitch recon flag which lead us, initially to look at clips and video descriptions from previous broadcasts, all to no avail. We then figured we’d try chat for commands for a bot that may give a flag, I sent the chat</p> <figure class="highlight"><pre><code class="language-shell" data-lang="shell"><span class="o">!</span>flag</code></pre></figure> <p>and got</p> <figure class="highlight"><pre><code class="language-shell" data-lang="shell"><span class="o">!</span>flag</code></pre></figure> <p>in reply from a twitch user by the name of “<a href="https://www.twitch.tv/definitelynotaflag">definitelynotaflag</a>” who has a stream description of</p> <figure class="highlight"><pre><code class="language-shell" data-lang="shell">thug<span class="o">{</span>streaming_video_platform<span class="o">}</span></code></pre></figure> <p>This flag was interesting in that the definitelynotaflag did not seem to always respond to people for the flag, and was often not watching the stream.</p> <h2 id="not-elliot-not-captured-10pts">Not Elliot (Not Captured, 10pts)</h2> <blockquote> <p>Snoop around the THUGCROWD and AIRGAP websites until you find some flags.</p> </blockquote> <p>Knowing now that Elliot was a reference to Mr. Robot we then looked for references to non robot things (hoping to take a hint from the title of this flag), we looked for a</p> <figure class="highlight"><pre><code class="language-shell" data-lang="shell">/notrobots.txt</code></pre></figure> <p>but did not check the location</p> <figure class="highlight"><pre><code class="language-shell" data-lang="shell">/humans.txt</code></pre></figure> <p>where the flag actually resided.</p> <h2 id="ayy-lmao-not-captured-10pts">ayy lmao (Not Captured, 10pts)</h2> <blockquote> <p>Snoop around the THUGCROWD and AIRGAP websites until you find some flags.</p> </blockquote> <p>Much like Not Elliot, we had some suspicions about what this might relate to. We figured it would be a reference to the ayy lmao alien meme, but did not think to check</p> <figure class="highlight"><pre><code class="language-shell" data-lang="shell">/aliens.txt</code></pre></figure> <h2 id="paramz-captured-200pts">paramz (Captured, 200pts.)</h2> <blockquote> <p>parameters are easy!</p> </blockquote> <p>This challenge provided a WASM file and an html file with some horrifically obfuscated JS. After setting up FireFox to allow WASM debugging, you can work through the parameters without spending time digging at the JS.</p> <details> <summary> Click to expand the WASM (Apologies for the lack of syntax highlighting)</summary> <pre> (module (type $type0 (func (param i32) (result i32))) (type $type1 (func)) (global $global0 i32 (i32.const 0)) (export "__wasm_apply_relocs" (func $func0)) (export "_acb" (func $func1)) (export "_bcb" (func $func2)) (export "_ccb" (func $func3)) (export "_dcb" (func $func4)) (export "_ecb" (func $func5)) (export "_fcb" (func $func6)) (export "_gcb" (func $func7)) (export "_hcb" (func $func6)) (export "_icb" (func $func5)) (export "_jcb" (func $func8)) (export "_kcb" (func $func9)) (export "_lcb" (func $func10)) (export "_mcb" (func $func11)) (export "_ncb" (func $func6)) (export "_ocb" (func $func5)) (export "_pcb" (func $func12)) (export "_qcb" (func $func13)) (export "_rcb" (func $func6)) (export "_scb" (func $func1)) (export "_tcb" (func $func3)) (export "_ucb" (func $func14)) (export "_vcb" (func $func15)) (export "_wcb" (func $func4)) (export "_xcb" (func $func9)) (export "__dso_handle" (global $global0)) (export "__post_instantiate" (func $func0)) (func $func0 nop ) (func $func1 (param $var0 i32) (result i32) get_local $var0 i32.const 100 i32.ne ) (func $func2 (param $var0 i32) (result i32) get_local $var0 i32.const 71 i32.ne ) (func $func3 (param $var0 i32) (result i32) get_local $var0 i32.const 104 i32.ne ) (func $func4 (param $var0 i32) (result i32) get_local $var0 i32.const 49 i32.ne ) (func $func5 (param $var0 i32) (result i32) get_local $var0 i32.const 90 i32.ne ) (func $func6 (param $var0 i32) (result i32) get_local $var0 i32.const 51 i32.ne ) (func $func7 (param $var0 i32) (result i32) get_local $var0 i32.const 116 i32.ne ) (func $func8 (param $var0 i32) (result i32) get_local $var0 i32.const 86 i32.ne ) (func $func9 (param $var0 i32) (result i32) get_local $var0 i32.const 57 i32.ne ) (func $func10 (param $var0 i32) (result i32) get_local $var0 i32.const 115 i32.ne ) (func $func11 (param $var0 i32) (result i32) get_local $var0 i32.const 98 i32.ne ) (func $func12 (param $var0 i32) (result i32) get_local $var0 i32.const 108 i32.ne ) (func $func13 (param $var0 i32) (result i32) get_local $var0 i32.const 88 i32.ne ) (func $func14 (param $var0 i32) (result i32) get_local $var0 i32.const 99 i32.ne ) (func $func15 (param $var0 i32) (result i32) get_local $var0 i32.const 50 i32.ne ) ) </pre> </details> <p>these are in order up to number 7 and with a little bit of scrolling and copying and pasting it can be simplified down to</p> <figure class="highlight"><pre><code class="language-nasm" data-lang="nasm"> <span class="err">(</span><span class="nf">export</span> <span class="s">"_acb"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">100</span><span class="p">))</span> <span class="err">(</span><span class="nf">export</span> <span class="s">"_bcb"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">71</span><span class="p">))</span> <span class="err">(</span><span class="nf">export</span> <span class="s">"_ccb"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">104</span><span class="p">))</span> <span class="err">(</span><span class="nf">export</span> <span class="s">"_dcb"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">49</span><span class="p">))</span> <span class="err">(</span><span class="nf">export</span> <span class="s">"_ecb"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">90</span><span class="p">))</span> <span class="err">(</span><span class="nf">export</span> <span class="s">"_fcb"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">51</span><span class="p">))</span> <span class="err">(</span><span class="nf">export</span> <span class="s">"_gcb"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">116</span><span class="p">))</span> <span class="err">(</span><span class="nf">export</span> <span class="s">"_hcb"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">51</span><span class="p">))</span> <span class="err">(</span><span class="nf">export</span> <span class="s">"_icb"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">90</span><span class="p">))</span> <span class="err">(</span><span class="nf">export</span> <span class="s">"_jcb"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">86</span><span class="p">))</span> <span class="err">(</span><span class="nf">export</span> <span class="s">"_kcb"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">57</span><span class="p">))</span> <span class="err">(</span><span class="nf">export</span> <span class="s">"_lcb"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">115</span><span class="p">))</span> <span class="err">(</span><span class="nf">export</span> <span class="s">"_mcb"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">98</span><span class="p">))</span> <span class="err">(</span><span class="nf">export</span> <span class="err">"</span><span class="nv">_ncb</span><span class="err">"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">51</span><span class="p">))</span> <span class="err">(</span><span class="nf">export</span> <span class="s">"_ocb"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">90</span><span class="p">))</span> <span class="err">(</span><span class="nf">export</span> <span class="s">"_pcb"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">108</span><span class="p">))</span> <span class="err">(</span><span class="nf">export</span> <span class="s">"_qcb"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">88</span><span class="p">))</span> <span class="err">(</span><span class="nf">export</span> <span class="s">"_rcb"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">51</span><span class="p">))</span> <span class="err">(</span><span class="nf">export</span> <span class="s">"_scb"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">100</span><span class="p">))</span> <span class="err">(</span><span class="nf">export</span> <span class="s">"_tcb"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">104</span><span class="p">))</span> <span class="err">(</span><span class="nf">export</span> <span class="s">"_ucb"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">99</span><span class="p">))</span> <span class="err">(</span><span class="nf">export</span> <span class="s">"_vcb"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">50</span><span class="p">))</span> <span class="err">(</span><span class="nf">export</span> <span class="s">"_wcb"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">49</span><span class="p">))</span> <span class="err">(</span><span class="nf">export</span> <span class="s">"_xcb"</span> <span class="p">(</span><span class="nv">func</span> <span class="mi">57</span><span class="p">))</span></code></pre></figure> <p>I then threw these lines into excel:</p> <p><img src="/assets/img/screenshots/params.png" alt="alt text" title="Excel sheet showing the splits and the params" /></p> <p>and split them at the <code class="highlighter-rouge">_</code> and <code class="highlighter-rouge">))</code> and eventually generating a list of parameters</p> <figure class="highlight"><pre><code class="language-shell" data-lang="shell">?a<span class="o">=</span>100&amp;b<span class="o">=</span>71&amp;c<span class="o">=</span>104&amp;d<span class="o">=</span>49&amp;e<span class="o">=</span>90&amp;f<span class="o">=</span>51&amp;g<span class="o">=</span>116&amp;h<span class="o">=</span>51&amp;i<span class="o">=</span>90&amp;j<span class="o">=</span>86&amp;k<span class="o">=</span>57&amp;l<span class="o">=</span>115 &amp;m<span class="o">=</span>98&amp;n<span class="o">=</span>51&amp;o<span class="o">=</span>90&amp;p<span class="o">=</span>108&amp;q<span class="o">=</span>88&amp;r<span class="o">=</span>51&amp;s<span class="o">=</span>100&amp;t<span class="o">=</span>104&amp;u<span class="o">=</span>99&amp;v<span class="o">=</span>50&amp;w<span class="o">=</span>49&amp;x<span class="o">=</span>57</code></pre></figure> <p>when these params are checked on the main site an alert is then shown with the flag</p> <figure class="highlight"><pre><code class="language-shell" data-lang="shell">thug<span class="o">{</span>we_love_wasm<span class="o">}</span></code></pre></figure> <h2 id="gerkinz-captured-200pts">Gerkinz (Captured, 200pts)</h2> <blockquote> <p>host: ctf.airgapp.in port: 5000</p> </blockquote> <p>See the amazing writeup by <a href="https://twitter.com/thomasvandoren">T Van Doren</a> over <a href="https://tvd.dev/airgap2020-ctf-writeup.html">here</a></p> <h2 id="tecmu-captured-300pts">tecmu (Captured, 300pts)</h2> <p>See the lovely writeup by <a href="https://twitter.com/sarahemm">Sen</a> over <a href="https://gopher.floodgap.com/gopher/gw?a=gopher%3A%2F%2Fsen.cx%2F0%2Fctf-writeups%2Fairgap2020-tcemu.txt">here</a> or over <a href="gopher://sen.cx/0/ctf-writeups/airgap2020-tcemu.txt">gopher</a></p> <h2 id="spilling-messtake-captured-200pts">Spilling Messtake (Captured, 200pts)</h2> <blockquote> <p>Since the world is falling apart, you decide to pick up your old Gameboy to play some Pokemon Red. Immediately after entering your name, you realize you accidentally misspelled WUTANG as VUTANG. Damn. Create a Gameshark code to fix this problem for you. Then submit the flag as thug{CODE_HERE}</p> </blockquote> <p>A teammate completed this flag, I may update this with their writeup.</p> <h2 id="compy385-not-captured-150pts">Compy385 (Not Captured, 150pts)</h2> <blockquote> <p>do you like techno music?</p> </blockquote> <p>A teammate <em>nearly</em> completed this flag, I may update this with their writeup.</p> <p>We were unable to complete the flag because we were defeated by newline characters.</p> <h2 id="the-thugcrowd-and-friends-happy-fun-time-crossword-not-captured-100pts">The Thugcrowd and Friends Happy Fun Time Crossword (Not Captured, 100pts)</h2> <blockquote> <p>Each clue is the Twitter handle of one of our friends. Fit them all into the puzzle and the highlighted letters will spell out the flag.</p> </blockquote> <p>For this we went through twitter users with links to thugcrowd, and as many people as we could find that had been guests on the podcast, resulting in <a href="https://docs.google.com/spreadsheets/d/1olpItjjmfC1v2po7Cg7TpGtKU4b-qd6N01pVlI_dcK0/edit?usp=sharing">this spreadsheet</a>. As you can tell, I <em>love</em> working in spreadsheets, if something can be reasonably improved by a spreadsheet, I make one!</p> <hr /> <h2 id="takeaways-and-lessons-learned">Takeaways and Lessons Learned</h2> <ol> <li>Stop assuming that hex with x86 like entropy is x86, try something else… this probably lost us flags.</li> <li>Crypto hard, practice moar.</li> <li>Communication is important, documentation more so… Partially completed flags should be in a state where team members can pick up your work.</li> <li>I should do more of these, I love doing this stuff.</li> <li>Working in teams is a great way to learn (see #4).</li> <li>Sometimes it’s important to prioritize targets based on their value, the time I spent digging for 10pt flags was not worth as much as that spent on the higher point flags.</li> </ol> <hr /> <p>And lastly, I know a number of my teammates were close with other challenges and would have loved to have worked with them a little longer to complete them all. I want to congratulate them all on the work, and thank them for letting me work with them during this CTF.</p> Tue, 05 May 2020 13:37:00 +0000 https://blog.q3w3e3.dev//writeup/2020/05/05/Airgapp-CTF-WriteUp.html https://blog.q3w3e3.dev//writeup/2020/05/05/Airgapp-CTF-WriteUp.html rss feed test <p>This post is to test my <a href="https://blog.q3w3e3.dev/feed.xml">RSS feed</a></p> Mon, 04 May 2020 22:39:00 +0000 https://blog.q3w3e3.dev//testing/2020/05/04/rss-feed-testing.html https://blog.q3w3e3.dev//testing/2020/05/04/rss-feed-testing.html Welcome to Jekyll! <p>You’ll find this post in your <code class="highlighter-rouge">_posts</code> directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run <code class="highlighter-rouge">jekyll serve</code>, which launches a web server and auto-regenerates your site when a file is updated.</p> <p>Jekyll requires blog post files to be named according to the following format:</p> <p><code class="highlighter-rouge">YEAR-MONTH-DAY-title.MARKUP</code></p> <p>Where <code class="highlighter-rouge">YEAR</code> is a four-digit number, <code class="highlighter-rouge">MONTH</code> and <code class="highlighter-rouge">DAY</code> are both two-digit numbers, and <code class="highlighter-rouge">MARKUP</code> is the file extension representing the format used in the file. After that, include the necessary front matter. Take a look at the source for this post to get an idea about how it works.</p> <p>Jekyll also offers powerful support for code snippets:</p> <figure class="highlight"><pre><code class="language-ruby" data-lang="ruby"><span class="k">def</span> <span class="nf">print_hi</span><span class="p">(</span><span class="nb">name</span><span class="p">)</span> <span class="nb">puts</span> <span class="s2">"Hi, </span><span class="si">#{</span><span class="nb">name</span><span class="si">}</span><span class="s2">"</span> <span class="k">end</span> <span class="n">print_hi</span><span class="p">(</span><span class="s1">'Charlotte'</span><span class="p">)</span> <span class="c1">#=&gt; prints 'Hi, Charlotte' to STDOUT.</span></code></pre></figure> <p>Check out the <a href="https://jekyllrb.com/docs/home">Jekyll docs</a> for more info on how to get the most out of Jekyll. File all bugs/feature requests at <a href="https://github.com/jekyll/jekyll">Jekyll’s GitHub repo</a>. If you have questions, you can ask them on <a href="https://talk.jekyllrb.com/">Jekyll Talk</a>.</p> Mon, 04 May 2020 21:07:00 +0000 https://blog.q3w3e3.dev//jekyll%20update/2020/05/04/welcome-to-jekyll.html https://blog.q3w3e3.dev//jekyll%20update/2020/05/04/welcome-to-jekyll.html