Skip to content

Commit e8c092a

Browse files
committed
Python: Support the dill pickling library.
1 parent 65337ef commit e8c092a

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

python/ql/src/semmle/python/security/injection/Pickle.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ private ModuleObject pickleModule() {
1515
result.getName() = "pickle"
1616
or
1717
result.getName() = "cPickle"
18+
or
19+
result.getName() = "dill"
1820
}
1921

2022
private FunctionObject pickleLoads() {

python/ql/test/query-tests/Security/CWE-502/UnsafeDeserialization.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ edges
33
| test.py:11:15:11:41 | externally controlled string | test.py:12:18:12:24 | externally controlled string |
44
| test.py:11:15:11:41 | externally controlled string | test.py:13:15:13:21 | externally controlled string |
55
| test.py:11:15:11:41 | externally controlled string | test.py:14:19:14:25 | externally controlled string |
6+
| test.py:11:15:11:41 | externally controlled string | test.py:16:16:16:22 | externally controlled string |
67
| test.py:13:15:13:21 | externally controlled string | ../lib/yaml.py:1:10:1:10 | externally controlled string |
78
parents
89
| ../lib/yaml.py:1:10:1:10 | externally controlled string | test.py:13:15:13:21 | externally controlled string |
910
#select
1011
| test.py:12:18:12:24 | unpickling untrusted data | test.py:11:15:11:26 | dict of externally controlled string | test.py:12:18:12:24 | externally controlled string | Deserializing of $@. | test.py:11:15:11:26 | flask.request.args | untrusted input |
1112
| test.py:13:15:13:21 | yaml.load vulnerability | test.py:11:15:11:26 | dict of externally controlled string | test.py:13:15:13:21 | externally controlled string | Deserializing of $@. | test.py:11:15:11:26 | flask.request.args | untrusted input |
1213
| test.py:14:19:14:25 | unmarshaling vulnerability | test.py:11:15:11:26 | dict of externally controlled string | test.py:14:19:14:25 | externally controlled string | Deserializing of $@. | test.py:11:15:11:26 | flask.request.args | untrusted input |
14+
| test.py:16:16:16:22 | unpickling untrusted data | test.py:11:15:11:26 | dict of externally controlled string | test.py:16:16:16:22 | externally controlled string | Deserializing of $@. | test.py:11:15:11:26 | flask.request.args | untrusted input |

python/ql/test/query-tests/Security/CWE-502/test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@ def hello():
1212
pickle.loads(payload)
1313
yaml.load(payload)
1414
marshal.loads(payload)
15+
import dill
16+
dill.loads(payload)
1517

1618

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def loads(*args, **kwargs):
2+
return None

0 commit comments

Comments
 (0)