/
gcm-detection.yaml
34 lines (34 loc) · 1.36 KB
/
gcm-detection.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
rules:
- id: gcm-detection
metadata:
category: security
cwe:
- 'CWE-323: Reusing a Nonce, Key Pair in Encryption'
references:
- https://cwe.mitre.org/data/definitions/323.html
technology:
- kotlin
license: Commons Clause License Condition v1.0[LGPL-2.1-only]
owasp:
- A02:2021 - Cryptographic Failures
subcategory:
- audit
likelihood: LOW
impact: LOW
confidence: LOW
languages:
- kt
# we should probably deprecate this...
message: GCM detected, please check that IV/nonce is not reused, an Initialization Vector (IV) is a nonce
used to randomize the encryption, so that even if multiple messages with identical plaintext are encrypted,
the generated corresponding ciphertexts are different.Unlike the Key, the IV usually does not need
to be secret, rather it is important that it is random and unique. Certain encryption schemes the IV
is exchanged in public as part of the ciphertext. Reusing same Initialization Vector with the same
Key to encrypt multiple plaintext blocks allows an attacker to compare the ciphertexts and then, with
some assumptions on the content of the messages, to gain important information about the data being
encrypted.
patterns:
- pattern-either:
- pattern: $METHOD.getInstance("AES/GCM/NoPadding",...)
- pattern: GCMParameterSpec(...)
severity: INFO