Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eff1325

Browse files
committed
Copying the response data to the archive
1 parent 545aab0 commit eff1325

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

python/ql/src/experimental/Security/CWE-022bis/UnsafeUnpack.ql

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,24 @@ class UnsafeUnpackingConfig extends TaintTracking::Configuration {
5353
nodeTo = is.(CallCfgNode).getArg(0)
5454
)
5555
or
56+
// Copying the response data to the archive
57+
exists(Stdlib::FileLikeObject::InstanceSource is, Node f, MethodCallNode mc |
58+
is.flowsTo(f) and
59+
mc = API::moduleImport("shutil").getMember("copyfileobj").getACall() and
60+
f = mc.getArg(1) and
61+
nodeFrom = mc.getArg(0) and
62+
nodeTo = is.(CallCfgNode).getArg(0)
63+
)
64+
or
5665
// Reading the response
5766
exists(MethodCallNode mc |
5867
nodeFrom = mc.getObject() and
5968
mc.getMethodName() = "read" and
6069
mc.flowsTo(nodeTo)
6170
)
6271
or
63-
// Accessing the name
64-
exists(AttrRead ar | ar.accesses(nodeFrom, "name") and nodeTo = ar)
72+
// Accessing the name or raw content
73+
exists(AttrRead ar | ar.accesses(nodeFrom, ["name","raw"]) and nodeTo = ar)
6574
or
6675
// Considering the use of closing()
6776
exists(API::Node closing |

0 commit comments

Comments
 (0)