<?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:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Digital Forensics, Incident Response & Security]]></title><description><![CDATA[Thoughts, stories and ideas.]]></description><link>https://dfirsec.nl/</link><image><url>https://dfirsec.nl/favicon.png</url><title>Digital Forensics, Incident Response &amp; Security</title><link>https://dfirsec.nl/</link></image><generator>Ghost 5.55</generator><lastBuildDate>Mon, 06 Apr 2026 20:37:01 GMT</lastBuildDate><atom:link href="https://dfirsec.nl/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[PlaySecure CTF Write Up]]></title><description><![CDATA[<h1 id="intro">Intro</h1><p><a href="https://playsecure.mssconference.com/?ref=dfirsec.nl">Play Secure Conference</a> was an online event held from 25th to 28th March 2021. The event focused on gamification to learn things and had many great speakers on this topic. I had a good time attending some of the talks on their virtual conference platform Gather, which was a</p>]]></description><link>https://dfirsec.nl/playsecure-ctf-write-up/</link><guid isPermaLink="false">606084fdbffad00001cd79e3</guid><dc:creator><![CDATA[Lennaert Oudshoorn]]></dc:creator><pubDate>Sun, 28 Mar 2021 16:00:53 GMT</pubDate><media:content url="https://dfirsec.nl/content/images/2021/03/playsecurectf.jpg" medium="image"/><content:encoded><![CDATA[<h1 id="intro">Intro</h1><img src="https://dfirsec.nl/content/images/2021/03/playsecurectf.jpg" alt="PlaySecure CTF Write Up"><p><a href="https://playsecure.mssconference.com/?ref=dfirsec.nl">Play Secure Conference</a> was an online event held from 25th to 28th March 2021. The event focused on gamification to learn things and had many great speakers on this topic. I had a good time attending some of the talks on their virtual conference platform Gather, which was a nice bit of a change from other virtual events. Next to a great conference with interesting content there was also a CTF, which this write up is about. </p><p>I managed to get a few solves, as you can see in the screenshot below mostly in categories I&apos;m the most comfortable with, DFIR and Web challenges, but also took baby steps outside of my comfort zone and took on Crypto and an Exploitation (or pwn as they are also called) challenges.</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="331" height="660"></figure><p>With eight challenges solved I secured myself a spot just inside the top ten, a result that I can be happy with. </p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-1.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="1067" height="536" srcset="https://dfirsec.nl/content/images/size/w600/2021/03/Untitled-1.png 600w, https://dfirsec.nl/content/images/size/w1000/2021/03/Untitled-1.png 1000w, https://dfirsec.nl/content/images/2021/03/Untitled-1.png 1067w" sizes="(min-width: 720px) 720px"></figure><h1 id="crypto">Crypto</h1><h2 id="crypto-0x01">Crypto 0x01</h2><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-2.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="511" height="589"></figure><p>The challenge gives a hashes.txt file, containing an array of hashes. The first step I tried was throwing these in to CrackStation:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-3.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="1240" height="1102" srcset="https://dfirsec.nl/content/images/size/w600/2021/03/Untitled-3.png 600w, https://dfirsec.nl/content/images/size/w1000/2021/03/Untitled-3.png 1000w, https://dfirsec.nl/content/images/2021/03/Untitled-3.png 1240w" sizes="(min-width: 720px) 720px"></figure><p>While it didn&apos;t crack many of the hashes, it did point me in the right direction to solve this puzzle. There is progression of one letter added for each next hash, indicating that a hash is:<br>plaintext of previous hash + one character</p><p>This makes cracking them rather trivial by writing a script to add one letter every time and check if it matches the hash in the array of hashes:</p><pre><code class="language-python">import hashlib
import string

hashes = [&apos;32096c2e0eff33d844ee6d675407ace18289357d&apos;, &apos;adca1294358f0b5c66365bb19a06486a0ad3f0a5&apos;, &apos;281310883bf7a5c9de7d31b7881e291213613491&apos;, &apos;2706f11064c008dd6e6721bb2cceedf01329b960&apos;, &apos;cb2af52a3d324fe0e7402ee843e0ab6b1fb4d32e&apos;, &apos;c2d5577179610a3e272ac59e03e0c745edf0dba5&apos;, &apos;5afce0dafe8a0a25aebf819f46ee7673886732e4&apos;, &apos;7daeb2400f309b0f5d735238eec30961807125fc&apos;, &apos;9de3ea131b4a841e9647b0b1296c011733f63ebc&apos;, &apos;202608ac71a16c9b83c72a3f7e680973d9b69fa5&apos;, &apos;d77605bd9ae05b0a977fca19fe1de8ac8fc87c4b&apos;, &apos;a0cf411c45d73e44cc0f26b6bb2bd76bf0a6b95b&apos;, &apos;a2913cb30c4e94af02be621951f34d6fc28e1042&apos;, &apos;c156632c6f1e2db4709c15f34cb37605cb2c442d&apos;, &apos;e850277d7ec0eca297def6ae8e17108632fcd90f&apos;, &apos;95a2b1aefd6fc349f0fda31f07c6d23cb8c4959b&apos;, &apos;7bf26f48605a1f73d3a2aa7e06b39bbf05a54e8d&apos;, &apos;be022e6d43475909f3d3187921b9a3e54f1b20b5&apos;, &apos;6652defa2f95eaece27fb40ee64b7dfafac83c86&apos;, &apos;46616b3677a1ffe495696c376a4f91b8337c3375&apos;, &apos;d7e6243d698b9272ad64309a9eee5428b9bd324a&apos;, &apos;a1e1d343911a9953a22a89703e412877a66ab1ee&apos;, &apos;ad17de1128468188fbc7d583f72cc4b32245b041&apos;, &apos;a582ed5dae10004ba66364846cef6cc415e555d3&apos;, &apos;debba38167bbce4146d0082f45c79f3c1efa924b&apos;, &apos;f1d0bbf5e045c45869aaef111d5c55afe1e5d799&apos;, &apos;8c74f5c86d527b2403c76f2d635ad649f4517a5e&apos;, &apos;d0ca474f225c2425100b259e39e2e065fa308ec8&apos;]

key = &apos;&apos;
for hash in hashes:
    for letter in (string.printable):
        sha1sum = hashlib.sha1(key.encode(&apos;utf-8&apos;) + letter.encode(&apos;utf-8&apos;))
        if sha1sum.hexdigest() == hash:
            key = key + letter
            print(&apos;updated key: &apos;+key)
            continue
</code></pre><p>The script has two loops, the outer looping over the hashes in the array, the inner looping over every printable ascii character. Adding the character to the so far known key, hashing the result as sha1 and comparing it to the next hash in the array, moving on and updating the key once it finds a match. Running this script gives us:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-4.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="1115" height="624" srcset="https://dfirsec.nl/content/images/size/w600/2021/03/Untitled-4.png 600w, https://dfirsec.nl/content/images/size/w1000/2021/03/Untitled-4.png 1000w, https://dfirsec.nl/content/images/2021/03/Untitled-4.png 1115w" sizes="(min-width: 720px) 720px"></figure><p>And the last hash cracked is the solution to this challenge. </p><h1 id="dfir">DFIR</h1><h2 id="backspace">Backspace</h2><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-5.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="513" height="614"></figure><p>As you can see the challenge gives us a AD1 file, the AD1 file type is primarily associated with Forensic Toolkit by Access Data. So lets open it up in FTK imager and inspect it:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-6.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="1906" height="1022" srcset="https://dfirsec.nl/content/images/size/w600/2021/03/Untitled-6.png 600w, https://dfirsec.nl/content/images/size/w1000/2021/03/Untitled-6.png 1000w, https://dfirsec.nl/content/images/size/w1600/2021/03/Untitled-6.png 1600w, https://dfirsec.nl/content/images/2021/03/Untitled-6.png 1906w" sizes="(min-width: 720px) 720px"></figure><p>We see a flag.txt and FileSlack, the Flag.txt contains:</p><pre><code>hello i will tell you something , im in love with memory forensics but also filesystem is great , so here is you flag in AES  CBC mode : 052eeee19e6fc1043260d0e978b7ad0410154b9cb4e4f64bb3f171e3cba8cc38e4c86c86c8af7bc61e8526cad894d69f   with iv : 001122355D223344D66FF87a51d20d1 and the key !! ops i think i removed it from the file , any way you can find it i thing it was the last words of this file  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
</code></pre><p>And inside the file slack we find:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-7.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="529" height="109"></figure><pre><code>dGhlIGtleSBpcyA6IDAwMTEyMjMzNDRBQTU1REQ2NkZGOEI3YTUxZDIwZDE=
</code></pre><p>The = at the end hints at Base64 encoding, so lets decode that with CyberChef:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-8.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="1271" height="733" srcset="https://dfirsec.nl/content/images/size/w600/2021/03/Untitled-8.png 600w, https://dfirsec.nl/content/images/size/w1000/2021/03/Untitled-8.png 1000w, https://dfirsec.nl/content/images/2021/03/Untitled-8.png 1271w" sizes="(min-width: 720px) 720px"></figure><p>Giving us the message:<br>the key is : 0011223344AA55DD66FF8B7a51d20d1</p><p>So know we know the flag is AES CBC mode encrypted, and we have the key and the IV needed to decrypt it, which we can again do using CyberChef:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/image.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="1023" height="727" srcset="https://dfirsec.nl/content/images/size/w600/2021/03/image.png 600w, https://dfirsec.nl/content/images/size/w1000/2021/03/image.png 1000w, https://dfirsec.nl/content/images/2021/03/image.png 1023w" sizes="(min-width: 720px) 720px"></figure><p>And there we see the flag, bringing this challenge to an end. </p><h2 id="registry">Registry</h2><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-9.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="513" height="611"></figure><p>The file contains a chall.vmem:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-10.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="1906" height="718" srcset="https://dfirsec.nl/content/images/size/w600/2021/03/Untitled-10.png 600w, https://dfirsec.nl/content/images/size/w1000/2021/03/Untitled-10.png 1000w, https://dfirsec.nl/content/images/size/w1600/2021/03/Untitled-10.png 1600w, https://dfirsec.nl/content/images/2021/03/Untitled-10.png 1906w" sizes="(min-width: 720px) 720px"></figure><p>Running strings against things like this is always a good &#xA0;first attempt:</p><pre><code>strings chall.vmem | grep CTF
</code></pre><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-11.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy"></figure><p>And as you can see that got us an answer quite fast.</p><h2 id="stream">Stream</h2><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-12.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="511" height="563"></figure><p>So we get a pdf file with the flag hidden somewhere inside it.</p><p>To analyze a PDF like this, I looked at the following blogpost by Didier Stevens:</p><p><a href="https://blog.didierstevens.com/2019/03/07/analyzing-a-phishing-pdf-with-objstm/?ref=dfirsec.nl">https://blog.didierstevens.com/2019/03/07/analyzing-a-phishing-pdf-with-objstm/</a></p><p>Using his pdf-parser python tool, I used the following command to extract from the PDF, decode the extracted content, and piping the output to grep and searching for the &apos;CTF&apos; keyword a flag begins with. </p><pre><code>python3 pdf-parser.py -c -O -f challenge.pdf | grep CTF
 b&apos;CTFAE{Nice_yoU_kNow_h0w_to_an4ly5333_A_PDF}&apos;
</code></pre><p>As you can see, the command neatly outputted the flag. </p><h1 id="exploitation">Exploitation</h1><h2 id="point-to-the-stars">Point To The Stars</h2><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-13.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="512" height="620"></figure><p>First step is to connect to the challenge using netcat:</p><pre><code>nc exploitation.ps.ctf.ae 5454
</code></pre><p>Lets see what we get:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-14.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="1115" height="624" srcset="https://dfirsec.nl/content/images/size/w600/2021/03/Untitled-14.png 600w, https://dfirsec.nl/content/images/size/w1000/2021/03/Untitled-14.png 1000w, https://dfirsec.nl/content/images/2021/03/Untitled-14.png 1115w" sizes="(min-width: 720px) 720px"></figure><p>Alright, we input &apos;test&apos; at the &apos;Enter your wish:&apos; prompt, and not much seems to have changed. The application also tells us where the flag is stored, and where the pointer is currently pointing at. Lets see if we give it some awkward input, like &apos;a&apos;*100:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-15.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="1082" height="173" srcset="https://dfirsec.nl/content/images/size/w600/2021/03/Untitled-15.png 600w, https://dfirsec.nl/content/images/size/w1000/2021/03/Untitled-15.png 1000w, https://dfirsec.nl/content/images/2021/03/Untitled-15.png 1082w" sizes="(min-width: 720px) 720px"></figure><p>As we can see we overwrote the pointer with 0x61, which is &apos;a&apos;. Lets see where we stop overwriting the pointer, working back 10 &apos;a&apos;s at a time (so sending 90 next).</p><p>At 70*&apos;a&apos; we see we no longer overwrote the pointer. Also noticing that the hex difference between the star pointer and the flag storage is \x50 every time, so lets see if we can modify the pointer by 50, by sending 70*&apos;a&apos;50:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-16.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="1088" height="211" srcset="https://dfirsec.nl/content/images/size/w600/2021/03/Untitled-16.png 600w, https://dfirsec.nl/content/images/size/w1000/2021/03/Untitled-16.png 1000w, https://dfirsec.nl/content/images/2021/03/Untitled-16.png 1088w" sizes="(min-width: 720px) 720px"></figure><p>And indeed, that modifies the pointer correctly and makes the application out its flag.</p><h1 id="web">Web</h1><h2 id="public-secrets">Public Secrets</h2><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-17-1.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="512" height="662"></figure><p>The obvious first step is going to visit the site:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-18.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="1266" height="552" srcset="https://dfirsec.nl/content/images/size/w600/2021/03/Untitled-18.png 600w, https://dfirsec.nl/content/images/size/w1000/2021/03/Untitled-18.png 1000w, https://dfirsec.nl/content/images/2021/03/Untitled-18.png 1266w" sizes="(min-width: 720px) 720px"></figure><p>We need to access the admin panel according to the challenge text, so lets browse to /admin:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-19.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="1280" height="700" srcset="https://dfirsec.nl/content/images/size/w600/2021/03/Untitled-19.png 600w, https://dfirsec.nl/content/images/size/w1000/2021/03/Untitled-19.png 1000w, https://dfirsec.nl/content/images/2021/03/Untitled-19.png 1280w" sizes="(min-width: 720px) 720px"></figure><p>Okay, so we&apos;re not admin. Taking the hint from the challenge text we&apos;ll need to modify our cookie and we&apos;ll be granted access to this admin directory. Our cookie looks like this:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-20.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="597" height="67"></figure><p>Not something easily modified to just say admin=true or something like that.</p><p>Lets look a little bit further at the website, and see what we can learn. The source code of the index page has an interesting script:</p><pre><code class="language-jsx">&lt;script&gt;
		$(&apos;.nav-link&apos;).click(e =&gt; {
			$(&apos;.active&apos;).removeClass(&apos;active&apos;);
			$(e.currentTarget).addClass(&apos;active&apos;);
			fetch(&apos;/api/getResource?resource=&apos; + $(e.currentTarget).attr(&apos;file&apos;))
				.then(res =&gt; {
					return res.json();
				}).then(jsonRes =&gt; {
					if (jsonRes.content) {
						$(&apos;#content&apos;).empty();
						$(&apos;#content&apos;).append(jsonRes.content);
					} else {
						alert(&apos;An error has occurred.&apos;);
					}
				})
		});
	&lt;/script&gt;
</code></pre><p>Using that API end point lets us grab the code of the app, so lets see whats going on under the hood by browsing to:<br><a href="http://web.ps.ctf.ae:8881/api/getResource?resource=..%2Fmain.py&amp;ref=dfirsec.nl">http://web.ps.ctf.ae:8881/api/getResource?resource=../main.py</a></p><p>And we see:</p><pre><code class="language-json">{&quot;content&quot;:&quot;import os\nfrom flask import Flask, render_template, jsonify, request, session\n\napp = Flask(__name__, template_folder=&apos;templates&apos;)\napp.secret_key = b&apos;SuperSecretKey&apos; # Probably should change this...\n\n@app.route(&apos;/&apos;, methods=[&apos;GET&apos;])\ndef main():\n\tif &apos;type&apos; not in session:\n\t\tsession[&apos;type&apos;] = &apos;user&apos;\n\treturn render_template(&apos;index.html&apos;)\n\n@app.route(&apos;/admin&apos;, methods=[&apos;GET&apos;])\ndef admin():\n\tif &apos;type&apos; not in session:\n\t\treturn &apos;Invalid session!&apos;\n\telse:\n\t\tif session[&apos;type&apos;] == &apos;admin&apos;:\n\t\t\treturn render_template(&apos;admin.html&apos;, initf=os.getenv(&apos;INITF&apos;))\n\t\telse:\n\t\t\treturn &apos;You are not admin!&apos;\n\n@app.route(&apos;/api/getResource&apos;, methods=[&apos;GET&apos;])\ndef getResource():\n\tif request.args.get(&apos;resource&apos;):\n\t\ttry:\n\t\t\tresource = request.args.get(&apos;resource&apos;)\n\t\t\tf = open(f&apos;{os.getcwd()}/resources/{resource}&apos;, &apos;r&apos;)\n\t\t\tcontent = f.read()\n\t\t\tf.close()\n\t\t\treturn jsonify({\n\t\t\t\t&apos;content&apos;: content\n\t\t\t})\n\t\texcept Exception as e:\n\t\t\tprint(str(e))\n\t\t\treturn jsonify({\n\t\t\t\t&apos;error&apos;: str(e),\n\t\t\t\t&apos;message&apos;: &apos;Error in main.py!&apos;\n\t\t\t})\n\telse:\n\t\treturn jsonify({\n\t\t\t&apos;error&apos;: &apos;Missing argument.&apos;\n\t\t})&quot;}
</code></pre><p>Standing out:</p><p>app.secret_key = b&apos;SuperSecretKey&apos; # Probably should change this</p><p>And the check for admin:</p><p>if session[&apos;type&apos;] == &apos;admin&apos;</p><p>So we now know the app&apos;s secret key, which is probably used to sign our cookie with. Doing a little more research finds the following blogpost. </p><p><a href="https://blog.paradoxis.nl/defeating-flasks-session-management-65706ba9d3ce?ref=dfirsec.nl">https://blog.paradoxis.nl/defeating-flasks-session-management-65706ba9d3ce</a></p><p>Reading Luke (who is awesome btw) his blog post we find we can decode our existing cookie, and even create our own cookies using his script.</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-21.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="1101" height="139" srcset="https://dfirsec.nl/content/images/size/w600/2021/03/Untitled-21.png 600w, https://dfirsec.nl/content/images/size/w1000/2021/03/Untitled-21.png 1000w, https://dfirsec.nl/content/images/2021/03/Untitled-21.png 1101w" sizes="(min-width: 720px) 720px"></figure><p>Decoding the cookie shows that the cookie contains &apos;type&apos; : &apos;user&apos;. &#xA0;Using the flask-unsign tool with the secret_key that was found, its possible to create a cookie for ourselves with &apos;type&apos;: &apos;admin&apos;:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-22.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="1088" height="60" srcset="https://dfirsec.nl/content/images/size/w600/2021/03/Untitled-22.png 600w, https://dfirsec.nl/content/images/size/w1000/2021/03/Untitled-22.png 1000w, https://dfirsec.nl/content/images/2021/03/Untitled-22.png 1088w" sizes="(min-width: 720px) 720px"></figure><p>Changing our cookie in the browser and visiting the /admin page again gets us:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-23.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="1258" height="281" srcset="https://dfirsec.nl/content/images/size/w600/2021/03/Untitled-23.png 600w, https://dfirsec.nl/content/images/size/w1000/2021/03/Untitled-23.png 1000w, https://dfirsec.nl/content/images/2021/03/Untitled-23.png 1258w" sizes="(min-width: 720px) 720px"></figure><h2 id="welcome-card">Welcome Card</h2><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-24.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="512" height="714"></figure><p>Visiting the website we see:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-25.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="1246" height="597" srcset="https://dfirsec.nl/content/images/size/w600/2021/03/Untitled-25.png 600w, https://dfirsec.nl/content/images/size/w1000/2021/03/Untitled-25.png 1000w, https://dfirsec.nl/content/images/2021/03/Untitled-25.png 1246w" sizes="(min-width: 720px) 720px"></figure><p>After trying different types of input it turns out to be valuable to template injection, entering {{7*7}} gives:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-26.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="822" height="407" srcset="https://dfirsec.nl/content/images/size/w600/2021/03/Untitled-26.png 600w, https://dfirsec.nl/content/images/2021/03/Untitled-26.png 822w" sizes="(min-width: 720px) 720px"></figure><p>So we see the expression got evaluated, some google as to how to abuse jinja template injection lands us at:</p><p><a href="https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Server%20Side%20Template%20Injection?ref=dfirsec.nl#jinja2---basic-injection">https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Server Side Template Injection#jinja2---basic-injection</a></p><p>With the filter bypass payload:</p><pre><code class="language-json">{{request|attr(&apos;application&apos;)|attr(&apos;\x5f\x5fglobals\x5f\x5f&apos;)|attr(&apos;\x5f\x5fgetitem\x5f\x5f&apos;)(&apos;\x5f\x5fbuiltins\x5f\x5f&apos;)|attr(&apos;\x5f\x5fgetitem\x5f\x5f&apos;)(&apos;\x5f\x5fimport\x5f\x5f&apos;)(&apos;os&apos;)|attr(&apos;popen&apos;)(&apos;id&apos;)|attr(&apos;read&apos;)()}}
</code></pre><p>Entering this in to the website:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-27.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="354" height="232"></figure><p>We see the &apos;id&apos; command got executed. Now replacing the &apos;id&apos; command for: find / -name flag.txt shows us the flag is in opt:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-28.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="335" height="167"></figure><p>And changing the command again to &quot;cat /opt/flag.txt&quot; gets us a nice welcome card containing the flag:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-29.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="309" height="169"></figure><h2 id="leaked-hosts">Leaked Hosts</h2><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-30.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="516" height="642"></figure><p>The site shows us:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-31.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="1267" height="907" srcset="https://dfirsec.nl/content/images/size/w600/2021/03/Untitled-31.png 600w, https://dfirsec.nl/content/images/size/w1000/2021/03/Untitled-31.png 1000w, https://dfirsec.nl/content/images/2021/03/Untitled-31.png 1267w" sizes="(min-width: 720px) 720px"></figure><p>Searching for a test user:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-32.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="771" height="303" srcset="https://dfirsec.nl/content/images/size/w600/2021/03/Untitled-32.png 600w, https://dfirsec.nl/content/images/2021/03/Untitled-32.png 771w" sizes="(min-width: 720px) 720px"></figure><p>Alright, lets see if we can search for all users:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-33.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="157" height="115"></figure><p>Gives us an sql error:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-34.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="176" height="41"></figure><p>As we see the spaces got stripped, causing the error. But we can replace them for comments /**/:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-35.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy"></figure><p>And this gets us ALL the users:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-36.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="753" height="629" srcset="https://dfirsec.nl/content/images/size/w600/2021/03/Untitled-36.png 600w, https://dfirsec.nl/content/images/2021/03/Untitled-36.png 753w" sizes="(min-width: 720px) 720px"></figure><p>Lets use SQL map to get the entire database:</p><pre><code class="language-json">sqlmap -u &apos;http://web.ps.ctf.ae:8883/getUsers?username=test&apos; --tamper=space2comment --dump
</code></pre><p>And we find a very complex password:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-37.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="697" height="152" srcset="https://dfirsec.nl/content/images/size/w600/2021/03/Untitled-37.png 600w, https://dfirsec.nl/content/images/2021/03/Untitled-37.png 697w"></figure><p>Using these credentials we can use the file inclusion, we know we need to find a server only reachable from this one, so lets look at the hosts file:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-38.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="416" height="315"></figure><p>The 172.22.0.2 looks interesting, lets use the URL fetching utility to look at that:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-39.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="157" height="120"></figure><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-40.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="744" height="218" srcset="https://dfirsec.nl/content/images/size/w600/2021/03/Untitled-40.png 600w, https://dfirsec.nl/content/images/2021/03/Untitled-40.png 744w" sizes="(min-width: 720px) 720px"></figure><p>So lets grab that flag:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-41.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="229" height="130"></figure><p>And success:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2021/03/Untitled-42.png" class="kg-image" alt="PlaySecure CTF Write Up" loading="lazy" width="771" height="175" srcset="https://dfirsec.nl/content/images/size/w600/2021/03/Untitled-42.png 600w, https://dfirsec.nl/content/images/2021/03/Untitled-42.png 771w" sizes="(min-width: 720px) 720px"></figure><!--kg-card-begin: markdown--><h1 id="closing">Closing</h1>
<!--kg-card-end: markdown--><p>That concludes the write up for the few challenges I managed to solve. Had a lot of fun playing this CTF and picked up a few new tricks as well as dabbling in to Crypto and Exploitation challenges for the first time. </p><p>I want to thank everyone that made this possible, the teams behind CTF.AE, the Play Secure conference and all the volunteers and sponsors involved. </p>]]></content:encoded></item><item><title><![CDATA[A stein full of positivity: Beercon2]]></title><description><![CDATA[My write up of the amazing positive experience that was BeerCon2. Volunteering in a super positive atmosphere and delivering my first ever conference talk.  ]]></description><link>https://dfirsec.nl/a-stein-full-of-positivity-beercon2/</link><guid isPermaLink="false">5f9dead55c0e1d00017dcee7</guid><dc:creator><![CDATA[Lennaert Oudshoorn]]></dc:creator><pubDate>Sun, 01 Nov 2020 16:29:06 GMT</pubDate><media:content url="https://dfirsec.nl/content/images/2020/11/bc2_zoombg.png" medium="image"/><content:encoded><![CDATA[<img src="https://dfirsec.nl/content/images/2020/11/bc2_zoombg.png" alt="A stein full of positivity: Beercon2"><p>This past week I had the pleasure of helping out at Beercon2: The Rise of the Rookie, a virtual information security conference put on by <a href="https://twitter.com/TheBeerFarmers?ref=dfirsec.nl">The Beer Farmers</a>. As the title suggest this conference was all about Rookie speakers, people new to giving presentations. The best introduction to this conference I can probably give you is this one minute hype video that was made. </p><figure class="kg-card kg-embed-card"><iframe width="612" height="344" src="https://www.youtube.com/embed/UoCsSa2mjcU?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></figure><p>Across two days, 29 speakers delivered 27 outstanding talks that would not have been out of place at some of the bigger name conferences. In this blog post I will talk about how I experienced this event, both helping out behind the scenes and as a first time speaker. </p><p>With a global pandemic making in person events near impossible some conferences have chosen to go virtual. Many more however have sadly decided to cancel all together, citing reasons such as &apos;nobody is waiting for more zoom meetings&apos;. While more established speakers will probably still be asked to deliver their talks, the opportunities for first time speakers are drastically reduced. Beercon2 looked to do the exact opposite and give a platform to these first time speakers, and succeeded in doing so in marvelous fashion. </p><p>A big part of the aforementioned success was not simply giving the rookies a platform to speak, but also offering them guidance and coaching in delivering their first talk. This came in the form of a mentoring workshop, put on by more experienced speakers. In this workshop tips and tricks were given and any questions the speakers might have were answered. After this workshop all the mentors remained available to answer questions and help practicing talks in the mentoring channel on the Beercon2 Slack server. In this channel it was just mentors and speakers, even the organizers stepped back from it, creating a very safe environment without judgement to share any doubts or concerns a rookie speaker might have. &#xA0;</p><p>This Slack server, and the mentoring channel in particular, was absolutely buzzing in the weeks leading up to the conference. People were clearly excited, tips were shared, and many speakers helped each other doing practice runs of their presentations. A true community and support system was forming, people helped each other with their talks, and I&apos;m sure many lasting friendships were born. </p><p>Thursday morning it was finally time to kick off the conference, I found myself in the lobby of our zoom meeting to do audio/video/screen share checks with all the speakers ~20 minutes before they went on the virtual stage. Every. Single. One. showed up well in advance, fully prepared and excited. At other conferences I&apos;ve volunteered at I have seen issues with getting speakers on stage in time, speakers disappearing when they were needed or showing up so late that sound checks came in jeopardy, not here. No ego, no arrogance, just passionate people excited to get to present. Getting speakers prepared and in the right place at the right time was the easiest job ever. </p><p>Friday, day two of the conference, was from a volunteering standpoint no different than day one and everything went off without a hitch. Once again everybody was lovely, and most importantly rocking their talks. The quality of all the talks was impressive, as someone on Twitter remarked &quot;nobody tuning in would have known they were rookies&quot;. </p><p>This did however add to my nerves, as I was scheduled to speak at 18:00, as last talk of the event. Right before I went on friends and mentors gave me some encouraging words, reminded me to drink water and wished me luck. In the meeting with the hosts we had another quick 5 minute chat to get ready before we went live. </p><p>While I was nervous at the start this faded about &#xA0;two sentences in and I just gave my presentation. Just like everybody said would happen. I feel it went well and am happy with it, and a river of positive feedback would suggest this feeling is justified. If you want to see my talk its available on YouTube.</p><figure class="kg-card kg-embed-card"><iframe width="612" height="344" src="https://www.youtube.com/embed/Oing7VmKS7w?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></figure><p>After all the talks the hosts gave a short closing remark before we went on to the after party, a beer farmer hosted pub quiz over at <a href="https://twitter.com/InfosecHour?ref=dfirsec.nl">InfosecHappyHour</a>. It was a bit rowdy at times but that is to be expected from a pub, and the quiz was a hilarious closing to an amazing conference. </p><p>There is a <a href="https://twitter.com/i/lists/1315662418773774338?ref=dfirsec.nl">twitter list</a> with all the speakers in it that I can recommend you to follow because they are all equally amazing, and all the talks are available on YouTube. </p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://www.youtube.com/playlist?list=PLD6Eke-wt28k91eUbYDLsyE6UTRWQgXSJ&amp;ref=dfirsec.nl"><div class="kg-bookmark-content"><div class="kg-bookmark-title">BeerCon2</div><div class="kg-bookmark-description">Geniet van je favoriete video&#x2019;s en muziek, upload originele content en deel alles met vrienden, familie en anderen op YouTube.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://www.youtube.com/s/desktop/db70be64/img/favicon_144.png" alt="A stein full of positivity: Beercon2"><span class="kg-bookmark-author">YouTube</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://i.ytimg.com/vi/UoCsSa2mjcU/hqdefault.jpg?sqp=-oaymwEWCKgBEF5IWvKriqkDCQgBFQAAiEIYAQ==&amp;rs=AOn4CLAAR6CAnQYMDZbf3lYZBsuL9QpmZw&amp;days_since_epoch=18567" alt="A stein full of positivity: Beercon2"></div></a></figure><p>I had an absolute blast both helping out and speaking myself. So a massive thank you to the entire organization for making this possible, giving me and other rookies the chance to deliver our first talk. </p><p>The Beer Farmers:</p><ul><li><a href="https://twitter.com/AppSecBloke?ref=dfirsec.nl">Mike Thompson</a></li><li><a href="https://twitter.com/SeanWrightSec?ref=dfirsec.nl">Sean Wright</a></li><li><a href="https://twitter.com/ScottMcGready?ref=dfirsec.nl">Scott McGready</a></li><li><a href="https://twitter.com/phat_hobbit?ref=dfirsec.nl">Ian Thornton-Trump</a></li><li><a href="https://twitter.com/j_opdenakker?ref=dfirsec.nl">John Opdenakker</a></li></ul><p>The Mentors:</p><ul><li><a href="https://twitter.com/ClaireTills?ref=dfirsec.nl">Claire Tills</a></li><li><a href="https://twitter.com/Coffee_Fueled?ref=dfirsec.nl">James Bore</a></li><li><a href="https://twitter.com/safesecs?ref=dfirsec.nl">Sam Humphries</a></li><li><a href="https://twitter.com/RoseSecOps?ref=dfirsec.nl">Zoe Rose</a></li><li><a href="https://twitter.com/davewj?ref=dfirsec.nl">Dave McKenzie</a></li></ul><p>And last but not least, my fellow roadie <a href="https://twitter.com/ddsgerard?ref=dfirsec.nl">Gerard</a>.</p><p></p>]]></content:encoded></item><item><title><![CDATA[My Environment]]></title><description><![CDATA[<p>With the intention to showcase some of my work, and publish tutorials for people to follow along with on this blog I feel like it is important to have a certain baseline environment. In this post I will describe and document my environment this should enable people to create a</p>]]></description><link>https://dfirsec.nl/my-environment/</link><guid isPermaLink="false">5ec92fbe25a7a80001fc8540</guid><category><![CDATA[Kali Linux]]></category><category><![CDATA[Tutorial]]></category><dc:creator><![CDATA[Lennaert Oudshoorn]]></dc:creator><pubDate>Tue, 26 May 2020 12:24:37 GMT</pubDate><media:content url="https://dfirsec.nl/content/images/2020/05/default.png" medium="image"/><content:encoded><![CDATA[<img src="https://dfirsec.nl/content/images/2020/05/default.png" alt="My Environment"><p>With the intention to showcase some of my work, and publish tutorials for people to follow along with on this blog I feel like it is important to have a certain baseline environment. In this post I will describe and document my environment this should enable people to create a similar setup for themselves as to avoid issues where examples I show don&apos;t work for others. As the title of this post says, this is my environment, configured how I like it. This is by no means the only, or the best way, but it is what works for me.</p><p>As I learn more, and new tools and software gets released its only natural that my toolbox and thus my environment keeps evolving. With this in mind I intend to keep this post up-to-date to reflect changes I make, so feel free to check back here once in awhile to see what is new. </p><p>As virtualization software I use VMWare Workstation Pro. But as a free alternative you can use VMWare Workstation Player, this free version is available for non-commercial, personal and home use and can be downloaded from: <a href="https://www.vmware.com/products/workstation-player.html?ref=dfirsec.nl">https://www.vmware.com/products/workstation-player.html</a>.</p><p>My OS of choice is Kali Linux, a distribution aimed at security professionals. There are a few great alternatives, most notably <a href="https://parrotlinux.org/?ref=dfirsec.nl">Parrot OS</a>. Personally I chose for Kali Linux as I&apos;m most familiar with this distribution, but I encourage you all to experiment around with different options and find out what works for you. Next to the disc images (ISO files) to install Kali Linux with, Offensive Security has Virtual Machine versions available. I find that using these makes it fast and easy to get your environment up and running, they can be downloaded from <a href="https://www.offensive-security.com/kali-linux-vm-vmware-virtualbox-image-download/?ref=dfirsec.nl">here</a>, as I&apos;m using VMware I grab the Kali Linux VMware 64-Bit image, but images for Virtual Box and Hyper-V are also available if you chose for different virtualization software.</p><p>With your virtualization software of choice installed, and the appropriate image of Kali downloaded its time to make the machine, screenshots are taken from the VMware version that I use, but steps should not be to different with other software.</p><h3 id="creating-the-virtual-machine">Creating the Virtual Machine</h3><p>On the Home screen of VMware we need the option &quot;Open a Virtual Machine&quot;:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2020/05/image.png" class="kg-image" alt="My Environment" loading="lazy"></figure><p>Navigate to the folder where you&apos;ve unpacked the archive containing the Kali Linux image, and select the vmx file and open it. You can assign more cores and/or memory to the VM in the &quot;Virtual Machine settings&quot; menu (shortcut CTRL+D), but in most cases the default settings should be fine, you can always change this later if you find the VM not running well enough. </p><p>The first thing I like to do is take a snap shot of the current state of the machine, so we can always easily revert back to here in case we make a mistake somewhere and something breaks. In fact, I often take snapshots before and after making major changes to my environment. To do this, open the snapshot manager by pressing CTRL+M or navigating to it through the menu &quot; VM --&gt; Snapshot --&gt; Snapshot Manager&quot;.</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2020/05/image-5.png" class="kg-image" alt="My Environment" loading="lazy"></figure><p>Click the &quot;Take Snapshot...&quot; button and give your snapshot a name and a description so that you can remember what state the machine was in at this point. For the first snapshot I often chose &quot;Fresh Install Kali $version&quot; as a description, so in this case &quot;Fresh install Kali 2020.2&quot;. That is all there&apos;s to it. </p><p>You can now start the machine by clicking the play button, the first time it starts you should get the following prompt:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2020/05/image-6.png" class="kg-image" alt="My Environment" loading="lazy"></figure><p>Choose &apos;I Copied It&apos;. <br><br>After the machine has finished booting up, you should be greeted by the Kali Linux login prompt. </p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2020/05/image-7.png" class="kg-image" alt="My Environment" loading="lazy"></figure><p>In the past Kali Linux came with a root account by default, but recently this has changed and the default user is called kali, with as password kali. Enter these credentials and you should land on the desktop of your very own Kali Linux VM.</p><h3 id="bringing-kali-up-to-date">Bringing Kali up-to-date</h3><p>Now we have a running Kali Linux machine, lets first bring her up to date. To do this open a terminal and run the following command.</p><pre><code class="language-shell">sudo apt update &amp;&amp; sudo apt dist-upgrade -y</code></pre><p>Running this command will first prompt you for your password, as we are using sudo to run this command with elevated rights as an administrator, after you entered your credentials the system will start downloading the latest updates.</p><h3 id="configuring-the-correct-timezone-and-keyboard-layout">Configuring the correct timezone and keyboard layout</h3><p>Chances are, especially if you are not from the United States, that the default VM Image does not have your correct timezone and/or keyboard layout, so lets fix that. </p><p>First for timezone, enter the following command in the terminal.</p><pre><code class="language-shell">sudo dpkg-reconfigure tzdata</code></pre><p>Again this command needs to be ran with elevated privileges so enter your sudo password, and follow the instructions on the screen.</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2020/05/image-8.png" class="kg-image" alt="My Environment" loading="lazy"></figure><p>Changing the keyboard layout works much the same, this time the command required is:</p><pre><code class="language-shell">sudo dpkg-reconfigure keyboard-configuration</code></pre><p>And again, follow the instructions on the screen to select the correct layout. </p><h3 id="change-the-default-password-and-creating-a-new-user">Change the default password and creating a new user</h3><p>With the VM by default configured with kali/kali as username and password, it is advised to change this password, to do so type the passwd command in to the terminal.</p><pre><code class="language-shell">passwd</code></pre><p>After typing this command you will be asked for your current password, a new one, and once more to confirm this new password.</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2020/05/image-9.png" class="kg-image" alt="My Environment" loading="lazy"></figure><p>You can continue working as the kali user, now with a new password that not everyone knows, or you can choose to make your own user. If you want to create a new user follow these steps. First, create the user.</p><pre><code class="language-shell">sudo adduser UserName</code></pre><p>Replace UserName with your desired new username, this command will ask you for a new password for this user and a few other details, these other details you can leave blank. Now we have created the user and a home directory for this user.</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2020/05/image-10.png" class="kg-image" alt="My Environment" loading="lazy"></figure><p>As you have noticed before, we&apos;ve quite often used the sudo command to run other commands with elevated privileges, to give our new user the rights to also use this command we need to add them to the sudo group.</p><pre><code class="language-shell">sudo usermod -aG sudo UserName</code></pre><p>Again, replace UserName with the name of your new user. </p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2020/05/image-11.png" class="kg-image" alt="My Environment" loading="lazy"></figure><p>As a last step, we should change the default shell of our user to Bash, in order to do that run:</p><pre><code class="language-shell">sudo chsh -s /bin/bash UserName</code></pre><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2020/05/image-12.png" class="kg-image" alt="My Environment" loading="lazy"></figure><p>Finally we can now logout, and sign in as our new user.</p><h3 id="changing-your-ssh-keys">Changing your SSH keys</h3><p>Because the default image we used has the same SSH keys for everyone, an attacker could use this knowledge to perform Man in the Middle attack on your SSH session. Therefor it is advised to change these keys. </p><p>These keys we need to change are inside <em>/etc/ssh</em>, and all start with <em>ssh_host_*</em> </p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2020/05/image-13.png" class="kg-image" alt="My Environment" loading="lazy"></figure><p>First I&apos;d start by making a backup of these keys. To do this we will create a backup-keys directory inside the <em>/etc/ssh</em> directory and move all the files starting with <em>ssh_host_ </em>in to it.</p><pre><code class="language-shell">sudo mkdir /etc/ssh/backup-keys &amp;&amp; sudo mv /etc/ssh/ssh_host_* /etc/ssh/backup-keys</code></pre><p>With the keys moved in to the backup directory we can create new keys.</p><pre><code class="language-shell">sudo dpkg-reconfigure openssh-server</code></pre><p>The output of this command should look something like this:</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2020/05/image-14.png" class="kg-image" alt="My Environment" loading="lazy"></figure><p>Now to confirm our new keys are different than the ones we just created, we can compare them to the keys in the backup folder, to do this we will take a MD5 sum of both sets of files.</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2020/05/image-15.png" class="kg-image" alt="My Environment" loading="lazy"></figure><p>As you can see, the computed checksum for all the files is different. </p><p>You now have a fully functional and up-to-date Kali Linux VM to use in a CTF or participate in various bug bounty programs with. Anything after this is installation of software I use and tweaking of configurations to suit my personal preferences. Non of it is mandatory or required but feel free to take from it what you feel might be useful.</p><hr><h3 id="create-a-shared-directory-between-host-and-vm">Create a shared directory between host and VM</h3><p>I like to have a shared folder between my host machine and the virtual machine where I keep most of the work I do in. This way if I spin up a new VM I still have all the work files readily available. To create a shared folder, open up the Virtual Machine Settings menu in VMware (CTRL+D), go to the options tab, select the &apos;Shared Folders&apos; option and make sure &apos;Always Enabled&apos; is checked. You can now pick which folder you want to share by clicking the Add button.</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2020/05/image-21.png" class="kg-image" alt="My Environment" loading="lazy"></figure><p>Try to avoid using spaces in your folder name, as Linux does not always play nice with this. Afterwards you can mount your shared folder with this command.</p><pre><code class="language-shell">sudo mount -t fuse.vmhgfs-fuse .host:/ /mnt -o allow_other</code></pre><p>If you want to automatically mount your shared folder on boot, you can add the following to the <em>/etc/fstab </em>file:</p><pre><code class="language-shell"># Use shared folders between VMWare guest and host
.host:/    /mnt/hgfs/    fuse.vmhgfs-fuse    defaults,allow_other,uid=1000     0    0</code></pre><p>Your shared folder should now be inside /mnt/hgfs/ everytime you start your virtual machine.</p><h3 id="install-atom">Install Atom</h3><p>Atom is a hackable text editor, and it is my editor of choice to modify scripts or take notes in. You can read more about this tool over at their own website, <a href="https://atom.io/?ref=dfirsec.nl">https://atom.io/</a>.</p><p>First we need to download Atom:</p><pre><code class="language-shell">https://github.com/atom/atom/releases/download/v1.47.0/atom-amd64.deb</code></pre><p>After downloading the file we can install it:</p><pre><code class="language-shell">sudo dpkg -i atom-amd64.deb</code></pre><p>After installing, you can start the program via the menu, or by typing the atom command inside your terminal.</p><figure class="kg-card kg-image-card"><img src="https://dfirsec.nl/content/images/2020/05/image-20.png" class="kg-image" alt="My Environment" loading="lazy"></figure><h3 id="install-tree-htop-nethog">Install tree, htop, nethog</h3><pre><code class="language-shell">sudo apt-get install -y tree htop nethogs
</code></pre><p>I like knowing what is going on on my system. These tools help me get insight in that.</p><ul><li>Tree gives a depth indented recursive listing of files and directories.</li><li>Htop is an alternative to the default top and is used for real-time process monitoring.</li><li>Nethogs can be used to view the network traffic to see which applications are using up your bandwidth. </li></ul><h3 id="install-filezilla">Install FileZilla</h3><p>If you are participating in a CTF chances are you will have to interact with an FTP server at some point. I know this can all be done from the terminal, but personally I prefer to have a graphical FTP program, and FileZilla is the one that I like most. </p><p>The command:</p><pre><code class="language-shell">sudo apt-get install filezilla</code></pre><p>Will install this application for you, just like Atom you can then start it from the menu, or by typing filezilla in to your terminal. </p><h3 id="install-jopin">Install Jopin</h3><p>Taking notes is extremely important. They help you writing your report for bug bounties, and they let you search back how you did something in the past if you encounter something that is very similar to something you have seen before.</p><p>My application of choice for taking notes is Joplin, you can install it with:</p><pre><code class="language-shell">sudo apt-get install joplin
</code></pre><p>If you choose to use Joplin for taking notes like I do, I&apos;d advice you to look in to how to configure syncing for it, and use the application on multiple of your devices.</p><h3 id="install-chrome">Install Chrome</h3><p>Kali comes default with FireFox as the web browser, personally I prefer Chrome while conducting tests against websites, so lets install that. </p><pre><code class="language-shell">wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install -y ./google-chrome-stable_current_amd64.deb
</code></pre><p>I add two addons to chrome, both can be downloaded in the <a href="https://chrome.google.com/webstore?ref=dfirsec.nl">chrome webstore</a>:</p><ul><li>Foxy Proxy Standard, to quickly turn on/off a webproxy such as Burp Suite or OWASP ZAP</li><li>Joplin Web Clipper, to capture and save things from the web in to my notes</li></ul><h3 id="seclists">Seclists</h3><p>Word lists are super useful when brute forcing passwords, subdomains, or directories. A great collection of word lists is Seclists, you can read more about this project on the github page <a href="https://github.com/danielmiessler/SecLists/?ref=dfirsec.nl">https://github.com/danielmiessler/SecLists/</a>. On kali you can install it with the command: </p><pre><code class="language-shell">sudo apt -y install seclists</code></pre><h3 id="customizing-your-terminal">Customizing your terminal</h3><p>This will probably be different for everyone, there are many different terminal emulators to choose from, for example Guake or Terminator. Personally I use a combination of Terminator/ZSH/Oh-My-ZSH/P10K Theme. </p><h3 id="adding-some-fun">Adding some fun</h3><pre><code class="language-shell">sudo apt-get install -Y cmatrix cowsay sl lolcat</code></pre><p>This command will install:</p><ul><li>cmatrix</li><li>cowsay</li><li>sl (steam locomotive)</li><li>lolcat</li></ul><p>Non of these add any value to being productive, but they are fun when you find yourself giving a demo or just need a little something to cheer yourself up with. </p>]]></content:encoded></item><item><title><![CDATA[First blog post]]></title><description><![CDATA[<p>Hello World, &#xA0;</p><p>This is my first post on this blog. First I&apos;ll start with &#xA0;a short introduction of myself before I get in to why I started this blog and what kind of content you can expect to see here. &#xA0;</p><p>My name is Lennaert and</p>]]></description><link>https://dfirsec.nl/why-this-blog/</link><guid isPermaLink="false">5ec5484225a7a80001fc8528</guid><dc:creator><![CDATA[Lennaert Oudshoorn]]></dc:creator><pubDate>Wed, 20 May 2020 15:11:50 GMT</pubDate><media:content url="https://dfirsec.nl/content/images/2020/05/black-business-computer-contemporary-296115.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://dfirsec.nl/content/images/2020/05/black-business-computer-contemporary-296115.jpg" alt="First blog post"><p>Hello World, &#xA0;</p><p>This is my first post on this blog. First I&apos;ll start with &#xA0;a short introduction of myself before I get in to why I started this blog and what kind of content you can expect to see here. &#xA0;</p><p>My name is Lennaert and I&apos;m from Amsterdam, where I was born and raised. In my younger years I got in to video games and from there in to computers in general, and eventually developed an interest in hacking and cyber security. I study Digital Forensics at the University of Applied Science in Leiden. </p><p>This study exposes me to a lot of the digital forensics and incident response side of cyber security. I try to stay in touch with the more offensive ethical hacking side as a hobby by doing things like bug bounties, try hack me, and hack the box. I also try to practice Responsible/Coordinated vulnerability disclosure whenever I find a vulnerable system in the wild. Trying to balance these things I hope to form a good all-round perspective of the cyber security world. </p><p>Since 2018 I&apos;ve volunteered for Hack In The Box Amsterdam, a cool security conference taking place in my home town. I also volunteer as a security researcher for the DIVD, the Dutch Institute for Vulnerability Disclosure.</p><p>In my spare time I like to play the occasional video game, and when I&apos;m not behind a computer I enjoy cooking or riding my bicycle. Time with friends will be generally spent in a bar, or at home playing board games. </p><p>I feel that&apos;s enough about me, so on to why I started this blog and what kind of content you can expect here. </p><p>My main reason to start blogging is to document my journey of learning. I will be using this space to share my thoughts and ideas on subjects when I feel it&apos;s appropriate to do so. Next to that I hope to show case some projects that I&apos;ve been working on once they reach the stage that I feel confident enough in them to do so. </p><p>Another thing I might write about are bug bounties and/or responsible disclosures, but only if they provide something that I feel is unique or make for a good story. Of course, I will only share these things once the issues involved are resolved, or I feel I have given the involved parties enough time to resolve them. </p><p>Write-ups of vulnerable machines / HTB / TryHackMe are something else I often see on people&apos;s blogs, currently I&apos;m not sure how many of those I will be posting, simply because I feel others often have already published a more eloquent write up than I possibly could. If I find something unique about a machine or learned something special I will probably write a bit about it. <br><br>I hope this first post gave you a little insight in who I am and what you can expect from this blog, and I hope to see you check back here at some point!<br><br> &#xA0;</p>]]></content:encoded></item></channel></rss>