GHSA-h7wh-q2qr-458c

Suggest an improvement
Source
https://github.com/advisories/GHSA-h7wh-q2qr-458c
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/11/GHSA-h7wh-q2qr-458c/GHSA-h7wh-q2qr-458c.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-h7wh-q2qr-458c
Aliases
Downstream
CGA (32)
Published
2026-11-13T18:09:16Z
Modified
2026-11-13T18:15:07Z
Severity
  • 4.7 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N CVSS Calculator
Summary
rails-html-sanitizer: Possible XSS via shared scrubber state in concurrent calls
Details

Summary

Rails::HTML::SafeListSanitizer (both the HTML4 and HTML5 variants) shares one Rails::HTML::PermitScrubber across every sanitize call on the same instance, assigning its tags and attributes on each call without synchronization. Two concurrent sanitize calls with different tags: or attributes: options can interleave, so one call is scrubbed with the other call's allowlist.

  • Versions affected: < 1.7.2
  • Not affected: none
  • Fixed versions: 1.7.2

Impact

Action View memoizes a single SafeListSanitizer per helper module and uses it for every sanitize call in the process, so in a multi-threaded server (for example Puma) all requests share the same PermitScrubber. If any code path calls sanitize with a more permissive allowlist, an attacker who can trigger that path concurrently with another request can cause the other request to be sanitized with the permissive allowlist. If the permissive allowlist admits script or an event-handler attribute, the strict call emits it unchanged, which is a cross-site scripting vector when the strict output is stored or rendered to other users.

Applications are affected only if they run more than one thread per process and some sanitize call passes tags: or attributes: options that differ from another call's, including a call that passes no options and so uses the defaults. Applications that use a single configuration everywhere, pass their own scrubber:, or run single-threaded are not affected.

Workarounds

Use the same allowlist for every sanitize call, or pass a scrubber: built per call (Rails::HTML::PermitScrubber.new with tags= and attributes= set) instead of tags: and attributes: options.

Credit

Reported by hiumee via HackerOne.

Database specific
{
    "cwe_ids": [
        "CWE-362",
        "CWE-79"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-11-13T18:09:16Z",
    "nvd_published_at": null,
    "severity": "MODERATE"
}
References

Affected packages

RubyGems / rails-html-sanitizer

Package

Name
rails-html-sanitizer
Purl
pkg:gem/rails-html-sanitizer

Affected ranges

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

Affected versions

1.*
1.0.0
1.0.1
1.0.2
1.0.3
1.0.4
1.1.0
1.2.0
1.3.0
1.4.0
1.4.1
1.4.2
1.4.3
1.4.4
1.5.0
1.6.0.rc1
1.6.0.rc2
1.6.0
1.6.1
1.6.2
1.7.0
1.7.1

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/11/GHSA-h7wh-q2qr-458c/GHSA-h7wh-q2qr-458c.json"