# CVE-2026-33170: Ruby on Rails Active Support XSS in SafeBuffer

Source: https://junglewise.ai/threats/cve-2026-33170-ruby-on-rails-active-support-xss-in-safebuffer  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-03-23. Updated: 2026-05-10  
License: CC BY 4.0 with a link back

CVE-2026-33170 · Severity: medium · CVSS 4 · Published 2026-03-23

A vulnerability in the Ruby on Rails Active Support library could allow attackers to perform Cross-Site Scripting (XSS) attacks. Active Support provides essential utility functions for the Rails web framework, including tools for safely handling web content. An exploit could allow an attacker to inject malicious scripts into web pages viewed by other users, potentially leading to unauthorized actions or data theft.

Technologies: [activesupport (RubyGems)](https://junglewise.ai/threats/technologies/activesupport). Vendors: [Ruby on Rails](https://junglewise.ai/threats/vendors/ruby-on-rails), [RubyGems](https://junglewise.ai/threats/vendors/rubygems).

## Quick answers

**Is CVE-2026-33170 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-33170 being exploited in the wild.

**How severe is CVE-2026-33170?** Medium severity, with a CVSS score of 4, published 23 March 2026.

**Which products and versions are affected?** activesupport (RubyGems) ECOSYSTEM:introduced=8.1.0.beta1,fixed=8.1.2.1.

**Is there a fix for CVE-2026-33170?** Yes. activesupport (RubyGems): upgrade to 8.1.2.1 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-33170 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-33170?** Check whether you run Ruby on Rails Active Support or activesupport (RubyGems) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- activesupport (RubyGems): upgrade to 8.1.2.1 or later

  ```sh
  bundle update activesupport
  ```


## Technical details

A vulnerability exists in Active Support's SafeBuffer#% method where it fails to correctly propagate the @html_unsafe flag to newly created buffers. If a SafeBuffer is mutated in place (using methods like gsub!) and subsequently formatted using the % operator with untrusted arguments, the resulting object incorrectly identifies as html_safe. This flaw allows an attacker to bypass ERB auto-escaping mechanisms, leading to reflected or stored XSS. The issue is resolved in versions 8.1.2.1, 8.0.4.1, and 7.2.3.1.

## Affected products

- Ruby on Rails activesupport >= 8.1.0.beta1, < 8.1.2.1
- Ruby on Rails activesupport >= 8.0.0.beta1, < 8.0.4.1
- Ruby on Rails activesupport < 7.2.3.1

## Identifiers

- CVE-2026-33170
- GHSA-89vf-4333-qx8v

## Timeline

- 2026-03-23: disclosed
- 2026-03-23: advisory
- 2026-03-23: patched

## References

- [https://api.github.com/users/ch4n3-yoon](https://api.github.com/users/ch4n3-yoon)
- [https://github.com/ch4n3-yoon](https://github.com/ch4n3-yoon)
- [https://api.github.com/users/ch4n3-yoon/gists%7B/gist_id%7D](https://api.github.com/users/ch4n3-yoon/gists%7B/gist_id%7D)
- [https://api.github.com/users/ch4n3-yoon/repos](https://api.github.com/users/ch4n3-yoon/repos)
- [https://avatars.githubusercontent.com/u/13852925?v=4](https://avatars.githubusercontent.com/u/13852925?v=4)
- [https://api.github.com/users/ch4n3-yoon/events%7B/privacy%7D](https://api.github.com/users/ch4n3-yoon/events%7B/privacy%7D)

## Related threats

- [Rails Active Support regular expression injection in safe_constantize](https://junglewise.ai/threats/cve-2026-126080-active-support-is-a-collection-of-utility-classes-and-standard)
- [Rails Active Support MessagePack unsafe serialization XSS](https://junglewise.ai/threats/cve-2026-126075-active-support-is-a-collection-of-utility-classes-and-standard)
- [Rails Active Support has a possible DoS vulnerability in its number helpers](https://junglewise.ai/threats/cve-2026-33176-rails-active-support-has-a-possible-dos-vulnerability-in-its)
- [Rails Active Support has a possible ReDoS vulnerability in number_to_delimited](https://junglewise.ai/threats/cve-2026-33169-rails-active-support-has-a-possible-redos-vulnerability-in-number)
- [Active Support Possibly Discloses Locally Encrypted Files](https://junglewise.ai/threats/cve-2023-38037-active-support-possibly-discloses-locally-encrypted-files)
