<?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[Stories by DigitalAndrew on Medium]]></title>
        <description><![CDATA[Stories by DigitalAndrew on Medium]]></description>
        <link>https://medium.com/@DigitalAndrew?source=rss-eb899a8dc13------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*X0lZS8obRgNmSkws</url>
            <title>Stories by DigitalAndrew on Medium</title>
            <link>https://medium.com/@DigitalAndrew?source=rss-eb899a8dc13------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 13:57:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@DigitalAndrew/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Hardware and IoT Hacking Resources]]></title>
            <link>https://medium.com/@DigitalAndrew/hardware-and-iot-hacking-resources-6b925632e2c6?source=rss-eb899a8dc13------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b925632e2c6</guid>
            <category><![CDATA[iot-security]]></category>
            <category><![CDATA[hardware-hacking]]></category>
            <dc:creator><![CDATA[DigitalAndrew]]></dc:creator>
            <pubDate>Tue, 13 Feb 2024 21:18:42 GMT</pubDate>
            <atom:updated>2025-05-17T17:03:30.502Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MEpU4xREtFzYG-JUj5H10A.png" /></figure><h3>Intro</h3><p>The most frequent follow-up question I get from students finishing my <a href="https://academy.tcm-sec.com/p/beginner-s-guide-to-iot-and-hardware-hacking?affcode=770707_2thywigv">Beginner’s Guide to IoT and Hardware Hacking</a> course is “That was great but where can I learn more”.</p><p>Unfortunately, I haven’t had time to finish an intermediate-level course and to my knowledge, there isn’t anything similar to my course in its delivery style and price range so there isn&#39;t a natural follow-on course. I have however compiled a list of additional resources that I’ve shared so many times now I figured it was time to host it somewhere.</p><p>I’ll keep this list updated as best as I can as I find new resources, and if you have any suggestions please let me know. I’ve split it up into free and paid, keep in mind for Iot/Hardware Hacking paid courses some of these are going to be in a whole different ballpark of prices from a TCM or Udemy course. Final note, I’ve got no skin in the game for any of these links, none of them are affiliates and I don’t get any kickback (except for the one to my course), they are listed in no particular order. Most of the paid training I have not taken but have heard good things about.</p><h3>Free</h3><p><strong>Matt Brown: </strong>a host of great hardware and IoT hacking tutorials and videos <a href="https://www.youtube.com/@mattbrwn">https://www.youtube.com/@mattbrwn</a></p><p><strong>TCM Security IoT Hacking Blog Series: </strong>this is a zero to hero 4 part blog series I wrote walking through hacking your first IoT device. <a href="https://tcm-sec.com/getting-started-with-iot-hardware-hacking/">https://tcm-sec.com/getting-started-with-iot-hardware-hacking/</a></p><p><strong>Make Me Hack: </strong>awesome<strong> </strong>series on hacking a gemtek router <a href="https://www.youtube.com/@MakeMeHack">https://www.youtube.com/@MakeMeHack</a></p><p><strong>Flashback Team: </strong>Some interesting tutorials and walkthroughs on how they found vulnerabilities and developed exploits on their YouTube, most of their training is paid though <a href="https://www.youtube.com/@FlashbackTeam">https://www.youtube.com/@FlashbackTeam</a></p><p><strong>Hackaday: </strong>Repository of tutorials, projects and hacks mostly focused around hardware <a href="https://hackaday.com/">https://hackaday.com/</a></p><p><strong>ZeroDayInitiative: </strong>Some great blogs about previous vulnerabilities and exploits and how they were found <a href="https://www.zerodayinitiative.com/blog/">https://www.zerodayinitiative.com/blog/</a></p><p><strong>OWASP IoT: </strong>Just like OWASP for web but for IoT, less hardware related but some really good examples and resources including a vulnerable firmware sample to practice on (IoT GOAT) <a href="https://owasp.org/www-project-internet-of-things/">https://owasp.org/www-project-internet-of-things/</a></p><p><strong>Hardwear.io: </strong>Some great talks and conference videos here, they also have a conference and paid training <a href="https://www.youtube.com/@hardweario">https://www.youtube.com/@hardweario</a></p><p><strong>Iot Village at DEFCON: </strong>Lots of great trainings and workshops here, putting it in free because they have other resources available through their website but of course if you want to attend in person it costs the admission to DEFCON but usually the workshops and villages inside are all free <a href="https://www.iotvillage.org/index.html">https://www.iotvillage.org/index.html</a></p><h3>Paid</h3><p><strong>Beginner’s Guide to IoT and Hardware Hacking: </strong>Okay maybe I’m a little biased on this one, but I’ve had pretty much only good feedback and you can get this course for as little $29.99 if you finish it in a month <a href="https://academy.tcm-sec.com/p/beginner-s-guide-to-iot-and-hardware-hacking?affcode=770707_2thywigv">https://academy.tcm-sec.com/p/beginner-s-guide-to-iot-and-hardware-hacking</a></p><p>There is also certification through TCM called the Practical IoT Pentest Associate that goes with this training material, you can learn more about it here: <a href="https://certifications.tcm-sec.com/pipa/?ref=285">https://certifications.tcm-sec.com/pipa/?ref=285</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*dQuMyUjqzkwajpeIWvnr8Q.jpeg" /><figcaption>TCM Security PIPA Certification</figcaption></figure><p><strong>Practical IoT Hacking: </strong>This is a “No Starch Press” book and it’s an awesome resource, well worth it. I have a copy I reference frequently. Has a good of mix of hardware and no hardware-based methodology. Amazon link here but you can get this lots of places <a href="https://www.amazon.ca/Practical-IoT-Hacking-Fotios-Chantzis/">https://www.amazon.ca/Practical-IoT-Hacking-Fotios-Chantzis/</a></p><p><strong>Hardware Hacking Handbook: </strong>Another “No Starch Press” and excellent resource, this one more focused purely on hardware hacking. There is a bit of overlap with the Practical IoT Hacking book. If you’re going to get just one I’d get the IoT one but there is lots of value in having them both. Amazon link again <a href="https://www.amazon.ca/Hardware-Hacking-Handbook-Breaking-Embedded">https://www.amazon.ca/Hardware-Hacking-Handbook-Breaking-Embedded</a></p><p><strong>Securing Hardware: </strong>I’ve heard great things about their courses and they are also the maker of the tigard board (awesome hardware hacking Swiss army tool). They have both online and in-person classes <a href="https://securinghardware.com/training/">https://securinghardware.com/training/</a></p><p><strong>Flashback Team: </strong>As mentioned above in linking their YouTube channel, these guys have some in-person training events that I’ve also heard good things about <a href="https://www.flashback.sh/training">https://www.flashback.sh/training</a></p><p><strong>SANS SEC556: </strong>Good Old SANS, if you can afford it or get your employer to pay for it then go for it, their training is top notch but if you’re not familiar with their pricing you might be in for a shock <a href="https://www.sans.org/cyber-security-courses/iot-penetration-testing/">https://www.sans.org/cyber-security-courses/iot-penetration-testing/</a></p><p><strong>Hardwear.io: </strong>This is a conference but it also has some great hands-on training, and some top-notch instructors like Joe Grand <a href="https://hardwear.io/usa-2024/training.php">https://hardwear.io/usa-2024/training.php</a></p><p><strong>WeHackInDisguise: </strong>The course syllabus for this looks promising, but I haven’t heard much else about them <a href="https://www.whid.ninja/store">https://www.whid.ninja/store</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b925632e2c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Square CTF 2022]]></title>
            <link>https://medium.com/@DigitalAndrew/square-ctf-2022-49b94834538e?source=rss-eb899a8dc13------2</link>
            <guid isPermaLink="false">https://medium.com/p/49b94834538e</guid>
            <category><![CDATA[sql-injection]]></category>
            <category><![CDATA[sal]]></category>
            <category><![CDATA[hardware-hacking]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[DigitalAndrew]]></dc:creator>
            <pubDate>Mon, 21 Nov 2022 19:07:01 GMT</pubDate>
            <atom:updated>2022-11-21T19:07:01.987Z</atom:updated>
            <content:encoded><![CDATA[<p>A couple of solutions from the recent Square CTF that I competed in with some colleagues.</p><h4>Alex Hanlon has the flag!</h4><p>This was a web challenge where we must find Alex’s username to get the flag. Upon visiting the website we are greeted with a login prompt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*bAsaQ_tuuTATkSIJSd3Peg.png" /><figcaption>Initial Login Prompt</figcaption></figure><p>Since there is a login prompt, I first tried a basic SQL injection test by putting a single quote at the end of an input ‘ in each field, and it appeared to be vulnerable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hDRxWQRF_dRwhvqpxd63OA.png" /><figcaption>Using a’ for password shows an SQL Error message</figcaption></figure><p>Knowing that the login appeared to be vulnerable to SQL injection I thought that this could be used to log in as the admin account and see if we have additional permissions. Based on the error message we can get an idea of how the SQL statement is being used and we can try for a basic ‘OR ‘1’ = ‘1 injection in the password. Taking a guess at how the backend SQL is written, the password will be checked against the database password for the username and return true or 1 if the password is correct. By appending the injection this will always return true regardless of the password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*tweqjLdbcCd6tLICT0pM2g.png" /><figcaption>Logging in as Admin with SQLi</figcaption></figure><p>We were able to successfully use this to log in as Admin, however, this doesn’t give us any additional access. We will need a way to try and find Alex’s username without the admin account.</p><p>Luckily from the login and error message we see that there is output from the database based on our injection. Knowing this we may be able to dump out database contents into this output that we have. One way to do this when you have an injection into what appears to already be a SELECT statement is with a UNION SELECT. The UNION SELECT is used to combine the results of two or more select statements. Doing so can allow us to force the web app to return additional information that we control the SELECT for.</p><p>In order for UNION SELECT to work we must know how many parameters or columns the first select is doing. One way to test this is to try a payload of:</p><pre>&#39; UNION SELECT NULL; -</pre><p>and increase the number of NULL selects. Generally, if you are trying to do a UNION SELECT where the number of parameters doesn’t match you’ll get an SQL error. In this case, running it for one NULL gives an interesting error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RlzZFO5GUpcqwLWsPDX5uQ.png" /><figcaption>Union Select Error</figcaption></figure><p>However, when trying it for additional NULL selects we see the below error which helped me identify that we only need to return one column to match in our UNION SELECT.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*T3Q4m4XE9hBnwY9FBhIaOA.png" /><figcaption>UNION SELECT mismatch of columns</figcaption></figure><p>Using the above knowledge I tried to craft a payload to dump the usernames from the DB. This took a little bit of trial and error to figure out the DB column names. I eventually worked out that the column holding the usernames was “user” and crafted an injection.</p><pre>a&#39; UNION SELECT username FROM user; --</pre><p>The issue with this injection is that the output from the web page that contained the SQL result only returned one entry, which in this case is the admin account since it is the first item.</p><p>I decided to try and reverse the order and see what came out by added a sort by descending into the injection.</p><pre>a&#39; UNION SELECT username FROM user ORDER BY username DESC; -- </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*CYjwYQIVkWmiYqG_EKwSLQ.png" /><figcaption>Success!</figcaption></figure><p>This worked as it looks like Alex’s username was the last one in the column.</p><h4>sqUARe paymenT terminal</h4><p>This was a hardware challenge where we were given a single .sal file. This is common for hardware challenges and represents a signal-capture file that can be opened using Saleae Logic 2 software.</p><p>Looking at the name of the challenge we are given a big hint with the capitalized letters spelling out UART. UART (Universal Asynchronous Receiver-Transmitter) is a very common serial communication protocol for hardware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Iii98ew769tM-6QCMx1Sdg.png" /><figcaption>First look at the capture</figcaption></figure><p>Looking at the capture we see what appears to be three blips of communication. Zooming in we can see the individual waveforms in detail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tmCT6BRmG472sCzcHQiOog.png" /><figcaption>Closer look at the waveforms</figcaption></figure><p>In Logic 2 a captured UART signal can easily be decoded using the asynchronous serial analyzer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/523/1*T5P4JIf9x13VzKKV9pTZBg.png" /><figcaption>Asynchronous Serial Settings</figcaption></figure><p>I started with the defaults, however for this analyzer and when dealing with any serial communication we’ll need to know the bit or baud rate. We can calculate this since we have the waveform. The easiest way to do this in Logic 2 is actually to add a community-created extension that estimates it when you take a measurement of the waveform.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/1*Q5qcu0qY6P0MliDuuMCmDw.png" /><figcaption>Baud rate estimator</figcaption></figure><p>With this extension added we can just take a measurement over one of the communication transmissions and we will see the baud rate displayed in the measurement parameters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5fCK1H_WnAGkqA6rhG9OlQ.png" /><figcaption>Meauring for baud rate</figcaption></figure><p>Now we can run the asynchronous analyzer and see if we can decode anything. The decoded output looks promising, by default it will show in hex, however, we can swap this to ASCII and see if we have a message.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dWRMwDm8TBixJDsHVQut1g.png" /><figcaption>Decoded to Hex</figcaption></figure><p>Switching to ASCII we see some readable text, looks like we’ve decoded it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q3Uirr1cJ3aEAFJqvVWetg.png" /><figcaption>Decoded to ASCII</figcaption></figure><p>Checking the other transmitions we find the flag in the final one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4V4-ZRPU6BTkNXrK_VoH7g.png" /><figcaption>Flag for hardware challenge</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49b94834538e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Serving up AD Decoy accounts to Responder]]></title>
            <link>https://medium.com/@DigitalAndrew/serving-up-ad-decoy-accounts-to-responder-1f54591befc3?source=rss-eb899a8dc13------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f54591befc3</guid>
            <category><![CDATA[blue-team]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[DigitalAndrew]]></dc:creator>
            <pubDate>Tue, 25 Oct 2022 14:17:56 GMT</pubDate>
            <atom:updated>2022-10-25T14:17:56.239Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ffrh0Buwc2xPt1-0" /></figure><h3>Responding to Responder</h3><p>Responder is one of the most popular Active Directory (AD) exploitation tools used once an adversary (or penetration tester) has gained a foothold into a network. In this article we’re going to look at how we can turn it around to serve up a juicy decoy account which will both waste attackers time and give us a high quality early alert to their presence. Want to just see a video, skip to the end of the article for a YouTube demo.</p><h3>An Intro to LLMNR Poisoning</h3><p>If you’re not familiar with Responder I’d highly suggest checking out this TCM Security <a href="https://www.youtube.com/watch?v=Fg2gvk0qgjM">video</a> on it’s use, if you are familiar feel free to skip ahead to the <strong>Poisoning the Poisoner</strong> section below.</p><p>The TLDR; on Responder is that it listens on a network for NetBIOS, LLMNR and MDNS for SMB connections (think network shares). These generally happen when someone (or something) tries to resolve a hostname that doesn’t exist or is offline. When DNS resolution fails, on most default configured networks it will then fallback to LLMNR. LLMNR works by sending out a broadcast message asking if other hosts knows how to reach the host name. In theory, this sounds great, however Responder abuses this by sending poisoned LLMNR responses for SMB connections saying that it’s actually hosting the share. When the victim connects back it will automatically send over it’s username and NTLMv2 hash unknowingly to Responder which will capture it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xK7nTH_8o2_jVOwZ" /></figure><p>Attackers can use this hash to relay it on the network and gain a shell. Alternatively these hashes are very crackable especially for weak passwords. One of the first things most attackers will do after capturing a hash is take it offline and try and crack it.</p><h3>Poisoning the Poisoner</h3><p>Most modern IDS/IPS can detect and alert on the poisoned responses from Responder, however, these sometimes have false positives and have to wait for something on the network to trigger an LLMNR look up. One way to avoid this is to trigger the LLMNR lookup yourself. This can be done by simply trying to connect to a network share for a known bad host name and seeing if it resolves. If it does resolve and you get a response back this is a good indication of poisoning.</p><p>Proactively triggering Responder poisoned responses is not a new idea and there have been open source tools that do some form of this as a Responder detection. One of the reasons detecting Responder early on is so advantageous for defenders is that for a lot of penetrations testers (and adversaries) it’s one of the very <em>first things they will start up on an engagement</em>. We can get an early warning of network intrusion or an unannounced pen test.</p><p>I created an open source tool called <strong>f1rstResponder</strong> which proactively detects responder by attempting to connect to an SMB share with a bad hostname. You can pass a hostname to the tool so that it matches your network naming convention, I suggest using a common typo of a high traffic share.</p><p>If f1rstResponder picks up a response to the hostname it will record the IP address it came from and alert on the possibility of a poisoned response by Responder. In addition to writing out to the console, it can also write out to syslog which allows it to interface with most popular SIEMs or log collectors.</p><h3>Serving up a JUICY hash</h3><p>Active Directory decoy accounts seem to be all the rage right now, while these aren’t a new creation or concept by any means they are picking up lots of popularity. The main idea behind these accounts is to make them appealing to attackers while being locked down and monitored such that any activity on them will trigger an alert. Ippsec recently did an awesome <a href="https://www.youtube.com/watch?v=BT9pT1tAmX8">video</a> on AD Honey Pot accounts that gave me the idea to tie them in with f1rstResponder. Check out his video below on how to set them up and also for an alternative alerting method.</p><p>For decoy accounts to work we need to entice an attacker to interact with them somehow. One common method is to include a password in the account description which will then be viewed by popular AD enumeration tools (like PowerView).</p><p>Alternatively, using f1rstResponder we can serve the account up on a silver platter to anyone running Responder. By specifying the account name, password and domain as optional flags to f1rstResponder it can send these back as if it were a regular victim. When the script picks up a response to the bad hostname, it will attempt to connect back to the share on the IP that responds using the credentials which passes the username and hash right to Responder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mECx7w24YfrJfG43" /></figure><p>In the example above we try to connect to the share EngineeringServerr (notice the typo) and if there is a response to that host resolution the script will pass back the username and domain for our decoy account along with a common weak password hash.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3PIRsnVmfAt-rGe6" /></figure><p>The password should fall to any cracking tool and word-list almost immediately and the network intruder will be ready to take their easy win and pass it around the network. At this point not only will we get a notification that Responder is running but we’ll also get a trigger on our decoy account for the login attempt. If we correlate these two alerts together we can have a basically 100% indication of network intrusion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qUKWm37MWXWLJIWr" /></figure><h3>Ringing the alarm bell with Graylog</h3><p>Of course, no one is going to sit and watch the console output of a script or Windows event log. Luckily f1rstResponder can write out to syslog and we can capture that along with Windows logs in any SIEM.</p><p>For my lab I used Graylog because it’s free and relatively easy to get up. A huge shoutout to <a href="https://www.linkedin.com/in/david-elgut?miniProfileUrn=urn%3Ali%3Afs_miniProfile%3AACoAACvutTABzr2uJADas11mWlL2cDUyDO9-Jnc">🛡️ David Elgut</a> for his <a href="https://www.linkedin.com/pulse/creating-threat-hunting-lab-free-graylog-david-elgut">write up</a> on setting up Graylog to do Windows threat hunting.</p><p>Following along with the above guide will get Graylog set up and all of the required Windows logging required. Next add a basic Syslog UDP input keeping note of the port it’s setup on and point 1rstResponder to log the Graylog IP and port. Once it’s working you’ll start to see messages come in (don’t forget to open up your firewall ports if needed).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VUmxbsRdaFbWtWQD" /></figure><p>Finally we can add some alerts in Graylog so that we’re notified of the important events. I added events for f1rstResponder poisoning detection, when it passed back a hash/username and finally for any logon attempts to our decoy account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_9124x-k55ZRfyl2" /></figure><p>In Graylog you can configure alerts to be sent out to many different sources including email, text, slack and discord. You can also correlate alerts together to create higher priority alerts, for example you could create a high priority alert if there was a f1rstResponder detection where it passed back a username and hash and then an attempted decoy account login.</p><h3>Video Demo</h3><p><a href="https://www.youtube.com/watch?v=hoBELulE7Js">https://www.youtube.com/watch?v=hoBELulE7Js</a></p><p>Have any questions, please send me a message, I love to chat about all things Cybersecurity!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f54591befc3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB Cyber Apocalypse ’22 — Android-In-The-Middle Write Up]]></title>
            <link>https://medium.com/@DigitalAndrew/htb-cyber-apocalypse-22-android-in-the-middle-write-up-41c97608d210?source=rss-eb899a8dc13------2</link>
            <guid isPermaLink="false">https://medium.com/p/41c97608d210</guid>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[cyberapocalypse22]]></category>
            <dc:creator><![CDATA[DigitalAndrew]]></dc:creator>
            <pubDate>Fri, 20 May 2022 19:55:09 GMT</pubDate>
            <atom:updated>2022-05-24T00:44:55.086Z</atom:updated>
            <content:encoded><![CDATA[<h3>HTB Cyber Apocalypse ’22 — Android-In-The-Middle Write Up</h3><p>Android-In-The-Middle was one of the cryptographic challenges from the Hack The Box Cyber Apocalypse ’22 CTF. The challenge is focused on a weak implementation of a shared secret due to allowing users to set their public key without validating proper input.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jvq_ny_Htqt2iMIyPDEXRg.png" /></figure><p>The challenge gives a download of the source code and allows you to start up a container provided with an IP address and port number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cpiaYt_eDXZYfMXMQPpJdA.png" /></figure><p>Trying to visit through the browser gives some debugging messages and appears to be looking for a user input however the webpage does not accept any user inputs.</p><p>Luckily we have the source code to review. The first step that I took was to add comments to the code in order to get a better idea of what it was doing. The last few lines of the code give some clue as to how the application is being hosted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*yQMtV2Q3BS7h18QsxNVeLg.png" /></figure><p>Since it is opening up a TCP socket we can’t access via a webpage using HTTP, an easy tool to open up a TCP connection is netcat.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*yu8qTU4QIvsjHa3ZdvZgBQ.png" /></figure><p>Note that at this point I have hosted the application locally for ease of debugging and troubleshooting. In order to do this, you will most likely need to install some of the packages used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*Whuil9-GPo78TY_-iqr4mg.png" /></figure><p>The packages are included in pycrypto (<a href="https://github.com/pycrypto/pycrypto">https://github.com/pycrypto/pycrypto</a>). You may also need to install python2-dev (<em>sudo apt-get install python2-dev</em>).</p><p>Now that we are able to interact with the service it was time to figure out how to get the flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K5e03OZrNIosUutjlfgiDA.png" /></figure><p>Analyzing the source code we can see that the first input we are asked for is at line 54 where we are asked to input a public key, the application then checks to ensure that our input is an integer (but it can be any integer at all, we’ll come back to this later).</p><p>After that, the application calculates a shared secret using our input of M, a random number of c and the variable p which is hardcoded as a global variable.</p><p>Next, the application asks for an input of the encryption sequence, we can see on line 67 that there is some input checking to ensure that the input is in hex and has a length that is a multiple of 16 bytes.</p><p>Finally, if our input is validated it is then decrypted using the decryption function and the shared secret earlier. If the decrypted message == “Initialization Sequence — Code 0” then it will output the flag.</p><p>Now we know how to get the flag, the only problem is how we can pass an encrypted message that will be decrypted to the passphrase above. Taking a look at the decryption function we can start to come up with some potential weaknesses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8rgse7iWwjEzcmMT87S-0A.png" /></figure><p>Since we know the plain text, we can create our own function that is essentially the reverse of this to give us the encrypted message. The only problem is we need the shared secret that is created. Recalling our previous look at the poor input validation for the public key we can break the key generation.</p><p>The key is generated using the function <em>shared_secret = pow(M, c, p) </em>the POW function can be written mathematically as <em>shared_secret =M^c % p </em>we have control over M, however, c is a random number initialization vector. We can break this by setting <em>M=1</em> as <em>1^x</em> will always equal 1 and <em>1%p=1</em>. This means that if we pass an integer of M as the public key we can use 1 as the shared key to encrypt the function.</p><p>With this knowledge, I wrote a python script that essentially is a reverse of the decryption function in the source code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*PvIUT1IaYwoQ9k0LyvZeow.png" /></figure><p>In line 6 we hardcoded the shared secret of 1 and then pass it to the encryption function. Finally, we convert the output from ASCII to hex as is required for the input of the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*uBC_2N5XaebErpUOF91DYA.png" /></figure><p>We can now pass the 1 as the public key and the above-encrypted message to the live application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*63T-1LjdPMRkcLpxPZuLnQ.png" /></figure><p>Better watch out for those Danber Copyright Laws!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41c97608d210" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 Tips for new leads in Trace Labs Search Party]]></title>
            <link>https://medium.com/@DigitalAndrew/5-tips-for-new-leads-in-trace-labs-search-party-5916f8d66cb7?source=rss-eb899a8dc13------2</link>
            <guid isPermaLink="false">https://medium.com/p/5916f8d66cb7</guid>
            <category><![CDATA[osint]]></category>
            <category><![CDATA[trace-labs]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[DigitalAndrew]]></dc:creator>
            <pubDate>Fri, 20 May 2022 18:45:55 GMT</pubDate>
            <atom:updated>2022-10-25T14:05:31.764Z</atom:updated>
            <content:encoded><![CDATA[<p>I recently participated in the Trace Labs Search Party CTF, if you’re not familiar it’s a non-theoretical OSINT CTF where participants search for information on actual missing persons to help law enforcement. If you’re interested in OSINT, I highly recommend participating, you can find more information at <a href="https://www.tracelabs.org/initiatives/search-party">www.tracelabs.org/initiatives/search-party</a>. If you’ve participated in any kind of live CTF before you probably know the feeling, you’re maybe 3/4 in with time running out and you’re out of ideas or leads, it feels like you’ve tried everything and have hit that brick wall. This happened to me at the most recent Search Party CTF and I thought it might be helpful to share some of the things that I eventually thought of to generate some new leads. If you’re an OSINT pro then most of these will be obvious, but if you’re new to OSINT or find yourself stuck at the next Trace Labs CTF hopefully one of them will help out. The idea of these tips is to generate at least one new lead that you can pick up on and run with all of your other tools and strategies.</p><p><strong>Tip 1:</strong> Look for a GoFundMe page for the missing person, and check out who the top donors are, if they aren’t on your radar yet they’re worth checking out. You can use this tool: <a href="https://github.com/digitalandrew/gofindme">https://github.com/digitalandrew/gofindme</a> to easily pull down a list of all donor and donations amounts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/0*_01NvACUOxeTgklJ" /></figure><p>Take the GoFundMe link and search for where it has been shared on popular social media websites, there are a few ways to do this. First is using a google search with the link and site filter, for example, <em>‘www.gofundme.com/f/test-fundraising-for-example’ site:facebook.com</em>, repeat for LinkedIn, Reddit, Instagram or your social media site of choice. Sometimes social media platforms use link shorteners so this doesn’t work, you can also try searches like — <em>GoFundMe AND Missing Person Name site:facebook.com</em> to see if it’s being shared with different variations of the URL or link shorteners. The third is to use the built-in search features of each social media platform itself to look for the GoFundMe page being shared. If you can find accounts sharing the GoFundMe page this can link additional friends, family and coworkers’ social media accounts to the missing person.</p><p><strong>Tip 2:</strong> If there is a police report or other missing person file that has been the central piece of information for the missing person, take that URL and perform the same above search for social media profiles, check out who is sharing the link and if there is a relationship to the missing person.</p><p><strong>Tip 3:</strong> A trick to locate a subject’s work email address (if they have one). Go to the website of the company they work for and look for an about or contact page to find the email domain (this step is useful as sometimes the email domain will be different than the website). Go to hunter.io and search for the previously found email domain, if you’re lucky their email will show up there, if not take note of the pattern for example firstname.lastname@company.com. To verify that they actually have an email address at that account you can check if the address is valid using tools.verifyemailaddress.io and/or email-checker.net/validate. Remember as tempting as it may be, never try a password reset to validate or check links to email addresses found during the Trace Labs CTF. Once you have a valid work email address, try to verify it is in fact for the missing person (this will take some sleuthing). One way to start is to see if they used it to sign up for any accounts or if it showed up in any data breaches.</p><p><strong>Tip 4:</strong> Try and find any accounts the missing person or other person of interest may have on special forums or websites that relate to their hobbies. Sometimes people have fewer privacy expectations or privacy settings on these forums compared to their social media platforms. You can try searching for known usernames or email AND hobby. For example, searching for DigitalAndrew AND metal detecting would help you find posts from me on metal detecting that may otherwise be buried.</p><p><strong>Tip 5:</strong> This one may seem obvious, but it’s helped me find things I’ve missed before and it’s a good last resort if you’re completely stuck. If you’ve made it this far in your OSINT journey to be competing in a Trace Labs CTF you’ve probably heard of and used the OSINT Framework (<a href="http://osintframework.com/">www.osintframework.com</a>), if you haven’t, it’s a very useful listing of tools that you can use based on what information you already have. If you’re stuck, make a list of the intel you have for your person of interest (usernames, email addresses, DOB, workplace, addresses etc.) for each of those link them up with the corresponding OSINT Framework starting point and follow it along the entire tree trying each tool and suggestion. Keep doing this for all of the things from your list. I’ve had this open up obvious leads that I didn’t think of under pressure.</p><p>Hopefully, one of these will help you if you’re stuck at the next Trace Labs Search Party CTF, or if you’re participating and stuck right now reading this, good luck!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*3XYOzIyWQ3WVSjrF.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5916f8d66cb7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HackTheBox ‘Secret’ Write Up]]></title>
            <link>https://medium.com/@DigitalAndrew/hackthebox-secret-write-up-62185eb763c3?source=rss-eb899a8dc13------2</link>
            <guid isPermaLink="false">https://medium.com/p/62185eb763c3</guid>
            <dc:creator><![CDATA[DigitalAndrew]]></dc:creator>
            <pubDate>Fri, 20 May 2022 18:40:17 GMT</pubDate>
            <atom:updated>2022-05-20T18:40:17.224Z</atom:updated>
            <content:encoded><![CDATA[<p>Secret is an “Easy” Capture The Flag box from HackTheBox (www.hackthebox.com). I put easy in quotations as even the easy boxes on HackTheBox can be quite the challenge in addition to being a great learning experience. I had a lot of fun with this challenge and it forced me to take a break from the machine and learn about how JSON Web Tokens function.</p><p>My first step for all Capture The Flags is to start with an NMAP Scan to check for open ports.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/0*PytPGwd7U0nOCnD-.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/0*9FX1Z9e_yIxoiORw.png" /></figure><p>NMAP Reveals open ports for 22/tcp OpenSSH, 80/tcp HTTP nginx, 3000/tcp HTTP node.js. A quick web search doesn’t show any exploits or known vulnerabilities for the versions of services running.</p><p>If port 80 is open I will usually start there, check for a web server and perform some manual enumeration. On the landing page, I noted some instructions for setup and also a link to download the source code. I downloaded the source code for inspection later. I find it tempting to further inspect any interesting leads when they pop up, however, I have found the best strategy is to complete each portion of enumeration taking good notes before moving on to the next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4ano1a1SiKKN6AGp.png" /></figure><p>Manually navigating through the rest of the website I checked out the instructions for using the product, registering a user and logging in along with how to access a private route of the website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/0*OE55jrCxGOJfYy6j.png" /></figure><p>One of the first things that I noticed was the screenshots of what appeared to be a GitHub page and repo for the code. With all of the interesting information and screenshots on this page, I did a quick check through the page source to check and see if there was anything of note.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*r05BdC0x2QdQuowu.png" /></figure><p>Interestingly the screenshots of the GitHub repos are actually coming straight from a GitHub account. I made note of the account, however, my experience with past HackTheBox CTFs has been that everything needed for solving the box has been locally on the box itself so I didn’t initially go check out the GitHub account. I didn’t find anything else through manual enumeration of the website so I started a Nikto scan and dirbuster scan to check for any vulnerabilities or extra directories that I didn’t pick up manually. Neither of them returned anything of interest. With nowhere left to look on the website that I had access to I decided to dig into the source code that was provided.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/0*kqZTSkBoYJz_FyP0.png" /></figure><p>Taking a quick look through the source code it appears to be a JavaScript application built on Mongo DB for creating user accounts and handling user sign-ons, I noted that it appears the application is using JSON Web Tokens for validating login sessions. I dug through all the JSON config files and most of the source code to get an idea of how the application works. Most of the .js files in the routes folder were of interest, more specifically the private.js one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/0*LDfojDOF2weBgm-c.png" /></figure><p>From the private.js route I noticed that in order to gain access to the private area we need to set our name equal to ‘theadmin’, also from the private area it appears that we can pass a variable $file that will fetch a log for us. This appears to be a potential injection point. At this point, my plan of attack was to get access to the private area and then try for injections on the log file retrieval function. My first attempt was to follow the instructions given for creating a username and just try to set the name to ‘theadmin’, this didn’t work and I received an error that that account was already created. In order to see what was going on in more detail with the HTTP requests and responses, I fired up Burp Suite and followed the instructions provided on the website to navigate to the private area and sent the request to repeater in Burp so I could try and modify the auth-token.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AeQ-kW1z8mmSXgz8.png" /></figure><p>At this point, I realized I didn’t understand enough about how the JSON Web Tokens function in order to try and break or hack them so I took a break from hacking to read up on how they work.</p><p>The important takeaway from my dive into JWTs is that there are 3 sections of every JWT and they are Base64 encoded and then separated by a period. The first section is the header and contains the token type (JWT) and the cryptographic algorithm type used in the signature. The second section is the payload that contains all of the information that will be stored in the token, for example, the username, any privilege they have, really any persistent property that is tied to the account or token. The third section is the signature, the signature is formed by taking the header and payload, Base64 encoding them, concatenating them and signing that by passing it through the cryptographic algorithm that is specified in the header. With this knowledge in hand, I passed the auth-token from the website through a Base64 decoder to take a look at the header and the payload. I was able to see that the algorithm being used is HS256 (HMAC + SHA-256), and in the payload, there is the “name” variable which if we can change to ‘theadmin’ will grant us access to the private area.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/0*mdBPoUkdACRS9Dmc.png" /></figure><p>I did some more research about possible vulnerabilities for JWT and HS256. There was nothing for cracking HS256 (as I expected), however, I did note two common misconfiguration vulnerabilities for handling the JWT tokens. The first is that you can set the alg type to ‘none’ which denotes that there is no signature required and then pass the token without a signature. I crafted a token by changing the name to ‘theadmin’, Base64 encoding it, removing the signature and fired it off. This one didn’t work so it appears the configuration is correctly set up to reject changing alg type. The second misconfiguration is that the secret may not be properly checked and any valid signature from past tokens will work. I appended my signature from the valid token with my username to the previous token I created with ‘theadmin’ name but without a secret and passed that. This also did not work and for both methods I got an invalid token response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-g3t3CplVGemRPr3.png" /></figure><p>At this point, I was out of ideas for vulnerabilities, with the box name being secret and with my new knowledge about how JWT tokens work I was thinking I’d need to come up with the secret used to sign the tokens in order to craft my own. I retraced all of my steps through the source code paying close attention to the JSON config files to see if I missed the secret however I didn’t find anything. I will admit I was stumped at this point and took a break for a couple of days. I was actually at work and reviewing some changes for documentation in GitHub when I remembered the Github user I found in my previous enumeration (https://raw.githubusercontent.com/dasithsv/API-Authentication-With-JWT/main/images/adminrole.png) I tried for an easy win and checked <a href="http://www.github.com/dasithsv/API-Authenticaion-With-JWT/">www.github.com/dasithsv/API-Authenticaion-With-JWT/.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*s-7Ibw4ogdP_o7H-.png" /></figure><p>I took a quick look through the source code on Github for any notable differences and the first one that I found was the .env file so I opened that up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*e_9SHX-1_xPbO19g.png" /></figure><p>The TOKEN_SECRET variable has clearly been removed as it is listed as secret, however, I did notice that there appears to be a history for this file. One common theme that I’ve come across for HTB challenges is to look for backups of all files especially environment files or logs as they frequently contain juicy information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NODBxE6j2EhJaWg8.png" /></figure><p>Looking through the history, in the first commit, the TOKEN_SECRET is not removed. I copied this secret and wanted to make sure that it was the one being used by the website. I found a webtool on <a href="https://jwt.io/">https://jwt.io/</a> that encodes and decodes JWT along with checking if the signature is valid if you supply it with a secret. Since I had a known good token from signing in with my account I passed in that token and the secret to confirm that the secret was the one used from the site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*i55w4JxuX0AEw25W.png" /></figure><p>Thankfully the token was valid, with this information I was able to simply change the “name” variable in the payload to the ‘theadmin’ re-sign it and then I would have a valid token that could get me access to the private area of the website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0pOnIPPsUMHl1x4I.png" /></figure><p>I used Burpsuite again on repeater mode to send the baked secret back with the ‘theadmin’ name and was successfully able to access the private area of the website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AyK1Rs6RkbiZ4FRd.png" /></figure><p>From the previous investigation of the source code I was pretty sure that there was going to be an injection point by submitting a command as the $logs argument (recall the const getLogs = ‘git log –oneline ${file}’; function). From the NMAP scans I also knew that this was a Linux box and it looks like a BASH script so I started with a simple whoami injection by setting logs=;whoami (; finishes the first command and allows us to then run a second command).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oMs8OS9BjtKaRxv1.png" /></figure><p>In the response, you can see the result of the initial function that retrieves logs from the server and then at the end the result of the whoami command which returns as ndasith (the creator of the box). I tried a few other commands just to confirm injection and then switched over to getting a shell. The easiest route would be to try a BASH reverse shell one-liner however if I get the chance I’ll usually go straight for a meterpreter shell. I fired up msfvenom, created my meterpreter payload for Linux and then hosted it on my machine using python simpleHTTPServer to transfer over.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/0*YTSMCtl0L_C5c6gH.png" /></figure><p>Since I already knew I had bash injection I downloaded the shell-x86.elf meterpreter reverse shell that I was hosting on my kali machine by using wget command. One of the nice things about using a python simpleHTTPServer is that you can see a record of the download. If I had not gotten a response through our test bash injection, this is also a possible way to do a blind injection test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YD3KgKgG9busZEGS.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/0*0mkav1xyRo_M8FA0.png" /></figure><p>Using the bash injection for a few last steps, I confirmed the file downloaded and was present, changed the permissions to be able to run and then after setting up a reverse meterpreter handler ran the .elf file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/0*G16vvTR4VOYl3nli.png" /></figure><p>The meterpreter shell came in as the regular user as is expected for HTB machines, I first grabbed the user flag and then started on privilege escalation to get the root flag. Using the same hosting and download method I transferred over Linpeas (Linux Privilege Escalation Awesome Script) which is a great tool for helping to identify potential privilege escalation paths.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/0*BhfHkrm0zWuFtYAd.png" /></figure><p>Generally, Linpeas will have a long list of possible avenues to attempt privilege escalation, however in this case there was a vulnerability found directly for the Sudo version. This vulnerability is the recent very publicized pwnkit vulnerability and exploit for local privilege escalation. I am thinking now upon review that this may not be the intended method for gaining root as the box was actually published before this exploit was discovered. At the time I found a proof of concept exploit for this specific CVE and followed the instructions to compile and transferred it to the victim machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/0*0pw7YOhi99r-bMJK.png" /></figure><p>Running the proof of concept exploit on the victim machine immediately got root and I was able to grab the root flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/216/0*a1NHe6DkrDvLATRC.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=62185eb763c3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>