|
| 1 | +--- |
| 2 | +gem: turbo_boost-commands |
| 3 | +cve: 2024-28181 |
| 4 | +ghsa: mp76-7w5v-pr75 |
| 5 | +url: https://github.com/hopsoft/turbo_boost-commands/security/advisories/GHSA-mp76-7w5v-pr75 |
| 6 | +title: TurboBoost Commands vulnerable to arbitrary method invocation |
| 7 | +date: 2024-03-15 |
| 8 | +description: | |
| 9 | + ### Impact |
| 10 | +
|
| 11 | + TurboBoost Commands has existing protections in place to |
| 12 | + guarantee that only public methods on Command classes can be invoked; however, the |
| 13 | + existing checks aren't as robust as they should be. It's possible for a sophisticated |
| 14 | + attacker to invoke more methods than should be permitted depending on the the strictness |
| 15 | + of authorization checks that individual applications enforce. Being able to call |
| 16 | + some of these methods can have security implications. |
| 17 | +
|
| 18 | + #### Details |
| 19 | +
|
| 20 | + Commands verify that the class must be a `Command` and that the method requested is |
| 21 | + defined as a public method; however, this isn't robust enough to guard against all |
| 22 | + unwanted code execution. The library should more strictly enforce which methods are |
| 23 | + considered safe before allowing them to be executed. |
| 24 | +
|
| 25 | + ### Patches |
| 26 | +
|
| 27 | + Patched in the following versions. |
| 28 | + - 0.1.3 |
| 29 | + - [NPM Package](https://www.npmjs.com/package/@turbo-boost/commands/v/0.1.3) |
| 30 | + - [Ruby GEM](https://rubygems.org/gems/turbo_boost-commands/versions/0.1.3) |
| 31 | + - 0.2.2 |
| 32 | + - [NPM Package](https://www.npmjs.com/package/@turbo-boost/commands/v/0.2.2) |
| 33 | + - [Ruby GEM](https://rubygems.org/gems/turbo_boost-commands/versions/0.2.2) |
| 34 | +
|
| 35 | + ### Workarounds |
| 36 | +
|
| 37 | + You can add this guard to mitigate the issue if running an unpatched |
| 38 | + version of the library. |
| 39 | +
|
| 40 | + ```ruby |
| 41 | + class ApplicationCommand < TurboBoost::Commands::Command |
| 42 | + before_command do |
| 43 | + method_name = params[:name].include?(\"#\") ? params[:name].split(\"#\").last : :perform |
| 44 | + ancestors = self.class.ancestors[0..self.class.ancestors.index(TurboBoost::Commands::Command) - 1] |
| 45 | + allowed = ancestors.any? { |a| a.public_instance_methods(false).any? method_name.to_sym } |
| 46 | + throw :abort unless allowed # ← blocks invocation |
| 47 | + # raise \"Invalid Command\" unless allowed # ← blocks invocation |
| 48 | + end |
| 49 | + end |
| 50 | + ``` |
| 51 | +cvss_v3: 8.1 |
| 52 | +patched_versions: |
| 53 | + - "~> 0.1.3" |
| 54 | + - ">= 0.2.2" |
| 55 | +related: |
| 56 | + url: |
| 57 | + - https://nvd.nist.gov/vuln/detail/CVE-2024-28181 |
| 58 | + - https://github.com/hopsoft/turbo_boost-commands/security/advisories/GHSA-mp76-7w5v-pr75 |
| 59 | + - https://github.com/hopsoft/turbo_boost-commands/commit/337cda7d9222f1f449905454a7374222017a7477 |
| 60 | + - https://github.com/hopsoft/turbo_boost-commands/commit/88af4fc0ac39cc1799d16c49fab52f6dfbcec9ba |
| 61 | + - https://github.com/advisories/GHSA-mp76-7w5v-pr75 |
0 commit comments