-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathpickles-in-keras-deprecation.yaml
36 lines (35 loc) · 1.41 KB
/
pickles-in-keras-deprecation.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
35
36
rules:
- id: pickles-in-keras-deprecation
message: >-
The usage of pickle and hdf5 formats for model files are deprecated in Keras.
The keras.models.load_model function is deprecated as well. Keras is now
embedded in Tensorflow 2 under tensorflow.keras.
languages: [python]
severity: WARNING
metadata:
category: security
cwe: "CWE-502: Deserialization of Untrusted Data"
subcategory: [vuln]
confidence: MEDIUM
likelihood: MEDIUM
impact: HIGH
technology: [keras]
description: "Potential arbitrary code execution from Keras' load_model function"
references:
- https://blog.trailofbits.com/2021/03/15/never-a-dill-moment-exploiting-machine-learning-pickle-files/
patterns:
- pattern-either:
- pattern: keras.models.load_model(...)
- pattern: tensorflow.keras.models.load_model(...)
- pattern: keras.saving.load_model(...)
- pattern: tensorflow.keras.saving.load_model(...)
- pattern-not:
patterns:
- pattern-either:
- pattern: keras.models.load_model($FILE)
- pattern: tensorflow.keras.models.load_model($FILE)
- pattern: keras.saving.load_model($FILE)
- pattern: tensorflow.keras.saving.load_model($FILE)
- metavariable-regex:
metavariable: $FILE
regex: .*\.keras