<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Security on Such geek. Wow.</title><link>https://www.ericlight.com/categories/security.html</link><description>Recent content in Security on Such geek. Wow.</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Thu, 21 May 2020 00:00:00 +1200</lastBuildDate><atom:link href="https://www.ericlight.com/categories/security/index.xml" rel="self" type="application/rss+xml"/><item><title>Why are all Split-Tunnel VPN diagrams so ugly?</title><link>https://www.ericlight.com/post/split-tunnel-image.html</link><pubDate>Thu, 21 May 2020 00:00:00 +1200</pubDate><guid>https://www.ericlight.com/post/split-tunnel-image.html</guid><description>&lt;img src="https://www.ericlight.com/post/split-tunnel-image/split_tunnel_yes.jpg" alt="Featured image of post Why are all Split-Tunnel VPN diagrams so ugly?" /&gt;&lt;p&gt;Right.&lt;/p&gt;
&lt;p&gt;Today I needed to find a diagram of the traffic flow for a split-tunnel VPN. Nothing fancy, just a real simple user-facing diagram to form part of an article.&lt;/p&gt;
&lt;p&gt;And friends, there was &lt;em&gt;nothing&lt;/em&gt;. Nothing at all. I found proper technical ones from &lt;a class="link" href="https://documentation.meraki.com/@api/deki/files/721/c6ddeaa8-5df4-4e5e-b542-c52766568816?revision=1" target="_blank" rel="noopener"
 &gt;Cisco Meraki&lt;/a&gt;; fancy Office365 ones, depicting an &lt;a class="link" href="https://docs.microsoft.com/en-us/office365/enterprise/media/vpn-split-tunneling/vpn-model-2.png" target="_blank" rel="noopener"
 &gt;ExpressRoute to O365&lt;/a&gt; and tunnelling everything &lt;em&gt;else&lt;/em&gt; through the VPN; and another Office365 tunnel with &lt;a class="link" href="https://docs.microsoft.com/en-us/office365/enterprise/media/vpn-split-tunneling/vpn-model-5.png" target="_blank" rel="noopener"
 &gt;ExpressRoute and a split-tunnel&lt;/a&gt; for the rest of the traffic.&lt;/p&gt;
&lt;p&gt;Pretty much the closest I came to my needs was this atrocity, via &lt;a class="link" href="http://blog.soundtraining.net/2013/03/how-to-configure-split-tunneling-on.html" target="_blank" rel="noopener"
 &gt;http://blog.soundtraining.net/2013/03/how-to-configure-split-tunneling-on.html&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img alt="An accurate, but not aesthetic, diagram of how split tunnels work." class="gallery-image" data-flex-basis="158px" data-flex-grow="66" data-title-escaped="Although accurate and functional, this is not a pleasant sight." height="1600" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://www.ericlight.com/post/split-tunnel-image/split_tunnel_yes.jpg" srcset="https://www.ericlight.com/post/split-tunnel-image/split_tunnel_yes_hu_cb0dc953174bedbc.jpg 800w, https://www.ericlight.com/post/split-tunnel-image/split_tunnel_yes.jpg 1059w" title="Although accurate and functional, this is not a pleasant sight." width="1059"&gt;&lt;/p&gt;
&lt;p&gt;So I went over to &lt;a class="link" href="https://www.draw.io" target="_blank" rel="noopener"
 &gt;https://www.draw.io&lt;/a&gt; and whipped up something a bit prettier. This isn&amp;rsquo;t marvelous, but it&amp;rsquo;s way better than I could find anywhere else:&lt;/p&gt;
&lt;p&gt;&lt;img alt="A slightly more pleasant diagram of how split tunnels work." class="gallery-image" data-flex-basis="382px" data-flex-grow="159" height="301" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://www.ericlight.com/post/split-tunnel-image/split_tunnel_better.png" width="480"&gt;&lt;/p&gt;
&lt;p&gt;In retrospect, I could have done better - I really should have had the corporate tunnel going &lt;strong&gt;through&lt;/strong&gt; the cloud of the internet. However this works for ne.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;d like to use this, feel free. You can even use &lt;a class="link" href="https://app.diagrams.net/?lightbox=1&amp;amp;highlight=0000ff&amp;amp;edit=_blank&amp;amp;layers=1&amp;amp;nav=1&amp;amp;title=VPN%20Split%20Tunnel%282%29.drawio#R7Vddb5swFP01PCbCfCV5XJKmU9VKrSp1W1%2BQAzdgxWBkTCD99TPFTiCwtZMSdZWqRMI%2B9%2Foa33Nscw17kVTXHGfxHQuBGpYZVoa9NCwLOZZl1H8z3DeIN7MbIOIkbCDzCDySF1AjNVqQEHKFNZBgjAqSdcGApSkEooNhzlnZddswGnaADEfQAx4DTPvoDxKKWKGe6xwN34FEsZ4aebPGkmDtrZaSxzhkZSusfWXYC86YaFpJtQBaZ6%2BbmNUfrIc345CK9wy4dZ9vls8%2F4e7p9uEO3QTldTQaKTZ2mBZqxeplxV6nIGMkFcCvdnKeOpvIsOeHtZiyE%2BI8hlB1YpFQ7SQ428KCUcYlkrJUBpxvCKUaMizbNeufxCleA71nORGEpdIWQD2pNOyACyIJuT1xWDMhWNJy%2BEZJVBsEyyTKCkFJKmfXuqgnwcrlEFyuI6uXmVRRrd8x22xIAOMQdvKRj0vGt7nAzYzzfsIVB%2FUbQHXKrNwTwBIQfC9dlNX2lBjUdrBnql8exaV3SNySlXbDSs7RIfKRcNlQnP8D%2F84F%2Bf%2BvKM2By6i5evobzJO%2BGlerqWOaPem2LWcQgTc9EcG0LwJkeX0VIHQpGUy%2BjoFBzQQFJ2I%2FpizY%2BiURsb%2BFva9hf%2F2arXNIwnVOz4VpTxL66GgrYuJcSBCzzy%2BIQeqHVfJeQQSUFWE%2Bzoo1JYH%2F2jsP%2F84MdfiXX079I2EyIABkowspQJ81n1kCF7xHRCFHU18uBDdszDnTXwrLEZqe6a5wJt2DwXH6d4U7G9DFpW4KhL5k8fGy8NDHyYK%2F4EfysCrTnefSp8p9iX%2FxkfW2KnTmNhSqb3VpJlMBaaiay4DiPCdBVxDSrssuNG36qkZ0x7b1t1wKzCMQb99wEHYKwH7G2xkdOIA1xoFKmnfdsnEozWqG%2B3qPtPa55XQJNb1uiJwVPAA1ql3lnQaadAPZ7kmgJjG9QK%2BsH5Y9JATZPRarjfux5revfgM%3D" target="_blank" rel="noopener"
 &gt;this fancy URL&lt;/a&gt; to open the drawing as an editable vector graphic at &lt;a class="link" href="https://www.draw.io" target="_blank" rel="noopener"
 &gt;Draw.io&lt;/a&gt; directly!&lt;/p&gt;</description></item><item><title>RingZer0team CTF - Challenges 86, 87, and 88</title><link>https://www.ericlight.com/post/r0-86.html</link><pubDate>Thu, 13 Jul 2017 00:00:00 +1200</pubDate><guid>https://www.ericlight.com/post/r0-86.html</guid><description>&lt;p&gt;There are a bunch of fantastic Capture The Flag security challenges on &lt;a class="link" href="https://www.ringzer0team.com" target="_blank" rel="noopener"
 &gt;RingZer0Team.com&lt;/a&gt;. I&amp;rsquo;ve been working through some of these for a wee while now, and with the &lt;a class="link" href="https://www.cybersecuritychallenge.org.nz/" target="_blank" rel="noopener"
 &gt;New Zealand Cyber Security Challenge&lt;/a&gt; coming up again soon, I thought I&amp;rsquo;d get back into some of them.&lt;/p&gt;
&lt;p&gt;Challenge 86 (&amp;ldquo;1/3 Do not waste the environment&amp;rdquo;, under the Forsensic Challenges) is one of a series of challenges where you need to dig through some provided data to find the flag.&lt;/p&gt;
&lt;p&gt;I started by downloading the &amp;lsquo;forensic bundle&amp;rsquo;, which was just a large zip file. The first challenge was to figure out the contents of that zip file. The file name was just a jumble of characters, and there was no extension. Running &lt;code&gt;file&lt;/code&gt; on it just returned the file type &amp;ldquo;Data&amp;rdquo;&amp;hellip; not very enlightening, but &lt;code&gt;head&lt;/code&gt; uncovered the string &amp;ldquo;VBOX&amp;rdquo; in the file&amp;hellip; okay, it&amp;rsquo;s VirtualBox file.&lt;/p&gt;
&lt;p&gt;Because I didn&amp;rsquo;t have Virtualbox installed, I spent a bit of time digging through the actual Vbox file itself, trying to see if there&amp;rsquo;s a flag already in there. I used &lt;code&gt;strings | egrep -i flag-....&lt;/code&gt;, to try to find any flags embedded in the file itself. I didn&amp;rsquo;t find any flags, but I did discover that the computer name itself is &amp;ldquo;FLAG-PC&amp;rdquo;. Very clever. :-|&lt;/p&gt;
&lt;h3 id="update-many-hours-later"&gt;Update, many hours later:
&lt;/h3&gt;&lt;p&gt;Okay this totally cooked my bacon. After hours of playing with VirtualBox and playing with files, I finally gave up and Googled the name of the downloaded file.&lt;/p&gt;
&lt;p&gt;Turns out I was &lt;em&gt;REALLY&lt;/em&gt; close. The flag IS embedded in the actual file itself, but the format is different for the first time. The correct grep string would have been &lt;code&gt;egrep -i '.?f.?l.?a.?g.?-'&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Real frustrated by how close I was, I&amp;rsquo;ll have to expand my searches in the future. Hat-tip to &lt;a class="link" href="https://twitter.com/professormahi" target="_blank" rel="noopener"
 &gt;@professormahi&lt;/a&gt; and his &lt;a class="link" href="https://github.com/professormahi/CTF/tree/master/ringzer0team/Forensics/1-3%20Do%20not%20waste%20the%20enviroment" target="_blank" rel="noopener"
 &gt;GitHub&lt;/a&gt; page.&lt;/p&gt;
&lt;p&gt;Once I understood that, I also discovered the flag for challenge 87 (&amp;ldquo;2/3 Did you see my desktop?&amp;rdquo;), in the same manner.&lt;/p&gt;
&lt;p&gt;I haven&amp;rsquo;t managed to get the flag for Challenge 88 (&amp;ldquo;3/3 Suspicious Account Password&amp;rdquo;) yet, but I do know what it is. I can see (by grepping for &amp;ldquo;Visited&amp;rdquo;) a bunch of visits to &lt;a class="link" href="http://www.forensicswiki.org/wiki/Tools:Memory_Imaging" target="_blank" rel="noopener"
 &gt;http://www.forensicswiki.org/wiki/Tools:Memory_Imaging&lt;/a&gt;&amp;hellip; this thing is a memory dump. That explains now why it doesn&amp;rsquo;t work as a VirtualBox disk.&lt;/p&gt;
&lt;p&gt;Next time I sit down here, I&amp;rsquo;ll find visit Forensics Wiki, and start digging through the memory dump for the passwords.&lt;/p&gt;
&lt;h3 id="update-two"&gt;Update two
&lt;/h3&gt;&lt;p&gt;I decided not to put this up as a separate post, because once I knew what I was looking at, it was pretty easy. Again though, I relied on @professormahi&amp;rsquo;s work - but now thanks to him I have a little bit of experience with &lt;a class="link" href="https://www.volatilityfoundation.org/" target="_blank" rel="noopener"
 &gt;Volatility&lt;/a&gt;!&lt;/p&gt;
&lt;p&gt;First, we get Volatility to scan the image and see what it&amp;rsquo;s dealing with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ volatility -f vm.vmdk imageinfo
Volatility Foundation Volatility Framework 2.6
INFO : volatility.debug : Determining profile based on KDBG search...
 Suggested Profile(s) : Win7SP1x86_23418, Win7SP0x86, Win7SP1x86
 AS Layer1 : IA32PagedMemory (Kernel AS)
 AS Layer2 : FileAddressSpace (/home/eric/Downloads/86/vm.vmdk)
 PAE type : No PAE
 DTB : 0x185000L
 KDBG : 0x82920be8L
 Number of Processors : 1
 Image Type (Service Pack) : 0
 KPCR for CPU 0 : 0x82921c00L
 KUSER_SHARED_DATA : 0xffdf0000L
 Image date and time : 2014-03-09 20:57:55 UTC+0000
 Image local date and time : 2014-03-09 13:57:55 -0700
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, knowing the profile that we need to use, we can use it to just&amp;hellip; dump the password table:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ volatility -f vm.vmdk --profile Win7SP1x86 hashdump
Volatility Foundation Volatility Framework 2.6
Administrator:500:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
flag:1000:aad3b435b51404eeaad3b435b51404ee:3008c87294511142799dca1191e69a0f:::
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And then, we grab that NTLM hash and pop it into an online NTLM decryptor service, and we&amp;rsquo;re away!&lt;/p&gt;</description></item><item><title>Staying Secure in Business</title><link>https://www.ericlight.com/post/hygiene.html</link><pubDate>Wed, 28 Jun 2017 00:00:00 +1200</pubDate><guid>https://www.ericlight.com/post/hygiene.html</guid><description>&lt;p&gt;A friend asked a question today on Facebook. I started writing a reply, and it turned into a 700-word essay. Hate it when that happens&amp;hellip;&lt;/p&gt;
&lt;p&gt;The question was:&lt;/p&gt;
&lt;h4 id="heading"&gt;&lt;em&gt;&amp;ldquo;If large multi-international companies are getting hacked in Europe who have millions if not billions of $$ and capacity to protect their IT systems - how can small/micro businesses protect their IT platforms and systems?&amp;rdquo;&lt;/em&gt;
&lt;/h4&gt;&lt;p&gt;Firstly - nobody is safe from an APT (&amp;ldquo;Advanced Persistent Threat&amp;rdquo;). The recent &lt;a class="link" href="https://twitter.com/search?q=NotPetya" target="_blank" rel="noopener"
 &gt;NotPetya&lt;/a&gt; outbreak was an APT - malicious actors hacked a Ukrainian firm that produced accounting software, and &lt;a class="link" href="https://medium.com/@thegrugq/pnyetya-yet-another-ransomware-outbreak-59afd1ee89d4" target="_blank" rel="noopener"
 &gt;used their software&amp;rsquo;s update facility&lt;/a&gt; to literally deliver malicious code specifically to the users of this particular software package (&amp;ldquo;M.E. Doc&amp;rdquo;). Nothing&amp;rsquo;s keeping folks safe from that level of sophistication.&lt;/p&gt;
&lt;p&gt;However, the exploit by which NotPetya &lt;em&gt;spreads&lt;/em&gt; was &lt;a class="link" href="https://technet.microsoft.com/en-us/library/security/ms17-010.aspx" target="_blank" rel="noopener"
 &gt;actually patched by Microsoft&lt;/a&gt; in &lt;strong&gt;March&lt;/strong&gt;. If people had updated their internet-connected devices, this virus would have been limited to only users of M.E. Doc.&lt;/p&gt;
&lt;p&gt;Aside from that though, there&amp;rsquo;s actually a disappointingly simple answer to this. Security is actually relatively within reach, if we all follow these simple steps:&lt;/p&gt;
&lt;h3 id="1--update-everything-at-every-opportunity"&gt;1) Update. Everything. At every opportunity.
&lt;/h3&gt;&lt;p&gt;That includes Windows Updates, but also &lt;a class="link" href="http://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=adobe&amp;#43;reader" target="_blank" rel="noopener"
 &gt;Adobe Reader&lt;/a&gt; (annoying!), &lt;a class="link" href="http://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=java" target="_blank" rel="noopener"
 &gt;Java&lt;/a&gt; (double annoying!), &lt;a class="link" href="https://twitter.com/taviso/status/860679110728622080" target="_blank" rel="noopener"
 &gt;anti-virus engines&lt;/a&gt;, etc. This is absolutely the top priority, and the cybersecurity industry has been trotting this line out for years, but people just don&amp;rsquo;t. Because annoying.&lt;/p&gt;
&lt;p&gt;Real life incident: June 22, 2017 - Honda falls prey to the WannaCry worm, 37 days after release (four months after the patch was released), due to poor patching hygiene.&lt;/p&gt;
&lt;p&gt;See &lt;a class="link" href="http://thehackernews.com/2017/06/honda-wannacry-attack.html" target="_blank" rel="noopener"
 &gt;http://thehackernews.com/2017/06/honda-wannacry-attack.html&lt;/a&gt;&lt;/p&gt;
&lt;h3 id="2--backup-everything-important"&gt;2) Backup everything important.
&lt;/h3&gt;&lt;p&gt;The more important it is, the more places you should keep it. You should have at least three copies of every important file. THIS IS ANNOYING, but if you don&amp;rsquo;t do it, data loss will hit you. Something like &lt;a class="link" href="https://www.crashplan.com" target="_blank" rel="noopener"
 &gt;Crashplan&lt;/a&gt; (a low-cost service that sends backups to the cloud), plus a regular (weekly?) copy to a read-only media (e.g. a DVD), should be enough for a small business.&lt;/p&gt;
&lt;p&gt;Real life incident: Feb 1, 2017 - GitLabs suffers a major outage after data was accidentally deleted, followed by a sequence of discoveries that none of their five layers of backup or replication techniques “are working reliably or set up in the first place”.&lt;/p&gt;
&lt;p&gt;See &lt;a class="link" href="https://techcrunch.com/2017/02/01/gitlab-suffers-major-backup-failure-after-data-deletion-incident/" target="_blank" rel="noopener"
 &gt;https://techcrunch.com/2017/02/01/gitlab-suffers-major-backup-failure-after-data-deletion-incident/&lt;/a&gt;&lt;/p&gt;
&lt;h3 id="3--use-next-generation-anti-virus-software"&gt;3) Use next-generation anti-virus software.
&lt;/h3&gt;&lt;p&gt;Many of the AV products these days include very clever ways of analysing the behaviour of unknown software, and literally just rolling back all the changes if the AV decides it&amp;rsquo;s not trustworthy. &lt;a class="link" href="https://www.webroot.com" target="_blank" rel="noopener"
 &gt;Webroot&lt;/a&gt; is a good example of this, at a very affordable price.&lt;/p&gt;
&lt;p&gt;Real life incident: April 23, 2017 - the Adylkuzz virus started quietly spreading around the internet, and setting up Monero cryptocurrency mining operations on infected PC&amp;rsquo;s. Because the payload wasn&amp;rsquo;t destructive, it flew under the radar and was missed by many antiviruses for weeks.&lt;/p&gt;
&lt;p&gt;See &lt;a class="link" href="https://www.proofpoint.com/us/threat-insight/post/adylkuzz-cryptocurrency-mining-malware-spreading-for-weeks-via-eternalblue-doublepulsar" target="_blank" rel="noopener"
 &gt;https://www.proofpoint.com/us/threat-insight/post/adylkuzz-cryptocurrency-mining-malware-spreading-for-weeks-via-eternalblue-doublepulsar&lt;/a&gt;&lt;/p&gt;
&lt;h3 id="4--be-alert-cautious-and-sufficiently-paranoid"&gt;4) Be alert, cautious, and sufficiently paranoid.
&lt;/h3&gt;&lt;p&gt;The last - and hardest - step is to maintain a healthy sense of distrust; sometimes referred to as &amp;ldquo;&lt;a class="link" href="https://pthree.org/2013/10/04/sufficient-paranoia/" target="_blank" rel="noopener"
 &gt;sufficient paranoia&lt;/a&gt;&amp;rdquo;. When you receive an email, ask yourself: is this email in-character for this person? Is the spelling what I&amp;rsquo;d expect? Is it appropriate? Is it asking me to take an action (even if that action is just opening a file)? If so, is it expected, or is it out of the blue? If it&amp;rsquo;s out of the blue, why? What&amp;rsquo;s the story behind that?&lt;/p&gt;
&lt;p&gt;Real life incident: Sept 30, 2011 - I received an email from a lady I&amp;rsquo;d once interviewed for a job. It was a distraught email saying she was stuck in Wales, had been mugged, lost all her money, and needed a brief loan until she got home. I wrote her an email (not a reply), telling her email had been hacked; lo and behold, I got a reply! &amp;ldquo;It&amp;rsquo;s me&amp;hellip; this is for real, i have checked with the consulate but there is nothing really working out, most important is i don&amp;rsquo;t have enough money on please, please i need you to loan me some, i can pay you back once i get home.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;I ended up finding her cellphone number and sending her a message - she was at home, safe and sound.&lt;/p&gt;
&lt;p&gt;See &lt;a class="link" href="https://blog.malwarebytes.com/cybercrime/2014/08/email-hijack-leads-to-i-was-robbed-send-me-money-scam/" target="_blank" rel="noopener"
 &gt;https://blog.malwarebytes.com/cybercrime/2014/08/email-hijack-leads-to-i-was-robbed-send-me-money-scam/&lt;/a&gt; &amp;ndash; this was exactly the wording I received.&lt;/p&gt;
&lt;h3 id="geez-that-was-a-long-facebook-post-eric"&gt;Geez, that was a long Facebook post Eric.
&lt;/h3&gt;&lt;p&gt;It really was, and a few minutes afterwards, this tweet came to my attention:&lt;/p&gt;
&lt;p&gt;&lt;a class="link" href="https://twitter.com/josephfcox/status/879982828418719744" target="_blank" rel="noopener"
 &gt;https://twitter.com/josephfcox/status/879982828418719744&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s fun to laugh, but it&amp;rsquo;s a good reminder that there&amp;rsquo;s always going to be a weakness. You need to structure your business disaster recovery in a way that you can quickly and efficiently deal with a complete wipe-out like this.&lt;/p&gt;
&lt;h3 id="and-were-done"&gt;And we&amp;rsquo;re done.
&lt;/h3&gt;&lt;p&gt;So, to summarise this essay, you need to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Always install updates&lt;/li&gt;
&lt;li&gt;Always take backups&lt;/li&gt;
&lt;li&gt;Use AV software with full journaling and rollback capabilities&lt;/li&gt;
&lt;li&gt;Practice sufficient paranoia&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With these four steps, you will be as safe as the biggest corporate. (roughly speaking)&lt;/p&gt;</description></item><item><title>RingZer0team CTF - Challenge 44</title><link>https://www.ericlight.com/post/r0-44.html</link><pubDate>Sat, 24 Jun 2017 00:00:00 +1200</pubDate><guid>https://www.ericlight.com/post/r0-44.html</guid><description>&lt;p&gt;There are a bunch of fantastic Capture The Flag security challenges on &lt;a class="link" href="https://www.ringzer0team.com" target="_blank" rel="noopener"
 &gt;RingZer0Team.com&lt;/a&gt;. I&amp;rsquo;ve been working through some of these for a wee while now, and with the &lt;a class="link" href="https://www.cybersecuritychallenge.org.nz/" target="_blank" rel="noopener"
 &gt;New Zealand Cyber Security Challenge&lt;/a&gt; coming up again soon, I thought I&amp;rsquo;d get back into some of them.&lt;/p&gt;
&lt;p&gt;Challenge 56 (&amp;ldquo;Hey Chuck where is the flag?&amp;rdquo;, under the Forensic Challenges) started by only offering a .pcap file. I downloaded Wireshark and had a quick dig. The packet capture consisted of a brief browse of a &amp;ldquo;Chuck Norris Facts&amp;rdquo; website.&lt;/p&gt;
&lt;p&gt;After quickly flicking through the pcap itself looking for low-hanging fruit, I used File -&amp;gt; Export Objects -&amp;gt; HTTP. This takes all the HTTP traffic, recombines the packets into files, and saves them.&lt;/p&gt;
&lt;p&gt;Once I&amp;rsquo;d done that, I opened up the files and had a quick flick through. I checked the images for metadata etc but didn&amp;rsquo;t find anything. However I did fine a picture of Chuck Norris, appearing to urge the reader to keep searching files &amp;ndash; in French.&lt;/p&gt;
&lt;p&gt;When I didn&amp;rsquo;t find anything super-obvious in the image contents, I hopped into Bash and just ran &lt;code&gt;grep -i flag *&lt;/code&gt;. It quickly returned the flag, stored in a php file!&lt;/p&gt;
&lt;p&gt;Nice and easy hunt, great way to finish the day.&lt;/p&gt;</description></item><item><title>RingZer0team CTF - Challenge 65</title><link>https://www.ericlight.com/post/r0-65.html</link><pubDate>Sat, 24 Jun 2017 00:00:00 +1200</pubDate><guid>https://www.ericlight.com/post/r0-65.html</guid><description>&lt;p&gt;This is a continuation of my series on &lt;a class="link" href="https://www.ringzer0team.com" target="_blank" rel="noopener"
 &gt;RingZer0Team.com&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Challenge 65 (&amp;ldquo;Hide my ass in my home&amp;rdquo;, under the Forensic challenges) is a nice quick little forensic challenge. You get to download a .tar file, and do a bit of digging to uncover the flag.&lt;/p&gt;
&lt;p&gt;This was a nice easy few minutes. After downloading the archive, I discovered a few files inside - including a &lt;em&gt;particularly groovy&lt;/em&gt; electronica swing track, which I&amp;rsquo;m listening to again right now. Yeaaaaahhhhh.&lt;/p&gt;
&lt;p&gt;Apart from a groovy mp3, the archive contains some dot-files such as .bash_history, a .jpg picture, an index.html, and some other bits.&lt;/p&gt;
&lt;p&gt;I found the Flag in one of the dot-files; specifically, it was inside a Vim swap file that seemed to be leftover from a power failure or similar.&lt;/p&gt;</description></item><item><title>RingZer0team CTF - Linux Sysadmin challenges</title><link>https://www.ericlight.com/post/r0-sysadmin.html</link><pubDate>Sun, 28 May 2017 00:00:00 +1200</pubDate><guid>https://www.ericlight.com/post/r0-sysadmin.html</guid><description>&lt;p&gt;There are a bunch of fantastic Capture The Flag security challenges on &lt;a class="link" href="https://www.ringzer0team.com" target="_blank" rel="noopener"
 &gt;RingZer0Team.com&lt;/a&gt;. I&amp;rsquo;ve been working through some of these for a wee while now, and with the &lt;a class="link" href="https://www.cybersecuritychallenge.org.nz/" target="_blank" rel="noopener"
 &gt;New Zealand Cyber Security Challenge&lt;/a&gt; coming up again soon, I thought I&amp;rsquo;d get back into some of them.&lt;/p&gt;
&lt;p&gt;The Sysadmin Linux series of challenges is where you&amp;rsquo;re trying to breach the security of a Linux system. I actually finished most of these last year, but I wanted to finish my last two. Of course, to get to the last two stages, you need to use the flags from the &lt;em&gt;previous&lt;/em&gt; stages. So I&amp;rsquo;m revisiting them.&lt;/p&gt;
&lt;h2 id="level-1---morpheus---trinity"&gt;Level 1 - Morpheus -&amp;gt; Trinity
&lt;/h2&gt;&lt;p&gt;We start by SSH&amp;rsquo;ing into a particular user account on the ringzer0team server:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;You have mail.
Last login: Thu Apr 27 02:52:40 2017 from &amp;lt;somewhere&amp;gt;
morpheus@forensics:~$ 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There&amp;rsquo;s only one file in the home folder, and I can&amp;rsquo;t read it. There&amp;rsquo;s a /home/trinity folder with full read access, but also nothing legible.&lt;/p&gt;
&lt;p&gt;The flag for level 1 is found by running ps aux, which reveals what appears to be Trinity&amp;rsquo;s password:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;root 3241 0.0 0.0 4188 572 ? S Jan14 1:44 /bin/sh /root/backup.sh -u trinity -p Flag-&amp;lt;redacted&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="level-2---morpheus---architect"&gt;Level 2 - Morpheus -&amp;gt; Architect
&lt;/h2&gt;&lt;p&gt;Aha, and the flag for level two is in /etc/fstab, which contains what appears to be The Architect&amp;rsquo;s password, in base64:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
#//TheMAtrix/phone /media/Matrix cifs username=architect,password=$(base64 -d &amp;quot;&amp;lt;redacted&amp;gt;&amp;quot;),iocharset=utf8,sec=ntlm 0 0
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="level-3---the-architect"&gt;Level 3 - The Architect
&lt;/h2&gt;&lt;p&gt;Level 3 requires you to log on as architect, using the password we discovered earlier. The only clue is &amp;ldquo;dig for password&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;This bit got a bit harder. There are a couple possible hints in architect&amp;rsquo;s mail file, including a bunch of attempts to mount a cifs volume, and reference to a file in /backup/.&lt;/p&gt;
&lt;p&gt;Digging through the files in /backup left me at a loss. There are references to /tmp/Gathering.py, but that&amp;rsquo;s a challenge for later (cypher&amp;rsquo;s challenge). After some digging I located /var/tmp/.swl, which contained some MySQL credentials!&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;mysql&amp;gt; show tables;
+----------------+
| Tables_in_arch |
+----------------+
| arch |
| flag |
+----------------+
2 rows in set (0.00 sec)

mysql&amp;gt; select * from arch;
+------+-----------------------+
| id | arch |
+------+-----------------------+
| 1 | The one |
| 1 | The null one |
| 1 | The mother of the one |
| 1 | The father of the one |
| 1 | The flag of the one |
| 1 | The null one |
+------+-----------------------+
6 rows in set (0.00 sec) 

mysql&amp;gt; select * from flag;
+---------------------------------+
| flag |
+---------------------------------+
| FLAG-&amp;lt;redacted&amp;gt; |
+---------------------------------+
1 row in set (0.00 sec)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Yasss after a solid hour of digging, I&amp;rsquo;ve found the flag for the third level!&lt;/p&gt;
&lt;h2 id="level-four---morpheus---oracle"&gt;Level Four - Morpheus -&amp;gt; Oracle
&lt;/h2&gt;&lt;p&gt;Again we&amp;rsquo;re logging on as morpheus, but this time the goal is to access the oracle account.&lt;/p&gt;
&lt;p&gt;Lots of tasty stuff under /var/tmp/.viminfo, now that I&amp;rsquo;ve found it. References to files in /backup/, to /tmp/Gathering.py, /tmp/mail_cypher&lt;/p&gt;
&lt;p&gt;Don&amp;rsquo;t make the mistake of trying to cat .swo; it&amp;rsquo;ll eat your console session.&lt;/p&gt;
&lt;p&gt;Found this interesting thing in mail, but it&amp;rsquo;s not helpful: &lt;code&gt;forensics.localdomain : Apr 14 21:14:33 : morpheus : user NOT in sudoers ; TTY=pts/4 ; PWD=/home/trinity ; USER=root ; COMMAND=/usr/sbin/usermod -aG neo morpheus&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;In one of the /backup files, I found the remains of an SSH key, and it worked! Access to the oracle account achieved. In the home folder, we&amp;rsquo;ve got a handy-dandy Base64-encoded flag in flag.txt.&lt;/p&gt;
&lt;h2 id="level-five---oracle-encrypted-file"&gt;Level Five - Oracle Encrypted File
&lt;/h2&gt;&lt;p&gt;There&amp;rsquo;s a file in the oracle home folder named encflag.txt.enc:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;U2FsdGVkX1+dCl4WEHNJKBqA8a4fQeheOgA7oiNmjwlJQvGaQAgqcIsGRIcbdHKF
heSs51JRSEmOLqVyGvoxDA--
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Decoding the base64 returns a binary blob, prefixed with the string &amp;ldquo;Salted&amp;rdquo;. This is one of the levels that I never completed originally, so maybe it&amp;rsquo;s time to give it another crack.&lt;/p&gt;
&lt;p&gt;A quick google of &amp;ldquo;salted base64&amp;rdquo; reveals an &lt;a class="link" href="https://security.stackexchange.com/a/124333" target="_blank" rel="noopener"
 &gt;interesting comment on StackExchange&lt;/a&gt;. Apparently I&amp;rsquo;m looking at a file encrypted with the OpenSSL &amp;rsquo;enc&amp;rsquo; command, so I first copy the file to my own computer to work.&lt;/p&gt;
&lt;p&gt;I discover that the command &lt;code&gt;openssl enc -in testfile -d -a&lt;/code&gt; will un-base64 it, then load the file in. I need to pass it a password to decrypt with though, so now I need to find that.&lt;/p&gt;
&lt;p&gt;Oh my god I just did &lt;code&gt;cat .*&lt;/code&gt; in the oracle home folder and literally found an alias that reads and decrypts the file. I can&amp;rsquo;t believe that took me almost an hour.&lt;/p&gt;
&lt;p&gt;There are no words.&lt;/p&gt;
&lt;h2 id="level-six---trinity---neo"&gt;Level Six - Trinity -&amp;gt; Neo
&lt;/h2&gt;&lt;p&gt;Okay getting serious now. Using Trinity&amp;rsquo;s account, I need to find the password for the neo account.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s a bit noisy on login:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;You have mail.
Last login: Tue Apr 25 16:29:29 2017 from &amp;lt;le blah&amp;gt;
-bash: hello: command not found
Sup Neo!
ls: cannot open directory /home/neo: Permission denied
cat: phonebook: Permission denied
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A vague tickle in my memory prompted me to run sudo -l right off the bat. Rewarded with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;User trinity may run the following commands on this host:
 (neo) /bin/cat /home/trinity/*
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So of course I immediately run &lt;code&gt;sudo -u neo /bin/cat /home/trinity/*&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This gives us a &amp;lsquo;phone book&amp;rsquo; containing:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;The Oracle 1800-133-7133
Persephone 345-555-1244





copy made by Cypher copy utility on /home/neo/phonebook
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Trinity&amp;rsquo;s .bashrc contains a bit of kruft:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;hello neo
echo &amp;quot;Sup Neo!&amp;quot;
$(ls -lart /home/neo)
cat phonebook
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Really not useful. I remember finding Trinity&amp;rsquo;s password with &lt;code&gt;ps aux&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;root 3241 0.0 0.0 4188 572 ? S Jan14 1:47 /bin/sh /root/backup.sh -u trinity -p Flag-08grILsn3ekqhDK7cKBV6ka8B
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It looks a little bit like a MySQL connection string, so I try that but no dice. Nothing under /var/tmp this time, and grep doesn&amp;rsquo;t find anything useful under the /backup goldmine.&lt;/p&gt;
&lt;p&gt;There&amp;rsquo;s some weirdness under /etc/passwd. I don&amp;rsquo;t know what this means, but saving it for later:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;trinity:x:1002:1002:trinity,%,lsdf(940998+(n.~,3):/home/trinity:/bin/bash
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I looked through the mail file, but nothing jumped out at me there. Also trawled again through /backup, as well as /var/backups. Then /etc and /var. Argh.&lt;/p&gt;
&lt;p&gt;Finally I start looking for Persephone. Nothing helpful, but it reminds me of the last line in the phonebook.&lt;/p&gt;
&lt;p&gt;copy made by Cypher copy utility on /home/neo/phonebook&lt;/p&gt;
&lt;p&gt;And then I remember that the sudo command allows a * at the end of the cat command, which might allow me to do path traversal&amp;hellip;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo -u neo /bin/cat /home/trinity/../neo/phonebook
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Finally, after a whole hour of digging, I&amp;rsquo;m awarded Neo&amp;rsquo;s password!&lt;/p&gt;
&lt;h2 id="level-7---neo-is-not-alone"&gt;Level 7 - Neo is Not Alone
&lt;/h2&gt;&lt;p&gt;I don&amp;rsquo;t know what this clue means, but I bet it has something to do with Persephone. Persephone comes from Greek mythology as one of Zeus&amp;rsquo; daughters, and the goddess of the underworld. Does that help me here? I don&amp;rsquo;t know, it&amp;rsquo;s getting late&amp;hellip;&lt;/p&gt;
&lt;p&gt;I run &lt;code&gt;cat .*&lt;/code&gt; in Neo&amp;rsquo;s home directory to see if there&amp;rsquo;s anything hiding there, but no luck this time. Also nothing for &lt;code&gt;sudo -l&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;There&amp;rsquo;s an unreadable file (owned by root) called &amp;lsquo;result.stat&amp;rsquo;, that&amp;rsquo;s probably related to something. I browse the mail history and see:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;forensics.localdomain : Dec 7 14:08:08 : neo : user NOT in sudoers ; TTY=pts/2 ; PWD=/home/neo ; USER=morpheus ; COMMAND=/home/morpheus/egrep /home/morpheus/../neo/result.stat
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That could be handy. I do remember an egrep in /home/neo, will have a look. Lots of reference to /bin/monitor, too.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m only in the neo group, so nothing to see there.&lt;/p&gt;
&lt;p&gt;Running &lt;code&gt;ps aux | grep neo&lt;/code&gt; shows a heap of /bin/monitor processes started by root, but running under neo. There&amp;rsquo;s also a &amp;ldquo;SCREEN&amp;rdquo; instance there, but running &lt;code&gt;screen -D -RR&lt;/code&gt; doesn&amp;rsquo;t reclaim it, so something&amp;rsquo;s up there. I&amp;rsquo;m pretty sure there&amp;rsquo;s something there in /bin/monitor.&lt;/p&gt;
&lt;p&gt;In all honesty this one had me beat. It was half-past midnight and I was exhausted. I knew that there was something special about /bin/monitor, and I knew there was something special about the fact that it was running as neo. But I took the expedient route and had a quick google. I found the answer at &lt;a class="link" href="http://blog.dornea.nu/2016/10/30/ringzer0-ctf-sysadmin-linux/" target="_blank" rel="noopener"
 &gt;http://blog.dornea.nu/2016/10/30/ringzer0-ctf-sysadmin-linux/&lt;/a&gt; - without this I could have been looking for years. However, as is so often the case, this tutorial was the basis of some great learning for me.&lt;/p&gt;
&lt;p&gt;Because the process is owned by neo, and because /bin/monitor could be &lt;em&gt;read&lt;/em&gt; by neo, it meant I could run a stack trace. &lt;em&gt;I have never done this before&lt;/em&gt; - no false impressions here, I totally relied on that dornea.ru page to tip me off to the usage of strace. But once I knew that, I had the flag.&lt;/p&gt;
&lt;p&gt;I was very well misled by this one, actually. The Persephone comment in the phonebook totally led me down the wrong path, and I spent quite a long time searching for her details on the system. It was the reddest herring possible.&lt;/p&gt;
&lt;h2 id="level-8---morpheus---cypher"&gt;Level 8 - Morpheus -&amp;gt; Cypher
&lt;/h2&gt;&lt;p&gt;Okay it&amp;rsquo;s late now so I&amp;rsquo;m going to try to thrash this one quick. Nothing in &lt;code&gt;ps aux&lt;/code&gt; for cypher. Grepping /backup found a python file and a dump showing a cron job runs this file every minute. The contents of the python file are:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import os
os.system('ps aux &amp;gt; /tmp/28JNvE05KBltE8S7o2xu')
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I can&amp;rsquo;t read the output file, but I can edit the python script! This is gonna be easy.&lt;/p&gt;
&lt;p&gt;After a little bit of trial and error, I edited the python script to first list the contents of the /home/cypher folder, and after that, to output the contents of /home/cypher/flag.txt&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s important to note that the python file is recreated every three minutes when it&amp;rsquo;s run, so you need to redo your changes for every iteration.&lt;/p&gt;
&lt;h1 id="fin"&gt;Fin
&lt;/h1&gt;&lt;p&gt;That&amp;rsquo;s the end! I&amp;rsquo;m quite pleased I&amp;rsquo;ve managed to finish all of the Sysadmin Linux section. Of course that&amp;rsquo;s also scary, because it means I need to break into the other sections. That&amp;rsquo;s OK though&amp;hellip; it&amp;rsquo;s a good time to do it!&lt;/p&gt;</description></item><item><title>RingZer0team CTF - Challenge 148</title><link>https://www.ericlight.com/post/r0-148.html</link><pubDate>Sat, 27 May 2017 00:00:00 +1200</pubDate><guid>https://www.ericlight.com/post/r0-148.html</guid><description>&lt;p&gt;There are a bunch of fantastic Capture The Flag security challenges on &lt;a class="link" href="https://www.ringzer0team.com" target="_blank" rel="noopener"
 &gt;RingZer0Team.com&lt;/a&gt;. I&amp;rsquo;ve been working through some of these for a wee while now, and with the &lt;a class="link" href="https://www.cybersecuritychallenge.org.nz/" target="_blank" rel="noopener"
 &gt;New Zealand Cyber Security Challenge&lt;/a&gt; coming up again soon, I thought I&amp;rsquo;d get back into some of them.&lt;/p&gt;
&lt;p&gt;Challenge 148 (&amp;ldquo;Sysadmin Linux Level 2&amp;rdquo;) is one of a series of challenges where you&amp;rsquo;re trying to breach the security of a Linux system. I actually finished most of these last year, but I wanted to finish my last two. Of course, to get to the last two stages, you need to use the flags from the &lt;em&gt;previous&lt;/em&gt; stages. So I&amp;rsquo;m revisiting them.&lt;/p&gt;
&lt;p&gt;We start by SSH&amp;rsquo;ing into a particular user account on the ringzer0team server:&lt;/p&gt;
&lt;p&gt;You have mail.
Last login: Thu Apr 27 02:52:40 2017 from &lt;somewhere&gt;
morpheus@forensics:~$&lt;/p&gt;
&lt;p&gt;There&amp;rsquo;s only one file in the home folder, and I can&amp;rsquo;t read it. There&amp;rsquo;s a /home/trinity folder with full read access, but also nothing legible.&lt;/p&gt;
&lt;p&gt;Running ps aux reveals what appears to be Trinity&amp;rsquo;s password:&lt;/p&gt;
&lt;p&gt;root 3241 0.0 0.0 4188 572 ? S Jan14 1:44 /bin/sh /root/backup.sh -u trinity -p Flag-&lt;redacted&gt;&lt;/p&gt;
&lt;p&gt;Aha, and /etc/fstab contains what appears to be The Architect&amp;rsquo;s password, in base64:&lt;/p&gt;
&lt;p&gt;/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
#//TheMAtrix/phone /media/Matrix cifs username=architect,password=$(base64 -d &amp;ldquo;&lt;redacted&gt;&amp;rdquo;),iocharset=utf8,sec=ntlm 0 0&lt;/p&gt;
&lt;p&gt;Great! Now I can carry on to my &lt;em&gt;actual&lt;/em&gt; goal, which was to nail challenge 91 (&amp;ldquo;Sysadmin Linux Level 7&amp;rdquo;)!&lt;/p&gt;</description></item><item><title>RingZer0team CTF - Challenge 57</title><link>https://www.ericlight.com/post/r0-57.html</link><pubDate>Fri, 05 May 2017 00:00:00 +1200</pubDate><guid>https://www.ericlight.com/post/r0-57.html</guid><description>&lt;p&gt;This is a continuation of my series on &lt;a class="link" href="https://www.ringzer0team.com" target="_blank" rel="noopener"
 &gt;RingZer0Team.com&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Challenge 57 (&amp;ldquo;Hash Breaker Reloaded&amp;rdquo;, under the Coding Challenges) is one of a series of challenges where you&amp;rsquo;re simply presented with a hash - you need to return the plaintext value to the page within 3 seconds.&lt;/p&gt;
&lt;p&gt;In contrast to &lt;a class="link" href="https://www.ericlight.com/post/r0-56.html" &gt;Challenge 56&lt;/a&gt;, &lt;strong&gt;this&lt;/strong&gt; challenge also includes a salt:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;You have 3 seconds to break this hash
Send the answer back using https://ringzer0team.com/challenges/57/[clear_text]


----- BEGIN HASH -----
ab9507edbb2501b3c02e47c51af0178d68655980
----- END HASH -----

----- BEGIN SALT -----
c2ac9d8d004b4011d0864e76c7ebaaccfd18464bb8ff66bdbf19a703eb95a944
----- END SALT -----
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The hash looks like another SHA-1, but of course the online hash reversers don&amp;rsquo;t have the &lt;em&gt;now-salted&lt;/em&gt; hash in their rainbow tables. I figured that the challenge was a simple continuation of the previous challenge, so I crossed my fingers and guessed the hash was simply a number (from last time), concatenated with the plain-text salt.&lt;/p&gt;
&lt;p&gt;&amp;hellip; And I was lucky! The below code got me the flag:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/usr/bin/python3
from requests import get
from hashlib import sha1
from re import search

url='https://ringzer0team.com/challenges/57'
session=dict(PHPSESSID='&amp;lt;blahblah&amp;gt;')
resp=get(url,cookies=session)
hash=resp.text.split(&amp;quot;-----&amp;quot;)[2].split(&amp;quot;\t&amp;quot;)[2].split(&amp;quot;&amp;lt;&amp;quot;)[0]
salt=resp.text.split(&amp;quot;-----&amp;quot;)[6].split(&amp;quot;\t&amp;quot;)[2].split(&amp;quot;&amp;lt;&amp;quot;)[0]
newhash=''
salt=salt.encode('utf-8')
x=0
while newhash != hash:
		newhash=sha1(str(x).encode('utf-8')+salt).hexdigest()
		print(&amp;quot;%s = %s&amp;quot; % (newhash, x))
		x+=1
	
resp=get(url+'/'+str(x-1),cookies=session)
flag=search(&amp;quot;FLAG-.{24}&amp;quot;,resp.text).group()
print(flag)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As last time, there&amp;rsquo;s no error handling in that code, so if it runs for more than a few seconds it&amp;rsquo;s probably toast.&lt;/p&gt;</description></item><item><title>RingZer0team CTF - Challenge 56</title><link>https://www.ericlight.com/post/r0-56.html</link><pubDate>Tue, 02 May 2017 00:00:00 +1200</pubDate><guid>https://www.ericlight.com/post/r0-56.html</guid><description>&lt;p&gt;There are a bunch of fantastic Capture The Flag security challenges on &lt;a class="link" href="https://www.ringzer0team.com" target="_blank" rel="noopener"
 &gt;RingZer0Team.com&lt;/a&gt;. I&amp;rsquo;ve been working through some of these for a wee while now, and with the &lt;a class="link" href="https://www.cybersecuritychallenge.org.nz/" target="_blank" rel="noopener"
 &gt;New Zealand Cyber Security Challenge&lt;/a&gt; coming up again soon, I thought I&amp;rsquo;d get back into some of them.&lt;/p&gt;
&lt;p&gt;Challenge 56 (&amp;ldquo;Hash Breaker&amp;rdquo;, under the Coding Challenges) is one of a series of challenges where you&amp;rsquo;re simply presented with a hash - you need to return the plaintext value to the page within 3 seconds.&lt;/p&gt;
&lt;p&gt;Of course, this is impossible to do manually, so it&amp;rsquo;s a programming challenge.&lt;/p&gt;
&lt;p&gt;The hash looks like a simple SHA-1, so I put it into an online hash reverser and discovered it&amp;rsquo;s just a SHA1 hash of a random number. SHA1 is really fast, so this should be simple.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s how I tackled the problem:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!python
# It's in Python3, because of reasons
from requests import get
from hashlib import sha1
from re import search
calculated_hash=''
x=0

# Your session cookie needs to go here
session=dict(PHPSESSID='&amp;lt;cookie contents&amp;gt;')

# Load the web page
url='https://ringzer0team.com/challenges/56'
resp=get(url,cookies=session)

# Extract the hash from the page contents
target_hash=resp.text.split(&amp;quot;-----&amp;quot;)[2].split(&amp;quot;\t&amp;quot;)[2].split(&amp;quot;&amp;lt;&amp;quot;)[0]

# Iterate hashes from zero until the calculated hash matches the target hash
while calculated_hash != target_hash:
		calculated_hash=sha1(str(x).encode('utf-8')).hexdigest()
		print(&amp;quot;%s = %s&amp;quot; % (calculated_hash, x))
		x+=1

# If we got here, yay! We found the key. Now submit it back to the site, and print our magic flag
resp=get(url+'/'+str(x-1),cookies=session)
flag=search(&amp;quot;FLAG-.{24}&amp;quot;,resp.text).group()
print(flag)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There&amp;rsquo;s no error handling in that code, so if it runs for more than a few seconds it&amp;rsquo;s probably toast.&lt;/p&gt;</description></item></channel></rss>