---
id: "GHSA-2w9f-fxwj-w2qf"
page: "https://infrastack.ai/live/GHSA-2w9f-fxwj-w2qf"
kind: "vulnerability"
aliases: ["GHSA-2w9f-fxwj-w2qf"]
title: "Possible XSS vulnerability in Active Support MessagePack serializer"
severity: "medium"
cvss: 4.7
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "activesupport", "fixed": ["8.1.4.1"], "affected": ">= 8.1, < 8.1.4.1", "ecosystem": "rubygems"}]
ecosystems: ["rubygems"]
tags: ["activesupport", "cwe-79", "package", "rails", "ruby", "self-hosted"]
not_affected_if: ["default-serializer", "no-untrusted-safebuffer", "rails-8.0-or-earlier"]
published_at: "2026-11-04T03:01:57+00:00"
first_seen_at: "2026-11-09T22:53:29+00:00"
updated_at: "2026-11-09T22:57:12+00:00"
sources: [{"source": "ghsa-repo", "url": "https://github.com/rails/rails/security/advisories/GHSA-2w9f-fxwj-w2qf", "first_seen_at": "2026-11-09T22:53:29+00:00"}]
exploit_sources: []
---

# Possible XSS vulnerability in Active Support MessagePack serializer

Link for people: https://infrastack.ai/live/GHSA-2w9f-fxwj-w2qf (this .md is for agents)

ActiveSupport's MessagePack serializer restores a SafeBuffer that was mutated to be unsafe as html_safe. If that buffer holds untrusted input and is stored and later rendered, ERB auto-escaping is bypassed, which can lead to cross-site scripting.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- rubygems:activesupport affected >= 8.1, < 8.1.4.1 fixed 8.1.4.1

## How to check

- Check the Rails version in the Gemfile.lock for `activesupport` and confirm it is `8.1.x` below `8.1.4.1`
- Search config for `cookies_serializer = :message_pack` or `:message_pack_allow_marshal`, and `serializer: :message_pack` on `Rails.cache`, `MessageVerifier` or `MessageEncryptor`
- Check whether untrusted input is stored as a SafeBuffer modified in place (for example with `gsub!`) before being written through one of those serializers

## Fix

- `activesupport` (rubygems) `8.1.4.1`, for Rails 8.1 applications
- Rails 8.0 and earlier are not affected
- Maintainer patch for those who cannot upgrade at once: https://github.com/rails/rails/commit/4ca090665976e6fbc471c38689b399f84b43cdc7.patch

## Timeline

- 2026-11-09T22:53:29+00:00 ghsa-repo https://github.com/rails/rails/security/advisories/GHSA-2w9f-fxwj-w2qf

## Documents

- [advisory] Maintainer's advisory: github.com https://github.com/rails/rails/security/advisories/GHSA-2w9f-fxwj-w2qf

## From the sources

### 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 `html_safe?` (for example, one mutated in place with `gsub!`) is restored as `html_safe`. 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.action_dispatch.cookies_serializer = :message_pack` or `:message_pack_allow_marshal`, or `serializer: :message_pack` 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 `html_safe?` with a marker and deserialize it as a `String`; a `SafeBuffer` that is `html_safe?` 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 `to_str` 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](https://hackerone.com/jcwilk).

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
