GHSA-f8cm-364f-q9qh

Suggest an improvement
Source
https://github.com/advisories/GHSA-f8cm-364f-q9qh
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2020/10/GHSA-f8cm-364f-q9qh/GHSA-f8cm-364f-q9qh.json
JSON Data
https://api.test.osv.dev/v1/vulns/GHSA-f8cm-364f-q9qh
Aliases
Published
2020-10-20T20:03:52Z
Modified
2023-11-01T04:52:02.886630Z
Severity
  • 7.4 (High) CVSS_V3 - CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N CVSS Calculator
Summary
Ensure that doorkeeper_token is valid when authenticating requests in API v2 calls
Details

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: * Email us at security@spreecommerce.org

Database specific
{
    "nvd_published_at": "2020-10-20T21:15:00Z",
    "cwe_ids": [
        "CWE-287",
        "CWE-613"
    ],
    "severity": "HIGH",
    "github_reviewed": true,
    "github_reviewed_at": "2020-10-20T20:03:19Z"
}
References

Affected packages

RubyGems / spree

Package

Name
spree
Purl
pkg:gem/spree

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
3.7.11

Affected versions

0.*

0.0.5
0.0.6
0.0.7
0.0.8
0.0.9
0.2.0
0.4.0
0.4.1
0.5.0
0.5.1
0.6.0
0.7.0
0.7.1
0.8.0
0.8.1
0.8.2
0.8.3
0.8.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c3
3.0.0.rc4
3.0.0
3.0.1
3.0.2
3.0.3
3.0.4
3.0.5
3.0.6
3.0.6.1
3.0.7
3.0.8
3.0.9
3.0.10
3.1.0.rc1
3.1.0.rc2
3.1.0.rc3
3.1.0.rc4
3.1.0
3.1.1
3.1.2
3.1.3
3.1.4
3.1.5
3.1.6
3.1.7
3.1.8
3.1.9
3.1.10
3.1.11
3.1.12
3.1.13
3.1.14
3.2.0.rc1
3.2.0.rc2
3.2.0.rc3
3.2.0
3.2.1
3.2.2
3.2.3
3.2.4
3.2.5
3.2.6
3.2.7
3.2.8
3.2.9
3.3.0.rc1
3.3.0.rc2
3.3.0.rc3
3.3.0.rc4
3.3.0
3.3.1
3.3.2
3.3.3
3.3.4
3.3.5
3.3.6
3.4.0.rc1
3.4.0.rc2
3.4.0
3.4.1
3.4.2
3.4.3
3.4.4
3.4.5
3.4.6
3.5.0.rc1
3.5.0.rc2
3.5.0
3.6.0.rc1
3.6.0
3.6.1
3.6.2
3.6.3
3.6.4
3.6.5
3.6.6
3.7.0.rc1
3.7.0.rc2
3.7.0.rc3
3.7.0
3.7.1
3.7.2
3.7.3
3.7.4
3.7.5
3.7.6
3.7.7
3.7.8
3.7.9
3.7.10

RubyGems / spree

Package

Name
spree
Purl
pkg:gem/spree

Affected ranges

Type
ECOSYSTEM
Events
Introduced
4.0.0
Fixed
4.0.4

Affected versions

4.*

4.0.0
4.0.1
4.0.2
4.0.3

RubyGems / spree

Package

Name
spree
Purl
pkg:gem/spree

Affected ranges

Type
ECOSYSTEM
Events
Introduced
4.1.0
Fixed
4.1.11

Affected versions

4.*

4.1.0
4.1.1
4.1.2
4.1.3
4.1.4
4.1.5
4.1.6
4.1.7
4.1.8
4.1.9
4.1.10