-
Notifications
You must be signed in to change notification settings - Fork 575
[New Rule] Python Path File (pth) Creation #4499
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
Rule: New - GuidelinesThese guidelines serve as a reminder set of considerations when proposing a new rule. Documentation and Context
Rule Metadata Checks
New BBR Rules
Testing and Validation
|
⛔️ Tests failed:
|
cc @eric-forte-elastic --> Thoughts on these one from a wheel or common package dependency libraries perspective? |
⛔️ Tests failed: |
⛔️ Tests failed: |
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.
LGTM
⛔️ Tests failed: |
⛔️ Tests failed:
|
⛔️ Tests failed:
|
Due to the effort required to find/test all PTH creation paths for Windows/macOS, I will not be adding support to these platforms. I created an issue to track this, in case a maintainer from these platforms wants to tackle this. For now, I will just merge the PR for Linux only. cc @w0rk3r @DefSecSentinel. Issue: #4505 |
Summary
This rule detects the creation of .pth files in system-wide and user-specific Python package directories, which can be abused for persistent code execution. .pth files automatically execute Python code when the interpreter starts, making them a stealthy persistence mechanism. Monitoring these paths helps identify unauthorized modifications that could indicate persistence by an attacker or malicious package injection.
Telemetry