Public mode

No access to your tenant or devices. Every item links to its source. What this means

Sources need attention Customize Public modeDiscuss ChangeIntel on Discord

Reflex arbitrary method call in stimulus_reflex

CVSS 3.1 8.8 HIGHEUVD CVSS 3.1 8.8 CVSS 3.1 · [email protected] · Secondary 8.8 HIGHCVSS_V3 Publisher rating HIGHFixed by stimulus_reflex 3.5.0.rc4Fixed by stimulus_reflex 3.4.2Fixed by stimulus_reflex 3.5.0-rc4KEV status unknown

cve-program · CVE-2024-28121

Published

stimulus_reflex is a system to extend the capabilities of both Rails and Stimulus by intercepting user interactions and passing them to Rails over real-time websockets. In affected versions more methods than expected can be called on reflex instances. Being able to call some of them has security implications. To invoke a reflex a websocket message of the following shape is sent: `\"target\":\"[class_name]#[method_name]\",\"args\":[]`. The server will proceed to instantiate `reflex` using the provided `class_name` as long as it extends `StimulusReflex::Reflex`. It then attempts to call `method_name` on the instance with the provided arguments. This is problematic as `reflex.method method_name` can be more methods that those explicitly specified by the developer in their reflex class. A good example is the instance_variable_set method. This vulnerability has been patched in versions 3.4.2 and 3.5.0.rc4. Users unable to upgrade should: see the backing GHSA advisory for mitigation advice.

Read the publisher's advisory

euvd · EUVD-2024-0913

Published

stimulus_reflex is a system to extend the capabilities of both Rails and Stimulus by intercepting user interactions and passing them to Rails over real-time websockets. In affected versions more methods than expected can be called on reflex instances. Being able to call some of them has security implications. To invoke a reflex a websocket message of the following shape is sent: `\"target\":\"[class_name]#[method_name]\",\"args\":[]`. The server will proceed to instantiate `reflex` using the provided `class_name` as long as it extends `StimulusReflex::Reflex`. It then attempts to call `method_name` on the instance with the provided arguments. This is problematic as `reflex.method method_name` can be more methods that those explicitly specified by the developer in their reflex class. A good example is the instance_variable_set method. This vulnerability has been patched in versions 3.4.2 and 3.5.0.rc4. Users unable to upgrade should: see the backing GHSA advisory for mitigation advice.

Read the publisher's advisory

nvd · CVE-2024-28121

Published

stimulus_reflex is a system to extend the capabilities of both Rails and Stimulus by intercepting user interactions and passing them to Rails over real-time websockets. In affected versions more methods than expected can be called on reflex instances. Being able to call some of them has security implications. To invoke a reflex a websocket message of the following shape is sent: `\"target\":\"[class_name]#[method_name]\",\"args\":[]`. The server will proceed to instantiate `reflex` using the provided `class_name` as long as it extends `StimulusReflex::Reflex`. It then attempts to call `method_name` on the instance with the provided arguments. This is problematic as `reflex.method method_name` can be more methods that those explicitly specified by the developer in their reflex class. A good example is the instance_variable_set method. This vulnerability has been patched in versions 3.4.2 and 3.5.0.rc4. Users unable to upgrade should: see the backing GHSA advisory for mitigation advice.

Read the publisher's advisory

osv · GHSA-f78j-4w3g-4q65

Published

### Summary More methods than expected can be called on reflex instances. Being able to call some of them has security implications. ### Details To invoke a reflex a websocket message of the following shape is sent: ```json { "target": "[class_name]#[method_name]", "args": [] } ``` The server will proceed to instantiate `reflex` using the provided `class_name` as long as it extends `StimulusReflex::Reflex`. It then attempts to call `method_name` on the instance with the provided arguments [ref](https://github.com/stimulusreflex/stimulus_reflex/blob/0211cad7d60fe96838587f159d657e44cee51b9b/app/channels/stimulus_reflex/channel.rb#L83): ```ruby method = reflex.method method_name required_params = method.parameters.select { |(kind, _)| kind == :req } optional_params = method.parameters.select { |(kind, _)| kind == :opt } if arguments.size >= required_params.size && arguments.size <= required_params.size + optional_params.size reflex.public_send(method_name, *arguments) end ``` This is problematic as `reflex.method(method_name)` can be more methods than those explicitly specified by the developer in their reflex class. A good example is the `instance_variable_set` method. <details> <summary>Read more</summary> Let's imagine a reflex that uses `@user` as a trusted variable in an `after_reflex` callback. This variable can be overwritten using the following message: ```json { "target": "ChatReflex#instance_variable_set", "args": ["@user", "<admin-id>"] } ``` Here are other interesting methods that were found to be available for the [ChatReflex sample reflex](https://github.com/hopsoft/stimulus_reflex_expo/blob/dcce8c36a6782d1e7f57f0e2766a3f6fd770b3b1/app/reflexes/chat_reflex.rb) - `remote_byebug`: bind a debugging server - `pry`: drop the process in a REPL session All in all, only counting `:req` and `:opt` parameters helps. For example around [version 1.0](https://github.com/stimulusreflex/stimulus_reflex/blob/1f610b636abfed27de2c61104aebd1ac98180d5b/lib/stimulus_reflex/channel.rb#L41) only `.arity` was checked which allowed access to the `system` method (`.arity == -1`) ```json { "target": "ChatReflex#system", "args": ["[command here]"] } ``` Using `public_send` instead of `send` does not help but the following payloads **do not** work since `:rest` parameters are not counted in the current version ```json { "target": "ChatReflex#send", "args": ["system", "[command here]"] } ``` ```json { "target": "ChatReflex#instance_eval", "args": ["system('[command here]')"] } ``` </details> Pre-versions of 3.5.0 added a `render_collection` method on reflexes with a `:req` parameter. Calling this method could lead to arbitrary code execution: ```json { "target": "StimulusReflex::Reflex#render_collection", "args": [ { "inline": "<% system('[command here]') %>" } ] } ``` ### Patches Patches are [available on RubyGems](https://rubygems.org/gems/stimulus_reflex) and on [NPM](https://npmjs.org/package/stimulus_reflex). The patched versions are: - [`3.4.2`](https://github.com/stimulusreflex/stimulus_reflex/releases/tag/v3.4.2) - [`3.5.0.rc4`](https://github.com/stimulusreflex/stimulus_reflex/releases/tag/v3.5.0.rc4) ### Workaround You can add this guard to mitigate the issue if running an unpatched version of the library. 1.) Make sure all your reflexes inherit from the `ApplicationReflex` class 2.) Add this `before_reflex` callback to your `app/reflexes/application_reflex.rb` file: ```ruby class ApplicationReflex < StimulusReflex::Reflex before_reflex do ancestors = self.class.ancestors[0..self.class.ancestors.index(StimulusReflex::Reflex) - 1] allowed = ancestors.any? { |a| a.public_instance_methods(false).any?(method_name.to_sym) } raise ArgumentError.new("Reflex method '#{method_name}' is not defined on class '#{self.class.name}' or on any of its ancestors") if !allowed end end ```

Read the publisher's advisory

Affected versions, risk and source history

cve-program · CVE-2024-28121

Published

stimulus_reflex

Vendor product

Publisher's version information

Shown as published. These rules are not interpreted as NuGet package version ranges.

{
                    "vendor": "stimulusreflex",
                    "product": "stimulus_reflex",
                    "versions": [
                        {
                            "version": ">= 3.5.0.rc1, < 3.5.0.rc4",
                            "status": "affected"
                        },
                        {
                            "version": "< 3.4.2",
                            "status": "affected"
                        }
                    ]
                }

Original source record · Cite this exact observation · Complete original publisher JSON

euvd · EUVD-2024-0913

Published

EUVD source date text has no stated timezone and is retained without inventing a UTC instant. Related bulletin membership is not an alias, common cause or applicability claim. A missing vector with a zero score is treated as unrated. Complete vendor/product and underlying source evidence remains in the original JSON.

Original publisher date fields

datePublished: Mar 12, 2024, 7:44:29 PM

dateUpdated: Feb 13, 2025, 5:47:15 PM

No normalized affected-package data is projected for this source revision. The original publisher record may contain additional product and version evidence; this does not establish that a package is unaffected.

Original source record · Cite this exact observation · Complete original publisher JSON

nvd · CVE-2024-28121

Published

NVD analysis and CPE criteria are source context, not proof that a package or your environment is affected. Complete affected data, logical configurations and SSVC are retained in the original JSON.

Source analysis status: Analyzed

Weakness classifications: CWE-470

Original publisher date fields

published: 2024-03-12T20:15:08.313

lastModified: 2026-06-17T07:21:00.577

14 source CPE criteria · context only
  • cpe:2.3:a:stimulusreflex:stimulusrelfex:*:*:*:*:*:*:*:*
  • cpe:2.3:a:stimulusreflex:stimulusrelfex:3.5.0:pre1:*:*:*:*:*:*
  • cpe:2.3:a:stimulusreflex:stimulusrelfex:3.5.0:pre10:*:*:*:*:*:*
  • cpe:2.3:a:stimulusreflex:stimulusrelfex:3.5.0:pre2:*:*:*:*:*:*
  • cpe:2.3:a:stimulusreflex:stimulusrelfex:3.5.0:pre3:*:*:*:*:*:*
  • cpe:2.3:a:stimulusreflex:stimulusrelfex:3.5.0:pre4:*:*:*:*:*:*
  • cpe:2.3:a:stimulusreflex:stimulusrelfex:3.5.0:pre5:*:*:*:*:*:*
  • cpe:2.3:a:stimulusreflex:stimulusrelfex:3.5.0:pre6:*:*:*:*:*:*
  • cpe:2.3:a:stimulusreflex:stimulusrelfex:3.5.0:pre7:*:*:*:*:*:*
  • cpe:2.3:a:stimulusreflex:stimulusrelfex:3.5.0:pre8:*:*:*:*:*:*
  • cpe:2.3:a:stimulusreflex:stimulusrelfex:3.5.0:pre9:*:*:*:*:*:*
  • cpe:2.3:a:stimulusreflex:stimulusrelfex:3.5.0:rc1:*:*:*:*:*:*
  • cpe:2.3:a:stimulusreflex:stimulusrelfex:3.5.0:rc2:*:*:*:*:*:*
  • cpe:2.3:a:stimulusreflex:stimulusrelfex:3.5.0:rc3:*:*:*:*:*:*

The original JSON retains the logical configuration operators, exclusions and version bounds.

No normalized affected-package data is projected for this source revision. The original publisher record may contain additional product and version evidence; this does not establish that a package is unaffected.

Original source record · Cite this exact observation · Complete original publisher JSON

osv · GHSA-f78j-4w3g-4q65

Published

stimulus_reflex

RubyGems

ECOSYSTEM · introduced 3.5.0.pre0 → fixed 3.5.0.rc4

14 versions listed as affected

3.5.0.pre0, 3.5.0.pre1, 3.5.0.pre10, 3.5.0.pre2, 3.5.0.pre3, 3.5.0.pre4, 3.5.0.pre5, 3.5.0.pre6, 3.5.0.pre7, 3.5.0.pre8, 3.5.0.pre9, 3.5.0.rc1, 3.5.0.rc2, 3.5.0.rc3

stimulus_reflex

RubyGems

ECOSYSTEM · introduced 0 → fixed 3.4.2

71 versions listed as affected

0.1.0, 0.1.1, 0.1.10, 0.1.12, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 1.0.0, 1.0.1, 1.0.2, 1.1.0, 1.1.1, 2.0.0, 2.0.1, 2.0.2, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.1.5, 2.1.6, 2.1.7, 2.1.8, 2.1.9, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 3.0.0, 3.1.2, 3.1.3, 3.1.4, 3.2.0, 3.2.0.pre0, 3.2.0.pre1, 3.2.1, 3.2.2, 3.2.2.pre0, 3.2.2.pre1, 3.2.3, 3.3.0, 3.3.0.pre0, 3.3.0.pre1, 3.3.0.pre2, 3.3.0.pre3, 3.3.0.pre4, 3.3.0.pre5, 3.3.0.pre6, 3.4.0, 3.4.0.pre0, 3.4.0.pre1, 3.4.0.pre2, 3.4.0.pre3, 3.4.0.pre4, 3.4.0.pre5, 3.4.0.pre6, 3.4.0.pre7, 3.4.0.pre8, 3.4.0.pre9, 3.4.1

stimulus_reflex

npm

SEMVER · introduced 3.5.0-pre0 → fixed 3.5.0-rc4

stimulus_reflex

npm

SEMVER · introduced 0 → fixed 3.4.2

Original source record · Cite this exact observation · Complete original publisher JSON

ChangeIntel

An IT change radar: releases, security, known issues, retirements, documentation changes, and service status from public sources. Every item links to supporting evidence; dates and statuses can change after they are read.

Sources read 17 Nov 15:30 UTC · 274 of 275 readable · 250 fully read · 20 waiting for GitHub's hourly limit · documentation 469/469 current