Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-107360 — Proof-of-concept and differential lab for CVE-2026-107360, a rubygem-safemode compound-assignment Jail allow-list bypass enabling arbitrary no-arg method calls in Foreman/Satellite templates. | Kitploit
Tools/GitHubGitHub/googlesky/cve-2026-107360
Vulnerability AnalysisCode AnalysisExploitationWeb Application ExploitationSecurity VirtualizationPenetration TestingRed TeamingLabs & Practice
GitHubgooglesky/cve-2026-107360

CVE-2026-107360

Proof-of-concept and differential lab for CVE-2026-107360, a rubygem-safemode compound-assignment Jail allow-list bypass enabling arbitrary no-arg method calls in Foreman/Satellite templates.

4 days agoNot yet reviewed
View Repository
Share

CVE-2026-107360 — rubygem-safemode compound-assignment Jail allow-list bypass

CVECVE-2026-107360
Componentrubygem-safemode — sandboxed template evaluator (lib/safemode/parser.rb), as used by Foreman and Red Hat Satellite 6
AffectedEvery released safemode version through 2.0.3 (tag edc74ce); Red Hat Satellite 6.16, 6.17, 6.18 (rubygem-safemode 1.5.0-1/1.5.0-2)
Fixed inUpstream PR #75 (commits ca7d4e5, 0bd3998, branch fix/cve-2026-107360), not yet merged to master; Red Hat package rubygem-safemode 1.5.0-3.el8sat / 1.5.0-3.el9sat (RHSA-2026:99949/99950/99952)
CWECWE-183 (Permissive List of Allowed Inputs); classified CWE-265 by VulDB
ImpactArbitrary no-argument method invocation on objects exposed to the template renderer without Jail allow-list mediation (host deletion, host reboot), unmediated attribute and indexed setters, disclosure of non-allow-listed object state
VectorAuthenticated low-privilege user supplying ERB template content rendered by Foreman/Satellite with safemode_render enabled
TriggerAny compound assignment whose getter or setter is not allow-listed: `@host.destroy
CreditKaya Emre Arikan, via Red Hat Product Security (Bugzilla 2547645)

Compound assignment expressions in safemode-sandboxed template code are evaluated without mediating method calls through the Jail allow-list. The parser allowlist in safemode 2.0.3 admits the op_asgn/safe_op_asgn sexp node family while providing no handling for them, so Ruby2Ruby emits the assignment literally: the getter and the setter are invoked by assignment syntax on the raw receiver — an instance variable resolved directly on the Safemode::Scope — and never pass through the call nodes where safemode inserts .to_jail. An authenticated user who can supply template content therefore invokes any zero-argument method on any template object, executes any setter, and reads back any attribute the renderer exposes, regardless of the Jail allow-list. Foreman renders provisioning templates, partition tables, report templates and job templates exactly this way; the proof-of-concept in this repository deletes a probe host object and extracts a non-allow-listed secret attribute through the sandbox.

1. Root cause

safemode rewrites sandboxed Ruby source before evaluation: the source is parsed with Prism (Prism::Translation::RubyParser), every call node gets .to_jail inserted on its receiver by Safemode::Parser#process_call, and the rewritten tree is emitted back to Ruby source by Ruby2Ruby and evaluated inside a Safemode::Scope binding.

In safemode 2.0.3, the parser's static node allowlist explicitly admits the compound assignment node family while its own comment records the consequence (lib/safemode/parser.rb:93-96):

                   # NOTE: op_asgn*/safe_op_asgn* do not insert .to_jail on the
                   # receiver. Setters are called directly on the real object, bypassing Jail.
                   :op_asgn, :op_asgn1, :op_asgn2, :op_asgn_and, :op_asgn_or,
                   :safe_op_asgn, :safe_op_asgn2,

None of these node types has a process_* handler in 2.0.3, so they fall through to Ruby2Ruby's default processing and are emitted verbatim. The sexp shapes on ruby 3.1.7 / prism 1.9.0 (evidence/sexp-dump-vulnerable.txt) show why the bypass is complete: the receiver is an ivar node, not a call node, and the method invocation is implicit in the assignment syntax.

"@probe.dest ||= nil"  ->  s(:op_asgn2, s(:ivar, :@probe), :dest=, :"||", s(:nil))
"@probe&.dest ||= nil" ->  s(:safe_op_asgn2, s(:ivar, :@probe), :dest=, :"||", s(:nil))
"@probe[0] ||= 1"      ->  s(:op_asgn1, s(:ivar, :@probe), s(:arglist, s(:lit, 0)), :"||", s(:lit, 1))

Safemode::Scope resolves @probe as the real object (Scope#initialize assigns @probe = instance_vars[:probe]). The emitted code is the literal assignment, so:

  • @host.destroy ||= nil evaluates destroy on the real Host object — any zero-argument method name works as the getter, allow-listed or not;
  • a falsy getter (@host.audit ||= 1) reaches the setter audit= on the real object;
  • @host[0] ||= 1 invokes both [] and []= on the real object;
  • the expression value is the getter's return value, so @host.secret ||= nil returns non-allow-listed object state to the template.

Plain assignments are not exploitable: attrasgn/safe_attrasgn were removed from the allowlist by commit e963aab ("Reject unreviewed parser nodes", safemode 2.0.3) and raise Safemode::SecurityError at rewrite time. The compound-assignment family is the only gate left open.

The upstream fix (PR #75) moves op_asgn, op_asgn1 and op_asgn2 (and their safe-navigation forms) out of the static allowlist into explicit handlers (lib/safemode/parser.rb:159-205 on fix/cve-2026-107360):

LOGICAL_ASSIGNMENT_OPERATORS = [:"||", :"&&"].freeze

def process_op_asgn2(exp)
  return raise_security_error(:op_asgn2, super(exp)) unless LOGICAL_ASSIGNMENT_OPERATORS.include?(exp[3])

  _, receiver, name, operator, rhs = exp
  process_logical_attribute_assignment(receiver, name, operator, rhs)
end

def process_logical_attribute_assignment(receiver, name, operator, rhs, safe_call = false)
  receiver = jail(process_call_receiver(receiver), safe_call: safe_call)
  name = name.to_s.sub(/=$/, "")
  dot = safe_call ? "&." : "."
  "#{receiver}#{dot}#{name} #{operator}= #{process rhs}"
end

Compound assignments with an arithmetic operator (+=, -=, …) raise Safemode::SecurityError before template execution; logical assignments (||=, &&=) are rewritten with .to_jail on the receiver, so getter and setter are both mediated by the Jail and must both be allow-listed.

2. Reproduction environment

One target image, two builds. The vulnerable and fixed sides differ only in the checked-out safemode tree; base image, dependency set, service, entrypoint and configuration are identical.

ContainerImagesafemode refPortBounds
cve107360-vulncve-2026-107360:vulntag v2.0.3 (edc74ce)28081--cpus 2 --memory 4g
cve107360-fixedcve-2026-107360:fixedPR #75 head 0bd399828082--cpus 2 --memory 4g
PoC runnercve-2026-107360-poc:local——python:3.12-alpine

Network: dedicated Podman network cve2026107360lab.

Versions resolved at build time (evidence/versions.txt), identical on both sides:

ComponentVersion
Ruby3.1.7p261 (x86_64-linux-musl)
safemode2.0.3 (both sides; the fixed side carries the PR #75 parser)
prism1.9.0
ruby2ruby2.5.2
ruby_parser3.21.1
sexp_processor4.17.4

The service (lab/service/app.rb) reproduces Foreman's rendering path: template source → Safemode::Parser.jail (parse + rewrite) → Kernel.eval in a Safemode::Scope binding with the template assigns. The probe Host object exposes name and status through its Jail allow-list; destroy, reboot, secret, audit, audit= and the indexed accessors are deliberately not allow-listed, and every real invocation of them is recorded in a side-effect registry the sandbox cannot touch. The registry is the observer: a recorded call proves the method executed on the real object, not through the Jail.

3. Running the environment

make build            # builds both target images and the PoC runner
make run              # starts both containers on the lab network
make poc-vuln MODE=check
make poc-fixed MODE=exploit
make sweep-vuln       # behavioral 0day sweep on the vulnerable build
make sweep-fixed      # behavioral 0day sweep on the fixed build
make evidence         # recaptures everything in evidence/
make down
Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    894
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    821
  • 3

    wifit3

    derv82/wifit3

    Wifite but USB-only & cross-platform.

    649
  • 4

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    450
  • 5

    jumpserver

    jumpserver/jumpserver

    JumpServer is an open-source Privileged Access Management (PAM) platform that provides DevOps and IT teams with on-demand and secure access to SSH, RDP, Kubernetes, Database and RemoteApp endpoints through a web browser.

    437
  • 6

    SafeLine

    chaitin/safeline

    Self-hosted WAF and reverse proxy that filters malicious HTTP traffic, blocks SQL injection, XSS, and bot attacks, with rate limiting and dynamic HTML/JS encryption.

    389

Explore all tools

Browse our collection of tools

View all tools →