CWE
79
Advisory Published
Updated

REDHAT-BUG-921331: XSS

First published: Thu Mar 14 2013(Updated: )

XSS vulnerability in sanitize_css in Action Pack There is an XSS vulnerability in the `sanitize_css` method in Action Pack. This vulnerability has been assigned the CVE identifier <a href="https://access.redhat.com/security/cve/CVE-2013-1855">CVE-2013-1855</a>. Versions Affected: All. Not affected: None. Fixed Versions: 3.2.13, 3.1.12 Impact ------ Carefully crafted text can bypass the sanitization provided in the `sanitize_css` method in Action Pack. Impacted code will look like this: sanitize_css(some_user_input) All users running an affected release should either upgrade or use one of the work arounds immediately. Releases -------- The 3.2.13 and 3.1.12 releases are available at the normal locations. Workarounds ----------- To work around this issue, you can apply the following monkey patch: ``` module HTML class WhiteListSanitizer # Sanitizes a block of css code. Used by #sanitize when it comes across a style attribute def sanitize_css(style) # disallow urls style = style.to_s.gsub(/url\s*\(\s*[^\s)]+?\s*\)\s*/, ' ') # gauntlet if style !~ /\A([:,;#%.\sa-zA-Z0-9!]|\w-\w|\'[\s\w]+\'|\"[\s\w]+\"|\([\d,\s]+\))*\z/ || style !~ /\A(\s*[-\w]+\s*:\s*[^:;]*(;|$)\s*)*\z/ return '' end clean = [] style.scan(/([-\w]+)\s*:\s*([^:;]*)/) do |prop,val| if allowed_css_properties.include?(prop.downcase) clean &lt;&lt; prop + ': ' + val + ';' elsif shorthand_css_properties.include?(prop.split('-')[0].downcase) unless val.split().any? do |keyword| !allowed_css_keywords.include?(keyword) &amp;&amp; keyword !~ /\A(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)\z/ end clean &lt;&lt; prop + ': ' + val + ';' end end end clean.join(' ') end end end ``` Patches ------- To aid users who aren't able to upgrade immediately we have provided patches for the two supported release series. They are in git-am format and consist of a single changeset. * 3-2-css_sanitize.patch - Patch for 3.2 series * 3-1-css_sanitize.patch - Patch for 3.1 series * 3-0-css_sanitize.patch - Patch for 3.0 series * 2-3-css_sanitize.patch - Patch for 2.3 series Please note that only the 3.1.x and 3.2.x series are supported at present. Users of earlier unsupported releases are advised to upgrade as soon as possible as we cannot guarantee the continued availability of security fixes for unsupported releases. Credits ------- Thanks to Charlie Somerville for reporting this!

Affected SoftwareAffected VersionHow to fix
Ruby on Rails ActionPack<3.1.12
Ruby on Rails ActionPack<3.2.13

Never miss a vulnerability like this again

Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.

Frequently Asked Questions

  • What is the severity of REDHAT-BUG-921331?

    The REDHAT-BUG-921331 vulnerability can be considered critical due to its XSS nature.

  • How do I fix REDHAT-BUG-921331?

    To fix REDHAT-BUG-921331, upgrade Ruby on Rails Action Pack to a version newer than 3.2.13.

  • What versions are affected by REDHAT-BUG-921331?

    All versions of Ruby on Rails Action Pack up to 3.2.13 are affected by REDHAT-BUG-921331.

  • What type of vulnerability is REDHAT-BUG-921331?

    REDHAT-BUG-921331 is an XSS (Cross-Site Scripting) vulnerability found in the sanitize_css method.

  • Who is impacted by REDHAT-BUG-921331?

    Any application using vulnerable versions of Ruby on Rails Action Pack is impacted by REDHAT-BUG-921331.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2025 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203