Skip to content

Commit d5e7c8e

Browse files
committed
Add gsm: advisory field
1 parent 27ed0d3 commit d5e7c8e

File tree

5 files changed

+113
-10
lines changed

5 files changed

+113
-10
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ rubies/:
3737
The `gems/` directory contains sub-directories that match the names of the Ruby
3838
libraries on [rubygems.org]. Within each directory are one or more advisory
3939
files for the Ruby library. These advisory files are named using the
40-
advisories' [CVE] or [GHSA] ID.
40+
advisories' [CVE] or [GHSA] or [GSM] ID.
4141

4242
### `rubies/`
4343

4444
The `rubies/` directory contains sub-directories for each Ruby implementation.
4545
Within each directory are one or more advisory files for the Ruby
4646
implementation. These advisory files are named using the advisories' [CVE]
47-
or [GHSA] ID.
47+
or [GHSA] or [GSM] ID.
4848

4949
## Examples
5050

@@ -126,6 +126,7 @@ patched_versions:
126126
* `cve` \[String\] (optional): Common Vulnerabilities and Exposures (CVE) ID.
127127
* `osvdb` \[Integer\] (optional): Open Sourced Vulnerability Database (OSVDB) ID.
128128
* `ghsa` \[String\] (optional): GitHub Security Advisory (GHSA) ID.
129+
* `gsm` \[String\] (optional): GitLab Security Advisory (GSM) ID.
129130
* `url` \[String\] (required): The URL to the full advisory.
130131
* `title` \[String\] (required): The title of the advisory or individual vulnerability. It must be a single line sentence.
131132
* `date` \[Date\] (required): The public disclosure date of the advisory.
@@ -137,7 +138,7 @@ patched_versions:
137138
unaffected versions of the Ruby library.
138139
* `patched_versions` \[Array\<String\>\] (optional): The version requirements for the
139140
patched versions of the Ruby library.
140-
* `related` \[Hash\<Array\<String\>\>\] (optional): Sometimes an advisory references many urls and other identifiers. Supported keys: `cve`, `ghsa`, `osvdb`, and `url`
141+
* `related` \[Hash\<Array\<String\>\>\] (optional): Sometimes an advisory references many urls and other identifiers. Supported keys: `cve`, `ghsa`, `gsm`, `osvdb`, and `url`
141142
* `notes` \[String\] (optional): Internal notes regarding the vulnerability's inclusion in this database.
142143

143144
### `rubies`
@@ -147,6 +148,7 @@ patched_versions:
147148
* `cve` \[String\] (optional): Common Vulnerabilities and Exposures (CVE) ID.
148149
* `osvdb` \[Integer\] (optional): Open Sourced Vulnerability Database (OSVDB) ID.
149150
* `ghsa` \[String\] (optional): GitHub Security Advisory (GHSA) ID.
151+
* `gsm` \[String\] (optional): GitLab Security Advisory (GSM) ID.
150152
* `url` \[String\] (required): The URL to the full advisory.
151153
* `title` \[String\] (required): The title of the advisory or individual vulnerability. It must be a single line sentence.
152154
* `date` \[Date\] (required): The public disclosure date of the advisory.
@@ -158,7 +160,7 @@ patched_versions:
158160
unaffected versions of the Ruby implementation.
159161
* `patched_versions` \[Array\<String\>\] (optional): The version requirements for the
160162
patched versions of the Ruby implementation.
161-
* `related` \[Hash\<Array\<String\>\>\] (optional): Sometimes an advisory references many urls and other identifiers. Supported keys: `cve`, `ghsa`, `osvdb`, and `url`
163+
* `related` \[Hash\<Array\<String\>\>\] (optional): Sometimes an advisory references many urls and other identifiers. Supported keys: `cve`, `ghsa`, `gsm`, `osvdb`, and `url`
162164
* `notes` \[String\] (optional): Internal notes regarding the vulnerability's inclusion in this database.
163165

164166
## Tests
@@ -229,6 +231,7 @@ developed by the Open Security Foundation (OSF) and its contributors.
229231
[CVE]: https://cve.mitre.org/
230232
[OSVDB]: https://en.wikipedia.org/wiki/Open_Source_Vulnerability_Database
231233
[GHSA]: https://help.github.com/en/articles/about-maintainer-security-advisories
234+
[GSM]: https://advisories.gitlab.com/advisories
232235
[GitHub Security Advisory API]: https://developer.github.com/v4/object/securityadvisory/
233236
[CVSSv2]: https://www.first.org/cvss/v2/guide
234237
[CVSSv3]: https://www.first.org/cvss/v3.1/user-guide

gems/encryptor/GSM-2016-16.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
gem: encryptor
3+
gsm: 2016-16
4+
url: https://advisories.gitlab.com/pkg/gem/encryptor/GMS-2016-16
5+
title: AES-GCM nonce reuse vulnerability
6+
date: 2016-03-20
7+
description: |
8+
The encryptor gem prior to version 3.0.0 encrypts all messages using
9+
the same AES-GCM key/nonce pair when GCM mode is used. Reusing a
10+
nonce with AES-GCM catastrophically breaks the security of the scheme:
11+
by XORing two ciphertexts produced with the same key and nonce, an
12+
attacker can recover the XOR of the corresponding plaintexts.
13+
Worse, the construction leaks the AES-GCM authentication subkey,
14+
allowing attackers to forge valid authentication tags, mount chosen
15+
ciphertext attacks, and potentially recover full plaintexts. Users
16+
relying on encryptor 2.x with AES-GCM should assume confidentiality
17+
and integrity of affected ciphertexts are compromised and must
18+
re-encrypt data with a corrected implementation.
19+
20+
## PREVIOUS DESCRIPTION
21+
This gem was encrypting all messages using the same key/nonce. This
22+
not only exposes the XOR of the plaintexts if you XOR together two
23+
ciphertexts, but it also leaks the AES-GCM authentication key, allowing
24+
an attacker to forge messages and potentially perform chosen ciphertext
25+
attacks, which could potentially enable full plaintext recovery
26+
(especially if they've e.g. compromised the database, which is the
27+
threat model attr_encrypted is designed to defend against).
28+
29+
## NOTE
30+
The vulnerability arises from using a fixed or otherwise reused nonce with
31+
AES-GCM across multiple encryptions under the same key. This design flaw
32+
fatally undermines both confidentiality and integrity, enabling plaintext
33+
recovery and forgery of ciphertexts. Version 3.0.0 of encryptor changes
34+
the way IVs/nonces are generated for AES-GCM, addressing the nonce reuse
35+
issue and rendering prior ciphertexts produced under the vulnerable
36+
scheme unsafe.
37+
38+
NOTE: Release 3.0.0 (3/26/2018) is last release of gem as of 6/12/2023.
39+
patched_versions:
40+
- ">= 3.0.0"
41+
related:
42+
url:
43+
- https://advisories.gitlab.com/pkg/gem/encryptor/GMS-2016-16
44+
- https://security.snyk.io/vuln/SNYK-RUBY-ENCRYPTOR-20434
45+
- https://github.com/attr-encrypted/encryptor/releases/tag/3.0.0
46+
- https://github.com/rubysec/ruby-advisory-db/issues/305
47+
- https://github.com/attr-encrypted/encryptor#upgrading-from-v200-to-v300
48+
- https://github.com/attr-encrypted/encryptor/blob/master/CHANGELOG.md
49+
- https://github.com/attr-encrypted/encryptor/issues/30
50+
- https://github.com/attr-encrypted/encryptor/pull/22
51+
- https://github.com/attr-encrypted/encryptor/pull/22/commits/91f7228b6add7156f5bb38f9495be5141fe557a8
52+
notes: |
53+
- ISS#30 ("CVE for encryptor 2.0.0") is still open.
54+
- No CVE/GSHA/OSVDB ID.
55+
- No cvss_v2 or cvss_v3. SNYK has general CVSS values.
56+
- Empty https://github.com/attr-encrypted/encryptor/security
57+
- Using CWE-323.
58+
- keywords: CWE AES-GSM nonce reuse vulnerability encrypting authentication
59+
- (CWE-323) (yes)
60+
- https://www.ubiqsecurity.com/
61+
exploring-cwe-323-reusing-a-nonce-key-pair-in-encryption/
62+
- (CWE-327) (general)

spec/advisory_example.rb

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,36 @@
2727
end
2828
end
2929

30-
it "should be correctly named CVE-XXX or OSVDB-XXX or GHSA-XXX" do
30+
let(:filename_gsm) do
31+
if filename.start_with?('GSM-')
32+
filename.gsub('GSM-','')
33+
end
34+
end
35+
36+
it "should be correctly named CVE-XXX or OSVDB-XXX or GHSA-XXX or GSM-XXX" do
3137
expect(filename).to match(
3238
/\A
3339
(?:
3440
CVE-\d{4}-(?:0\d{3}|[1-9]\d{3,})|
3541
OSVDB-\d+|
36-
GHSA(-[a-z0-9]{4}){3}
42+
GHSA(-[a-z0-9]{4}){3}|
43+
GSM(-[a-z0-9]{4})-[0-9]{2}
3744
)\.yml\z
3845
/x
3946
)
4047
end
4148

42-
it "should have CVE or OSVDB or GHSA" do
43-
expect(advisory['cve'] || advisory['osvdb'] || advisory['ghsa']).not_to be_nil
49+
it "should have CVE or OSVDB or GHSA or GSM" do
50+
expect(advisory['cve'] || advisory['osvdb'] || advisory['ghsa'] || advisory['gsm']).not_to be_nil
4451
end
4552

4653
it "should CVE-XXX if cve field has a value" do
4754
if advisory['cve']
4855
expect(filename).to start_with('CVE-')
4956
elsif advisory['ghsa']
5057
expect(filename).to start_with('GHSA-')
58+
elsif advisory['gam']
59+
expect(filename).to start_with('GSM-')
5160
end
5261
end
5362

@@ -100,6 +109,19 @@
100109
end
101110
end
102111

112+
describe "gsm" do
113+
subject { advisory['gsm'] }
114+
115+
it "may be nil or a String" do
116+
expect(subject).to be_kind_of(String).or(be_nil)
117+
end
118+
it "should be id in filename if filename is GSM-XXX" do
119+
if filename_gsm
120+
expect(subject).to eq(filename_gsm.chomp('.yml'))
121+
end
122+
end
123+
end
124+
103125
describe "url" do
104126
subject { advisory['url'] }
105127

@@ -234,8 +256,8 @@
234256
when Hash
235257
advisory["related"].each_pair do |name,values|
236258
describe(name) do
237-
it "should be either a cve, an osvdb, a ghsa, or a url" do
238-
expect(["cve", "osvdb", "ghsa", "url"]).to include(name)
259+
it "should be either a cve, an osvdb, a ghsa, a gsm or a url" do
260+
expect(["cve", "osvdb", "ghsa", "gsm", "url"]).to include(name)
239261
end
240262

241263
it "should always contain an array" do

spec/schemas/gem.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ mapping:
1818
"ghsa":
1919
type: str
2020
pattern: /[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}/
21+
"gsm":
22+
type: str
23+
pattern: /[a-z0-9]{4}-[a-z0-9]{2}/
2124
"url":
2225
type: str
2326
required: true
@@ -58,6 +61,11 @@ mapping:
5861
sequence:
5962
- type: str
6063
pattern: /[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}/
64+
"gsm":
65+
type: seq
66+
sequence:
67+
- type: str
68+
pattern: /[a-z0-9]{4}-[a-z0-9]{2}/
6169
"osvdb":
6270
type: seq
6371
sequence:

spec/schemas/ruby.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ mapping:
1515
"ghsa":
1616
type: str
1717
pattern: /[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}/
18+
"gsm":
19+
type: str
20+
pattern: /[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{3}/
1821
"url":
1922
type: str
2023
required: true
@@ -55,6 +58,11 @@ mapping:
5558
sequence:
5659
- type: str
5760
pattern: /[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}/
61+
"gsm":
62+
type: seq
63+
sequence:
64+
- type: str
65+
pattern: /[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}/
5866
"osvdb":
5967
type: seq
6068
sequence:

0 commit comments

Comments
 (0)