Skip to content
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

GuardDog Only Scans "setup.py" For Code Execution #312

Open
cedricvanrompay-datadog opened this issue Mar 5, 2024 · 3 comments
Open

GuardDog Only Scans "setup.py" For Code Execution #312

cedricvanrompay-datadog opened this issue Mar 5, 2024 · 3 comments
Labels
enhancement New feature or request false-negative

Comments

@cedricvanrompay-datadog
Copy link
Member

# Only searches in setup.py to reduce false positives!

paths:
include:
- "*/setup.py"
- "*/code-execution.py"

This causes a lot of malicious packages not to be detected because they perform code execution in other files.

It's true that reporting every single code execution would result in a lot of noise though.

We should at least make this limitation clear, because a lot of people are surprised that GuardDog does not report some malicious packages. See:

@ColdHeat
Copy link

Hello! if possible I think this limitation should be removed or given a way to bypass it. Or perhaps non-setup.py hits should be shown as warnings.

To properly review a package I don't think it's enough to just look at setup.py, as evidenced by malicious packages that aren't being flagged by GuardDog.

@sobregosodd
Copy link
Contributor

sobregosodd commented Feb 7, 2025

Hello @ColdHeat , thank you reaching out.
We are considering this enhancement, personally I consider than malware is more prone to running executions in the setup.py but executions by themselves (In any other part of the program) might not be as correlated to malicious behaviour thus yielding lots of false positives.

But we're analyzing the path forward.

@ColdHeat
Copy link

ColdHeat commented Feb 7, 2025

@sobregosodd Yes setup.py is going to be an easier place to get quick RCE since it will run on package install but the exploitation path would merely require that the user then run the package which is not unreasonable given that they just installed it.

The way I see it, Guarddog needs the ability to scan across an entire package and also to have the ability to keep a seperate list of allowed "unsafe" executions.

I see a similar project being worked on that analyzes the whole package, analyzes differences between versions, and I think could possibly get to the point where findings could be allowed/rejected.

https://github.com/ancat/whiskers
https://github.com/ancat/whiskers/blob/f091b36f51f080f55b63a5348b5d3a290beaccec/cmd/gem_diff_scan.go#L19-L24
https://github.com/ancat/whiskers/blob/f091b36f51f080f55b63a5348b5d3a290beaccec/cmd/gem_diff_scan.go#L109-L123

At the very least, I think guarddog should have a way via CLI or config to scan all files for rule hits instead of just specific files. Perhaps this means that the user would need to have their own rule but I do think this is something Guarddog should provide out of the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request false-negative
Projects
None yet
Development

No branches or pull requests

4 participants