Vulnerabilities in pkg:gem/shrine

PACKAGE
Advisory Identifier: GHSA-5jjv-x4fq-qjwp
Advisory Summary

CVE-2020-15237 is a MODERATE (CVSS 5.9) possible timing attack vulnerability (CWE-203: Observable Discrepancy) affecting Shrine libraries in the RubyGems ecosystem. The issue involves possible timing attack in derivation_endpoint. Remediation is available by upgrading affected packages to version 3.3.0.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:gem/shrine

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:gem/shrine. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-5jjv-x4fq-qjwp CVE-2020-15237 MODERATE Possible timing attack in derivation_endpoint

CVE-2020-15237 at a Glance

CVE Identifier CVE-2020-15237
GHSA Identifier GHSA-5jjv-x4fq-qjwp
Severity MODERATE
CVSS v3.1 Base Score 5.9
CWE Classification CWE-203: Observable Discrepancy
Affected Product Shrine
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 5.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2020-15237

To remediate this vulnerability, upgrade all affected Shrine dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

shrine fixed: 3.3.0
Upgrade shrine to 3.3.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for shrine

How to Check if You Are Affected

To determine whether your application is affected by CVE-2020-15237, inspect your project dependencies for Shrine:

inspect dependencies for shrine

Analyze the terminal output to locate any version of Shrine in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.3.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-203: Observable Discrepancy, where the product behaves differently or sends different responses under different circumstances in a way that is observable to an unauthorized actor. In Shrine, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact When using the `derivation_endpoint` plugin, it's possible for the attacker to use a timing attack to guess the signature of the derivation URL. ### Patches The problem has been fixed by comparing sent and calculated signature in constant time, using `Rack::Utils.secure_compare`. Users using the `derivation_endpoint` plugin are urged to upgrade to Shrine 3.3.0 or greater. ### Workarounds Users of older Shrine versions can apply the following monkey-patch after loading the `derivation_endpoint` plugin: ```rb class Shrine class UrlSigner def verify_signature(string, signature) if signature.nil? fail InvalidSignature, "missing \"signature\" param" elsif !Rack::Utils.secure_compare(signature, generate_signature(string)) fail InvalidSignature, "provided signature does not match the calculated signature" end end end end ``` ### References You can read more about timing attacks [here](https://en.wikipedia.org/wiki/Timing_attack).

CVE-2020-15237 Affected Shrine Versions

1 component(s)
Fixed Versions:
3.3.0
Product / Package Ecosystem Affected Versions Fixed Version
shrine
RubyGems
< 3.3.0
3.3.0

References

Frequently Asked Questions

What is CVE-2020-15237?
CVE-2020-15237 is a security vulnerability in Shrine involving Possible timing attack in derivation_endpoint under CWE-203: Observable Discrepancy.
Which Shrine versions are affected?
Affected versions include releases prior to 3.3.0 across affected packages: shrine.
What version fixes CVE-2020-15237?
Upgrading to 3.3.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is shrine affected?
Yes, shrine is affected in releases prior to 3.3.0. Upgrade your dependency to 3.3.0 or later.
What is the CVSS score of CVE-2020-15237?
CVE-2020-15237 has a CVSS v3.1 base score of 5.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2020-15237?
CVE-2020-15237 is classified under CWE-203: Observable Discrepancy (The product behaves differently or sends different responses under different circumstances in a way that is observable to an unauthorized actor.).
How can I check RubyGems dependencies for CVE-2020-15237?
Run the dependency tree command: 'inspect dependencies for shrine'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-5jjv-x4fq-qjwp",
  "modified" : "2023-05-16T16:18:49Z",
  "published" : "2020-10-05T15:48:34Z",
  "aliases" : [ "CVE-2020-15237" ],
  "summary" : "Possible timing attack in derivation_endpoint",
  "details" : "### Impact\n\nWhen using the `derivation_endpoint` plugin, it's possible for the attacker to use a timing attack to guess the signature of the derivation URL.\n\n### Patches\n\nThe problem has been fixed by comparing sent and calculated signature in constant time, using `Rack::Utils.secure_compare`. Users using the `derivation_endpoint` plugin are urged to upgrade to Shrine 3.3.0 or greater.\n\n### Workarounds\n\nUsers of older Shrine versions can apply the following monkey-patch after loading the `derivation_endpoint` plugin:\n\n```rb\nclass Shrine\n  class UrlSigner\n    def verify_signature(string, signature)\n      if signature.nil?\n        fail InvalidSignature, \"missing \\\"signature\\\" param\"\n      elsif !Rack::Utils.secure_compare(signature, generate_signature(string))\n        fail InvalidSignature, \"provided signature does not match the calculated signature\"\n      end\n    end\n  end\nend\n```\n\n### References\n\nYou can read more about timing attacks [here](https://en.wikipedia.org/wiki/Timing_attack).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "shrine"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.3.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/shrinerb/shrine/security/advisories/GHSA-5jjv-x4fq-qjwp"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-15237"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/shrinerb/shrine/commit/1b27090ce31543bf39f186c20ea47c8250fca2f0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/shrine/CVE-2020-15237.yml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/shrinerb/shrine"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-203", "CWE-208" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-10-05T15:46:53Z",
    "nvd_published_at" : null
  }
}