On this page (7 sections)

A critical flaw has been recorded in rubygem-safemode, a Ruby library that runs template code inside a restricted sandbox. According to the GitHub Advisory Database entry, compound assignment expressions in sandboxed code are evaluated without going through the Jail allow-list, so a template author can call methods the sandbox is meant to block.

If your Ruby application lets users, editors or tenants write templates and renders them with safemode, this is worth checking today. The advisory currently lists no affected or patched versions, so you will need to work out your own exposure.

What happened

The NVD record and the GitHub advisory were published on November 12, 2026 and carry identical wording, so they should be read as one source rather than two confirmations. Red Hat also tracks the issue in its CVE page and a Bugzilla entry, which are listed as references.

The GitHub entry is marked Unreviewed and lists no package from a supported ecosystem, which is why Dependabot alerts are not supported for it. Do not wait for an automated alert; none will arrive from this advisory.

Technical details

Safemode works by evaluating template code against a Jail, an allow-list of objects and methods that template authors may touch. The idea is that even if an attacker controls the template text, they can only reach what you deliberately exposed.

The advisory says compound assignment expressions (the kind that combine an operation with an assignment) are evaluated without method calls being mediated by the Jail. As a result, an authenticated attacker who can supply template content can invoke arbitrary no-argument methods on objects exposed to the template renderer. The advisory names two impacts: destructive operations such as host deletion, and disclosure of object state that is not on the allow-list.

This is the weakness class CWE-183, where a protection based on an allow-list is too permissive. In plain terms, the guard exists, but one code path walks around it. The advisory does not describe more than this, and none of the research includes exploit details.

Reading the CVSS vector

  • Network attack vector and low complexity: no special conditions are needed beyond access to the template feature.
  • Low privileges required: the attacker needs an account that can submit template content, not an administrator.
  • No user interaction: nobody else has to click anything.
  • Scope changed, high confidentiality and high integrity impact, no availability impact in the score, even though the description mentions destructive operations.

Who is affected

The realistic exposure is a Ruby application that uses the safemode gem to render templates written by people you do not fully trust. Examples include admin-editable email or page templates, multi-tenant systems where each customer customizes output, and management tools that let operators write snippets.

Impact depends on which objects your application exposes to the renderer. The advisory describes arbitrary no-argument methods on those objects, so an exposed object with a destructive no-argument method is the worst case. Applications that never render user-written templates through safemode are not in the described scenario.

Affected and patched versions are listed as unknown in the advisory. Treat every version of the gem as potentially affected until the maintainers or your distribution say otherwise.

How to check your exposure

Start by finding out whether safemode is in your dependency tree at all. This read-only command, run from the root of a Ruby project that uses Bundler, lists the gem and its version if it is present:

Check whether safemode is a dependency (run in the project directory)Shell
bundle list | grep -i safemode

To see which gems depend on it, and whether it is only a transitive dependency, run this in the same directory. The output shows the gem and its dependents, or an error if it is not in the bundle:

Show what pulls in safemode (run in the project directory)Shell
bundle exec gem dependency safemode --reverse-dependencies

Also search your codebase for where the Jail and renderer are used, so you know which objects are exposed to template authors:

Find safemode usage in source files (run from the repository root)Shell
grep -rniE "safemode|jail" --include=*.rb --include=Gemfile --include=Gemfile.lock .

If your system installs the package from a Linux distribution, the name used by Red Hat for this component is rubygem-safemode. On RHEL-family systems you can query it read-only:

Check for the packaged gem (RHEL, Fedora and similar)Shell
rpm -q rubygem-safemode

What to do now

No fixed version is documented yet, so the priority is reducing who can submit template content and watching for a vendor fix.

  1. Confirm whether safemode is used, directly or as a dependency, using the checks above.
  2. List every place where users or tenants can submit template content, and restrict that feature to trusted administrators until a fix exists.
  3. Review which objects you expose to the template renderer and remove any that have destructive or sensitive no-argument methods.
  4. Follow the GitHub advisory, the Red Hat CVE page and the Bugzilla entry for patched versions, then update the gem and redeploy.
  5. Review recent template changes made by non-administrators and check application logs for unexpected deletions or data access.
  6. Back up data that your application can delete through exposed objects, and make sure the restore process works.
  7. If you cannot restrict template authoring and cannot patch, consider replacing sandboxed Ruby evaluation with a logic-less template format.
Caution. Redeploying or restarting your application to pick up a gem update briefly interrupts service. Do it in a maintenance window and test template rendering afterwards.

Detection and monitoring

Because exploitation is not confirmed in the research, focus on spotting misuse by authorized but low-privileged accounts. Log who creates or edits templates, and alert on edits by accounts that rarely do so. Watch for unexpected record or host deletions and for template output that contains internal object details.

A web application firewall will not reliably catch this, since the malicious input is a legitimate-looking template submitted by a logged-in user. For background, see what a WAF is and how outside-in detection has limits. Keeping an eye on your site's availability and changes through monitoring can help you notice side effects such as unexpected downtime after destructive actions.

What we do not know yet

  • Which safemode versions are affected and which, if any, contain a fix.
  • Whether the flaw is being exploited. The research reports no exploitation and no CISA KEV listing.
  • Whether a public proof of concept exists. None is described in the sources.
  • Whether other sandbox constructs beyond compound assignment are affected.

Only one independent publisher covers this story so far, and the NVD record repeats the GitHub text. Expect details to change as maintainers and distributors respond, and recheck the references above before deciding the issue is closed.

Sources

This article is based on the public sources below. Details can change as vendors and researchers publish more; check the original advisories before acting on version numbers.

  1. CVE-2026-107360 - GitHub Advisory Databasegithub.com
  2. CVE-2026-107360: A flaw was found in rubygem-safemode.nvd.nist.gov ·
  • CVE-2026-107360
  • Ruby
  • rubygem-safemode
  • sandbox escape
  • template injection