@gendigital/sage 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +13526 -0
- package/dist/index.cjs.map +7 -0
- package/openclaw.plugin.json +14 -0
- package/package.json +40 -0
- package/resources/allowlists/trusted-installer-domains.yaml +55 -0
- package/resources/skills/security-awareness/SKILL.md +59 -0
- package/resources/threats/LICENSE +45 -0
- package/resources/threats/commands.yaml +257 -0
- package/resources/threats/credentials.yaml +75 -0
- package/resources/threats/files.yaml +112 -0
- package/resources/threats/mitre.yaml +810 -0
- package/resources/threats/obfuscation.yaml +86 -0
- package/resources/threats/persistence.yaml +87 -0
- package/resources/threats/self-defense.yaml +55 -0
- package/resources/threats/supply_chain.yaml +15 -0
- package/resources/threats/urls.yaml +63 -0
- package/resources/threats/win-commands.yaml +785 -0
- package/resources/threats/win-credentials.yaml +112 -0
- package/resources/threats/win-files.yaml +124 -0
- package/resources/threats/win-obfuscation.yaml +205 -0
- package/resources/threats/win-persistence.yaml +100 -0
- package/resources/threats/win-supply-chain.yaml +15 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "sage",
|
|
3
|
+
"name": "Sage",
|
|
4
|
+
"version": "0.4.0",
|
|
5
|
+
"description": "Safety for Agents — ADR layer that guards commands, files, and web requests",
|
|
6
|
+
"skills": [
|
|
7
|
+
"resources/skills/security-awareness"
|
|
8
|
+
],
|
|
9
|
+
"configSchema": {
|
|
10
|
+
"type": "object",
|
|
11
|
+
"additionalProperties": false,
|
|
12
|
+
"properties": {}
|
|
13
|
+
}
|
|
14
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gendigital/sage",
|
|
3
|
+
"license": "Apache-2.0",
|
|
4
|
+
"version": "0.4.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "Safety for Agents — ADR layer for OpenClaw",
|
|
7
|
+
"main": "./dist/index.cjs",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist/**",
|
|
10
|
+
"resources/**",
|
|
11
|
+
"openclaw.plugin.json",
|
|
12
|
+
"package.json",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "pnpm -C ../core build && pnpm run clean && pnpm run sync:assets && node esbuild.config.js",
|
|
18
|
+
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true});require('node:fs').rmSync('resources',{recursive:true,force:true})\"",
|
|
19
|
+
"sync:assets": "node scripts/sync-assets.mjs",
|
|
20
|
+
"test": "vitest run"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@sage/core": "workspace:*",
|
|
24
|
+
"@types/node": "^22.0.0",
|
|
25
|
+
"esbuild": "^0.25.0",
|
|
26
|
+
"typescript": "^5.9.0",
|
|
27
|
+
"vitest": "^4.0.0"
|
|
28
|
+
},
|
|
29
|
+
"openclaw": {
|
|
30
|
+
"extensions": [
|
|
31
|
+
"./dist/index.cjs"
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=18"
|
|
36
|
+
},
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Trusted installer domains for Sage
|
|
2
|
+
#
|
|
3
|
+
# Pipe-to-shell commands (curl | bash) targeting these domains are suppressed
|
|
4
|
+
# from CLT-CMD-001, CLT-CMD-002, CLT-SUPPLY-001, and CLT-SUPPLY-004 heuristic matches.
|
|
5
|
+
#
|
|
6
|
+
# Only dedicated installer endpoints are listed here — generic hosting
|
|
7
|
+
# platforms (e.g. raw.githubusercontent.com) are deliberately excluded.
|
|
8
|
+
#
|
|
9
|
+
# Format: list of {domain, reason} entries. Domains are matched by suffix
|
|
10
|
+
# with dot boundary (e.g. "bun.sh" matches "cdn.bun.sh" but not "notbun.sh").
|
|
11
|
+
|
|
12
|
+
- domain: bun.sh
|
|
13
|
+
reason: Bun JavaScript runtime installer
|
|
14
|
+
|
|
15
|
+
- domain: astral.sh
|
|
16
|
+
reason: Astral tools (uv, ruff) installer
|
|
17
|
+
|
|
18
|
+
- domain: brew.sh
|
|
19
|
+
reason: Homebrew package manager installer
|
|
20
|
+
|
|
21
|
+
- domain: sh.rustup.rs
|
|
22
|
+
reason: Rust toolchain installer (rustup)
|
|
23
|
+
|
|
24
|
+
- domain: rustup.rs
|
|
25
|
+
reason: Rust toolchain installer (alternate domain)
|
|
26
|
+
|
|
27
|
+
- domain: get.docker.com
|
|
28
|
+
reason: Docker installer
|
|
29
|
+
|
|
30
|
+
- domain: install.python-poetry.org
|
|
31
|
+
reason: Python Poetry installer
|
|
32
|
+
|
|
33
|
+
- domain: get.volta.sh
|
|
34
|
+
reason: Volta Node.js version manager installer
|
|
35
|
+
|
|
36
|
+
- domain: volta.sh
|
|
37
|
+
reason: Volta Node.js version manager (alternate domain)
|
|
38
|
+
|
|
39
|
+
- domain: get.sdkman.io
|
|
40
|
+
reason: SDKMAN JVM toolchain manager installer
|
|
41
|
+
|
|
42
|
+
- domain: pyenv.run
|
|
43
|
+
reason: pyenv Python version manager installer
|
|
44
|
+
|
|
45
|
+
- domain: deno.land
|
|
46
|
+
reason: Deno runtime installer
|
|
47
|
+
|
|
48
|
+
- domain: get.pnpm.io
|
|
49
|
+
reason: pnpm package manager installer
|
|
50
|
+
|
|
51
|
+
- domain: nodesource.com
|
|
52
|
+
reason: Node.js binary distribution installer
|
|
53
|
+
|
|
54
|
+
- domain: ohmyz.sh
|
|
55
|
+
reason: Oh My Zsh shell framework installer
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-awareness
|
|
3
|
+
description: "Security best practices for safe command execution, URL handling, credential management, and supply chain safety. Guidance on avoiding common attack vectors like reverse shells, command injection, and malware distribution."
|
|
4
|
+
user-invocable: false
|
|
5
|
+
disable-model-invocation: false
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Security Awareness
|
|
9
|
+
|
|
10
|
+
You are working in an environment protected by Sage, a security plugin. Be mindful of these security considerations when executing commands and fetching URLs.
|
|
11
|
+
|
|
12
|
+
## Remote Code Execution
|
|
13
|
+
|
|
14
|
+
- **Never pipe untrusted content to a shell** (`curl | bash`, `wget | sh`). Always download first, inspect, then execute.
|
|
15
|
+
- Avoid `eval()` on untrusted input in any language.
|
|
16
|
+
- Be cautious with `source` or `.` commands on remote scripts.
|
|
17
|
+
|
|
18
|
+
## Malware Distribution Vectors
|
|
19
|
+
|
|
20
|
+
- Executables downloaded from the internet (`.exe`, `.msi`, `.bat`, `.ps1`, `.scr`) should be treated as potentially malicious.
|
|
21
|
+
- Raw paste sites (pastebin.com/raw, paste.ee/r) are commonly used to host payloads and C2 commands.
|
|
22
|
+
- Direct IP address URLs (e.g., `http://192.168.1.1/payload`) may indicate C2 infrastructure.
|
|
23
|
+
|
|
24
|
+
## Command Injection Patterns
|
|
25
|
+
|
|
26
|
+
- Watch for reverse shell patterns: `/dev/tcp/`, `nc -e`, `bash -i >& /dev/`.
|
|
27
|
+
- Destructive commands like `rm -rf /`, `mkfs`, `dd if=`, and `shred` can cause irreversible data loss.
|
|
28
|
+
- Be wary of download-and-execute chains: `curl ... && chmod +x && ./`.
|
|
29
|
+
|
|
30
|
+
## Supply Chain Security
|
|
31
|
+
|
|
32
|
+
- Verify package names carefully — typosquatting is common (e.g., `colourama` vs `colorama`).
|
|
33
|
+
- Check package popularity and maintenance status before installing.
|
|
34
|
+
- Prefer pinned versions over latest/wildcard versions.
|
|
35
|
+
- Review post-install scripts when possible.
|
|
36
|
+
|
|
37
|
+
## Credential Handling
|
|
38
|
+
|
|
39
|
+
- Never hardcode secrets, API keys, or passwords in source code.
|
|
40
|
+
- Use environment variables or secret managers for sensitive values.
|
|
41
|
+
- Never commit `.env` files, credentials, or private keys to version control.
|
|
42
|
+
- Be cautious with commands that read or transmit sensitive files (`/etc/passwd`, `.ssh/`, `id_rsa`).
|
|
43
|
+
|
|
44
|
+
## Safe URL Handling
|
|
45
|
+
|
|
46
|
+
- Prefer HTTPS over HTTP for all external requests.
|
|
47
|
+
- Validate URLs before fetching — check the domain is expected.
|
|
48
|
+
- Be cautious with URL redirects that might lead to malicious destinations.
|
|
49
|
+
- Don't fetch URLs from untrusted sources without verification.
|
|
50
|
+
|
|
51
|
+
## File Permissions
|
|
52
|
+
|
|
53
|
+
- Avoid `chmod 777` — use the minimum permissions needed.
|
|
54
|
+
- Be cautious with `NOPASSWD` in sudoers configurations.
|
|
55
|
+
- Don't create world-writable files or directories in shared locations.
|
|
56
|
+
|
|
57
|
+
## Sage Flagged Actions
|
|
58
|
+
|
|
59
|
+
When Sage flags a tool call (as opposed to blocking it outright), you **must** present the details to the user and wait for their explicit approval before calling `sage_approve`. Never auto-approve a flagged action on your own — the user must decide.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
Detection Rule License (DRL) 1.1
|
|
2
|
+
|
|
3
|
+
Copyright 2026 Gen Digital Inc.
|
|
4
|
+
|
|
5
|
+
Default author for all rules in this directory: Gen Digital Inc.
|
|
6
|
+
Individual rules may specify a different author in their "author" field.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this rule set and associated documentation files (the "Rules"), to deal in
|
|
12
|
+
the Rules without restriction, including without limitation the rights to use,
|
|
13
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
14
|
+
the Rules, and to permit persons to whom the Rules are furnished to do so,
|
|
15
|
+
subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
If you share the Rules (including in modified form), you must retain the
|
|
18
|
+
following if it is supplied within the Rules:
|
|
19
|
+
|
|
20
|
+
1. identification of the authors(s) ("author" field) of the Rule and any
|
|
21
|
+
others designated to receive attribution, in any reasonable manner
|
|
22
|
+
requested by the Rule author (including by pseudonym if designated).
|
|
23
|
+
|
|
24
|
+
2. a URI or hyperlink to the Rule set or explicit Rule to the extent
|
|
25
|
+
reasonably practicable
|
|
26
|
+
|
|
27
|
+
3. indicate the Rules are licensed under this Detection Rule License, and
|
|
28
|
+
include the text of, or the URI or hyperlink to, this Detection Rule
|
|
29
|
+
License to the extent reasonably practicable
|
|
30
|
+
|
|
31
|
+
If you use the Rules (including in modified form) on data, messages based on
|
|
32
|
+
matches with the Rules must retain the following if it is supplied within the
|
|
33
|
+
Rules:
|
|
34
|
+
|
|
35
|
+
1. identification of the authors(s) ("author" field) of the Rule and any
|
|
36
|
+
others designated to receive attribution, in any reasonable manner
|
|
37
|
+
requested by the Rule author (including by pseudonym if designated).
|
|
38
|
+
|
|
39
|
+
THE RULES ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
40
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
41
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
42
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
43
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
44
|
+
OUT OF OR IN CONNECTION WITH THE RULES OR THE USE OR OTHER DEALINGS IN THE
|
|
45
|
+
RULES.
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
# Command threat patterns for Sage
|
|
2
|
+
# Author: Gen Digital Inc.
|
|
3
|
+
# License: DRL-1.1 (see threats/LICENSE)
|
|
4
|
+
# Schema: id, category, severity, confidence, action, pattern, match_on, title, expires_at, revoked
|
|
5
|
+
|
|
6
|
+
# --- Pipe to shell (Remote Code Execution) ---
|
|
7
|
+
- id: "CLT-CMD-001"
|
|
8
|
+
category: tool
|
|
9
|
+
severity: critical
|
|
10
|
+
confidence: 0.95
|
|
11
|
+
action: block
|
|
12
|
+
pattern: "curl\\s[^|]*\\|\\s*(bash|sh|zsh|ksh|dash)"
|
|
13
|
+
match_on: command
|
|
14
|
+
title: "Remote code execution via curl pipe to shell"
|
|
15
|
+
expires_at: null
|
|
16
|
+
revoked: false
|
|
17
|
+
|
|
18
|
+
- id: "CLT-CMD-002"
|
|
19
|
+
category: tool
|
|
20
|
+
severity: critical
|
|
21
|
+
confidence: 0.95
|
|
22
|
+
action: block
|
|
23
|
+
pattern: "wget\\s[^|]*\\|\\s*(bash|sh|zsh|ksh|dash)"
|
|
24
|
+
match_on: command
|
|
25
|
+
title: "Remote code execution via wget pipe to shell"
|
|
26
|
+
expires_at: null
|
|
27
|
+
revoked: false
|
|
28
|
+
|
|
29
|
+
# --- Reverse shells ---
|
|
30
|
+
- id: "CLT-CMD-003"
|
|
31
|
+
category: tool
|
|
32
|
+
severity: critical
|
|
33
|
+
confidence: 0.90
|
|
34
|
+
action: block
|
|
35
|
+
pattern: "/dev/tcp/"
|
|
36
|
+
match_on: command
|
|
37
|
+
title: "Reverse shell via /dev/tcp"
|
|
38
|
+
expires_at: null
|
|
39
|
+
revoked: false
|
|
40
|
+
|
|
41
|
+
- id: "CLT-CMD-004"
|
|
42
|
+
category: tool
|
|
43
|
+
severity: critical
|
|
44
|
+
confidence: 0.90
|
|
45
|
+
action: block
|
|
46
|
+
pattern: "\\bnc\\b.*\\s-e\\s"
|
|
47
|
+
match_on: command
|
|
48
|
+
title: "Reverse shell via netcat -e"
|
|
49
|
+
expires_at: null
|
|
50
|
+
revoked: false
|
|
51
|
+
|
|
52
|
+
- id: "CLT-CMD-005"
|
|
53
|
+
category: tool
|
|
54
|
+
severity: critical
|
|
55
|
+
confidence: 0.85
|
|
56
|
+
action: block
|
|
57
|
+
pattern: "bash\\s+-i\\s+>\\s*&\\s*/dev/"
|
|
58
|
+
match_on: command
|
|
59
|
+
title: "Interactive reverse shell via bash"
|
|
60
|
+
expires_at: null
|
|
61
|
+
revoked: false
|
|
62
|
+
|
|
63
|
+
# --- Destructive operations ---
|
|
64
|
+
- id: "CLT-CMD-006"
|
|
65
|
+
category: tool
|
|
66
|
+
severity: critical
|
|
67
|
+
confidence: 0.95
|
|
68
|
+
action: block
|
|
69
|
+
pattern: "\\brm\\s+(-[a-zA-Z]*f[a-zA-Z]*\\s+)?(-[a-zA-Z]*r[a-zA-Z]*\\s+)?/\\s*$|\\brm\\s+(-[a-zA-Z]*r[a-zA-Z]*\\s+)?(-[a-zA-Z]*f[a-zA-Z]*\\s+)?/\\s*$|\\brm\\s+-[a-zA-Z]*rf[a-zA-Z]*\\s+/"
|
|
70
|
+
match_on: command
|
|
71
|
+
title: "Recursive forced deletion from root"
|
|
72
|
+
expires_at: null
|
|
73
|
+
revoked: false
|
|
74
|
+
|
|
75
|
+
- id: "CLT-CMD-007"
|
|
76
|
+
category: tool
|
|
77
|
+
severity: critical
|
|
78
|
+
confidence: 0.95
|
|
79
|
+
action: block
|
|
80
|
+
pattern: "\\bmkfs\\b"
|
|
81
|
+
match_on: command
|
|
82
|
+
title: "Filesystem format command"
|
|
83
|
+
expires_at: null
|
|
84
|
+
revoked: false
|
|
85
|
+
|
|
86
|
+
- id: "CLT-CMD-008"
|
|
87
|
+
category: tool
|
|
88
|
+
severity: high
|
|
89
|
+
confidence: 0.85
|
|
90
|
+
action: block
|
|
91
|
+
pattern: "\\bdd\\s+if=.*of=/dev/"
|
|
92
|
+
match_on: command
|
|
93
|
+
title: "Direct disk write via dd"
|
|
94
|
+
expires_at: null
|
|
95
|
+
revoked: false
|
|
96
|
+
|
|
97
|
+
- id: "CLT-CMD-009"
|
|
98
|
+
category: tool
|
|
99
|
+
severity: critical
|
|
100
|
+
confidence: 0.90
|
|
101
|
+
action: block
|
|
102
|
+
pattern: "\\bshred\\b"
|
|
103
|
+
match_on: command
|
|
104
|
+
title: "Secure file destruction via shred"
|
|
105
|
+
expires_at: null
|
|
106
|
+
revoked: false
|
|
107
|
+
|
|
108
|
+
# --- Download + execute chains ---
|
|
109
|
+
- id: "CLT-CMD-010"
|
|
110
|
+
category: tool
|
|
111
|
+
severity: critical
|
|
112
|
+
confidence: 0.90
|
|
113
|
+
action: block
|
|
114
|
+
pattern: "(curl|wget)\\s[^&]*&&\\s*chmod\\s+\\+x"
|
|
115
|
+
match_on: command
|
|
116
|
+
title: "Download and execute chain"
|
|
117
|
+
expires_at: null
|
|
118
|
+
revoked: false
|
|
119
|
+
|
|
120
|
+
# --- Privilege escalation ---
|
|
121
|
+
- id: "CLT-CMD-011"
|
|
122
|
+
category: tool
|
|
123
|
+
severity: high
|
|
124
|
+
confidence: 0.80
|
|
125
|
+
action: require_approval
|
|
126
|
+
pattern: "\\bchmod\\s+777\\b"
|
|
127
|
+
match_on: command
|
|
128
|
+
title: "Overly permissive file permissions"
|
|
129
|
+
expires_at: null
|
|
130
|
+
revoked: false
|
|
131
|
+
|
|
132
|
+
- id: "CLT-CMD-012"
|
|
133
|
+
category: tool
|
|
134
|
+
severity: high
|
|
135
|
+
confidence: 0.80
|
|
136
|
+
action: require_approval
|
|
137
|
+
pattern: "NOPASSWD"
|
|
138
|
+
match_on: command
|
|
139
|
+
title: "Passwordless sudo configuration"
|
|
140
|
+
expires_at: null
|
|
141
|
+
revoked: false
|
|
142
|
+
|
|
143
|
+
# --- Data exfiltration ---
|
|
144
|
+
- id: "CLT-CMD-013"
|
|
145
|
+
category: network_egress
|
|
146
|
+
severity: high
|
|
147
|
+
confidence: 0.80
|
|
148
|
+
action: require_approval
|
|
149
|
+
pattern: "curl\\s[^|;]*(-d|--data|--data-binary)\\s\\S*(/etc/passwd|/etc/shadow|\\.ssh/|id_rsa|credentials|secrets)"
|
|
150
|
+
match_on: command
|
|
151
|
+
title: "Possible data exfiltration of sensitive files"
|
|
152
|
+
expires_at: null
|
|
153
|
+
revoked: false
|
|
154
|
+
|
|
155
|
+
# --- Privileged pipe to shell ---
|
|
156
|
+
- id: "CLT-CMD-014"
|
|
157
|
+
category: tool
|
|
158
|
+
severity: critical
|
|
159
|
+
confidence: 0.95
|
|
160
|
+
action: block
|
|
161
|
+
pattern: "\\bsudo\\s+(curl|wget)\\s[^|]*\\|\\s*(bash|sh|zsh|ksh|dash)"
|
|
162
|
+
match_on: command
|
|
163
|
+
title: "Privileged pipe-to-shell (sudo curl/wget piped to shell)"
|
|
164
|
+
expires_at: null
|
|
165
|
+
revoked: false
|
|
166
|
+
|
|
167
|
+
# --- Python one-liner with dangerous imports ---
|
|
168
|
+
- id: "CLT-CMD-015"
|
|
169
|
+
category: tool
|
|
170
|
+
severity: high
|
|
171
|
+
confidence: 0.80
|
|
172
|
+
action: require_approval
|
|
173
|
+
pattern: "python[3]?\\s+-c\\s+[\"'][^\"']*\\b(os\\.system|subprocess|os\\.exec|os\\.popen|__import__)\\b"
|
|
174
|
+
match_on: command
|
|
175
|
+
title: "Python one-liner with dangerous imports"
|
|
176
|
+
expires_at: null
|
|
177
|
+
revoked: false
|
|
178
|
+
|
|
179
|
+
# --- Indirect execution patterns ---
|
|
180
|
+
- id: "CLT-CMD-016"
|
|
181
|
+
category: tool
|
|
182
|
+
severity: critical
|
|
183
|
+
confidence: 0.90
|
|
184
|
+
action: block
|
|
185
|
+
pattern: "\\bbash\\s+<\\(\\s*(curl|wget)\\b"
|
|
186
|
+
match_on: command
|
|
187
|
+
title: "Process substitution executing remote content"
|
|
188
|
+
expires_at: null
|
|
189
|
+
revoked: false
|
|
190
|
+
|
|
191
|
+
- id: "CLT-CMD-017"
|
|
192
|
+
category: tool
|
|
193
|
+
severity: high
|
|
194
|
+
confidence: 0.85
|
|
195
|
+
action: block
|
|
196
|
+
pattern: "\\beval\\b[^;|]*\\b(curl|wget)\\b"
|
|
197
|
+
match_on: command
|
|
198
|
+
title: "Eval executing remote download command"
|
|
199
|
+
expires_at: null
|
|
200
|
+
revoked: false
|
|
201
|
+
|
|
202
|
+
- id: "CLT-CMD-018"
|
|
203
|
+
category: tool
|
|
204
|
+
severity: high
|
|
205
|
+
confidence: 0.85
|
|
206
|
+
action: block
|
|
207
|
+
pattern: "\\bxargs\\b[^|;]*\\b(curl|wget|bash|sh)\\b"
|
|
208
|
+
match_on: command
|
|
209
|
+
title: "xargs dispatching download or shell execution"
|
|
210
|
+
expires_at: null
|
|
211
|
+
revoked: false
|
|
212
|
+
|
|
213
|
+
- id: "CLT-CMD-019"
|
|
214
|
+
category: tool
|
|
215
|
+
severity: high
|
|
216
|
+
confidence: 0.85
|
|
217
|
+
action: block
|
|
218
|
+
pattern: "\\bfind\\b[^|;]*-exec\\s+(bash|sh|curl|wget)\\b"
|
|
219
|
+
match_on: command
|
|
220
|
+
title: "find -exec executing shell or download commands"
|
|
221
|
+
expires_at: null
|
|
222
|
+
revoked: false
|
|
223
|
+
|
|
224
|
+
# --- DNS exfiltration ---
|
|
225
|
+
- id: "CLT-CMD-020"
|
|
226
|
+
category: network_egress
|
|
227
|
+
severity: high
|
|
228
|
+
confidence: 0.80
|
|
229
|
+
action: block
|
|
230
|
+
pattern: "\\b(nslookup|dig|host)\\b[^|;]*\\$\\([^)]+\\)\\.[a-zA-Z]"
|
|
231
|
+
match_on: command
|
|
232
|
+
title: "DNS exfiltration via command substitution as subdomain label"
|
|
233
|
+
expires_at: null
|
|
234
|
+
revoked: false
|
|
235
|
+
|
|
236
|
+
- id: "CLT-CMD-021"
|
|
237
|
+
category: network_egress
|
|
238
|
+
severity: high
|
|
239
|
+
confidence: 0.80
|
|
240
|
+
action: block
|
|
241
|
+
pattern: "\\b(nslookup|dig|host)\\b[^|;]*`[^`]+`\\.[a-zA-Z]"
|
|
242
|
+
match_on: command
|
|
243
|
+
title: "DNS exfiltration via backtick substitution as subdomain label"
|
|
244
|
+
expires_at: null
|
|
245
|
+
revoked: false
|
|
246
|
+
|
|
247
|
+
# --- Loop-based indirect execution ---
|
|
248
|
+
- id: "CLT-CMD-022"
|
|
249
|
+
category: tool
|
|
250
|
+
severity: high
|
|
251
|
+
confidence: 0.80
|
|
252
|
+
action: block
|
|
253
|
+
pattern: "\\b(while|for)\\b[^;]*;\\s*do[^;]*\\b(bash|sh|curl|wget)\\b"
|
|
254
|
+
match_on: command
|
|
255
|
+
title: "Loop executing shell or download commands"
|
|
256
|
+
expires_at: null
|
|
257
|
+
revoked: false
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Credential exposure threat patterns for Sage
|
|
2
|
+
# Author: Gen Digital Inc.
|
|
3
|
+
# License: DRL-1.1 (see threats/LICENSE)
|
|
4
|
+
|
|
5
|
+
# --- Known API key prefixes ---
|
|
6
|
+
- id: "CLT-CRED-001"
|
|
7
|
+
category: secrets
|
|
8
|
+
severity: critical
|
|
9
|
+
confidence: 0.80
|
|
10
|
+
action: block
|
|
11
|
+
pattern: "(sk-[a-zA-Z0-9_-]{20,}|sk-proj-[a-zA-Z0-9_-]{20,}|AKIA[0-9A-Z]{16}|AIza[0-9A-Za-z_-]{35}|ghp_[0-9a-zA-Z]{36}|gho_[0-9a-zA-Z]{36}|glpat-[0-9a-zA-Z_-]{20,}|xox[baprs]-[0-9a-zA-Z-]+)"
|
|
12
|
+
match_on: [command, content]
|
|
13
|
+
title: "Known API key prefix detected"
|
|
14
|
+
expires_at: null
|
|
15
|
+
revoked: false
|
|
16
|
+
|
|
17
|
+
# --- Export of credential env vars ---
|
|
18
|
+
- id: "CLT-CRED-002"
|
|
19
|
+
category: secrets
|
|
20
|
+
severity: high
|
|
21
|
+
confidence: 0.80
|
|
22
|
+
action: require_approval
|
|
23
|
+
pattern: "\\bexport\\s+[A-Z_]*(API_KEY|SECRET|TOKEN|PASSWORD|CREDENTIAL|AUTH)[A-Z_]*="
|
|
24
|
+
match_on: command
|
|
25
|
+
title: "Export of environment variable with credential keyword"
|
|
26
|
+
expires_at: null
|
|
27
|
+
revoked: false
|
|
28
|
+
|
|
29
|
+
# --- .env file writes ---
|
|
30
|
+
- id: "CLT-CRED-003"
|
|
31
|
+
category: secrets
|
|
32
|
+
severity: high
|
|
33
|
+
confidence: 0.80
|
|
34
|
+
action: require_approval
|
|
35
|
+
pattern: "(>>|>)\\s*\\.env(\\.local|\\.production|\\.staging|\\.development)?\\b"
|
|
36
|
+
match_on: command
|
|
37
|
+
title: "Write/append to .env file (potential credential exposure)"
|
|
38
|
+
expires_at: null
|
|
39
|
+
revoked: false
|
|
40
|
+
|
|
41
|
+
# --- Reading credential files ---
|
|
42
|
+
- id: "CLT-CRED-004"
|
|
43
|
+
category: secrets
|
|
44
|
+
severity: high
|
|
45
|
+
confidence: 0.80
|
|
46
|
+
action: require_approval
|
|
47
|
+
pattern: "\\b(cat|less|more|head|tail)\\s+.*(\\.(env|env\\.local|env\\.production)|credentials|\\.aws/credentials|\\.ssh/id_rsa|\\.ssh/id_ed25519|\\.netrc|\\.pgpass)"
|
|
48
|
+
match_on: command
|
|
49
|
+
title: "Reading credential or secret file"
|
|
50
|
+
expires_at: null
|
|
51
|
+
revoked: false
|
|
52
|
+
|
|
53
|
+
# --- Plaintext credential assignment ---
|
|
54
|
+
- id: "CLT-CRED-005"
|
|
55
|
+
category: secrets
|
|
56
|
+
severity: high
|
|
57
|
+
confidence: 0.85
|
|
58
|
+
action: require_approval
|
|
59
|
+
pattern: "\\b(PASSWORD|API_SECRET|SECRET_KEY|PRIVATE_KEY|DB_PASSWORD|MYSQL_PASSWORD|POSTGRES_PASSWORD)=[\"']?[^\\s\"']{8,}"
|
|
60
|
+
match_on: [command, content]
|
|
61
|
+
title: "Plaintext credential assignment detected"
|
|
62
|
+
expires_at: null
|
|
63
|
+
revoked: false
|
|
64
|
+
|
|
65
|
+
# --- Long-form API key patterns ---
|
|
66
|
+
- id: "CLT-CRED-006"
|
|
67
|
+
category: secrets
|
|
68
|
+
severity: critical
|
|
69
|
+
confidence: 0.92
|
|
70
|
+
action: block
|
|
71
|
+
pattern: "(github_pat_[0-9a-zA-Z_]{22,}|SG\\.[0-9a-zA-Z_-]{22,}\\.[0-9a-zA-Z_-]{22,}|pk_live_[0-9a-zA-Z]{24,}|sk_live_[0-9a-zA-Z]{24,}|rk_live_[0-9a-zA-Z]{24,})"
|
|
72
|
+
match_on: [command, content]
|
|
73
|
+
title: "Long-form API key pattern detected (GitHub PAT, SendGrid, Stripe)"
|
|
74
|
+
expires_at: null
|
|
75
|
+
revoked: false
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Sensitive file path threat patterns for Sage
|
|
2
|
+
# Author: Gen Digital Inc.
|
|
3
|
+
# License: DRL-1.1 (see threats/LICENSE)
|
|
4
|
+
# Detects Write/Edit operations targeting security-sensitive files
|
|
5
|
+
|
|
6
|
+
# --- System auth files ---
|
|
7
|
+
- id: "CLT-FILE-001"
|
|
8
|
+
category: secrets
|
|
9
|
+
severity: critical
|
|
10
|
+
confidence: 0.95
|
|
11
|
+
action: block
|
|
12
|
+
pattern: "(/etc/passwd|/etc/shadow|/etc/sudoers)"
|
|
13
|
+
match_on: file_path
|
|
14
|
+
title: "Write to system authentication file"
|
|
15
|
+
expires_at: null
|
|
16
|
+
revoked: false
|
|
17
|
+
|
|
18
|
+
# --- SSH authorized_keys ---
|
|
19
|
+
- id: "CLT-FILE-002"
|
|
20
|
+
category: secrets
|
|
21
|
+
severity: critical
|
|
22
|
+
confidence: 0.95
|
|
23
|
+
action: block
|
|
24
|
+
pattern: "\\.ssh/authorized_keys"
|
|
25
|
+
match_on: file_path
|
|
26
|
+
title: "Write to SSH authorized_keys (unauthorized access persistence)"
|
|
27
|
+
expires_at: null
|
|
28
|
+
revoked: false
|
|
29
|
+
|
|
30
|
+
# --- SSH private keys and config ---
|
|
31
|
+
- id: "CLT-FILE-003"
|
|
32
|
+
category: secrets
|
|
33
|
+
severity: high
|
|
34
|
+
confidence: 0.90
|
|
35
|
+
action: require_approval
|
|
36
|
+
pattern: "\\.ssh/(id_rsa|id_ed25519|id_ecdsa|id_dsa|config)$"
|
|
37
|
+
match_on: file_path
|
|
38
|
+
title: "Write to SSH key or config file"
|
|
39
|
+
expires_at: null
|
|
40
|
+
revoked: false
|
|
41
|
+
|
|
42
|
+
# --- Shell RC files ---
|
|
43
|
+
- id: "CLT-FILE-004"
|
|
44
|
+
category: tool
|
|
45
|
+
severity: high
|
|
46
|
+
confidence: 0.85
|
|
47
|
+
action: require_approval
|
|
48
|
+
pattern: "\\.(bashrc|zshrc|profile|bash_profile|zprofile|zshenv)$"
|
|
49
|
+
match_on: file_path
|
|
50
|
+
title: "Write to shell RC file (persistence mechanism)"
|
|
51
|
+
expires_at: null
|
|
52
|
+
revoked: false
|
|
53
|
+
|
|
54
|
+
# --- macOS LaunchAgents/LaunchDaemons ---
|
|
55
|
+
- id: "CLT-FILE-005"
|
|
56
|
+
category: tool
|
|
57
|
+
severity: high
|
|
58
|
+
confidence: 0.90
|
|
59
|
+
action: block
|
|
60
|
+
pattern: "(LaunchAgents|LaunchDaemons)/.*\\.plist$"
|
|
61
|
+
match_on: file_path
|
|
62
|
+
title: "Write to macOS LaunchAgent/LaunchDaemon plist"
|
|
63
|
+
expires_at: null
|
|
64
|
+
revoked: false
|
|
65
|
+
|
|
66
|
+
# --- Cron directories ---
|
|
67
|
+
- id: "CLT-FILE-006"
|
|
68
|
+
category: tool
|
|
69
|
+
severity: high
|
|
70
|
+
confidence: 0.85
|
|
71
|
+
action: require_approval
|
|
72
|
+
pattern: "(/etc/cron\\.(d|daily|hourly|weekly|monthly)/|/var/spool/cron/)"
|
|
73
|
+
match_on: file_path
|
|
74
|
+
title: "Write to cron directory"
|
|
75
|
+
expires_at: null
|
|
76
|
+
revoked: false
|
|
77
|
+
|
|
78
|
+
# --- systemd unit files ---
|
|
79
|
+
- id: "CLT-FILE-007"
|
|
80
|
+
category: tool
|
|
81
|
+
severity: high
|
|
82
|
+
confidence: 0.85
|
|
83
|
+
action: require_approval
|
|
84
|
+
pattern: "/etc/systemd/system/"
|
|
85
|
+
match_on: file_path
|
|
86
|
+
title: "Write to systemd service unit file"
|
|
87
|
+
expires_at: null
|
|
88
|
+
revoked: false
|
|
89
|
+
|
|
90
|
+
# --- Credential/env files ---
|
|
91
|
+
- id: "CLT-FILE-008"
|
|
92
|
+
category: secrets
|
|
93
|
+
severity: high
|
|
94
|
+
confidence: 0.85
|
|
95
|
+
action: require_approval
|
|
96
|
+
pattern: "(\\.env(\\.local|\\.production|\\.staging|\\.development)?|\\.aws/credentials|\\.netrc|\\.pgpass)$"
|
|
97
|
+
match_on: file_path
|
|
98
|
+
title: "Write to credential or environment file"
|
|
99
|
+
expires_at: null
|
|
100
|
+
revoked: false
|
|
101
|
+
|
|
102
|
+
# --- Git hooks ---
|
|
103
|
+
- id: "CLT-FILE-009"
|
|
104
|
+
category: tool
|
|
105
|
+
severity: high
|
|
106
|
+
confidence: 0.85
|
|
107
|
+
action: require_approval
|
|
108
|
+
pattern: "\\.git/hooks/"
|
|
109
|
+
match_on: file_path
|
|
110
|
+
title: "Write to git hook (potential code execution on git events)"
|
|
111
|
+
expires_at: null
|
|
112
|
+
revoked: false
|