/

CVE-2026-50883

Severity:

CRITICAL RISK

(9.6)

Reflected XSS (CWE-79) in Wastebin highlight module

CVE-2026-50883

Deferred

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Arbitrary Script Execution in User Browsers

Severity:

CRITICAL RISK

(9.6)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

An HTML injection vulnerability in the highlight component of matze wastebin allows attacker-controlled content to be rendered as active HTML and script code in the browser.

When a crafted payload is stored or reflected through the /src/highlight.rs path without proper encoding, it can lead to arbitrary script execution in users' sessions.

Affected context

This vulnerability arises in matze wastebin deployments that render user-supplied content through the /src/highlight.rs component, typically when displaying pastes or code snippets in HTML pages.

It is most relevant where the highlighting logic injects or concatenates user input into HTML without robust escaping, and where responses are delivered to browsers under the same origin as authenticated sessions or sensitive application state.

Exploit preconditions

  • Attack surface: HTTP interface serving highlighted or formatted content (e.g., paste/snippet views).
  • Required access: Ability to submit or influence the content that is later processed by /src/highlight.rs (e.g., creating or editing a paste).
  • Trigger point: A user visits or is forced to visit a URL where the vulnerable highlight output is rendered by their browser.
  • Why exploitation is possible: The highlight component injects user-controlled data into HTML without strict context-aware encoding or sanitization, allowing embedded script constructs to be interpreted by the browser.

Why this happens

The root cause is improper neutralization of user input before it is embedded into an HTML response, consistent with CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting).

The highlight logic likely treats user data as display-only but inserts it directly into HTML or attribute contexts without ensuring that characters such as <, >, ", ', and / are safely encoded for the specific context.

As a result, crafted payloads can break out of the intended text or markup structure and introduce executable JavaScript or event handlers in the rendered page.

Potential impact

  • Attackers may execute arbitrary JavaScript in the victim's browser under the application's origin.
  • Attackers could steal session tokens, CSRF tokens, or other sensitive data stored in the browser.
  • Attackers may perform actions on behalf of logged-in users, such as modifying or deleting content.
  • Attackers could inject malicious content that persists and affects future visitors, depending on how pastes are stored and shared.
  • Attackers may chain this issue with other weaknesses to escalate into broader account or application compromise.

General mitigation guidance

Effective mitigation centers on context-aware output encoding and strict separation of data from markup.

Recommended defensive patterns include:

  • Applying HTML, attribute, and JavaScript encoding at the final rendering layer whenever user-controlled data is inserted into a response.
  • Treating syntax highlighting output as untrusted until it has been encoded for the specific HTML context in which it appears.
  • Avoiding string concatenation to build HTML; instead, use templating engines that automatically escape output by default.
  • Where rich formatting is required, using a safelist-based HTML sanitizer that only allows a minimal set of benign tags and attributes.
  • Implementing a defense-in-depth posture: enable Content Security Policy (CSP) to restrict inline scripts and limit script sources.

How teams detect issues like this

Detection typically involves a mix of automated and manual review focused on how user input flows to HTML responses.

Common strategies:

  • Static analysis rules that flag direct insertion of user-controlled variables into HTML, attribute, or script contexts without escaping.
  • Code review checklists that require verifying all highlight or rendering paths encode or sanitize untrusted content.
  • Unit and integration tests that inject representative XSS payloads into paste content and assert that the rendered output remains inert text.
  • Security testing with automated scanners or fuzzers configured to probe parameters associated with paste creation and display, looking for script execution in responses.

Sources

SourceLink
gist.github.comgist.github.com/pyuysig/eb74ae37c49d0383bedc08881c2493c4

Frequently asked

questions

Yes. An attacker can craft a malicious paste or URL and convince a victim to open it in their browser. No direct access to the server filesystem is required; exploitation occurs entirely via HTTP requests.

The attacker generally needs the ability to submit or control content that is processed by the highlight component—such as creating a new paste or influencing its contents—and the ability to deliver a link to a victim who is using the application.

The most robust fix is to ensure all user-controlled data passed through the highlight pipeline is treated as plain text and encoded for the exact HTML context before rendering. This usually involves using a templating system with auto-escaping and avoiding any bypass of its escaping mechanisms.

Adopt a secure-by-default rendering layer that auto-escapes output, require context-aware encoding for all untrusted data, and enforce these rules via code review and automated checks. Additionally, define a standard XSS prevention guideline for the project and integrate it into development and testing processes.

Find out what's already
exploitable in your codebase.