← All posts

Ruby2Shell: Update Ruby, Protect Applications with Cloudflare

Diagram: ß becomes SS, one byte spills past the reserved memory, below it a WAF layer filters requests

A security flaw with the German letter ß in its name sounds like a joke at first. Behind "ruby2ßhell", usually written Ruby2Shell, lies a serious problem in the Ruby programming language. On 18 November 2026 the Ruby project released fixed versions and rated the flaw as critical in advisory GHSA-34m4-m9fh-gqp5. It has since also been registered as CVE-2026-132825. This article reflects the situation as of 21 November 2026.

How an ß becomes a security problem

The bug lies in converting between upper and lower case. Older single-byte character encodings such as ISO-8859-1 or Windows-1252 have no capital ß. When Ruby converts an ß to upper case, the result is "SS", and the output grows by one byte for every ß. According to the researchers at Veria Labs, Ruby reserves the input length plus 20 bytes for the result and only checks for room for one character when writing. From the 21st ß onwards, one byte therefore lands beyond the reserved memory area.

A single extra byte sounds harmless. Under suitable conditions, however, such a memory error can be turned into remote code execution, meaning an attacker runs their own commands from afar. According to the Ruby advisory, proofs of concept demonstrate this in some scenarios. Veria Labs has announced its own demonstration against a default Rails installation for 25 November.

Typing 21 ß into any web form does not take over a server. The input has to be in one of the affected single-byte encodings and reach one of the conversion functions, such as upcase, swapcase, downcase(:fold) or casecmp?. According to Veria Labs, UTF-8 strings take a different code path that is not affected. A general "we use UTF-8" is still no proof of protection. What matters is which inputs and encodings an application actually processes.

Which applications you should check

According to Veria Labs, the flaw is reachable without prior login in the default configuration of Ruby on Rails and of Sinatra in classic style. As Cloudflare explains, an attacker sends a multipart request whose _method field declares a legacy character encoding and contains a run of ß characters. The Rack middleware MethodOverride converts this value to upper case before the application even processes the request.

You therefore need to check every Ruby runtime environment, meaning the installed Ruby version your applications run on. Affected are Ruby up to 3.3.13, 3.4.0 to 3.4.12 and 4.0.0 to 4.0.9.

Many self-hosted products ship their own Ruby runtime, for example GitLab, GitHub Enterprise Server, Mastodon, OpenProject, Discourse and Chatwoot. Here the fix comes from the vendor. Always assess product name, installed version and patch level together. The following applies to self-hosted installations; for SaaS offerings such as GitLab.com, the providers themselves are responsible.

As of 21 November, Mastodon and Chatwoot have released versions with an updated Ruby runtime, and Discourse has updated its base image. Veria Labs' overview also lists fixed versions for GitLab and OpenProject; check these against the vendor's release notes. For GitHub Enterprise Server, the release notes showed no fixed release by 21 November.

Immediate steps: update Ruby and check running instances

The fix is included in Ruby 3.3.14, 3.4.13 and 4.0.10 (Ruby advisory). Ruby 3.2 and older branches have reached end of life and no longer receive these fixes. If you still rely on them, you need to move to a supported branch.

The releases fix seven vulnerabilities in total in string conversion and regular expressions. Ruby2Shell is one of them; the other flaws are separate and have different triggers.

What counts is the runtime that is actually running. An updated package is of no use while application processes and background workers still run on the old version. Container images have to be rebuilt and rolled out, and processes restarted.

Cloudflare protection: WAF, origin and Access

Check the WAF rules against Ruby2Shell

A web application firewall (WAF) inspects incoming HTTP requests and blocks those that match known attack patterns. With the emergency release of 19 November 2026, Cloudflare published rules against CVE-2026-132825 with the default action "Block". This is called virtual patching, because the WAF filters dangerous requests before they reach the application. It does not fix the faulty Ruby code; that is the job of the update.

On the Free plan, the Free Managed Ruleset runs automatically according to Cloudflare. On Pro, Business and Enterprise, the Cloudflare Managed Ruleset is not necessarily active on every zone, and Cloudflare explicitly recommends checking. Overrides can also change a rule's action or disable it, and exceptions via skip rules take precedence over overrides (Managed Rules). Check therefore:

  • whether all hostnames of the affected applications are proxied through Cloudflare,
  • whether the right managed ruleset is deployed for this traffic,
  • whether the Ruby2Shell rule is set to "Block" or has been changed by an override,
  • whether skip exceptions exclude individual paths or hostnames from the managed rules.

Info box: Cloudflare rules against Ruby2Shell

  • Free plan, Cloudflare Free Managed Ruleset: rule ID 7328f23691e44b07892ebd25b19210f1
  • Pro, Business, Enterprise, Cloudflare Managed Ruleset: rule ID 1afa543a1ed84893b01df04c34402c88
  • Description "Ruby - Heap Overflow - CVE: CVE-2026-132825", default action Block, published on 19 November 2026

Why a proxy in front is not enough on its own

For context: with the nginx flaws of NGINX2Root, it already helped that Cloudflare terminates and re-establishes the HTTP connection, so the manipulated protocol frames never reached nginx. Ruby2Shell is different. The dangerous input is ordinary request content, a form field such as _method, and a proxy passes it on to the application. Only a rule that inspects this content stops the attack. A proxy in front or a split connection is no proof of protection here.

Prevent direct access to the origin

The WAF only applies to requests that pass through Cloudflare. If the origin, meaning the server running your application, can also be reached directly from the internet, an attacker simply bypasses the rules. Cloudflare recommends accepting only Cloudflare traffic at the origin and names two connection models for this.

  • Cloudflare Tunnel: A connector opens the connection to Cloudflare outbound, so the origin needs no public inbound ports (documentation). The tunnel does not close existing firewall rules or port forwards by itself; you remove those separately.
  • Origin with a controlled public connection: A firewall only allows web access from Cloudflare's IP ranges. With Authenticated Origin Pulls (AOP), Cloudflare also identifies itself with a client certificate. This is only tied to your account with your own certificate at zone or hostname level.

The two models are separate: for hostnames behind Cloudflare Tunnel, AOP settings have no effect. The TLS mode Full (strict) encrypts the path to the origin and validates its certificate, but it does not prevent direct access.

Protect internal applications with Cloudflare Access

Some Ruby applications should only be open to employees or partners, for example a self-hosted GitLab or an internal ticketing system. Here, Cloudflare Access puts an identity and access check in front of the application. Only after users sign in through your identity provider, for example with their company account and MFA, does Cloudflare forward requests.

The Access policy must then cover the entire application. If you only protect the login or admin URL, other paths stay public, and Ruby2Shell needs no login. APIs, webhooks and other machine access belong in the plan from the start. Access does not suit public portals; there, the WAF and updates remain central.

Where protection ends

The WAF only sees HTTP traffic that flows through Cloudflare. Input from emails, file imports, queues, background jobs or internal connections reaches the flaw by another route, as Cloudflare also stresses. There is also a general limit: the WAF only inspects request bodies up to a plan-dependent size, and according to Cloudflare, content beyond that may not be fully analysed. This does not demonstrate a bypass of the Ruby2Shell rules, but it belongs in the risk assessment. The WAF is a compensating control; only the update delivers the fix.

The measures at a glance

Measure

Benefit

Prerequisite

Ruby or product update

Fixes the flaw in the code

Processes, workers and containers run on the new runtime

Cloudflare WAF

Blocks known Ruby2Shell requests before the application

Hostname proxied, ruleset active, rule set to "Block", no skip exception

Origin protection

Prevents attackers from bypassing the WAF

Tunnel without leftover open access, or a firewall with enforced AOP

Cloudflare Access

Only signed-in users reach internal applications

Policy covers the entire application, machine access is planned

Checklist for IT managers

  1. Inventory every Ruby runtime on servers, in container images and in products with their own Ruby version.
  2. Assess the versions. Ruby before 3.3.14, 3.4.13 and 4.0.10 as well as Ruby 3.2 and older count as affected; for products, the vendor's patch level is what matters.
  3. Install the updates, rebuild images, restart application and background processes and check the running version.
  4. Check the WAF's proxy status, active ruleset, rule action, overrides and skip exceptions.
  5. Close the direct path to the origin via Tunnel or a firewall with AOP, and test it from the outside.
  6. Put internal applications entirely behind Access and include input paths outside HTTP in your assessment.

How KAEMI helps

In an assessment we record the affected applications and Ruby runtimes together with you. We then review your Cloudflare configuration: which hostnames actually run through Cloudflare, whether the managed rules are effective and where overrides or exceptions leave gaps. We design origin access and Access policies to fit your applications and machine access.

In day-to-day operations as a managed service, we build updates and protective measures into fixed processes and monitor security events and configuration changes traceably, including the WAF from our Application Security offering.

Would you like to know how your Ruby applications and your Cloudflare environment are set up? Get in touch. Together we review applications, runtimes and configuration and agree on the next steps.

Sources

Want to protect your web apps and APIs from flaws like this for good?

Related to “Ruby2Shell”: KAEMI implements and manages WAF, DDoS protection, bot and API management on the Cloudflare platform — as a managed service.