-
Notifications
You must be signed in to change notification settings - Fork 1.7k
TarSlip vulnerability improvements #10851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good start. It would be nice if the examples were turned into query tests.
At the moment, you are making changes in the shipped query, so we will require fairly high quality before merging. Alternatively, you copy the whole query to experimental, and it could basically be merged as is.
I have given some pointers to things to improve. Further to that would be the comments referring to relevant APIs so other developers can convince themselves that the model is reasonable.
python/ql/lib/semmle/python/security/dataflow/TarSlipCustomizations.qll
Outdated
Show resolved
Hide resolved
class AllTarfileOpens extends API::CallNode { | ||
AllTarfileOpens() { | ||
exists(TarfileOpens tfo | this = tfo.getACall()) | ||
or | ||
exists(API::Node closing, Node arg, TarfileOpens tfo | | ||
closing = API::moduleImport("contextlib").getMember("closing") and | ||
this = closing.getACall() and | ||
arg = this.getArg(0) and | ||
arg = tfo.getACall() | ||
) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The extra source added here is better handled by an additional taint step. Then paths will start at the open call rather than at the closing call, and, if the two a separated in the code, we would find the data flow to connect them.
python/ql/lib/semmle/python/security/dataflow/TarSlipCustomizations.qll
Outdated
Show resolved
Hide resolved
python/ql/lib/semmle/python/security/dataflow/TarSlipCustomizations.qll
Outdated
Show resolved
Hide resolved
python/ql/lib/semmle/python/security/dataflow/TarSlipCustomizations.qll
Outdated
Show resolved
Hide resolved
python/ql/lib/semmle/python/security/dataflow/TarSlipCustomizations.qll
Outdated
Show resolved
Hide resolved
…tions.qll Use of the predicate. Co-authored-by: yoff <lerchedahl@gmail.com>
…tions.qll adjust to the use of the predicate. Co-authored-by: yoff <lerchedahl@gmail.com>
…tions.qll adjust to the use of the predicate. Co-authored-by: yoff <lerchedahl@gmail.com>
I did not get this one "query tests", please.
Ok, I will close this PR, take into consideration the previously suggested changes and make a new PR with a separate query within this folder as |
That is fine, but it would also be fine to do it in this PR.. |
Hi,
_extract_member()
extractall()
In the folder
/examples/
, you would find the bad samples named as:TarSlip_xxx.py
and the relatively good samples asNoHIT_TarSlip_xxx.py
. Plus to that, a little bash scriptscript.sh
that is supposed to execute the good and the bad samples using the malicious tarballarchive_malign.tar
.Thank you