<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>RingZer0Team on Such geek. Wow.</title><link>https://www.ericlight.com/tags/ringzer0team.html</link><description>Recent content in RingZer0Team on Such geek. Wow.</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Thu, 13 Jul 2017 00:00:00 +1200</lastBuildDate><atom:link href="https://www.ericlight.com/tags/ringzer0team/index.xml" rel="self" type="application/rss+xml"/><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>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>