Skip to content
XSS Write-up Advanced

OpenNMS Vulnerabilities: Securing Code against Attackers’ Unexpected Ways

An unauthenticated attacker could spoof an SNMP trap from localhost using an IPv4-mapped IPv6 address, injecting an XSS payload into the admin dashboard via the unsanitised Reduction Key. When an admin viewed the alarm, the payload executed and could add a malicious Detector, leading to command injection and remote code execution.

Stefan Schiller Follow

Published on sonarsource.com

Found it? If not, it’s easier than you may have expected.

Stefan Schiller (@scryh_), on sonarsource.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The Reduction Key value from SNMP traps was not sanitised before being output on the dashboard because developers assumed it was not attacker-controllable, and a separate command injection existed in a Detector class that allowed arbitrary script execution.

Impact

An unauthenticated attacker could execute arbitrary code on the OpenNMS server once an admin views the dashboard, but the XSS requires the admin to view the alarm and the command injection requires authenticated access to add a Detector.

What the attacker needed

Ability to send spoofed IPv6 packets; admin views the dashboard; no authentication needed for XSS

The fix

The XSS was fixed by sanitising the Reduction Key with WebSecurityUtils.sanitizeString, and the command injection was fixed by limiting script file locations to below the OpenNMS home directory.

How it was found

  1. Send a spoofed SNMP trap via IPv6 with source address set to the IPv4-mapped IPv6 address of localhost.
  2. The trap listener accepts it as from localhost and converts it to an Alarm, injecting the XSS payload into the Reduction Key.
  3. An admin views the alarm on the dashboard, triggering the JavaScript payload.
  4. The payload adds a custom Detector and starts a discovery with it.
  5. The command in the script attribute executes, establishing a reverse shell.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

OpenNMS is a tool that watches network devices. It accepts messages called SNMP traps from devices it monitors. The researchers found that an attacker could fake such a message so it appeared to come from the OpenNMS server itself, and the message contained JavaScript code that ran in an administrator's browser. That let the attacker then run commands on the server.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by Stefan Schiller

View all

10 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.