@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.
@@ -0,0 +1,86 @@
1
+ # Obfuscation threat patterns for Sage
2
+ # Author: Gen Digital Inc.
3
+ # License: DRL-1.1 (see threats/LICENSE)
4
+
5
+ # --- Base64 decode piped to shell ---
6
+ - id: "CLT-OBFUS-001"
7
+ category: tool
8
+ severity: critical
9
+ confidence: 0.95
10
+ action: block
11
+ pattern: "base64\\s+(-d|--decode)\\s*\\|\\s*(bash|sh|zsh|ksh|dash)"
12
+ match_on: command
13
+ title: "Base64 decode piped to shell execution"
14
+ expires_at: null
15
+ revoked: false
16
+
17
+ # --- Hex escape sequences in printf ---
18
+ - id: "CLT-OBFUS-002"
19
+ category: tool
20
+ severity: medium
21
+ confidence: 0.70
22
+ action: require_approval
23
+ pattern: "printf\\s+[\"']\\\\x[0-9a-fA-F]{2}(\\\\x[0-9a-fA-F]{2}){3,}"
24
+ match_on: command
25
+ title: "Hex escape sequences in printf (potential obfuscation)"
26
+ expires_at: null
27
+ revoked: false
28
+
29
+ # --- Reversed string piped to shell ---
30
+ - id: "CLT-OBFUS-003"
31
+ category: tool
32
+ severity: critical
33
+ confidence: 0.90
34
+ action: block
35
+ pattern: "\\|\\s*rev\\s*\\|\\s*(bash|sh|zsh|ksh|dash)"
36
+ match_on: command
37
+ title: "Reversed string piped to shell execution"
38
+ expires_at: null
39
+ revoked: false
40
+
41
+ # --- Eval with decode ---
42
+ - id: "CLT-OBFUS-004"
43
+ category: tool
44
+ severity: critical
45
+ confidence: 0.90
46
+ action: block
47
+ pattern: "\\beval\\s+.*\\$\\(\\s*base64|python[3]?\\s+-c\\s+[\"'].*exec\\(.*decode"
48
+ match_on: [command, content]
49
+ title: "Eval with decode (obfuscated code execution)"
50
+ expires_at: null
51
+ revoked: false
52
+
53
+ # --- Shell metacharacter escaping ---
54
+ - id: "CLT-OBFUS-005"
55
+ category: tool
56
+ severity: high
57
+ confidence: 0.85
58
+ action: block
59
+ pattern: "\\|\\s*[\\\\'\"]+(bash|sh|zsh|ksh|dash)[\\\\'\"]*(\\s|$)"
60
+ match_on: command
61
+ title: "Shell metacharacter escaping to hide pipe target"
62
+ expires_at: null
63
+ revoked: false
64
+
65
+ # --- Alias/function redefinition ---
66
+ - id: "CLT-OBFUS-006"
67
+ category: tool
68
+ severity: high
69
+ confidence: 0.80
70
+ action: require_approval
71
+ pattern: "\\balias\\s+(bash|sh|zsh|curl|wget|nc|netcat|python|ruby|perl|node)="
72
+ match_on: command
73
+ title: "Alias redefinition of security-relevant command"
74
+ expires_at: null
75
+ revoked: false
76
+
77
+ - id: "CLT-OBFUS-007"
78
+ category: tool
79
+ severity: high
80
+ confidence: 0.80
81
+ action: require_approval
82
+ pattern: "\\b(function\\s+)?(bash|sh|curl|wget|nc|python|ruby|perl|node)\\s*\\(\\s*\\)"
83
+ match_on: command
84
+ title: "Function redefinition of security-relevant command"
85
+ expires_at: null
86
+ revoked: false
@@ -0,0 +1,87 @@
1
+ # Persistence mechanism threat patterns for Sage
2
+ # Author: Gen Digital Inc.
3
+ # License: DRL-1.1 (see threats/LICENSE)
4
+
5
+ # --- Shell RC file modification ---
6
+ - id: "CLT-PERSIST-001"
7
+ category: tool
8
+ severity: high
9
+ confidence: 0.85
10
+ action: require_approval
11
+ pattern: "(>>|>)\\s*~?/?(\\$HOME/)?\\.?(bashrc|zshrc|profile|bash_profile|zprofile|zshenv)"
12
+ match_on: command
13
+ title: "Write/append to shell RC file (persistence mechanism)"
14
+ expires_at: null
15
+ revoked: false
16
+
17
+ # --- Crontab manipulation ---
18
+ - id: "CLT-PERSIST-002"
19
+ category: tool
20
+ severity: high
21
+ confidence: 0.80
22
+ action: require_approval
23
+ pattern: "\\bcrontab\\s+(-[er]|[^-])"
24
+ match_on: command
25
+ title: "Crontab manipulation (list, edit, or remove scheduled tasks)"
26
+ expires_at: null
27
+ revoked: false
28
+
29
+ # --- Cron directory writes ---
30
+ - id: "CLT-PERSIST-003"
31
+ category: tool
32
+ severity: high
33
+ confidence: 0.85
34
+ action: require_approval
35
+ pattern: "/etc/cron\\.(d|daily|hourly|weekly|monthly)/"
36
+ match_on: command
37
+ title: "Write to system cron directory"
38
+ expires_at: null
39
+ revoked: false
40
+
41
+ # --- macOS LaunchAgent/LaunchDaemon ---
42
+ - id: "CLT-PERSIST-004"
43
+ category: tool
44
+ severity: high
45
+ confidence: 0.90
46
+ action: block
47
+ pattern: "(LaunchAgents|LaunchDaemons)/.*\\.plist"
48
+ match_on: command
49
+ title: "macOS LaunchAgent/LaunchDaemon persistence"
50
+ expires_at: null
51
+ revoked: false
52
+
53
+ # --- systemd service manipulation ---
54
+ - id: "CLT-PERSIST-005"
55
+ category: tool
56
+ severity: high
57
+ confidence: 0.85
58
+ action: require_approval
59
+ pattern: "\\bsystemctl\\s+(enable|start)\\b|/etc/systemd/system/"
60
+ match_on: command
61
+ title: "systemd service enable/start or unit file write"
62
+ expires_at: null
63
+ revoked: false
64
+
65
+ # --- SSH authorized_keys modification ---
66
+ - id: "CLT-PERSIST-006"
67
+ category: tool
68
+ severity: critical
69
+ confidence: 0.95
70
+ action: block
71
+ pattern: ">>\\s*~?/?\\.ssh/authorized_keys"
72
+ match_on: command
73
+ title: "Append to SSH authorized_keys (unauthorized access persistence)"
74
+ expires_at: null
75
+ revoked: false
76
+
77
+ # --- Echo/printf append to shell RC files ---
78
+ - id: "CLT-PERSIST-007"
79
+ category: tool
80
+ severity: critical
81
+ confidence: 0.90
82
+ action: block
83
+ pattern: "(echo|printf)\\s+.*>>\\s*~?/?(\\$HOME/)?\\.?(bashrc|zshrc|profile|bash_profile)"
84
+ match_on: command
85
+ title: "Echo/printf append to shell RC file (code injection persistence)"
86
+ expires_at: null
87
+ revoked: false
@@ -0,0 +1,55 @@
1
+ # Self-defense patterns — protect Sage and Claude Code configuration
2
+ # Author: Gen Digital Inc.
3
+ # License: DRL-1.1 (see threats/LICENSE)
4
+ # These flag when the AI agent may be manipulated into disabling its own guardrails
5
+ # Using require_approval (not block) to allow legitimate plugin dev and config changes
6
+
7
+ # Delete .sage directory
8
+ - id: "CLT-SELF-001"
9
+ category: self_defense
10
+ severity: critical
11
+ confidence: 0.90
12
+ action: require_approval
13
+ pattern: "(rm|del|rmdir|rd|Remove-Item|unlink)\\s.*\\.sage(\\s|[\\\\/]|$)"
14
+ case_insensitive: true
15
+ match_on: command
16
+ title: "Attempt to delete Sage configuration directory"
17
+ expires_at: null
18
+ revoked: false
19
+
20
+ # Write to Sage config files
21
+ - id: "CLT-SELF-002"
22
+ category: self_defense
23
+ severity: high
24
+ confidence: 0.85
25
+ action: require_approval
26
+ pattern: "\\.sage[\\\\/](allowlist|config)\\.json"
27
+ match_on: file_path
28
+ title: "Attempt to write to Sage configuration files"
29
+ expires_at: null
30
+ revoked: false
31
+
32
+ # Delete Claude Code hook or plugin config
33
+ - id: "CLT-SELF-003"
34
+ category: self_defense
35
+ severity: high
36
+ confidence: 0.85
37
+ action: require_approval
38
+ pattern: "(rm|del|Remove-Item|unlink)\\s.*\\.claude[\\\\/].*(hooks\\.json|installed_plugins)"
39
+ case_insensitive: true
40
+ match_on: command
41
+ title: "Attempt to delete Claude Code hook or plugin configuration"
42
+ expires_at: null
43
+ revoked: false
44
+
45
+ # Disable Sage security features via config
46
+ - id: "CLT-SELF-004"
47
+ category: self_defense
48
+ severity: high
49
+ confidence: 0.85
50
+ action: require_approval
51
+ pattern: "heuristics_enabled.*false|url_check.*enabled.*false"
52
+ match_on: content
53
+ title: "Attempt to disable Sage security features via config"
54
+ expires_at: null
55
+ revoked: false
@@ -0,0 +1,15 @@
1
+ # Supply chain threat patterns for Sage
2
+ # Author: Gen Digital Inc.
3
+ # License: DRL-1.1 (see threats/LICENSE)
4
+
5
+ # --- Install scripts piped to shell ---
6
+ - id: "CLT-SUPPLY-001"
7
+ category: supply_chain
8
+ severity: high
9
+ confidence: 0.85
10
+ action: block
11
+ pattern: "(curl|wget)\\s+.*install.*\\|\\s*(bash|sh|zsh|sudo\\s+bash|sudo\\s+sh)"
12
+ match_on: command
13
+ title: "Install script piped to shell (supply chain risk)"
14
+ expires_at: null
15
+ revoked: false
@@ -0,0 +1,63 @@
1
+ # URL/domain 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
+ # --- Known malware hosting patterns ---
7
+ - id: "CLT-URL-001"
8
+ category: network_egress
9
+ severity: critical
10
+ confidence: 0.85
11
+ action: block
12
+ pattern: "raw\\.githubusercontent\\.com/.*/malware"
13
+ match_on: url
14
+ title: "Known malware hosting pattern on GitHub raw"
15
+ expires_at: null
16
+ revoked: false
17
+
18
+ # --- Paste sites used for C2 ---
19
+ - id: "CLT-URL-002"
20
+ category: network_egress
21
+ severity: high
22
+ confidence: 0.75
23
+ action: require_approval
24
+ pattern: "pastebin\\.com/raw/"
25
+ match_on: url
26
+ title: "Pastebin raw content (commonly used for C2 payloads)"
27
+ expires_at: null
28
+ revoked: false
29
+
30
+ - id: "CLT-URL-003"
31
+ category: network_egress
32
+ severity: high
33
+ confidence: 0.75
34
+ action: require_approval
35
+ pattern: "paste\\.ee/r/"
36
+ match_on: url
37
+ title: "paste.ee raw content (commonly used for C2 payloads)"
38
+ expires_at: null
39
+ revoked: false
40
+
41
+ # --- IP-based URLs (often C2 or staging) ---
42
+ - id: "CLT-URL-004"
43
+ category: network_egress
44
+ severity: medium
45
+ confidence: 0.65
46
+ action: require_approval
47
+ pattern: "https?://\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}[:/]"
48
+ match_on: url
49
+ title: "Direct IP address URL (potential C2 or staging server)"
50
+ expires_at: null
51
+ revoked: false
52
+
53
+ # --- Executable downloads ---
54
+ - id: "CLT-URL-005"
55
+ category: network_egress
56
+ severity: high
57
+ confidence: 0.80
58
+ action: require_approval
59
+ pattern: "/[^/\\s]{1,255}\\.(exe|msi|bat|cmd|ps1|vbs|scr|pif|hta|inf)([?#]|$)"
60
+ match_on: url
61
+ title: "URL pointing to executable file download"
62
+ expires_at: null
63
+ revoked: false