<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Code Cadets - Medium]]></title>
        <description><![CDATA[The Code Cadets are a group of students at Canberra Grammar School with a passion towards technology and for exploring new and exciting projects. - Medium]]></description>
        <link>https://medium.com/codecadets?source=rss----873afb4ede1c---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Code Cadets - Medium</title>
            <link>https://medium.com/codecadets?source=rss----873afb4ede1c---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 04:22:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/codecadets" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Welcome home developers.]]></title>
            <link>https://medium.com/codecadets/welcome-home-developers-4e3a39a2a1ab?source=rss----873afb4ede1c---4</link>
            <guid isPermaLink="false">https://medium.com/p/4e3a39a2a1ab</guid>
            <category><![CDATA[apple]]></category>
            <category><![CDATA[wwdc]]></category>
            <dc:creator><![CDATA[Dylan Turner]]></dc:creator>
            <pubDate>Wed, 13 Jun 2018 09:11:34 GMT</pubDate>
            <atom:updated>2018-06-13T09:11:33.733Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ifMd-BJ1mFgc8yCHs-ztmg.jpeg" /></figure><h4>Our journey to WWDC18.</h4><p>Apple’s Worldwide Developer Conference (WWDC) is held annually in San Jose — bringing developers from all around the world together to discuss and learn about new Apple developer technologies.</p><p>Apple awards 350 scholarships to students from around the world. To apply for these scholarships, candidates must create a Swift or Xcode playground which demonstrates technical accomplishment and creativity. Also required is an essay titled “Beyond WWDC” detailing how you share your passion for coding with others.</p><p>This year, two Canberra Grammar Students won scholarships to the conference Dylan Turner and William Loughton — both in Year 10 at Canberra Grammar School.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DO5OeQ3LzO9RsPQfE6Bifg.jpeg" /><figcaption>Will (Left) and Dylan (Right) at Steve Jobs Theatre, Apple Park, Cupertino</figcaption></figure><p>This is following on from the successes in previous years of Code Cadets from Canberra Grammar School being awarded scholarships to WWDC — with five of our students being awarded scholarships to WWDC 2017 (out of ten in Australia), two being awarded scholarships to WWDC 2016 (out of eight in Australia), and three being awarded scholarships to WWDC 2015 (out of six in Australia).</p><p>This write-up of WWDC 2018 is from the perspective of Dylan and Will.</p><p>After the long flight from Australia we arrived at WWDC, ready for a great week. Things kicked-off on the Sunday morning with registration at the McEnery Convention Centre. Following that was the scholarship orientation. The location of the orientation was kept secret — all we knew was getting onto busses departing the convention centre at 9:30am. To our surprise and delight, we arrived at the brand new Apple HQ — aptly named Apple Park (also known as the “Spaceship Campus”).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nIzMGikC4pzY5hVvL0q9Xg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SQ9CsGpBMfSlv-H7WjnVSg.jpeg" /></figure><p>We started with lunch at Caffe Macs within the campus, before being taken to the Steve Jobs Theatre where we had presentations from different Apple executives.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rCtQTwTRGkfX9Mf5Ccr0Sg.jpeg" /></figure><p>The final talk was from Apple CEO Tim Cook who congratulated and encouraged us all. After the talk we were taken out into the foyer and got our scholar’s photo. Some of us were also lucky enough to get selfies with Tim Cook as he left the theatre!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vnWHo9CzoF2HuMgAPPYrzA.jpeg" /><figcaption>Dylan got a photo with Apple’s Chief Executive Officer, Tim Cook</figcaption></figure><p>We then had an opportunity to talk to a range of Apple engineers, learning about how they started at Apple and what’s their role at Apple. We then hopped back onto the bus to the convention centre.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_fKfqPpyObyglQyatxlJJg.jpeg" /></figure><p>We spent the rest of the week at the conference learning about new technologies, attending sessions presented by Apple engineers, and learning from the best to better our own projects in the labs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JqmWrUu4hyyseZTPe6sDzA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bQ0ol6r5a7MkgYCfwSyvoA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WaSuLvuaOdI1HvIRgAc9kA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_TuA_-5o902EXLVO-jB1mw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aCGCbQzr8KogV03GrnQmVg.jpeg" /></figure><p>We also took a part day off from the conference to visit some friends of the Code Cadets who work at Google and Facebook — having some special tours of the campuses.</p><p>WWDC 2018 was an unforgettable experience and adventure. Not only did we learn new and exciting technologies to incorporate into our apps, of equal importance was the opportunity to meet with other students from around the world with the same passion as ourselves — making new lifelong friends. We are also filled to the brim with new knowledge that we are looking forward to sharing with our peers back here in Canberra during our IT classes and Code Cadets sessions.</p><p>A very big thank you to Apple for hosting an amazing WWDC. Special shout out to Mr Purcell at Canberra Grammar School for all his support and advice in the lead-up to, and during, WWDC — having attended the past ten WWDC’s himself.</p><p>— Dylan and Will</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e3a39a2a1ab" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codecadets/welcome-home-developers-4e3a39a2a1ab">Welcome home developers.</a> was originally published in <a href="https://medium.com/codecadets">Code Cadets</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BSides Canberra 2018 CTF Write-Up: Birdie Yellow]]></title>
            <link>https://medium.com/codecadets/bsides2018-ctf-writeup-birdie-yellow-23a539aea79c?source=rss----873afb4ede1c---4</link>
            <guid isPermaLink="false">https://medium.com/p/23a539aea79c</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[infosec]]></category>
            <dc:creator><![CDATA[Damian C]]></dc:creator>
            <pubDate>Sun, 10 Jun 2018 11:30:31 GMT</pubDate>
            <atom:updated>2018-06-10T11:30:30.967Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a write-up of the Birdie Yellow<em> </em>challenge from the BSides Canberra 2018 CTF. This challenge was worth 175 points.</p><h3>The challenge</h3><p>The aim of the Birdie series is to pose as the “admin” user, without being able to simply enter “admin” into the username field. Birdie Yellow is no exception to this. When trying to enter admin as the username, we are greeted with the below friendly error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*rKsGCP-GXWZbbG_HH1ilqg.png" /><figcaption>Entering “admin” as the username directly.</figcaption></figure><h3>Recon Time</h3><p>Let’s start by inspecting the source for this page, perhaps it will drop some hints as to how to solve this challenge.</p><pre>&lt;!doctype html&gt;<br>&lt;html&gt;<br> &lt;head&gt;<br>   &lt;style&gt;<br>    html, body {height: 100%;background-color: black;height: 100%;margin: 0px;padding: 0px;color: white;font-family: courier, monospace;text-align: center;}h1 {margin-top: 5%;}a {color: green;}input {padding: 10px;}<br>  &lt;/style&gt;<br>  &lt;title&gt;Inebriated Alibis&lt;/title&gt;<br> &lt;/head&gt;<br> &lt;body&gt;<br>  &lt;h1&gt;&lt;font color=&quot;Gold&quot;&gt;Inebriated Alibis&lt;/font&gt;&lt;/h1&gt;<br>  &lt;p&gt;&lt;form action=&quot;/login&quot; method=&quot;post&quot;&gt;<br> Username: &lt;input name=&quot;username&quot; /&gt;<br> &lt;br /&gt;&lt;br /&gt;<br> &lt;input type=&quot;submit&quot; value=&quot;Login / Register&quot; /&gt;<br>&lt;/form&gt;<br>&lt;/p&gt;<br> &lt;/body&gt;<br>&lt;/html&gt;</pre><p>Hmm… there really isn’t anything to go off there. Time to dive a little deeper.</p><h4>Input Fuzzing</h4><p>Now its time to try and fuzz the input to see what messages or other behaviours occur from various inputs. From this we can note that a valid input will send us back to the root of the server with a welcome message.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*crn1cJQ9WIUCf3fR8xc84A.png" /></figure><p>If we have a further look at some other inputs, we note that some special characters are blacklisted. For example, trying any string with a ‘\’ (escape character), will also be blocked with the error message “Please.” Interestingly, other commonly filtered characters such as ‘&quot;’ and ‘{ or }’ have not been filtered in a similar way here, and are allowed through. More on this later…</p><p>But what about other elements of the page? Good question. From the valid input “letmein” which was tried earlier, some cookies appear from the server with the response welcome page. Specifically, a cookie names session_data looks quite appealing.</p><h4>Fuzzing Cookies</h4><p>The cookie session_data contains a simple string:</p><pre>%7B%22username%22%3A%22letmein%22%7D</pre><p>This string looks rather like URL encoded characters… A quick pass through an online URL encoder/decoder reveals the encoded characters:</p><pre>{&quot;username&quot;:&quot;letmein&quot;}</pre><h4>AHAH! (some ways in)</h4><p>The cookie seems to be storing a JSON string. From a quick look at the source code, there is nothing manipulating this on the client side because there is no JavaScript on the page. That must mean that this string is manipulated and managed purely by the server. This is good news for us.</p><p>Let’s have a play around with the value for the “username” parameter using a cookie editor extension. If this is changed to “admin” by us, and then the page refreshed, nothing changes. The page still thinks we are logged in under the “letmein” username. This is not looking good…</p><p>Going back a step, how is this cookie created? It must be constructed from the contents of the input field “username” before being passed to the rest of the server code for setting the rest of the session up — like the rendering of the username on the welcome page. Perhaps there is a way of manipulating the JSON string from the username field and using that to get “admin” recognised as the username to be parsed on the server?</p><h4>JSON Parsing</h4><p>Now for some background: given the way in which most languages parse JSON strings, if the same parameter exists twice within the one string in the same scope, the last encountered value for that parameter will be used.</p><p>For example, if I have the following JSON string…</p><pre>{&quot;mood&quot;:&quot;happy&quot;,&quot;current_task&quot;:&quot;fuzzing&quot;,&quot;mood&quot;:&quot;frustrated&quot;}</pre><p>… when it is parsed, mood will first be set to the value “happy”, but then subsequently be overridden by the value “frustrated”. Now let’s see if we can use the same attack vector on Birdie Yellow.</p><h3>The Attack</h3><p>Before getting ahead of ourselves, lets see if we can indeed use this attack vector to our advantage with this challenge. To do this, we can build a payload to change the username using the inherent function of most JSON parsers (as explored above).</p><p>Back on the login page, we can take advantage of knowing that the output JSON is {“username”:”&lt;the username we type in&gt;”} to build what is in essence a JSON injection payload.</p><h4>The Payload</h4><p>Due to whatever is typed into the username field being (as long as it passes the basic filter) placed directly into the JSON value field, we can use a payload which closes the first username value (“ ), and then add our own repetition of the username parameter with our malicious value (admin). This means our payload will look like this…</p><pre>letmein&quot;, &quot;username&quot;:&quot;admin</pre><p>Remember that this will be slotted into the value of the pre-existing username field, making the final full JSON string which the server then interprets our malicious valid JSON:</p><pre>{&quot;username&quot;:&quot;*letmein&quot;, &quot;username&quot;:admin*&quot;}</pre><p><em>NOTE</em> that above I have placed a pair of ‘ *’ to denote the start and end of the injected payload. These are <strong>not</strong> part of the actual final string.</p><p>Let’s give that a go on the login page now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*1IqP18Ms_8lSulbmL4F0Lg.png" /><figcaption>Booyah!</figcaption></figure><p>Nice!</p><p>If we have a look at that session_data cookie from earlier again, we can see that out payload has been put to work well.</p><pre>%7B%22username%22%3A%22letmein%22%2C+%22username%22%3A%22admin%22%7D<br>&gt;&gt;&gt;{&quot;username&quot;:&quot;letmein&quot;, &quot;username&quot;:&quot;admin&quot;}</pre><h3>Recap</h3><p>This challenge involved a JSON string injection which was able to bypass a simple filter which screened for the word “admin” exclusively in the username field and a simple filter for some escape characters such as “\”.</p><p>By taking advantage of the way in which JSON parsers evaluate the values for properties which occur multiple times within the same scope, the injection was able to re-write the username property’s value. This was, in this instance, evaluated after the server performed its initial filter checks as listed above, which is the reason this attack is able to work.</p><p>It is always a good idea to take a checklist of web recon techniques into a challenge like this one. This would make solving a challenge like this much simpler as it would immediately be clear from different inputs what was happening on the server, and how the input could manipulate that.</p><p>Thank you once again to <a href="https://www.elttam.com.au/">Elttam</a> for providing these challenges, it was certainly a great experience, and lots was learnt from tackling the various challenges.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23a539aea79c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codecadets/bsides2018-ctf-writeup-birdie-yellow-23a539aea79c">BSides Canberra 2018 CTF Write-Up: Birdie Yellow</a> was originally published in <a href="https://medium.com/codecadets">Code Cadets</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BSides Canberra 2018 CTF Write-Ups]]></title>
            <link>https://medium.com/codecadets/bsides-canberra-2018-ctf-write-ups-6a176bf206d?source=rss----873afb4ede1c---4</link>
            <guid isPermaLink="false">https://medium.com/p/6a176bf206d</guid>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Matthew Purcell]]></dc:creator>
            <pubDate>Tue, 05 Jun 2018 09:03:55 GMT</pubDate>
            <atom:updated>2018-06-10T11:31:49.468Z</atom:updated>
            <content:encoded><![CDATA[<h4>Canberra Grammar School Code Cadets come 3rd in the BSides Canberra 2018 CTF</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tl_-7gkTs8DT2qoMbXmvow.jpeg" /></figure><p>The Canberra Grammar School <a href="https://www.codecadets.com/">Code Cadets</a> once again participated in the annual BSides Canberra Capture the Flag (CTF) competition.</p><p>This two-day competition has teams of hackers trying their skills at a variety of challenges — ranging from web vulnerabilities through to Linux challenges, binary exploitation, and OSINT/forensic analysis.</p><p>Last year a team of seven Code Cadets from Year 11 participated and achieved 4th place in the competition. Learning from experience, this year the Code Cadets was 28 students strong — with a range of boys and girls from Years 8 to 12. The group split into three teams, named Code Cadets Alpha, Code Cadets Charlie, and Code Cadets Delta.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OwGj53n3mYpDRV8Fl8T4XQ.jpeg" /></figure><p>In an impressive performance, all teams finished in the top 10 (against 185 registered teams) — with Code Cadets Delta in 9th place (2725 points), Code Cadets Charlie in 8th place (2725 points)…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FlC_O7Lx0wBlGOKwhbl_fg.jpeg" /><figcaption>The scoreboard at the end of the two day competition.</figcaption></figure><p>…and Code Cadets Alpha in an amazing 3rd place (4375 points). This team consisted of all our students who participated last year, and it was great to see them level-up to achieve a podium finish in 2018.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wvcNzevfd8tW-u-ASCSipg.jpeg" /><figcaption>The victorious 3rd place Code Cadets Alpha team: Finn Reid, Luke Chatfield, George Dan, Sam Reading-Thompson, Joseph Fergusson, Robin Hodda, Damian Camilleri, and Jonathon Soper (absent, had to fly out before the presentation).</figcaption></figure><p>The teams have been busy completing write-ups of all the CTF challenges they solved, with the first batch now online:</p><h4>Web</h4><ul><li><a href="https://codecadets.blog/bsides-canberra-2018-ctf-write-up-birdie-red-b35903698152"><strong>Birdie Red</strong></a> (75 points) by Tyra Kuan</li><li><a href="https://codecadets.blog/bsides-canberra-2018-ctf-write-up-birdie-orange-84204be4586e"><strong>Birdie Orange</strong></a> (125 points) by Chamindu Dayajeewa</li><li><a href="https://codecadets.blog/bsides2018-ctf-writeup-birdie-yellow-23a539aea79c"><strong>Birdie Yellow</strong></a> (175 points) by Damian Camilleri</li><li><em>Birdie Green (225 points) — Coming Soon</em></li><li><em>Birdie Blue (275 points) — Coming Soon</em></li><li><a href="https://codecadets.blog/bsides-canberra-2018-ctf-write-up-rollpay-7f7b050497c2"><strong>Rollpay</strong></a> (100 points) by Jack Carey</li></ul><h4>Linux</h4><ul><li><a href="https://codecadets.blog/bsides-canberra-2018-ctf-write-up-rhadinesthes-8bc4cd6414a8"><strong>Rhadinesthes</strong></a> (100 points) by Alvin Charles</li><li><a href="https://codecadets.blog/bsides-canberra-2018-ctf-write-up-pedantiism-df5ae230b686"><strong>Pedantiism</strong></a> (150 points) by Nathan Heldon</li></ul><h4>Binaries</h4><ul><li><a href="https://codecadets.blog/bsides-canberra-2018-ctf-write-up-softcover-walk-846425929dde"><strong>Softcover Walk</strong></a> (300 points) by Zack Noyes</li><li><em>Bashes SP Data (300 points) — Coming Soon</em></li><li><a href="https://codecadets.blog/bsides-canberra-2018-ctf-write-up-fat-morphine-fd9b8e1d6324"><strong>Fat Morphine</strong></a> (400 points) by George Dan</li><li><em>Neo Boffy (1000 points) — Coming Soon</em></li></ul><h4>OSINT/Forensics</h4><ul><li><a href="https://codecadets.blog/bsides-canberra-2018-ctf-write-up-maze-two-bird-e4550003115f"><strong>Maze — Two Bird</strong></a> (350 points) by Yasas Kulatunga</li><li><a href="https://codecadets.blog/bsides-canberra-2018-ctf-write-up-old-pc-37116ab7625e"><strong>Old PC</strong></a> (375 points) by Ben Daniell</li><li><a href="https://codecadets.blog/bsides-canberra-2018-ctf-write-up-red-or-blue-86ee226a7e3e"><strong>Red or Blue</strong></a> (400 points) by Zack Noyes</li></ul><p>We would like to say a big thank you to Elttam for setting-up these fun (albeit sometimes entertainingly frustrating!) CTF challenges which certainly kept us very mentally occupied over the two days.</p><p>Also, a very special thank you to <a href="https://ionize.com.au/">Ionize</a> — particularly Ash, Rick, Michael, Ryan, and Andrew for all their support providing the Code Cadets with specialised training in the lead-up to the CTF, and also being a sounding board and supporter for our younger teams during the CTF competition. You guys are truely awesome and honorary Code Cadets :)</p><p>In case you’re keen to see a few more photos from the CTF, they are available on our Code Cadets SmugMug at: <a href="https://photos.codecadets.com/BSides-2018-CTF/">https://photos.codecadets.com/BSides-2018-CTF/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a176bf206d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codecadets/bsides-canberra-2018-ctf-write-ups-6a176bf206d">BSides Canberra 2018 CTF Write-Ups</a> was originally published in <a href="https://medium.com/codecadets">Code Cadets</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BSides Canberra 2018 CTF Write-Up: Fat Morphine]]></title>
            <link>https://medium.com/codecadets/bsides-canberra-2018-ctf-write-up-fat-morphine-fd9b8e1d6324?source=rss----873afb4ede1c---4</link>
            <guid isPermaLink="false">https://medium.com/p/fd9b8e1d6324</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[George Dan]]></dc:creator>
            <pubDate>Tue, 05 Jun 2018 08:23:43 GMT</pubDate>
            <atom:updated>2018-06-05T08:23:42.688Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a write-up of the Fat Morphine challenge from the BSides Canberra 2018 CTF. This challenge was worth 400 points.</p><h4>Description</h4><blockquote>The format of this is easy enough, but my name will be least significant when you go for the flag.</blockquote><h4>Solution</h4><p>The first thing we did was to run the binary and see what happens:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/367/1*e7nOsFmTkA8UJLPdqyEPPg.png" /><figcaption>Output with no arguments</figcaption></figure><p>Providing a “name” resulted in that name being printed out, along with some other messages:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/1*mZDdioaQrXZPeL8yLMe0sA.png" /><figcaption>Output with the name “George”</figcaption></figure><p>Trying names with long lengths did not seem to affect the binary at all. We then re-read the problem description, and noticed a key word: “format”. We believed this could refer to format strings. We tried with a name of “%x”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*vADzzovo5P0S1gXHU5IXxA.png" /><figcaption>Output with the name “%x”</figcaption></figure><p>Interestingly, the output didn’t contain “%x”, rather some hex value.</p><h4>Format Strings</h4><p>Before we continue, we will briefly introduce format strings. Format strings assist in printing out all sorts of variables with a variety of types. Format strings are used in printf calls, for example:</p><pre>char* str = &quot;World!&quot;;<br>printf(&quot;Hello, %s&quot;, str); // Prints &quot;Hello, World!&quot;</pre><p>There are a variety of “specifiers” telling printf how to print out a variable. Some of these specifiers are:</p><ul><li>%x — prints out the value in hex</li><li>%p — prints out the value as a pointer</li><li>%s — prints out the value as a string (until a NULL byte is reached)</li><li>%n — stores the number of characters that have been printed into the value (which is an int*)</li></ul><p>A width flag can be specified for padding purposes. Using a format string of %8x will print the hex value, padded to 8 characters with spaces. A selection flag can be used to specify which variable the specifier is referring to. Using a format string of %3$x refers to the third variable.</p><h4>Exploiting Format Strings</h4><p>A format string vulnerability looks like the following:</p><pre>char* input = &quot;%x&quot;; /* This is actually user input */<br>printf(input);</pre><p>Trying to compile this will result in a warning stating it is unsafe to directly put a variable as the first argument of a printf statement.</p><p>If this were to run, what would happen? There is no arguments, so printf will use variables on the stack. We can use the %x specifier to first find a place to write to, or to find where our inputted string is on the the stack, then use that specifier with the padding flag to increase the character count to a certain value, then use %n to write that value to a specific location.</p><p>Let’s do this for this challenge.</p><p>First, we have to find at what offset is out inputted string. We use multiple %x specifiers to print out the hex values on the stack:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*6YqgWLPcuM-IJ5hG9vUvLA.png" /><figcaption>Output with multiple %x, using “..” to separate the values</figcaption></figure><p>We immediately see a range of values printed out. We see the fourth value representing the length of the input string, then some random values, then a recurring pattern (from the 7th value). These hex values look like our string!. We now know where the string starts from.</p><p>We now need to figure out what we want to write. From the previous challenges, there has been a read_flag() function. If we list the functions in the binary through gdb, we see that the function is still there:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/293/1*2OY3VOYZz6-Iet0v9eBGVQ.png" /><figcaption>Snippet of the function list in the fat_morphine binary</figcaption></figure><p>Running disas read_flag in gdb tells us the starting address is 0x400726. We do not need to account for ASLR since it is not enabled:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/190/1*hONySn89WcPkeJWpgXnCpA.png" /></figure><p>Now we need to figure out where we should be writing to. We can use similar techniques as in the previous challenges by overwriting an entry in the GOT. We have to find an appropriate entry to overwrite.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*25c370CwI6ffjVGkk_nwww.png" /><figcaption>Disassembly of the main function</figcaption></figure><p>The code block above is the code block executed if there is a name argument provided. We notice that there are no printf calls, as we would expect there are 3, but there are 3 calls to a function at 0x4007ab (which is stored in 0x600d98). Disassembling the function at this address shows us the printfs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y9pgnkH7FjTAMPgoIC0LUg.png" /><figcaption>Disassembly of 0x4007ab</figcaption></figure><p>We decided to overwrite the putchar entry since it occurred directly after the printf call. The GOT entry address for putchar is at 0x600d30.</p><p>Now we have what we want to write (0x400726), and we know where we want to write it (0x600d30). Now let’s structure our payload.</p><p>First, we want to use padding to get the character output count to what we want to write. We can do this by converting the hex value to decimal, then use that as the padding.</p><pre>payload = &quot;&quot;<br>payload += &quot;%4196134x&quot;</pre><p>Using this will print 0x400726 spaces (minus the amount of characters actually printed). The value printed out after all these spaces is 0x40095c.</p><p>We then want to write that value to a specific location. For the time being, we won’t worry about where. We also have to use a slight variation of the classic %n: %lln. This writes the value as 64 bit number, so that it zero’s the upper 4 bytes of the GOT entry (otherwise the upper 4 bytes from the libc library will remain).</p><pre>payload += &quot;%{}$lln&quot; # to fill</pre><p>Using gdb, we will not find anywhere on the stack reference to 0x600d30, the place where we want to write to. However, we can put that value on the stack.</p><p>Recall that C strings are terminated by a NULL character, and the 4-byte address of where we want to write to is 0x00600d30. So as long as we put the address of where we want to write to at the end of our payload, it will automatically have the NULL character at the end of it.</p><pre>payload += &quot;\x30\x0d\x60&quot;</pre><p>Note we put the address in reverse due to how the string is stored in memory.</p><p>Now we have all our components, we can fill in the position where we want to write to. To find what position our string starts, we can use a string of the same length as above, with different characters every 4 characters, and use %&lt;&gt;$x to find the position, which turned out to be 7. Every increase of the position by 1 moves 4 bytes into the payload.</p><p>However, we forgot that this was a 64 bit binary, so in fact an increase of 1 in the position would move forward by 8 characters!</p><p>If we assume the position to fill will be 2 digits long (&gt;= 10), then each position would map to the following characters:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*ONQv1bbohkpupSoTKChM1Q.png" /></figure><p>So using the position 10 would make our payload work.</p><pre>payload = payload.format(10)</pre><p>Running this print a lot of empty characters, followed by a value from the stack and the flag.</p><p>Final solution:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/83f188e882f1c74fc84e4a6865af3702/href">https://medium.com/media/83f188e882f1c74fc84e4a6865af3702/href</a></iframe><p>A big thank you to Elttam for organising the CTF challenges!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd9b8e1d6324" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codecadets/bsides-canberra-2018-ctf-write-up-fat-morphine-fd9b8e1d6324">BSides Canberra 2018 CTF Write-Up: Fat Morphine</a> was originally published in <a href="https://medium.com/codecadets">Code Cadets</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BSides Canberra 2018 CTF Write-Up: Maze — Two Bird]]></title>
            <link>https://medium.com/codecadets/bsides-canberra-2018-ctf-write-up-maze-two-bird-e4550003115f?source=rss----873afb4ede1c---4</link>
            <guid isPermaLink="false">https://medium.com/p/e4550003115f</guid>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Yasas Kulatunga]]></dc:creator>
            <pubDate>Tue, 05 Jun 2018 08:22:25 GMT</pubDate>
            <atom:updated>2018-06-05T08:22:25.162Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a write-up of the Maze — Two Bird challenge from the BSides Canberra 2018 CTF. This challenge was worth 350 points.</p><blockquote>So you know my first name. What else do you know about me? Or, what do you want to know?</blockquote><blockquote>I’ll give you a hint, have a look at my profile picture attached. If you can find any of the medium’s I’m on, you’ll be rewarded.</blockquote><blockquote>— — -END PGP SIGNATURE — — -</blockquote><p>For this challenge we are given the description above as well as a file called image.jpg</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2uTr4Byc3NazrgZv." /><figcaption>This is the image provided in the challenge</figcaption></figure><p>There did not appear to be any data hidden through steganographic means, so we instead turned our attention to the metadata of the image.</p><p>To gather this metadata we used a free online tool such as <a href="http://metapicz.com/#landing">http://metapicz.com/#landing</a> .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4jeg0Fzsk0pDdkCOVOLqOQ.png" /></figure><p>From this metadata we noticed that artist was “h. hashimoto”. Given that the CTF was called “The Return of Hahn” we make the assumption that his first name is Hahn. Full name, Hahn Hashimoto.</p><p>Using this information, we look at the information provided in the description — which mentioned a PGP signature. With a bit of research we find out that PGP is a method of sending encrypted messages. PGP uses public keys whcih are often listed on public databases.</p><p>So, we searched the MIT PGP key database at <a href="http://pgp.mit.edu/pks/lookup?op=vindex&amp;search=0x6460E1B6CB59561B">http://pgp.mit.edu</a> for “Hahn Hashimoto”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JC9Pq8GDHGqKnbfkKv8r2A.png" /></figure><p>This returned a result for a ProtonMail email address — which we promptly emailed but did not receive a reply :( We figured that the reply would be instant, so we stared looking elsewhere.</p><p>Since this is a challenge of logic, we needed to turn to our riddle solving skills. The challenge description mentions birds, so what mediums this person is on? What social media platforms have a bird as a prominent mascot? Twitter!</p><p>There is a method to find Twitter accounts from an email address, but you need to install the Twitter app and then sync your contacts. So, we created a new Twitter account, a blank address book on our computer, added <strong>hanh.hashimoto@protonmail.com</strong> to the address book, and then synced the contacts to the Twitter account. This then allowed us to use the “Find Friends” feature on Twitter and search for Hahn Hashimoto.</p><p>This yielded a Twitter account for Hahn Hashimoto and the biography seemed to match. The profile picture was a QR code…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*P7bbFVUi49qrk-ozkl458A.png" /></figure><p>…which when scanned, showed the flag.</p><p>This was a really cool puzzle in logic, so thanks to Elttam for this super fun challenge!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4550003115f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codecadets/bsides-canberra-2018-ctf-write-up-maze-two-bird-e4550003115f">BSides Canberra 2018 CTF Write-Up: Maze — Two Bird</a> was originally published in <a href="https://medium.com/codecadets">Code Cadets</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BSides Canberra 2018 CTF Write-Up: Red or Blue]]></title>
            <link>https://medium.com/codecadets/bsides-canberra-2018-ctf-write-up-red-or-blue-86ee226a7e3e?source=rss----873afb4ede1c---4</link>
            <guid isPermaLink="false">https://medium.com/p/86ee226a7e3e</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[infosec]]></category>
            <dc:creator><![CDATA[Zack Noyes]]></dc:creator>
            <pubDate>Tue, 05 Jun 2018 08:13:19 GMT</pubDate>
            <atom:updated>2018-06-05T08:13:18.978Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a write-up of the Red or Blue challenge from the BSides Canberra 2018 CTF. This challenge was worth 400 points.</p><blockquote>Does it end with the blue pill? Is the red pill leading into Wonderland?</blockquote><p>The challenge contained the above message, as well as two zip files: red.zip and blue.zip.</p><p><strong>The Hack</strong></p><p>When downloading the ZIP files you need to be a bit careful, as one of them results in an infinitely extracting archive on certain platforms (such as macOS) — as one of our team members discovered when it filled-up his entire free hard drive space. Always best to download into a sandboxed VM. In this case, we needed the archives intact and unexpanded, so downloading them into Kali Linux was a reliable way to do this.</p><p>After the zip files were downloaded, we could see that red.zip contains a file red.gz and blue.zip is encrypted. It might be possible to crack the ZIP file by brute forcing the password, but there is a much easier method <em>(with hindsight, we found out that the password is 8 random characters, so it would take a very long time for even a fast computer to crack).</em></p><p>With a bit of research, we discovered that you can look at the contents of a ZIP file even if it is encrypted. The easiest way to see the files was to open them with Kali Linux’s Archive Manager.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*k42gV6HPIOZze7l_." /><figcaption><em>Red and Blue zip files opened in Archive Manager</em></figcaption></figure><p>Looking at this, we can see that blue.zip contains two files, red.gz and blue.txt. Because the file red.gz is in both the encrypted and unencrypted zip files, and because of the way the encryption works, we can do something called a <a href="https://en.wikipedia.org/wiki/Known-plaintext_attack">known plaintext attack</a>.</p><p>This would require a lot of effort to do manually, luckily, there is a tool online that can help, <a href="https://www.unix-ag.uni-kl.de/~conrad/krypto/pkcrack.html">pkcrack</a>.</p><p>See the <a href="https://www.unix-ag.uni-kl.de/~conrad/krypto/pkcrack.html">website</a> for instructions on downloading and compiling the tool.</p><p>Once the tool is installed we had to run the command below this will use the red.gz file to do a known plaintext attack on red.zip and will output a cracked.zip file.</p><p><strong>Important!</strong> You must use the <strong>original </strong>red.zip file, <strong>not</strong> unzip it and then zip it again. This is because in order for the known plaintext attack to work, the zip files must be zipped using the same compression software.</p><pre>pkcrack -C <strong>blue.zip</strong> -c <strong>red.gz</strong> -P <strong>red.zip</strong> -p <strong>red.gz</strong> -d <strong>cracked.zip</strong> -a</pre><p>After running this command (and a long wait), the file cracked.zip was created. Opening this file, we find that we can open blue.txt, which contains the flag.</p><p>A big thank you to all the organisers of the CTF for this great challenge.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86ee226a7e3e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codecadets/bsides-canberra-2018-ctf-write-up-red-or-blue-86ee226a7e3e">BSides Canberra 2018 CTF Write-Up: Red or Blue</a> was originally published in <a href="https://medium.com/codecadets">Code Cadets</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BSides Canberra 2018 CTF Write-Up: Pedantiism]]></title>
            <link>https://medium.com/codecadets/bsides-canberra-2018-ctf-write-up-pedantiism-df5ae230b686?source=rss----873afb4ede1c---4</link>
            <guid isPermaLink="false">https://medium.com/p/df5ae230b686</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[infosec]]></category>
            <dc:creator><![CDATA[Nathan Heldon]]></dc:creator>
            <pubDate>Tue, 05 Jun 2018 08:05:17 GMT</pubDate>
            <atom:updated>2018-06-05T08:05:17.072Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a write-up of the Pedantiism challenge from the BSides Canberra 2018 CTF. This challenge was worth 150 points.</p><p>This was the second Linux/binary challenge and involved nmap and permission bypassing.</p><p>Firstly, we needed to SSH into the challenge server: ssh://skid.libctf.so</p><p>The main priority was discovering who owned the file flag.txt. so we could figure out what permissions were necessary to access the file. In this case, flag.txt was owned by <strong>root</strong> and the group was called <strong>flag2</strong>.</p><p>Looking around in all the usual places, such as /etc/passwd, there didn’t seem to be a way to access/exploit into an account which was a member of the <strong>flag2</strong> group — so we had to look for a different way.</p><p>Doing some Googling around it seems that sometimes common utilities might be installed on the system using special privileges, such as root via setuid/setgid. This allows the executable, when run, to have the effective privileges of either the owning user or group. In this case, if we could find an executable which had the setuid or setgid bit set then it would effectively run as either the <strong>root</strong> user or <strong>flag2</strong> group.</p><p>As it turns out, the <strong>nmap</strong> utility was installed on the system with the setgid set to <strong>flag2 </strong>— giving it permission to read the flag.txt file. If we could get nmap to read the flag.txt file, and somehow spit out its contents, then we would likely have the flag.</p><p>As it turns out, <strong>nmap</strong> can read network targets from a file — so we tried feeding <strong>nmap</strong> with the flag.txt file using the following command:</p><p>nmap -iL flag.txt</p><p>Obviously <strong>nmap</strong> failed reading the file, since it is certainly not a valid network target file, but in doing so output the contents of the file (to prove it was invalid) revealing the flag!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_EVYC_PTezJJ_svZ." /></figure><p>Thanks to Elttam for this challenge which certainly made us think outside of the box!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df5ae230b686" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codecadets/bsides-canberra-2018-ctf-write-up-pedantiism-df5ae230b686">BSides Canberra 2018 CTF Write-Up: Pedantiism</a> was originally published in <a href="https://medium.com/codecadets">Code Cadets</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BSides Canberra 2018 CTF Write-Up: Old PC]]></title>
            <link>https://medium.com/codecadets/bsides-canberra-2018-ctf-write-up-old-pc-37116ab7625e?source=rss----873afb4ede1c---4</link>
            <guid isPermaLink="false">https://medium.com/p/37116ab7625e</guid>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Ben Daniell]]></dc:creator>
            <pubDate>Tue, 05 Jun 2018 07:52:52 GMT</pubDate>
            <atom:updated>2018-06-05T07:52:51.870Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a write-up of the Old PC challenge from the BSides Canberra 2018 CTF. This challenge was worth 375 points.</p><p>The only context given for the Old PC task was a single .bin file. With a size around 1.4MB, it was immediately assumed that this was a floppy disk image.</p><p>After extracting the disk image, the only file within was .HOME01.TIM. Searching for the “TIM” file extension returned two possibilities: A Playstation image file, or a level file for an archaic PC Game — The Incredible Machine by Sierra software.</p><p>Reading through the content of the file in a hex editor all but confirmed this — the file was sparse, so it didn’t make sense for it to be an image. So now all that was left was to get the level into the game.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*LH46TOAemFK77B_DuOa8DA.png" /><figcaption><em>A typical PNG image (Left), the file in question (Right)</em></figcaption></figure><p>We installed DosBox and downloaded the first version of The Incredible Machine available on the internet. Originally the file did not appear in the level editor — load menu. We tried changing the file name to be that of an already existing, valid level, after selecting it in the load menu (although different teams had different experiences with this — some couldn’t open the file without swapping file names, others could). This didn’t end up working — the level was corrupted. The game would either freeze, or give an error message:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*XMBysrQsr0dhdr3dpUc03A.png" /><figcaption><em>Frozen, with the load button pressed down.</em></figcaption></figure><p>Upon further inspection in a hex editor, the headers were different between the valid level and the challenge file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*LPJ6LGcTCk2J085KbpIIXw.png" /><figcaption><em>A TIM 1 save file (left), the flag file (right)</em></figcaption></figure><p>This seemed to imply that while we were onto the right direction, we needed to try something else. We downloaded every other version of The Incredible Machine available, and tried each one at opening the file. None saw it as openable from the outset, but by swapping the file names meant that the level could be loaded. TIM 2 loaded the level, and simply pressing the start button “revealed the flag”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*X-LMip2cjTqICocI2-at-A.png" /><figcaption><em>The screen visible upon opening the level</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*pwpMnPunfqN-fXzKbd46Zg.png" /><figcaption>T<em>he final message that was displayed</em></figcaption></figure><p>We say “revealed the flag”, because there still remained one mystery: what was the flag? There were a series of characters shown, but which order should the be read in? In the order of the ball’s bounce, as the hint “Watch the superball’s bounce” suggested, or in top to bottom, or left to right?</p><p>After a twitter hint, it turned out to be much simpler than we’d anticipated…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rlrM-HdtmLy34xHvzY4EFA.png" /><figcaption>The hint</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cy6CPp6L6gTaBOgD74SXzA.png" /><figcaption><em>The results of a quick web search</em></figcaption></figure><p>…and simply reading from left to right granted us the 375 points.</p><p>Thanks to Elttam for this quite interesting challenge.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=37116ab7625e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codecadets/bsides-canberra-2018-ctf-write-up-old-pc-37116ab7625e">BSides Canberra 2018 CTF Write-Up: Old PC</a> was originally published in <a href="https://medium.com/codecadets">Code Cadets</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BSides Canberra 2018 CTF Write-Up: Softcover Walk]]></title>
            <link>https://medium.com/codecadets/bsides-canberra-2018-ctf-write-up-softcover-walk-846425929dde?source=rss----873afb4ede1c---4</link>
            <guid isPermaLink="false">https://medium.com/p/846425929dde</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[infosec]]></category>
            <dc:creator><![CDATA[Zack Noyes]]></dc:creator>
            <pubDate>Tue, 05 Jun 2018 07:49:10 GMT</pubDate>
            <atom:updated>2018-06-05T07:49:10.272Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a write-up of the Softcover Walk challenge from the BSides Canberra 2018 CTF. This challenge was worth 300 points.</p><h4><strong>Description</strong></h4><p>| <em>Walk softly over to the edge and peak over to the flag.</em></p><p>The challenge contained the above message, as well as an SSH address:</p><pre>ssh://peasant.libctf.so</pre><p>Looking around a bit, we found a challenges directory in the root folder that contains a folder for each challenge.</p><p>There are two files inside the softcover_walk folder, flag.txt and challenge. Experimenting with the challenge file a bit, we can see that this challenge requires a buffer overflow exploit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/0*Aqrc4HqhhQgyUZeP." /></figure><h4><strong>The Hack</strong></h4><p>The first step in making this challenge easier to work with is to copy the file to our computer. We can use scp (<a href="https://en.wikipedia.org/wiki/Secure_copy">Secure CoPy</a>) to accomplish this.</p><pre>scp CodeCadetsDelta@peasant.libctf.so:/challenges/softcover_walk/challenge/root/Desktop</pre><p>We then used this simple starter template for the buffer overflow. It’s a Python script that allows us to pass in the name of the file and then sets up a very useful debugging environment. These tools need to be installed for it to work:</p><ul><li><a href="https://docs.pwntools.com/">PwnTools</a></li><li><a href="https://www.gnu.org/s/gdb/">GDB Debugger</a> (<a href="https://www.cnx-software.com/2012/01/31/debugging-embedded-linux-with-gdbserver-and-insight-gdb-gui/">gdbserver</a>)</li><li><a href="https://github.com/longld/peda">Peda</a> (no required, but useful)</li><li><a href="https://en.wikipedia.org/wiki/Tmux">Tmux</a></li></ul><pre>import pwn</pre><pre>pwn.context.terminal = [‘tmux’,’splitw’,’-h’]</pre><pre>name = ‘test’</pre><pre>p = pwn.gdb.debug([‘./challenge’,name], ‘’)</pre><pre>p.interactive()</pre><p>When running this python script inside tmux, we got this window:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sqojeN5ms1V-5Sl2." /></figure><p>We could then use various debugger commands to control the execution of this program.</p><p>Our next step was to see what happens when we send, let’s say, 600 of the letter A to the program. We’ll change line 4 to:</p><pre>name = ‘A’ * 600</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/0*KbN-U4AZYL37tu1h." /></figure><p>We can see that the program has stopped on ret and is trying to return into an address that we have overflowed into. To figure out at what point we overflow into the register (the buffer), we can use PwnTools cyclic method. This will create a pattern where every four letters is unique. We change line 4 to: name = pwn.cyclic(600).</p><p>We find that the first four characters in the overflow are ‘acpa’. Using pwn.cyclic_find(‘acpa’), we find that the buffer length is 258.</p><p>Next, we have to find out what to overflow into the buffer. This is usually the hardest part of a buffer overflow, but in this case, it was easy. The code has a read_flag function. If we can overwrite the address of this function into the return pointer, we can make the program go “back” to the read_flag function.</p><p>Finding the address of the function is outside the scope of this tutorial, but the tool we used was <a href="https://www.hex-rays.com/products/ida/">IDA Pro</a>.The address was:</p><pre>0x0000000000400696</pre><p>The next part of this challenge created a very big problem. We tried putting this value at the end of the buffer, but then realised that it wouldn’t work because it is impossible to send the “null bytes” (00). Luckily, we realised that the bytes are stored in reverse. This meant that we only needed to overwrite the “96” byte, the “06” byte and the “40” byte. The rest of the null bytes do not need to be overwritten as they are the same when the program runs normally. We now change line 4 to the following:</p><pre>name = ‘A’ * 258 + ‘\x96\x06\x40’</pre><p>All we needed to do then was upload our file to the server and run it there — and the flag was returned! The server already has the tools that we used installed, making it easier to run the exploit.</p><p>A big thank you to the CTF organisers — Elttam — for this great challenge.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=846425929dde" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codecadets/bsides-canberra-2018-ctf-write-up-softcover-walk-846425929dde">BSides Canberra 2018 CTF Write-Up: Softcover Walk</a> was originally published in <a href="https://medium.com/codecadets">Code Cadets</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BSides Canberra 2018 CTF Write-Up: Birdie Red]]></title>
            <link>https://medium.com/codecadets/bsides-canberra-2018-ctf-write-up-birdie-red-b35903698152?source=rss----873afb4ede1c---4</link>
            <guid isPermaLink="false">https://medium.com/p/b35903698152</guid>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Tyra Kuan]]></dc:creator>
            <pubDate>Tue, 05 Jun 2018 07:39:15 GMT</pubDate>
            <atom:updated>2018-06-05T07:39:38.868Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a write-up of the Birdie Red challenge from the BSides Canberra 2018 CTF. This challenge was worth 75 points.</p><blockquote>A little series for you to play — let’s start with red.</blockquote><blockquote>Birdie is designed to see the difference between peasants and gods.</blockquote><blockquote>If you can prove to each colour on the spectrum of birdie you’re a god, you’ll be rewarded.</blockquote><blockquote><a href="https://red.libctf.so/">https://red.libctf.so/</a></blockquote><p>When we clicked the link it came up with the page “Inebriated Alibis”. Clicking on the next link “Are you a peasant or a god?” it directed us to log in.</p><p>The goal is to log in as admin. To do this, we use two tools: Burp Suite, which is software that can intercept and modify website requests between the website server and client browser, and Foxy Proxy, which you can download on the Chrome Web Store. Go into the options for Foxy Proxy and add a new proxy called localhost 8080. Enable Foxy Proxy to use the localhost proxy for all web requests.</p><p>We then opened a temporary project in Burp Suite went to the Proxy tab to turn off the intercept. Then, we switched to the HTTP history tab, went back to the login page, and entered a random username. It successfully logged us in, but did not provide the flag…yet.</p><p>Once we were logged in, back in Burp Suite we checked the HTTP history for a row with the host <a href="https://red.libctf.so/">https://red.libctf.so</a> and the title “Insatiable Birdie”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AFvtAK7AkJYR5N7_." /></figure><p>We then clicked the row and in the <strong>Raw</strong> tab, at the bottom of the page, it came up with information about the page. Right-click that area and select the <strong>Send to Repeater</strong> option. Then go to the <strong>Repeater</strong> tab and look at the information about the page.</p><p>The important part is the cookie. You’ll see that the session_data cookie shows the username which was entered.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7wE_0yF3CutWCJnZ." /></figure><p>For this example, the user was logged in as username “hello”. Changing this to “admin” and then pressing the Go button (to replay the request) results in being logged in as admin. In the request section on the right click the <strong>Render</strong> tab which shows the flag on the screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*meAzS-d6B58T_-PT1ca0Lw.png" /><figcaption>Here’s the flag!</figcaption></figure><p>Thanks to Elttam for putting together this challenge.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b35903698152" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codecadets/bsides-canberra-2018-ctf-write-up-birdie-red-b35903698152">BSides Canberra 2018 CTF Write-Up: Birdie Red</a> was originally published in <a href="https://medium.com/codecadets">Code Cadets</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>