Vulnerability Disclosure

Multiple critical vulnerabilities found in NeDi

Product: NeDi
Vendor: NeDi Consulting GmbH
Version: <= 1.7C
Found: 2018-10-24
By: Oscar Arnflo
[Show TXT-version]


Several critical vulnerabilities has been found in NeDi version <= 1.7C.
The most severe giving any remote authenticated user full OS code execution (see 5.3).
But by chaining multiple exploits together it is possible for a remote unauthenticated
attacker to gain full OS code execution.

Product description

"NeDi discovers your network devices and tracks connected end-nodes. It 
contains many additional features for
managing enterprise networks:

* Intelligent topology awareness
* MAC address mapping/tracking
* Traffic, error, discard and broadcast graphing with threshold based alerting
* Uptime, BGP peer and interface status monitoring
* Correlate syslog messages and traps with discovery events
* Network maps for documentation and monitoring dashboards
* Detecti rouge access points and find missing devices
* Extensive reporting ranging from devices, modules, interfaces all the way to
  assets and nodes"

Vulnerability description

1. XSS Reflected

The endpoint /mh.php suffers from a XSS vulnerability the GET-parameter, reg.
This allows for an UNAUTHENTICATED USER to execute code in the victims browser.
If the victim is an authenticated user it is possible for an attacker to
escalate privileges(see point 3), code execution(see 5).

    (Verified in Firefox)
Also verified against version 1.8 DEMO:;%22%3E

2. XSS Stored

The endpoint /User-Chat.php suffers from a XSS vulnerability.
By posting a message containing a link it is possible to add extra attributes to
the a-tag created by the server side.

   This message will trigger XSS when the victim hovers over the hyperlink: 
    Check out my website:"onmouseover="alert('XSS')

Affected source code:
   User-Chat.php, Line 73.

3. CSRF Privilege escalation

The endpoint User-Management.php does not protect against a CSRF-attack.
It makes it possible for an attacker to send a link or in any other way(see 1 and 2) 
get a high-priv user to create a new user.

    If a high-priv user visits this url, a new user test with password test will
    be created:

    And this would give the user test admin privileges:

    Simply by putting this code on a attacker controlled webpage would make any administrative user
    in NeDi, create and elevate a new user to administrator.
        <img src="http://nedi-host/User-Management.php?grp=&ord=&usr=test&eml=&phn=&add=Add">
        <img src="http://nedi-host/User-Management.php?grp=&ord=&usr=test&gup=1">

Affected source code:

4. SQL Injection / Arbitrary read from database

The endpoint query.php allows ANY user to read from the database, making it possible
for an attacker to steal password-hashes, etc.

    Fetch all users password hashes with user(test:test) :
    curl -k -d "u=test&p=test&t=users" ""

    OUTPUT (prettified & truncated):
              "version":"#157-Ubuntu SMP Thu Jul 12 15:51:36 UTC 2018",
              "comment":"default admin",
              "dateformat":"j.M y G:i470",

Affected source code:

5. Code Execution

Multiple endpoints was found vulnerable to command injection giving full OS code execution
for a low-prived authenticated user.

ALSO NOTE that the following endpoints are also vulnerable to a CSRF-attack, which means
in a worst case scenario; giving full OS code execution to an UNAUTHENTICATED USER.
5.1 Helpdesk User
 The endpoint /Nodes-Traffic.php and the GET-parameter flt is vulnerable to command injection.
 Giving the user type "Helpdesk" code execution.


 Affected source code:
    Nodes-Traffic.php, line 424.
5.2 Network User
 The endpoint /Devices-Graph.php and the GET-parameter dv is vulnerable to command injection.
 Giving the user type "Network" code execution.

 Affected source code:
    Devices-Graph.php, line 210.
5.3 ANY Authenticated User
 The endpoint /drawmap.php and the GET-parameter tit is vulnerable to code injection,
 allowing ANY authenticated user to run PHP-code and thus also giving OS code execution on the server.

 Affected source code:
    drawmap.php, line 108
    inc/libmap.php, line 88 & line 92