Stored XSS On-Call Roles.

Description

Overview

Cross-Site Scripting (XSS) attacks are a type of injection, in which malicious scripts are injected into otherwise benign and trusted websites. XSS attacks occur when an attacker uses a web application to send malicious code, generally in the form of a browser side script, to a different end user. Flaws that allow these attacks to succeed are quite widespread and occur anywhere a web application uses input from a user within the output it generates without validating or encoding it.

An attacker can use XSS to send a malicious script to an unsuspecting user. The end user’s browser has no way to know that the script should not be trusted, and will execute the script. Because it thinks the script came from a trusted source, the malicious script can access any cookies, session tokens, or other sensitive information retained by the browser and used with that site. These scripts can even rewrite the content of the HTML page.

Stored attacks are those where the injected script is permanently stored on the target servers, such as in a database, in a message forum, visitor log, comment field, etc. The victim then retrieves the malicious script from the server when it requests the stored information. Stored XSS is also sometimes referred to as Persistent or Type-I XSS.

Browser URL

https://onmspentest.eastus.cloudapp.azure.com/opennms/admin/userGroupView/roles

Steps To Reproduce

Replication steps are below:

![1.png](https://api.cobalt.io/v1/attachments/att_0ET4OZR/preview)

  • Click on `Add New On-Call Role`

![2.png](https://api.cobalt.io/v1/attachments/att_tlhpxdE/preview)

  • Inject XSS payload on name of the role and save new role. Follow below screenshot

![3.png](https://api.cobalt.io/v1/attachments/att_6lfctoD/preview)

![Proof.png](https://api.cobalt.io/v1/attachments/att_YzFkELC/preview)

Suggested Fix

1. Always treat all user input as untrusted data.

2. Never insert untrusted data except in allowed locations.
3. Always input or output-encode all data coming into or out of the application.
4. Always whitelist allowed characters and seldom use blacklisting of characters except in certain use cases.
5. Always use a well-known and security encoding API for input and output encoding such as the OWASP ESAPI.
6. Never try to write input and output encoders unless absolutely necessary. Chances are that someone has already written a good one.
7. Never use the DOM function innerHtml and instead use the functions innerText and textContent to prevent against DOM-based XSS.
8. As a best practice, consider using the HTTPOnly flag on cookies that are session tokens or sensitive tokens.
9. As a best practice, consider implementing Content Security Policy to protect against XSS and other injection type attacks.
10. As a best practice, consider using an auto-escaping templating system.
11. As a best practice, consider using the X-XSS-Protection response header.

Cobalt URL

#PT9265_14

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Show:

Jeff Jancula February 16, 2022 at 7:44 PM

Rated as security-low, as this is not related to login pages.

Details

Assignee

Reporter

HB Backlog Status

Priority

PagerDuty

Created February 15, 2022 at 10:19 PM
Updated March 10, 2022 at 1:41 PM

Flag notifications