generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support for semgrep rules, currently two implemented, with cust…
…om options
- Loading branch information
Showing
5 changed files
with
441 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
146 changes: 146 additions & 0 deletions
146
src/macaron/resources/pypi_malware_rules/exfiltration.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
# Copyright (c) 2025 - 2025, Oracle and/or its affiliates. All rights reserved. | ||
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/. | ||
|
||
rules: | ||
- id: remote-exfiltration | ||
metadata: | ||
description: Detected the exfiltration of data to a remote endpoint | ||
message: Detected exfiltration of sensitive data to a remote endpoint. | ||
languages: | ||
- python | ||
severity: ERROR | ||
mode: taint | ||
options: | ||
symbolic_propagation: true | ||
pattern-sources: | ||
- pattern-either: | ||
# result of code/command evaluation | ||
- pattern: exec(...) | ||
- pattern: eval(...) | ||
- pattern: ast.literal_eval(...) | ||
- pattern: builtins.exec(...) | ||
- pattern: builtins.eval(...) | ||
- pattern: __import__('builtins').exec(...) | ||
- pattern: __import__('builtins').eval(...) | ||
|
||
# environment variables | ||
- pattern: os.environ | ||
- pattern: os.environ[...] | ||
- pattern: os.environ.get(...) | ||
- pattern: os.environb | ||
- pattern: os.environb[...] | ||
- pattern: os.environb.get(...) | ||
- pattern: os.getenv(...) | ||
- pattern: os.getenvb(...) | ||
|
||
# system information | ||
- pattern: os.uname(...) | ||
- pattern: os.confstr(...) | ||
- pattern: os.confstr_names | ||
- pattern: os.sysconf(...) | ||
- pattern: os.sysconf_names | ||
- pattern: platform.release(...) | ||
- pattern: platform.version(...) | ||
- pattern: platform.uname(...) | ||
- pattern: platform.win32_ver(...) | ||
- pattern: platform.win32_edition(...) | ||
- pattern: platform.win32_is_iot(...) | ||
- pattern: platform.mac_ver(...) | ||
- pattern: platform.ios_ver(...) | ||
- pattern: platform.libc_ver(...) | ||
- pattern: platform.freedesktop_os_release(...) | ||
- pattern: platform.android_ver(...) | ||
|
||
# network information | ||
- pattern: psutil.net_connections(...) | ||
- pattern: psutil.net_if_addrs(...) | ||
- pattern: psutil.net_if_stats(...) | ||
- pattern: platform.node(...) | ||
- pattern: platform.platform(...) | ||
- pattern: socket.gethostname(...) | ||
- pattern: socket.gethostbyname(...) | ||
- pattern: socket.gethostbyname_ex(...) | ||
- pattern: socket.getfqdn(...) | ||
- pattern: socket.if_nameindex(...) | ||
|
||
# user information | ||
- pattern: psutil.users(...) | ||
|
||
# sensitive information | ||
- pattern: getpass.getpass(...) | ||
- pattern: getpass.unix_getpass(...) | ||
- pattern: getpass.win_getpass(...) | ||
- pattern: getpass.getuser(...) | ||
- pattern: pwd.getpwuid(...) | ||
- pattern: pwd.getpwnam(...) | ||
- pattern: pwd.getpwall(...) | ||
- pattern: keyring.get_keyring(...) | ||
- pattern: keyring.get_password(...) | ||
- pattern: keyring.get_credential(...) | ||
- pattern: winreg.ConnectRegistry(...) | ||
- pattern: winreg.LoadKey(...) | ||
- pattern: winreg.OpenKey(...) | ||
- pattern: winreg.OpenKeyEx(...) | ||
- pattern: winreg.QueryInfoKey(...) | ||
- pattern: winreg.QueryValue(...) | ||
- pattern: winreg.QueryValueEx(...) | ||
|
||
pattern-sinks: | ||
- pattern-either: | ||
# remote connection | ||
# using socket module | ||
- pattern: socket.socket(...) | ||
- pattern: $SOC.accept(...) | ||
- pattern: $SOC.bind(...) | ||
- pattern: $SOC.connect(...) | ||
- pattern: $SOC.connect_ex(...) | ||
- pattern: $SOC.listen(...) | ||
- pattern: $SOC.recv(...) | ||
- pattern: $SOC.recvfrom(...) | ||
- pattern: $SOC.recvmsg(...) | ||
- pattern: $SOC.recvmsg_into(...) | ||
- pattern: $SOC.recvfrom_into(...) | ||
- pattern: $SOC.recv_into(...) | ||
- pattern: $SOC.send(...) | ||
- pattern: $SOC.sendall(...) | ||
- pattern: $SOC.sendto(...) | ||
- pattern: $SOC.sendmsg(...) | ||
- pattern: $SOC.sendmsg_afalg(...) | ||
- pattern: $SOC.sendfile(...) | ||
# using requests module | ||
- pattern: requests.get(...) | ||
- pattern: requests.post(...) | ||
- pattern: requests.put(...) | ||
- pattern: requests.delete(...) | ||
- pattern: requests.head(...) | ||
- pattern: requests.options(...) | ||
- pattern: requests.Session(...) | ||
- pattern: requests.Request(...) | ||
# using urllib3 module | ||
- pattern: urllib3.PoolManager(...) | ||
- pattern: urllib3.request(...) | ||
- pattern: urllib3.HTTPConnectionPool(...) | ||
- pattern: urllib3.HTTPSConnectionPool(...) | ||
- pattern: urllib3.ConnectionPool(...) | ||
- pattern: urllib3.ProxyManager(...) | ||
- pattern: urllib3.contrib.socks.SOCKSProxyManager(...) | ||
# using urllib | ||
- pattern: urllib.request(...) | ||
- pattern: urllib.request.urlopen(...) | ||
# using urlrequest module | ||
- pattern: UrlRequest(...) | ||
- pattern: UrlRequestRequests(...) | ||
- pattern: UrlRequestUrllib(...) | ||
# using httpx | ||
- pattern: httpx.request(...) | ||
- pattern: httpx.get(...) | ||
- pattern: httpx.post(...) | ||
- pattern: httpx.put(...) | ||
- pattern: httpx.delete(...) | ||
- pattern: httpx.head(...) | ||
- pattern: httpx.options(...) | ||
- pattern: httpx.stream(...) | ||
- pattern: httpx.AsyncClient(...) | ||
- pattern: httpx.AsyncHTTPTransport(...) | ||
- pattern: httpx.Client(...) | ||
- pattern: httpx.Request(...) |
Oops, something went wrong.