Skip to content

NethSecurity Log XSS

Critical
gsanchietti published GHSA-74xv-ww67-jjpx Jun 20, 2024

Package

nethsecurity-ui (NethSecurity)

Affected versions

<= 1.0.0

Patched versions

1.0.1
ns8-nethsecurity-controller (NethServer 8)
<= 0.0.18
0.0.19

Description

Summary

NethSecurity 8 logs are prone to Stored XSS

Details

On a NethSecurity 8 instance parsing logs of malicious events with XSS in it causes execution on browser looking at them. This happens due to the usage of v-html to display the log entries: if a log entry contains javascript code, it is interpreted by the browser.

PoC

Trying to login with: <img src/onerror=alert("XSS")> [and a random password] causes to store XSS on logs

Impact

This is a Stored XSS and administrators looking at the logs may be impacted (with store of session information)

Attack attempts detection

To check for any attack attempts, execute the following command:

grep '\[INFO\]\[AUTH\] authentication failed for user' /var/log/messages

Example output:

Jun  5 13:08:51 NethSec nethsecurity-api[6306]: nethsecurity_api 2024/06/05 13:08:51 middleware.go:71: [INFO][AUTH] authentication failed for user root: exit status 250

A potential indicator of an attack is the presence of JavaScript code (either in clear text or base64) in the username field.

Mitigation steps

For NethSecurity Firewall:

To mitigate this issue, follow these guidelines:

  1. Avoid Accessing the Log Page: Do not access the Log page if the ns-ui package has not been updated to the version containing the fix.
  2. Restrict UI Access: Restrict access to the configuration UI only from trusted IP addresses. Refer to the documentation for detailed instructions.
  3. Reboot the Machine: Perform a system reboot. This will invalidate all active tokens and clean up the logs.

For NS8 Controller Application:

To mitigate this issue, follow these guidelines:

  1. Avoid Accessing the Log Page: Do not access the Log page of the unit if the ns-ui package has not been updated to the version containing the fix.
  2. Reboot the Unit: Perform a reboot of the unit. This will invalidate all active tokens and clean up the logs.

Severity

Critical

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H

CVE ID

No known CVE

Weaknesses

No CWEs