@kenhkl/agent-moss 0.17.45 → 0.17.46
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/cli.js +1164 -239
- package/dist/engine/coordinator.js +1042 -170
- package/dist/rules/inline_rules.json +2 -2
- package/dist/rules/l1_rules.json +182 -204
- package/dist/rules/l2_rules.json +6 -6
- package/dist/rules/mc_rules.json +3 -45
- package/dist/rules/script_rules.json +6 -6
- package/dist/server.js +1127 -210
- package/dist/skills/file_access_guard.md +4 -2
- package/dist/static/index.html +537 -96
- package/package.json +1 -1
package/dist/rules/l2_rules.json
CHANGED
|
@@ -270,7 +270,7 @@
|
|
|
270
270
|
"listen\\("
|
|
271
271
|
],
|
|
272
272
|
"EXEC": [
|
|
273
|
-
"\\
|
|
273
|
+
"\\bpython[0-9.]*\\s+-c\\s+['\\\"](?!.*(?:requests|urllib(?:\\.request)?|aiohttp|httpx)\\.(?:post|put|request|send)\\s*\\()(?![^'\\\"]*\\b(?:print|pprint|echo)\\s*\\()",
|
|
274
274
|
"\\b(?:bash|sh)\\s+-[ce]\\b",
|
|
275
275
|
"(?:^|[;&|\\s])(?!grep\\b|cat\\b|sed\\b|awk\\b|find\\b|less\\b|more\\b|head\\b|tail\\b)\\b(?:os\\.system\\b|subprocess\\b|shell\\s*=\\s*True\\b)",
|
|
276
276
|
"\\b(?:bash|sh)\\s+-[ce]\\b",
|
|
@@ -282,16 +282,16 @@
|
|
|
282
282
|
"\\bcurl\\b[^;&|\\n]*(?:-X\\s+POST\\s+|-d\\s+|-F\\s+|--data|--upload-file|--data-binary)[^;&|\\n]*(?:/etc/shadow|/etc/passwd|id_rsa|credentials|[^\\s]*\\.db|secret[^\\s]*)[^;&|\\n]*https?://(?!127\\.\\d+\\.\\d+\\.\\d+|0\\.0\\.0\\.0|localhost|\\[?::1\\]?)",
|
|
283
283
|
"\\bcurl\\b[^;&|\\n]*(?:-X\\s+POST\\s+|-d\\s+|-F\\s+|--data|--upload-file|--data-binary)[^;&|\\n]*https?://(?!127\\.\\d+\\.\\d+\\.\\d+|0\\.0\\.0\\.0|localhost|\\[?::1\\]?)",
|
|
284
284
|
"\\b(?:curl|wget)\\b[^;&|\\n]*\\s(?:-T|--upload-file)\\s+[^;&|\\n]*https?://(?!localhost|127\\.0\\.0\\.1)",
|
|
285
|
-
"\\|\\s*nc\\s+[^;&|\\n]*\\d{1,5}\\b",
|
|
285
|
+
"\\|\\s*(?:nc|ncat|netcat)\\s+[^;&|\\n]*\\d{1,5}\\b",
|
|
286
286
|
"\\b(?:scp|sftp|rsync)\\s+[^;&|\\n]*(?:/etc/shadow|/etc/passwd|id_rsa|id_dsa|credentials|\\S*secret\\S*|\\.ssh/)[^;&|\\n]*\\S+@\\S+:",
|
|
287
|
-
"\\
|
|
287
|
+
"\\bpython[0-9.]*\\s+-c\\s+['\"][^'\"]*(?:requests|urllib(?:\\.request)?|aiohttp)\\.(?:post|put|request|send)\\s*\\([^'\"]*['\"]https?://(?!127\\.\\d+\\.\\d+\\.\\d+|0\\.0\\.0\\.0|localhost|\\[?::1\\]?)"
|
|
288
288
|
],
|
|
289
289
|
"CRED": [
|
|
290
290
|
"(?:cat|head|tail|less|more|sed|awk|strings|base64|dd)\\s+[^;&|\\n]*[~]?/\\.ssh(?:/[\\w.-]+)?\\b",
|
|
291
291
|
"(?:cat|head|tail|less|more|sed|awk|strings|base64|dd)\\s+[^;&|\\n]*(?:id_rsa|id_dsa|id_ecdsa|\\.aws/credentials|credentials\\.json|\\.netrc)",
|
|
292
292
|
"(?:cat|head|tail|less|more|sed|awk|strings|base64)\\s+[^;&|\\n]*(?:/etc/shadow|/etc/passwd|/etc/master\\.passwd)",
|
|
293
293
|
"(?:cat|head|tail|less|more|grep)\\s+[^;&|\\n]*known_hosts",
|
|
294
|
-
"\\
|
|
294
|
+
"\\bpython[0-9.]*\\s+-c\\s+['\\\"][\\s\\S]{0,200}?(?:base64\\.b64encode|open\\s*\\(|Path\\(|io\\.open\\s*\\(|read_text\\s*\\(|read\\s*\\()[\\s\\S]{0,200}?(?:/etc/shadow|/etc/passwd|id_rsa|credentials|\\.ssh)",
|
|
295
295
|
"(?:grep|find|cat)\\s+[^;&|\\n]*\\b(?:password|secret|passwd|shadow|credential|api[_-]?key)\\b[^;&|\\n]*(?:/etc/shadow|/etc/passwd|id_rsa|credentials|\\.ssh)",
|
|
296
296
|
"(?:cp|mv|dd|curl)\\s+[^;&|\\n]*(?:/etc/shadow|/etc/passwd|id_rsa|credentials|\\.ssh)",
|
|
297
297
|
"(?:cat|head|tail|less|more|sed|awk|strings|base64|dd|cp|mv|grep|xxd|od)\\s+[^;&|\\n]*(?:\\.config/agentmoss/auth_token|\\.agentmoss/stateful_chains|agent_moss_policy_cache|agent_moss/rules|agent_moss/skills|agent_moss/agents/|agent_moss/scenarios/)"
|
|
@@ -299,7 +299,7 @@
|
|
|
299
299
|
"PERSIST": [
|
|
300
300
|
"(?:echo|printf|cat)\\b[^;\\n]*\\|[^;\\n]*(?:crontab|at\\b)\\s*-",
|
|
301
301
|
"\\bsystemctl\\s+enable\\s+",
|
|
302
|
-
"(?:echo|printf)\\b[^;\\n]*(?:/dev/tcp/|nc\\s+-
|
|
302
|
+
"(?:echo|printf)\\b[^;\\n]*(?:/dev/tcp/|(?:nc|ncat|netcat)\\s+-[el]|reverse|backdoor|bash\\s+-i)[^;\\n]*(?:>>|>)\\s*(?:~?/\\.bashrc|~?/\\.profile|/etc/rc\\.local|/etc/crontab)",
|
|
303
303
|
"\\bat\\s+now\\b|\\bchkconfig\\s+\\S+\\s+on\\b",
|
|
304
304
|
"\\bcrontab\\s+-e\\b"
|
|
305
305
|
]
|
|
@@ -405,4 +405,4 @@
|
|
|
405
405
|
}
|
|
406
406
|
]
|
|
407
407
|
}
|
|
408
|
-
}
|
|
408
|
+
}
|
package/dist/rules/mc_rules.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"(?:cat|head|tail|less|more|grep)\\s+[^;&|\\n]*known_hosts",
|
|
9
9
|
"(?:grep|find)\\s+[^;&|\\n]*\\b(?:password|secret|passwd|credential|api[_-]?key)\\b[^;&|\\n]*(?:/etc/shadow|/etc/passwd|id_rsa|credentials|~?/\\.aws/credentials)",
|
|
10
10
|
"\\bcurl\\b[^;&|\\n]*(?:/etc/shadow|/etc/passwd|id_rsa|credentials|\\.ssh)",
|
|
11
|
-
"\\
|
|
11
|
+
"\\bpython[0-9.]*\\s+-c\\s+['\\\"][\\s\\S]{0,200}?(?:base64\\.b64encode|open\\s*\\(|Path\\(|io\\.open\\s*\\(|read_text\\s*\\(|read\\s*\\()[\\s\\S]{0,200}?(?:/etc/shadow|/etc/passwd|id_rsa|credentials|\\.ssh)"
|
|
12
12
|
],
|
|
13
13
|
"network_egress": [
|
|
14
14
|
"\\bcurl\\b[^;&|\\n]*(?:-X\\s+POST\\s+|-d\\s+|-F\\s+|--data|--upload-file|--data-binary|-T\\s+)[^;&|\\n]*https?://(?!127\\.\\d+\\.\\d+\\.\\d+|0\\.0\\.0\\.0|localhost|\\[?::1\\]?)",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"\\b(?:smtplib|ftplib|paramiko)\\s*\\."
|
|
20
20
|
],
|
|
21
21
|
"execute_file": [
|
|
22
|
-
"\\
|
|
22
|
+
"\\bpython[0-9.]*\\s+-c\\s+['\\\"](?![^'\\\"]*\\b(?:print|pprint|echo)\\s*\\()",
|
|
23
23
|
"\\b(?:bash|sh)\\s+-[ce]\\b",
|
|
24
24
|
"\\bos\\.system\\s*\\(",
|
|
25
25
|
"\\bsubprocess\\.(?:run|call|Popen|check_output|check_call)\\s*\\(",
|
|
@@ -61,14 +61,10 @@
|
|
|
61
61
|
"\\b(?:tar|zip|7za?|rar)\\s+[^;&|\\n]*(?:-c|-a)\\s+[^;&|\\n]*(?:(?:/etc|/var|/home|/root)|shadow|passwd|\\.ssh|secret)",
|
|
62
62
|
"\\bbase64\\b[^;&|\\n]*(?:/etc/shadow|/etc/passwd|id_rsa|secret)"
|
|
63
63
|
],
|
|
64
|
-
"prompt_injection": [
|
|
65
|
-
"ignore\\s+(?:previous|prior|all)\\s+(?:instructions?|commands?)",
|
|
66
|
-
"<INFORMATION>|TODO:\\s*(?:send|email|transfer|delete|forward|reserve)"
|
|
67
|
-
],
|
|
68
64
|
"sensitive_data": [
|
|
69
65
|
"(?:api[_-]?token|access[_-]?token|bearer\\s+[a-z0-9._-]+|sk-[a-z0-9_-]{10,})",
|
|
70
66
|
"-----BEGIN [A-Z ]*PRIVATE KEY-----",
|
|
71
|
-
"(?:^|[\\s\\W]|/)(?:\\.env|\\.env\\.local)\\b"
|
|
67
|
+
"(?:^|[\\s\\W]|/)(?:\\.env|\\.env\\.local)(?!\\.(?:example|template|sample|dist)(?![A-Za-z0-9_-]))\\b"
|
|
72
68
|
],
|
|
73
69
|
"lateral_movement": [
|
|
74
70
|
"\\bssh\\s+[^;&|\\n]*\\S+@\\S+[\\s;&|]+(?:exec|cat|curl|wget|nc|scp|ssh|sudo|chmod|base64)",
|
|
@@ -169,44 +165,6 @@
|
|
|
169
165
|
"action": "block",
|
|
170
166
|
"reason": "禁用安全后破坏性操作(mc-ltl-003)"
|
|
171
167
|
},
|
|
172
|
-
{
|
|
173
|
-
"id": "mc-ltl-004",
|
|
174
|
-
"type": "ltl",
|
|
175
|
-
"formula": [
|
|
176
|
-
"F",
|
|
177
|
-
[
|
|
178
|
-
"&",
|
|
179
|
-
[
|
|
180
|
-
"ap",
|
|
181
|
-
"prompt_injection"
|
|
182
|
-
],
|
|
183
|
-
[
|
|
184
|
-
"F",
|
|
185
|
-
[
|
|
186
|
-
"|",
|
|
187
|
-
[
|
|
188
|
-
"ap",
|
|
189
|
-
"network_egress"
|
|
190
|
-
],
|
|
191
|
-
[
|
|
192
|
-
"|",
|
|
193
|
-
[
|
|
194
|
-
"ap",
|
|
195
|
-
"write_file"
|
|
196
|
-
],
|
|
197
|
-
[
|
|
198
|
-
"ap",
|
|
199
|
-
"execute_file"
|
|
200
|
-
]
|
|
201
|
-
]
|
|
202
|
-
]
|
|
203
|
-
]
|
|
204
|
-
]
|
|
205
|
-
],
|
|
206
|
-
"risk_level": "critical",
|
|
207
|
-
"action": "block",
|
|
208
|
-
"reason": "注入后敏感操作(mc-ltl-004)"
|
|
209
|
-
},
|
|
210
168
|
{
|
|
211
169
|
"id": "mc-ltl-005",
|
|
212
170
|
"type": "ltl",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
"name": "nc -e",
|
|
40
|
-
"pattern": "\\
|
|
40
|
+
"pattern": "\\b(?:nc|netcat)\\s+.*-e\\b",
|
|
41
41
|
"flags": ""
|
|
42
42
|
},
|
|
43
43
|
{
|
|
@@ -57,17 +57,17 @@
|
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
"name": "$(base64",
|
|
60
|
-
"pattern": "\\$\\(\\s*base64",
|
|
60
|
+
"pattern": "\\$\\(\\s*(?:base64|base32)",
|
|
61
61
|
"flags": ""
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
"name": "`base64",
|
|
65
|
-
"pattern": "`\\s*base64",
|
|
65
|
+
"pattern": "`\\s*(?:base64|base32)",
|
|
66
66
|
"flags": ""
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
"name": "base64 decode pipe",
|
|
70
|
-
"pattern": "base64\\s+(-d|--decode)\\s*\\|",
|
|
70
|
+
"pattern": "(?:base64|base32)\\s+(-d|--decode)\\s*\\|",
|
|
71
71
|
"flags": ""
|
|
72
72
|
},
|
|
73
73
|
{
|
|
@@ -257,11 +257,11 @@
|
|
|
257
257
|
"flags": "i"
|
|
258
258
|
},
|
|
259
259
|
{
|
|
260
|
-
"pattern": "(?:^|\\s|&&|\\|\\|)\\s*
|
|
260
|
+
"pattern": "(?:^|\\s|&&|\\|\\|)\\s*python[0-9.]*\\s+(\\S+\\.py)",
|
|
261
261
|
"flags": "i"
|
|
262
262
|
},
|
|
263
263
|
{
|
|
264
|
-
"pattern": "(?:^|\\s|&&|\\|\\|)\\s*node
|
|
264
|
+
"pattern": "(?:^|\\s|&&|\\|\\|)\\s*node(?:js)?\\s+(\\S+\\.js)",
|
|
265
265
|
"flags": "i"
|
|
266
266
|
},
|
|
267
267
|
{
|