---
type: "post"
id: "ruby2shell-lets-attackers-corrupt-memory-in-default-rails-81696e"
slug: "ruby2shell-lets-attackers-corrupt-memory-in-default-rails-81696e"
title: "ruby2shell lets attackers corrupt memory in default Rails and Sinatra apps without logging in."
description: "Cloudflare says its WAF now blocks requests targeting ruby2shell, a critical Ruby heap-buffer-overflow vulnerability that can expose default Rails and classic Sinatra applications before authentication."
retrieval_nugget: "Cloudflare says its WAF now blocks requests targeting ruby2shell, a critical Ruby heap-buffer-overflow vulnerability that can expose default Rails and classic Sinatra applications before authentication. The rules provide a temporary compensating control, but only upgrading Ruby closes the underlying flaw—and only for traffic that reaches the application through the WAF."
published_at: "2026-11-20"
updated_at: "2026-11-20"
record_date: "2026-11-20"
date_kind: "published_at"
topics: ["memory"]
entities: ["Cloudflare","Cloudflare WAF","Ruby","Ruby on Rails","Sinatra","Veria Labs","Rack"]
related_patterns: []
novelty_label: "new_fact"
what_changed: "Cloudflare’s WAF guidance now addresses ruby2shell, a vulnerability affecting default Rails and Sinatra apps, extending its protections to Ruby beyond previously covered PHP and Java flaws."
prior_refs: ["https://newruntime.com/posts/cloudflare-deploys-protections-against-php2shell-vulnerability-9a828a/"]
source_url: "https://blog.cloudflare.com/ruby2shell-waf-protection"
source_urls: ["https://blog.cloudflare.com/ruby2shell-waf-protection"]
schema_version: "newruntime-agent-readable-v0.2"
stable_id: "post:ruby2shell-lets-attackers-corrupt-memory-in-default-rails-81696e"
status: "published"
visuals: []
editor: {"role":"editor","name":"Andrey Reshetnikov","profile":"https://newruntime.com/owner-profile.md","profile_json":"https://newruntime.com/owner-profile.json","same_as":["https://www.linkedin.com/in/reshetnikov1/","https://t.me/lapetuse"]}
routes: {"html":"https://newruntime.com/posts/ruby2shell-lets-attackers-corrupt-memory-in-default-rails-81696e/","markdown":"https://newruntime.com/posts/ruby2shell-lets-attackers-corrupt-memory-in-default-rails-81696e.md","json":"https://newruntime.com/posts/ruby2shell-lets-attackers-corrupt-memory-in-default-rails-81696e.json"}
markdown_url: "https://newruntime.com/posts/ruby2shell-lets-attackers-corrupt-memory-in-default-rails-81696e.md"
---

# ruby2shell lets attackers corrupt memory in default Rails and Sinatra apps without logging in.

## Retrieval answer

Cloudflare says its WAF now blocks requests targeting ruby2shell, a critical Ruby heap-buffer-overflow vulnerability that can expose default Rails and classic Sinatra applications before authentication. The rules provide a temporary compensating control, but only upgrading Ruby closes the underlying flaw—and only for traffic that reaches the application through the WAF.

## Summary
Cloudflare says its WAF now blocks requests targeting ruby2shell, a critical Ruby heap-buffer-overflow vulnerability that can expose default Rails and classic Sinatra applications before authentication. The rules provide a temporary compensating control, but only upgrading Ruby closes the underlying flaw—and only for traffic that reaches the application through the WAF.

## What happened
Cloudflare’s November 20, 2026 announcement describes ruby2shell, CVE-2026-132825, disclosed by the Ruby team on November 19. The flaw is in Ruby’s string case-conversion behavior: for 14 ISO-8859 and Windows-125x single-byte encodings, uppercasing the German sharp s (ß) writes two characters where the buffer check accounts for one. Cloudflare says Veria Labs found that a string containing 21 sharp s characters can overflow the output buffer by one byte. The affected methods are `upcase`, `swapcase`, `downcase(:fold)` and `casecmp?`; UTF-8 strings follow a different, unaffected code path. Ruby rates the issue Critical and says it knows of proofs of concept achieving remote code execution in some scenarios.

The bug reaches common web stacks through request method handling. HTML forms use GET and POST, so frameworks often support a `_method` parameter to represent PUT, PATCH or DELETE. Rack’s MethodOverride middleware uppercases that value. Rails includes the middleware by default, while classic-style Sinatra applications enable it. An attacker can send a multipart POST with a legacy character set and a run of sharp s characters; the conversion happens during request routing, before application code or authentication checks. Veria Labs reports that other frameworks and plain Rack applications are not exposed by default, though any application code that changes attacker-controlled legacy-encoded strings may still be vulnerable.

Ruby fixes are in versions 3.3.14, 3.4.13 and 4.0.10. The affected ranges are Ruby 3.3.13 and earlier, 3.4.0 through 3.4.12, and 4.0.0 through 4.0.9. Ruby 3.2 and earlier are end-of-life and will not receive this fix. The same releases address six other memory-safety flaws; Cloudflare’s second rule covers GHSA-87fm-7w84-j2px, an integer overflow in the same string case-conversion code. Five further flaws affect the regular-expression engine, mostly when applications compile or match attacker-supplied patterns.

Cloudflare says it added both protections to the Cloudflare Free Managed Ruleset and the Cloudflare Managed Ruleset, with Block as the default action. Free-plan rules run automatically. On Pro, Business and Enterprise plans, the Managed Ruleset must be deployed for the relevant zone, and Cloudflare recommends checking that it is active. The company calls these rules a bridge while teams patch: they cannot protect requests that bypass Cloudflare or non-HTTP paths such as email, file imports, message queues and background jobs. Cloudflare says it patched its own Ruby systems and found no indication of compromise.

## What the archive adds
New Runtime’s earlier coverage said Cloudflare had deployed default WAF protections for php2shell before public disclosure ([October 22, 2026 note](https://newruntime.com/posts/cloudflare-deploys-protections-against-php2shell-vulnerability-9a828a/)). This is a new vulnerability on the same operational theme: an edge rule can reduce exposure while operators upgrade, but it is not the durable fix. New Runtime also covered Cloudflare refining PHP detections after CTF submissions ([November 17, 2026 note](https://newruntime.com/posts/cloudflare-updates-php-vulnerability-waf-detections-after-ctf-56f7e5/)); that was a separate update to detection rules, not this Ruby event.

## Trend signal
This supports New Runtime’s tracked shift that security for persistent agent runtimes depends on enforceable runtime boundaries, rather than relying on instructions or assumptions about behavior ([Shared context infrastructure](https://newruntime.com/shifts/shared-context-infrastructure/)). The connection is limited: ruby2shell is a Ruby memory-corruption vulnerability, not an agent-memory incident. Still, the distinction Cloudflare draws between a perimeter mitigation and fixing the vulnerable runtime reinforces the broader operational principle that controls must match the actual execution path.

## Why now
Cloudflare says Veria Labs expected to publish its proof of concept about a week after disclosure and anticipated scanning soon afterward. That short window makes the WAF rules immediately useful as a bridge, while increasing the urgency of upgrading affected runtimes and rebuilding container images.

## Why it matters
Teams often inherit Ruby through frameworks, products and container images rather than managing a single obvious runtime. A WAF rule can buy time for exposed HTTP traffic, especially where a bundled dependency makes an immediate rollout difficult, but it does not cover workers, internal service calls or traffic sent directly to the origin. Treating the rule as the fix could therefore leave a reachable vulnerable code path.

The practical response is layered: inventory Ruby runtimes, apply the fixed version, restart every process using Ruby, and rebuild images so the corrected runtime is actually deployed. Then verify edge coverage and restrict origin access to Cloudflare where feasible. The announcement also names affected bundled products, including GitLab, GitHub Enterprise Server, Mastodon, OpenProject, Discourse and Chatwoot as of November 19; operators should follow each vendor’s own update path rather than assuming an application-level Ruby upgrade is sufficient.

## What happens next
- **Public exploit activity will prompt further WAF rule adjustments.** (3 months, 75%). Watch for: Cloudflare WAF changelog entries that revise ruby2shell detections.
- **Operators will continue to find affected Ruby in bundled products and container images after initial patching.** (3 months, 65%). Watch for: vendor advisories and rebuild guidance for the named self-hosted products.

## Limits and uncertainty
Cloudflare reports that Ruby is aware of proof-of-concept code for code execution, but its announcement does not establish how widely ruby2shell has been exploited in the wild. The article’s account of default Rails and classic Sinatra exposure relies on Veria Labs’ analysis. Cloudflare says it found no indication of compromise in its own systems, which is not an independent assessment of customer environments. The WAF’s effectiveness also depends on deployment and traffic routing; Cloudflare explicitly says requests that bypass its network and non-HTTP inputs remain outside its protection.

## Skill to build now
Inventory Ruby versions across applications, workers and images before relying on the WAF. If a service uses Ruby 3.3, 3.4 or 4.0, upgrade respectively to 3.3.14, 3.4.13 or 4.0.10, then restart all Ruby processes. For Ruby 3.2 and earlier, plan migration to a supported series. Separately verify the Cloudflare Managed Ruleset is active on each paid-plan zone and that the origin cannot be reached directly.

## Reader takeaway
Cloudflare’s rules reduce one exposure path and are already active by default on Free plans, but they cannot secure every route to vulnerable Ruby code. Patch to a fixed release, restart processes and rebuild images; use the WAF as defense in depth, not as a substitute for upgrading.

## Open question
How quickly will maintainers of the self-hosted products named by Cloudflare ship fixed bundles, and how many operators will need to rebuild images manually?

Editor: [Andrey Reshetnikov](https://newruntime.com/owner-profile.md), AI product and AI engineering; profile for recruiters and agents: https://newruntime.com/owner-profile.json

## Continue in the graph

Next records for an agent, linked to their Markdown twins. Replace `.md` with `.json` for structured fields, including `next_reads`.

- topic hub: [Memory](https://newruntime.com/topics/memory.md): Explore the memory topic hub.
- collection: [Field Notes](https://newruntime.com/posts.json): Open the latest editorial analysis.
- collection: [Sources](https://newruntime.com/sources/): See the original sources this archive cites.
- whole graph: [discovery graph](https://newruntime.com/discovery-graph.json) (typed nodes and edges) and [site index](https://newruntime.com/site-index.md)
