-
Notifications
You must be signed in to change notification settings - Fork 28
feat(heuristics): add two analyzers to detect dependency confusion and distinguish from stub packages #1117
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
base: main
Are you sure you want to change the base?
Conversation
src/macaron/malware_analyzer/pypi_heuristics/metadata/unknown_organization.py
Fixed
Show fixed
Hide fixed
2585e75
to
ab17698
Compare
…and distinguish from stub packages Signed-off-by: Amine <amine.raouane@enim.ac.ma>
ab17698
to
ae021e1
Compare
d555c54
to
7b6f07c
Compare
- **Rule**: Return `HeuristicResult.FAIL` if no descriptive word is found in the package description or summary ; otherwise, return `HeuristicResult.PASS`. | ||
- **Dependency**: None. | ||
|
||
13. **Unknown Organization** |
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.
Is this heuristic going to be included?
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.
no no a mistake , I forgot to update the README
@@ -411,6 +415,12 @@ def run_check(self, ctx: AnalyzeContext) -> CheckResultData: | |||
{Confidence.HIGH.value}::trigger(malware_high_confidence_4) :- | |||
quickUndetailed, forceSetup, failed({Heuristics.TYPOSQUATTING_PRESENCE.value}). | |||
|
|||
% Package released with dependency confusion . | |||
{Confidence.HIGH.value}::trigger(malware_high_confidence_5) :- |
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.
I'm worried this rule may generate false positives. This is a package with more than 50 files, an anomalous version, and does not include a stub package keyword. Are there any other heuristics or properties we can add on to this rule to be more restrictive?
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.
maybe forceSetup can be added
Signed-off-by: Amine <amine.raouane@enim.ac.ma>
7b6f07c
to
157c1c2
Compare
Summary
This PR adds three new heuristic analyzers designed to detect potential dependency confusion attacks and differentiate them from harmless stub or placeholder packages.
Description of changes
heuristics.py
.Related issues
None
Checklist
verified
label should appear next to all of your commits on GitHub.