GHSA-2w9f-fxwj-w2qf: Active Support: Possible XSS vulnerability in Active Support MessagePack serializer

Published Nov 10, 2026
·
Updated

Impact ActiveSupport::MessagePack serializes an ActiveSupport::SafeBuffer as its bytes alone and deserializes it as a new SafeBuffer, so a buffer that is no longer htmlsafe? (for example, one mutated in place with gsub!) is restored as htmlsafe. If such a buffer holds untrusted input and is stored through a MessagePack serializer, rendering it after it is loaded bypasses ERB auto-escaping, possibly leading to XSS.

Applications on Rails 8.1 are affected if they use a MessagePack serializer, such as config.actiondispatch.cookiesserializer = :messagepack or :messagepackallowmarshal, or serializer: :messagepack for Rails.cache, ActiveSupport::MessageVerifier or ActiveSupport::MessageEncryptor, and store a SafeBuffer that was mutated in place with untrusted input. Rails 8.0 and earlier do not serialize SafeBuffer with MessagePack and are not affected.

Details The fixed releases serialize a SafeBuffer that is not htmlsafe? with a marker and deserialize it as a String; a SafeBuffer that is htmlsafe? keeps the existing format. Versions without the fix cannot read an unsafe buffer serialized by the fixed releases, so during a rolling deploy a cookie or cache entry holding one could fail to load on a process that has not been upgraded.

Workarounds Applications that cannot upgrade can convert a SafeBuffer to a String with tostr before storing it in a value that a MessagePack serializer writes.

Releases The fixed releases are available at the normal locations.

Patches for those who cannot upgrade at once: - 8.1: https://github.com/rails/rails/commit/4ca090665976e6fbc471c38689b399f84b43cdc7.patch

Credit This issue was responsibly reported by HackerOne researcher jcwilk.

Affected Software

1 affected componentFixes available
rubygems/activesupport>=8.1.0.beta1<8.1.4.1
8.1.4.1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade rubygems/activesupport to a version that resolves this vulnerability.

    Fixed in 8.1.4.1
  2. Upgrade

    Upgrade Rails to a version that resolves this vulnerability.

    Patch 4ca090665976e6fbc471c38689b399f84b43cdc7
  3. Compensating control

    If upgrading is not immediately possible, convert any SafeBuffer to a String with to_str before storing it in a value written by a MessagePack serializer.

Event History

Nov 10, 2026
Advisory Published
via GitHub·09:27 PM
Data Sourced
via GitHub·09:27 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Which Rails deployments are exposed?

Rails 8.1 applications are affected only when they use a MessagePack serializer and persist an ActiveSupport::SafeBuffer that has been mutated in place with untrusted input. Rails 8.0 and earlier are not affected because they do not serialize SafeBuffer with MessagePack.

2

Which MessagePack uses should be reviewed?

Review cookies configured with config.action_dispatch.cookies_serializer = :message_pack or :message_pack_allow_marshal. Also review Rails.cache, ActiveSupport::MessageVerifier, and ActiveSupport::MessageEncryptor when configured with serializer: :message_pack.

3

What conditions are needed for exploitation?

An attacker-controlled value must end up in a SafeBuffer that is made unsafe by an in-place mutation such as gsub!, then be stored and later loaded through a MessagePack serializer. The application must subsequently render that restored value in a context where ERB auto-escaping would otherwise be relied upon.

4

What should be considered during a rolling upgrade?

Older, unfixed versions cannot read an unsafe buffer serialized by a fixed release. Mixed fixed and unfixed instances may therefore have serialization compatibility issues during a rolling deployment.

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.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203