GHSA-gx93-m64w-5m6h

Suggest an improvement
Source
https://github.com/advisories/GHSA-gx93-m64w-5m6h
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/06/GHSA-gx93-m64w-5m6h/GHSA-gx93-m64w-5m6h.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-gx93-m64w-5m6h
Aliases
  • CVE-2026-55847
Published
2026-06-19T21:15:53Z
Modified
2026-06-19T21:30:08.815201607Z
Severity
  • 6.1 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N CVSS Calculator
Summary
Allure Report: Stored XSS via unescaped ANSI helper in status message/trace rendering
Details

Summary

The ansi.js Handlebars helper in allure-generator passes user-controlled statusMessage and statusTrace values from test result files through the ansi-to-html library and wraps the output in Handlebars SafeString without HTML escaping. Since ansi-to-html does not escape HTML entities by default, an attacker who can influence test result content (e.g., via crafted JUnit XML failure messages) can inject arbitrary JavaScript that executes when anyone views the generated Allure report.

Details

The vulnerability is an incomplete fix — commit 4c64b19 (PR #3271) fixed XSS in linky.js and text-with-links.js by adding escapeExpression(), but the same pattern in ansi.js was not addressed.

Vulnerable sinkallure-generator/src/main/javascript/helpers/ansi.js:10-11:

export default function (input) {
    return new SafeString(ansiConverter.toHtml(input));
};

The AnsiToHtml constructor at line 4 does not set escapeForHtml: true:

const ansiConverter = new AnsiToHtml({
    fg: "black",
    bg: "black",
    newline: true,
});

The ansi-to-html library (v0.7.2) defaults escapeForHtml to false, meaning HTML entities in the input pass through unchanged. Wrapping the result in SafeString tells Handlebars to skip its auto-escaping, so the raw HTML reaches the browser.

Template usageallure-generator/src/main/javascript/blocks/status-details/status-details.hbs:7,10:



<pre class="status-details__message"><code>{{ansi statusMessage}}</code></pre>


...


<pre class="{{b 'status-details' 'trace'}}"><code>{{ansi statusTrace}}</code></pre>


Sourceplugins/junit-xml-plugin/src/main/java/io/qameta/allure/junitxml/JunitXmlPlugin.java:307-308:

result.setStatusMessage(element.getAttribute(MESSAGE_ATTRIBUTE_NAME));
result.setStatusTrace(element.getValue());

These values are read directly from XML attributes with no sanitization. The same pattern exists in TRX, xUnit XML, xctest, and Allure1/2 plugins.

Contrast with the fixed helperlinky.js (post-fix) correctly escapes before wrapping in SafeString:

const safeText = escapeExpression(text);
return new SafeString(`<a href="${safeText}" ...>${safeText}</a>`);

PoC

  1. Create a malicious JUnit XML test result file:
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="XSSTest" tests="1" failures="1">
  <testcase name="xssPayload" classname="com.example.Test">
    <failure message="&lt;img src=x onerror=alert(document.cookie)&gt;">
      Stack trace: &lt;img src=x onerror=alert('statusTrace_XSS')&gt;
    </failure>
  </testcase>
</testsuite>
  1. Generate an Allure report:
allure generate /path/to/results-with-malicious-xml -o /tmp/allure-report
  1. Open the report and navigate to the failed test case:
allure open /tmp/allure-report
  1. When viewing the test's status details, the <img onerror> payloads execute JavaScript in the viewer's browser.

Impact

  • Arbitrary JavaScript execution in the browser of anyone viewing the generated Allure report
  • Cookie theft, session hijacking if the report is served from a domain with active sessions (e.g., CI dashboards)
  • Data exfiltration — the injected script can read the full report content and send it to an attacker-controlled server
  • Attack vectors: A malicious dependency that throws crafted exception messages, a CI pipeline processing test results from untrusted pull requests, or a contributor submitting test files containing XSS payloads
  • Allure reports are commonly hosted on CI/CD platforms (Jenkins, GitLab, GitHub Actions artifacts) where session cookies may be present

Recommended Fix

Configure AnsiToHtml with escapeForHtml: true to escape HTML entities while preserving ANSI-to-HTML conversion:

import AnsiToHtml from "ansi-to-html";
import {SafeString} from "handlebars/runtime";

const ansiConverter = new AnsiToHtml({
    fg: "black",
    bg: "black",
    newline: true,
    escapeForHtml: true,  // Escape HTML entities in non-ANSI input
});

export default function (input) {
    return new SafeString(ansiConverter.toHtml(input));
};

This is the correct approach because it preserves the ANSI escape sequence → HTML conversion (colored output) while ensuring that any non-ANSI HTML in the input is safely escaped. The alternative of using escapeExpression() on the input would destroy ANSI sequences before they could be converted.

Database specific
{
    "nvd_published_at": null,
    "severity": "MODERATE",
    "github_reviewed": true,
    "github_reviewed_at": "2026-06-19T21:15:53Z",
    "cwe_ids": [
        "CWE-79"
    ]
}
References

Affected packages

Maven / io.qameta.allure:allure-generator

Package

Name
io.qameta.allure:allure-generator
View open source insights on deps.dev
Purl
pkg:maven/io.qameta.allure/allure-generator

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
2.39.0

Affected versions

2.*
2.0-BETA8
2.0.0
2.0.1
2.1.1
2.2.0
2.3
2.3.1
2.3.2
2.3.4
2.4.1
2.5.0
2.8.0
2.8.1
2.9.0
2.10.0
2.11.0
2.12.0
2.12.1
2.13.0
2.13.1
2.13.2
2.13.3
2.13.4
2.13.5
2.13.6
2.13.7
2.13.8
2.13.9
2.13.10
2.14.0
2.15.0
2.16.0
2.16.1
2.17.0
2.17.1
2.17.2
2.17.3
2.18.0
2.18.1
2.19.0
2.20.0
2.20.1
2.21.0
2.22.0
2.22.1
2.22.2
2.22.3
2.22.4
2.23.0
2.23.1
2.24.0
2.24.1
2.25.0
2.26.0
2.27.0
2.28.0
2.29.0
2.30.0
2.31.0
2.32.0
2.32.2
2.33.0
2.34.0
2.34.1
2.35.0
2.35.1
2.36.0
2.37.0
2.38.0
2.38.1

Database specific

last_known_affected_version_range
"<= 2.38.1"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/06/GHSA-gx93-m64w-5m6h/GHSA-gx93-m64w-5m6h.json"