Skip to content

Commit 4398670

Browse files
authored
Merge pull request #775 from taus-semmle/python-dill-pickle-support
Python: dill pickle support.
2 parents 5e712b3 + a422215 commit 4398670

File tree

5 files changed

+9
-1
lines changed

5 files changed

+9
-1
lines changed

change-notes/1.20/analysis-python.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323

2424
## Changes to QL libraries
2525

26-
* *Series of bullet points*
26+
* Added support for the `dill` pickle library.

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)