Technical impact
Active Support's MessagePack serializer restores SafeBuffer objects as html_safe even after mutation, allowing attacker-controlled HTML to bypass ERB auto-escaping when rendered, which can lead to cross-site scripting attacks.
Affected Systems
Rails 8.1 (vendor rails:rails) is affected from version 8.1.0 up to but not including 8.1.4.1. Applications that enable the MessagePack serializer—for example, via config.action_dispatch.cookies_serializer = :message_pack, :message_pack_allow_marshal, or serializer: :message_pack for Rails.cache, ActiveSupport::MessageVerifier, or ActiveSupport::MessageEncryptor—and store a SafeBuffer that has been mutated with untrusted input are vulnerable. Rails 8.0 and earlier are not affected.
Risk and Exploitability
The CVSS score of 4.7 suggests moderate risk, while the EPSS score of <1% indicates a low likelihood of exploitation. The vulnerability is not listed in CISA KEV. The likely attack vector is an attacker supplying untrusted input that is stored via a MessagePack serializer; upon deserialization the content is treated as html_safe and rendered without escaping. Successful exploitation requires that the application subsequently renders the restored string in an ERB template. Because the vector involves local mutation of SafeBuffer objects in application code or configuration, widespread remote exploitation appears limited, but the presence of such data in cookies, cache, sessions, or other serializable payloads could expose vulnerable sites if attackers control the input.
Github GHSA