New rule for "silent execution" of popen based on Pytorch attack. Some cleanup of processing whl files #116
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On Dec 31 2022, pytorch maintainers published this post detailing a supply chain attack.
It primarily focused on using dependency confusion on how
pip
installs packages in a particular order. An internal package was used (triton), but someone registered triton on pypi.It was a copypasta of triton with one additional
__init__.py
that dropped a binary and executed it.Triage analysis here
This P/R adds a rule that "alerts" on this attack by looking for
subprocess.FUNC(...,)
with arguments that make it a "silent execution" to reduce false positives. I successfully tested this on the malicious package in the post and it found the malicious code!I thought our code execution code would catch this, but we scoped it to
setup.py
to reduce false positives. I think /dev/nulling std* is a very specific pattern for malware, so I added it here.