Skip to content

GHSA-f8cm-364f-q9qh CVE-2020-15269

Ensure that doorkeeper_token is valid when authenticating requests in API v2 calls

High RubyGems
Severity
7.4 / 10
High · CVSS 3.1
Exploit chance (EPSS)
1.06%
Chance of exploitation in the next 30 days. Higher than 64.67% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-287 Improper Authentication
CWE-613 Insufficient Session Expiration
Fix
3.7.11
Upgrade spree to this version or later

Description

Impact

The perpetrator who previously obtained an old expired user token could use it to access Storefront API v2 endpoints.

Patches

Please upgrade to 3.7.11, 4.0.4, or 4.1.11 depending on your used Spree version.

Workarounds

In your project directory create a decorator file app/controllers/spree/api/v2/base_controller_decotatror.rb with contents:

module Spree
  module Api
    module V2
      module BaseControllerDecorator
        private

        def spree_current_user
          return nil unless doorkeeper_token
          return @spree_current_user if @spree_current_user

          doorkeeper_authorize!

          @spree_current_user ||= ::Spree.user_class.find_by(id: doorkeeper_token.resource_owner_id)
        end
     end
  end
end

Spree::Api::V2::BaseController.prepend(Spree::Api::V2::BaseControllerDecorator)

For more information

If you have any questions or comments about this advisory:

Affected versions

RubyGems

PackageVulnerableFixed in
spree
< 3.7.11
3.7.11
spree
>= 4.0.0, < 4.0.4
4.0.4
spree
>= 4.1.0, < 4.1.11
4.1.11

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

spree RubyGems → 3.7.11

bundler
bundle update spree # Gemfile: gem "spree", ">= 3.7.11"

Severity breakdown

CVSS 3.1 7.4

CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N

Attack vector
Network
Attack complexity
High
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
None

Weakness

CWE-287: Improper Authentication

When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.

How to prevent it
  • Architecture and Design: Use an authentication framework or library such as the OWASP ESAPI Authentication feature.

CWE-613: Insufficient Session Expiration

According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization."

How to prevent it
  • Implementation: Set sessions/credentials expiration date.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-xf4v-w5x5-pv79
Spree: CSV Formula Injection in Customer Export
Medium Also affects spree
GHSA-x485-rhg3-cqr4
Spree Commerce is vulnerable to RCE through Search API
Critical Also affects spree
GHSA-97vm-c39p-jr86
Spree has Remote Command Execution vulnerability in search functionality
Critical Also affects spree
GHSA-7h48-m3rw-vr27
Spree does not properly restrict the use of a hash to provide values for a model's attributes
Medium Also affects spree
GHSA-g466-57gh-cqfw
Spree uses a hardcoded hash value
Medium Also affects spree
GHSA-hwrx-wc75-mgh7
Spree allows remote attackers to obtain sensitive information
Medium Also affects spree
GHSA-jxx8-v83v-rhw3
Spree Improper Input Validation vulnerability
Medium Also affects spree
GHSA-f9x3-7vq9-cph6
Laravel TokenGuard authentication bypass through non-string API credentials
Critical Same weakness, CWE-287
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor