CVE-2026-33170: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in rails activesupport
Active Support is a toolkit of support libraries and Ruby core extensions extracted from the Rails framework. Prior to versions 8.1.2.1, 8.0.4.1, and 7.2.3.1, `SafeBuffer#%` does not propagate the `@html_unsafe` flag to the newly created buffer. If a `SafeBuffer` is mutated in place (e.g. via `gsub!`) and then formatted with `%` using untrusted arguments, the result incorrectly reports `html_safe? == true`, bypassing ERB auto-escaping and possibly leading to XSS. Versions 8.1.2.1, 8.0.4.1, and 7.2.3.1 contain a patch.
AI Analysis
Technical Summary
This vulnerability, tracked as CVE-2026-33170, affects the ActiveSupport component of the Ruby on Rails framework, specifically the SafeBuffer class used for handling HTML-safe strings. SafeBuffer is designed to prevent cross-site scripting by marking strings as html_safe or unsafe, controlling whether ERB templates auto-escape content. Prior to the patched versions (8.1.2.1, 8.0.4.1, 7.2.3.1), the SafeBuffer#% method fails to propagate the @html_unsafe flag when the buffer is mutated in place (e.g., via destructive methods like gsub!) and then formatted with the % operator using untrusted input. This results in the output being incorrectly flagged as html_safe, causing ERB to skip escaping. Consequently, malicious input can be injected into web pages, leading to reflected or stored XSS attacks. The vulnerability does not require authentication but does require user interaction, such as visiting a crafted URL or submitting malicious input. The CVSS 4.0 vector indicates network attack vector, low attack complexity, no privileges required, user interaction needed, and limited impact on confidentiality and integrity, with no impact on availability. No known exploits are currently reported in the wild. The issue is fixed by ensuring the @html_unsafe flag is correctly propagated in the SafeBuffer#% method in the patched versions.
Potential Impact
The primary impact of this vulnerability is the potential for cross-site scripting attacks, which can allow attackers to execute arbitrary JavaScript in the context of affected web applications. This can lead to session hijacking, credential theft, defacement, or redirection to malicious sites. Organizations using vulnerable versions of Rails ActiveSupport in web applications risk exposing their users to these attacks, potentially damaging reputation and user trust. Since Rails is widely used for web development globally, the scope is broad. The vulnerability affects confidentiality and integrity partially but does not impact availability. Exploitation requires user interaction, which may limit automated widespread exploitation but targeted attacks remain a concern. The medium CVSS score reflects moderate risk, but the ease of patching and availability of fixes reduce long-term exposure if promptly addressed.
Mitigation Recommendations
Organizations should immediately upgrade to the patched versions of Rails ActiveSupport: 8.1.2.1 or later, 8.0.4.1 or later, or 7.2.3.1 or later, depending on their current version. If upgrading is not immediately feasible, review and audit any usage of SafeBuffer and string formatting in the application code to identify unsafe patterns, especially where destructive mutations and formatting with untrusted input occur. Implement additional input validation and sanitization on user-supplied data before it reaches formatting functions. Employ Content Security Policy (CSP) headers to mitigate the impact of potential XSS by restricting script execution sources. Conduct thorough testing of web applications to detect any XSS vulnerabilities, including automated scanning and manual penetration testing focused on input handling and output encoding. Monitor security advisories for any emerging exploit reports and apply patches promptly. Avoid relying solely on framework auto-escaping and consider defense-in-depth strategies for output encoding.
Affected Countries
United States, United Kingdom, Germany, France, Japan, India, Australia, Canada, Netherlands, Brazil
CVE-2026-33170: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in rails activesupport
Description
Active Support is a toolkit of support libraries and Ruby core extensions extracted from the Rails framework. Prior to versions 8.1.2.1, 8.0.4.1, and 7.2.3.1, `SafeBuffer#%` does not propagate the `@html_unsafe` flag to the newly created buffer. If a `SafeBuffer` is mutated in place (e.g. via `gsub!`) and then formatted with `%` using untrusted arguments, the result incorrectly reports `html_safe? == true`, bypassing ERB auto-escaping and possibly leading to XSS. Versions 8.1.2.1, 8.0.4.1, and 7.2.3.1 contain a patch.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
This vulnerability, tracked as CVE-2026-33170, affects the ActiveSupport component of the Ruby on Rails framework, specifically the SafeBuffer class used for handling HTML-safe strings. SafeBuffer is designed to prevent cross-site scripting by marking strings as html_safe or unsafe, controlling whether ERB templates auto-escape content. Prior to the patched versions (8.1.2.1, 8.0.4.1, 7.2.3.1), the SafeBuffer#% method fails to propagate the @html_unsafe flag when the buffer is mutated in place (e.g., via destructive methods like gsub!) and then formatted with the % operator using untrusted input. This results in the output being incorrectly flagged as html_safe, causing ERB to skip escaping. Consequently, malicious input can be injected into web pages, leading to reflected or stored XSS attacks. The vulnerability does not require authentication but does require user interaction, such as visiting a crafted URL or submitting malicious input. The CVSS 4.0 vector indicates network attack vector, low attack complexity, no privileges required, user interaction needed, and limited impact on confidentiality and integrity, with no impact on availability. No known exploits are currently reported in the wild. The issue is fixed by ensuring the @html_unsafe flag is correctly propagated in the SafeBuffer#% method in the patched versions.
Potential Impact
The primary impact of this vulnerability is the potential for cross-site scripting attacks, which can allow attackers to execute arbitrary JavaScript in the context of affected web applications. This can lead to session hijacking, credential theft, defacement, or redirection to malicious sites. Organizations using vulnerable versions of Rails ActiveSupport in web applications risk exposing their users to these attacks, potentially damaging reputation and user trust. Since Rails is widely used for web development globally, the scope is broad. The vulnerability affects confidentiality and integrity partially but does not impact availability. Exploitation requires user interaction, which may limit automated widespread exploitation but targeted attacks remain a concern. The medium CVSS score reflects moderate risk, but the ease of patching and availability of fixes reduce long-term exposure if promptly addressed.
Mitigation Recommendations
Organizations should immediately upgrade to the patched versions of Rails ActiveSupport: 8.1.2.1 or later, 8.0.4.1 or later, or 7.2.3.1 or later, depending on their current version. If upgrading is not immediately feasible, review and audit any usage of SafeBuffer and string formatting in the application code to identify unsafe patterns, especially where destructive mutations and formatting with untrusted input occur. Implement additional input validation and sanitization on user-supplied data before it reaches formatting functions. Employ Content Security Policy (CSP) headers to mitigate the impact of potential XSS by restricting script execution sources. Conduct thorough testing of web applications to detect any XSS vulnerabilities, including automated scanning and manual penetration testing focused on input handling and output encoding. Monitor security advisories for any emerging exploit reports and apply patches promptly. Avoid relying solely on framework auto-escaping and consider defense-in-depth strategies for output encoding.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-03-17T21:17:08.888Z
- Cvss Version
- 4.0
- State
- PUBLISHED
Threat ID: 69c1d4a9f4197a8e3ba0b46f
Added to database: 3/24/2026, 12:02:49 AM
Last enriched: 3/31/2026, 8:12:31 PM
Last updated: 5/7/2026, 3:01:45 PM
Views: 38
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.