GitHub Advisoryadvisory · RubyGems
GHSA-5jjv-x4fq-qjwp Possible timing attack in derivation_endpoint
MEDIUM
Official page ↗
- Aliases
- CVE-2020-15237
- Ecosystem
- RubyGems
- Packages
- shrine
- Severity
- Moderate
- CVSS vector
- CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
- Weaknesses
- CWE-203, CWE-208
- Reviewed
- 2020-10-05
Affected packages
• RubyGems shrine: < 3.3.0 → fixed in 3.3.0
Description
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.
Related
Alias · CVE (1)
- CVE-2020-15237 In Shrine before version 3.3.0, when using the `derivation_endpoint` plugin, it's possible for the attacker to use a timing attack to guess… vulnerability
References
- https://github.com/shrinerb/shrine/security/advisories/GHSA-5jjv-x4fq-qjwp web
- https://nvd.nist.gov/vuln/detail/CVE-2020-15237 advisory
- https://github.com/shrinerb/shrine/commit/1b27090ce31543bf39f186c20ea47c8250fca2f0 web
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/shrine/CVE-2020-15237.yml web
- https://github.com/shrinerb/shrine package