Security Vulnerability Report
中文
CVE-2026-33170 CVSS 6.1 MEDIUM

CVE-2026-33170

Published: 2026-03-24 00:16:28
Last Modified: 2026-03-24 18:00:00

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.

CVSS Details

CVSS Score
6.1
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Configurations (Affected Products)

cpe:2.3:a:rubyonrails:rails:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:a:rubyonrails:rails:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:a:rubyonrails:rails:*:*:*:*:*:*:*:* - VULNERABLE
Ruby on Rails Active Support < 8.1.2.1
Ruby on Rails Active Support < 8.0.4.1
Ruby on Rails Active Support < 7.2.3.1

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
# PoC for CVE-2026-33170 require 'active_support/core_ext/string/output_safety' # Create a SafeBuffer safe_str = ActiveSupport::SafeBuffer.new("Hello ") # Mutate in place safe_str.gsub!("Hello", "World") # Use untrusted input with % untrusted_input = "<script>alert(1)</script>" result = safe_str % untrusted_input # Check vulnerability if result.html_safe? puts "[VULNERABLE] Result is marked html_safe: #{result}" else puts "[PATCHED] Result is not html_safe" end

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-33170", "sourceIdentifier": "[email protected]", "published": "2026-03-24T00:16:28.287", "lastModified": "2026-03-24T18:00:00.080", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "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."}, {"lang": "es", "value": "Active Support es un conjunto de herramientas de bibliotecas de soporte y extensiones del núcleo de Ruby extraídas del framework de Rails. Antes de las versiones 8.1.2.1, 8.0.4.1 y 7.2.3.1, 'SafeBuffer#%' no propaga el flag '@html_unsafe' al búfer recién creado. Si un 'SafeBuffer' es mutado in situ (p. ej., a través de 'gsub!') y luego formateado con '%' usando argumentos no confiables, el resultado informa incorrectamente que 'html_safe? == true', omitiendo el auto-escapado de ERB y posiblemente llevando a XSS. Las versiones 8.1.2.1, 8.0.4.1 y 7.2.3.1 contienen un parche."}], "metrics": {"cvssMetricV40": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "4.0", "vectorString": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X", "baseScore": 5.3, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "attackRequirements": "NONE", "privilegesRequired": "NONE", "userInteraction": "PASSIVE", "vulnConfidentialityImpact": "NONE", "vulnIntegrityImpact": "LOW", "vulnAvailabilityImpact": "NONE", "subConfidentialityImpact": "NONE", "subIntegrityImpact": "NONE", "subAvailabilityImpact": "NONE", "exploitMaturity": "NOT_DEFINED", "confidentialityRequirement": "NOT_DEFINED", "integrityRequirement": "NOT_DEFINED", "availabilityRequirement": "NOT_DEFINED", "modifiedAttackVector": "NOT_DEFINED", "modifiedAttackComplexity": "NOT_DEFINED", "modifiedAttackRequirements": "NOT_DEFINED", "modifiedPrivilegesRequired": "NOT_DEFINED", "modifiedUserInteraction": "NOT_DEFINED", "modifiedVulnConfidentialityImpact": "NOT_DEFINED", "modifiedVulnIntegrityImpact": "NOT_DEFINED", "modifiedVulnAvailabilityImpact": "NOT_DEFINED", "modifiedSubConfidentialityImpact": "NOT_DEFINED", "modifiedSubIntegrityImpact": "NOT_DEFINED", "modifiedSubAvailabilityImpact": "NOT_DEFINED", "Safety": "NOT_DEFINED", "Automatable": "NOT_DEFINED", "Recovery": "NOT_DEFINED", "valueDensity": "NOT_DEFINED", "vulnerabilityResponseEffort": "NOT_DEFINED", "providerUrgency": "NOT_DEFINED"}}], "cvssMetricV31": [{"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "baseScore": 6.1, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "REQUIRED", "scope": "CHANGED", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "availabilityImpact": "NONE"}, "exploitabilityScore": 2.8, "impactScore": 2.7}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-79"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:rubyonrails:rails:*:*:*:*:*:*:*:*", "versionEndExcluding": "7.2.3.1", "matchCriteriaId": "D9DC6CB9-DC6C-4CBB-9806-3936ADBC8F1B"}, {"vulnerable": true, "criteria": "cpe:2.3:a:rubyonrails:rails:*:*:*:*:*:*:*:*", "versionStartIncluding": "8.0.0", "versionEndExcluding": "8.0.4.1", "matchCriteriaId": "FA8791E1-8B96-43F6-A3EC-A7E60D700330"}, {"vulnerable": true, "criteria": "cpe:2.3:a:rubyonrails:rails:*:*:*:*:*:*:*:*", "versionStartIncluding": "8.1.0", "versionEndExcluding": "8.1.2.1", "matchCriteriaId": "978E0135-D14B-41DE-87E4-CF059A23E189"}]}]}], "references": [{"url": "https://github.com/rails/rails/commit/50d732af3b7c8aaf63cbcca0becbc00279b215b7", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/rails/rails/commit/6e8a81108001d58043de9e54a06fca58962fc2db", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/rails/rails/commit/c1ad0e8e1972032f3395853a5e99cea035035beb", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/rails/rails/releases/tag/v7.2.3.1", "source": "[email protected]", "tags": ["Release Notes"]}, {"url": "https://github.com/rails/rails/releases/tag/v8.0.4.1", "source": "[email protected]", "tags": ["Release Notes"]}, {"url": ... (truncated)