@kenhkl/agent-moss 0.15.4 → 0.15.5

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.
@@ -7,7 +7,7 @@
7
7
  "reason": "检测到递归强制删除根目录 (rm -rf /)"
8
8
  },
9
9
  {
10
- "pattern": "\\brm\\s+-[a-zA-Z]*[rf][a-zA-Z]*\\s+/(etc|var(?!/tmp)|home|usr|boot|root|opt|srv|sys|proc)\\b",
10
+ "pattern": "\\brm\\s+-[a-zA-Z]*[rf][a-zA-Z]*\\s+/(?:etc|var(?!/tmp)|usr|boot|root|opt|srv|sys|proc|home(?:/|/[A-Za-z0-9_.-]+/?)?(?=[\\s;|&\\\"']|$))",
11
11
  "risk_level": "critical",
12
12
  "risk_type": "script_execution",
13
13
  "reason": "检测到删除关键系统目录"
@@ -73,16 +73,16 @@
73
73
  "reason": "检测到访问系统组密码文件 (/etc/gshadow)"
74
74
  },
75
75
  {
76
- "pattern": "\\.ssh/id_rsa(?!\\.pub)",
76
+ "pattern": "dd\\s+if=/dev/zero.*\\bof\\s*=\\s*/(?:etc|var|usr|boot|root|opt|srv|sys|proc|home(?:/|/[A-Za-z0-9_.-]+/?)?(?=[\\s;|&\\\"']|$))",
77
77
  "risk_level": "critical",
78
- "risk_type": "file_access",
79
- "reason": "检测到访问 SSH 私钥文件 (.ssh/id_rsa)"
78
+ "risk_type": "script_execution",
79
+ "reason": "检测到磁盘清零写入关键系统目录 (dd if=/dev/zero of=/系统目录)"
80
80
  },
81
81
  {
82
- "pattern": "dd\\s+if=/dev/zero.*\\bof\\s*=\\s*/(etc|var|home|usr|boot|root|opt|srv|sys|proc)\\b",
82
+ "pattern": "\\.ssh/id_rsa(?!\\.pub)",
83
83
  "risk_level": "critical",
84
- "risk_type": "script_execution",
85
- "reason": "检测到磁盘清零写入关键系统目录 (dd if=/dev/zero of=/系统目录)"
84
+ "risk_type": "file_access",
85
+ "reason": "检测到访问 SSH 私钥文件 (.ssh/id_rsa)"
86
86
  },
87
87
  {
88
88
  "pattern": "mkfs\\.\\w+\\s+/dev/(sd|hd|nvme|vd|loop|mapper|md|dm)\\S+",
@@ -156,6 +156,12 @@
156
156
  "risk_type": "script_execution",
157
157
  "reason": "检测到远程下载脚本到本地 (curl -o script.sh),存在后续执行风险"
158
158
  },
159
+ {
160
+ "pattern": "base64\\s+-d\\s+.*\\|\\s*bash",
161
+ "risk_level": "high",
162
+ "risk_type": "sensitive_action",
163
+ "reason": "base64 解码执行(编码绕过,下载或读取内容后解码执行)"
164
+ },
159
165
  {
160
166
  "pattern": "(?:curl|wget)\\s+\\S+.*\\b(?:chmod|chown)\\s+\\+x\\b",
161
167
  "risk_level": "high",
@@ -262,7 +268,7 @@
262
268
  "pattern": "curl\\s+.*\\|\\s*bash",
263
269
  "risk_level": "high",
264
270
  "risk_type": "sensitive_action",
265
- "reason": "curl pipe bash 执行 (user_rules)"
271
+ "reason": "curl pipe bash 执行(下载远程脚本直接执行)"
266
272
  },
267
273
  {
268
274
  "pattern": "curl\\s+.*\\|\\s*(sh|zsh|dash)",
@@ -282,12 +288,6 @@
282
288
  "risk_type": "script_execution",
283
289
  "reason": "eval 远程代码执行"
284
290
  },
285
- {
286
- "pattern": "base64\\s+-d\\s+.*\\|\\s*bash",
287
- "risk_level": "high",
288
- "risk_type": "sensitive_action",
289
- "reason": "base64 解码执行 (user_rules)"
290
- },
291
291
  {
292
292
  "pattern": "/dev/tcp/|bash\\s+-i\\s+>&",
293
293
  "risk_level": "critical",
@@ -341,6 +341,42 @@
341
341
  "risk_level": "critical",
342
342
  "risk_type": "script_execution",
343
343
  "reason": "检测到命令替换隐藏执行($(...)/反引号载荷含写/执行命令),可能产生文件系统副作用"
344
+ },
345
+ {
346
+ "pattern": "\\biptables\\s+-(?:[A-Za-z]*[FPIX][A-Za-z]*|[A-Za-z]*[FPIX]\\b)",
347
+ "risk_level": "high",
348
+ "risk_type": "script_execution",
349
+ "reason": "检测到修改防火墙规则(iptables -F/-P/-I/-X),可能关闭安全防护或建立隧道(ATT&CK T1562.004)"
350
+ },
351
+ {
352
+ "pattern": "\\b(?:ssh|scp)\\b[^;\\n]{0,200}?StrictHostKeyChecking\\s*=\\s*(?:no|accept-new)",
353
+ "risk_level": "high",
354
+ "risk_type": "lateral_movement",
355
+ "reason": "检测到 SSH/SCP 跳过主机密钥验证(-o StrictHostKeyChecking=no),允许中间人攻击,可能用于横向移动"
356
+ },
357
+ {
358
+ "pattern": "\\bwget\\s+(?:-\\S+\\s+)*--post-(?:data|file)\\s*=\\s*(?:\\$\\([^)]+\\)|[^ ]+|\\\"[^\\\"]+\\\"|'[^']+')\\s+(?!https?://(?:127\\.|localhost))https?://[a-zA-Z0-9.-]+",
359
+ "risk_level": "high",
360
+ "risk_type": "data_exfiltration",
361
+ "reason": "检测到 wget --post-data/--post-file 向外部地址发送数据(可能为数据外传,回环地址除外)"
362
+ },
363
+ {
364
+ "pattern": "\\bcurl\\b(?:[^;\\n]|&(?![&\\s]))*-X\\s+POST\\b[^;\\n]*https?://(?!(?:127\\.|localhost|\\[::1\\]))[a-zA-Z0-9.-]+",
365
+ "risk_level": "high",
366
+ "risk_type": "data_exfiltration",
367
+ "reason": "检测到 curl -X POST 到外部地址(可能为数据外传,回环地址除外)"
368
+ },
369
+ {
370
+ "pattern": "\\bcurl\\b[^;&\\n]*-F\\s+\\S+[^;&\\n]*https?://(?!(?:127\\.|localhost|\\[::1\\]))[a-zA-Z0-9.-]+",
371
+ "risk_level": "high",
372
+ "risk_type": "data_exfiltration",
373
+ "reason": "检测到 curl -F 表单上传到外部地址(可能为数据外传,回环地址除外)"
374
+ },
375
+ {
376
+ "pattern": "[|]\\s*crontab\\b",
377
+ "risk_level": "high",
378
+ "risk_type": "sensitive_action",
379
+ "reason": "检测到通过管道安装 crontab 定时任务(cron 后门/持久化)"
344
380
  }
345
381
  ],
346
382
  "injection_detection": [
@@ -872,5 +908,6 @@
872
908
  "deny_mode": "deny_write",
873
909
  "scope": "home"
874
910
  }
875
- ]
876
- }
911
+ ],
912
+ "_comment": "\n2026-09-11 新增:iptables 防火墙规则修改(T1562.004)+ SSH 跳过密钥验证(横向移动),原在 user_rules.json 下沉至此——攻击形态清晰、可静态判定,user_rules 回归仅存用户自定义例外的本位。"
913
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
- "_comment": "L2.2 模型检测规则单一事实源(Python + TS 共用)。原子命题正则 + LTL 公式(前缀 AST)。公式在事件迹位置 0 处评估:LTL 公式满足 = 攻击存在。对应站点 detection-l2-2.html 的 10 条 LTL + 5 条 CTL 规则(CTL 活性降级为 G(!φ) 安全不变量,见 docs/DETECTION_METHODS.md 5.4)。",
2
+ "_comment": "L2.2 模型检测规则单一事实源(Python + TS 共用)。原子命题正则 + LTL 公式(前缀 AST)。公式在事件迹位置 0 处评估:LTL 公式满足 = 攻击存在。对应站点 detection-l2-2.html 的 9 条 LTL + 5 条 CTL 规则(2026-09 移除 2 条单动作冗余:mc-ltl-010 F(install_persistence) 与 mc-ctl-001 F(clear_logs) —— 它们误伤正常运维,且攻击场景已由链式规则 006/007/008 覆盖)(CTL 活性降级为 G(!φ) 安全不变量,见 docs/DETECTION_METHODS.md 5.4)。",
3
3
  "ap_patterns": {
4
4
  "reads_credential": [
5
5
  "(?:cat|head|tail|less|more|sed|awk|strings|base64|dd)\\s+[^;&|\\n]*[~]?/\\.ssh(?:/[\\w.-]+)?\\b",
@@ -336,34 +336,6 @@
336
336
  "risk_level": "critical",
337
337
  "action": "block",
338
338
  "reason": "敏感数据→归档→外传(mc-ltl-009)"
339
- },
340
- {
341
- "id": "mc-ltl-010",
342
- "type": "ltl",
343
- "formula": [
344
- "F",
345
- [
346
- "ap",
347
- "install_persistence"
348
- ]
349
- ],
350
- "risk_level": "medium",
351
- "action": "approval",
352
- "reason": "持久化机制安装,需审批(mc-ltl-010)"
353
- },
354
- {
355
- "id": "mc-ctl-001",
356
- "type": "ltl",
357
- "formula": [
358
- "F",
359
- [
360
- "ap",
361
- "clear_logs"
362
- ]
363
- ],
364
- "risk_level": "critical",
365
- "action": "block",
366
- "reason": "安全不变量:任何情况不得清除日志(mc-ctl-001,AG(!clear_logs) 线性迹降级:违反 ⟺ 出现 clear_logs ⟺ F(clear_logs) 成立)"
367
339
  }
368
340
  ]
369
- }
341
+ }
@@ -1,77 +1,8 @@
1
1
  {
2
- "sensitive_actions": [
3
- {
4
- "pattern": "写入系统文件",
5
- "description": "写入 /etc, /usr, /boot 等系统目录下的文件"
6
- },
7
- {
8
- "pattern": "发送外部邮件",
9
- "description": "通过 email 工具发送邮件到外部地址"
10
- },
11
- {
12
- "pattern": "危险 shell 命令",
13
- "description": "执行 rm -rf, chmod 777, sudo 等危险命令"
14
- },
15
- {
16
- "pattern": "修改全局配置",
17
- "description": "修改系统级配置文件或环境变量"
18
- },
19
- {
20
- "pattern": "支付操作",
21
- "description": "涉及支付、转账等金融操作"
22
- },
23
- {
24
- "pattern": "访问密钥文件",
25
- "description": "访问 .ssh/id_rsa, .env, credentials 等密钥/凭证文件"
26
- },
27
- {
28
- "pattern": "网络数据外传",
29
- "description": "通过 HTTP/wget/curl 等方式将数据发送到外部服务器"
30
- },
31
- {
32
- "pattern": "curl * -d *",
33
- "description": "使用 curl 发送数据到外部服务器(可能为数据外传)"
34
- },
35
- {
36
- "pattern": "curl * POST *",
37
- "description": "使用 curl POST 请求发送数据到外部服务器"
38
- },
39
- {
40
- "pattern": "wget *--post-data*",
41
- "description": "使用 wget 发送 POST 数据到外部服务器"
42
- },
43
- {
44
- "pattern": "crontab -e",
45
- "description": "编辑定时任务(可能用于持久化后门)"
46
- },
47
- {
48
- "pattern": "crontab -r",
49
- "description": "删除定时任务(可能用于清除审计痕迹)"
50
- },
51
- {
52
- "pattern": "* | crontab",
53
- "description": "管道方式安装/修改定时任务(可能用于持久化后门)"
54
- },
55
- {
56
- "pattern": "iptables -",
57
- "description": "修改防火墙规则(可能用于关闭安全防护)"
58
- },
59
- {
60
- "pattern": "ssh* -o StrictHostKeyChecking=no",
61
- "description": "SSH 跳过主机密钥验证(可能用于横向移动)"
62
- },
63
- {
64
- "pattern": "base64 -d * bash",
65
- "description": "Base64 解码后执行(可能用于编码绕过)"
66
- },
67
- {
68
- "pattern": "curl * | bash",
69
- "description": "下载远程脚本并执行(远程代码执行风险)"
70
- }
71
- ],
2
+ "sensitive_actions": [],
72
3
  "sensitive_tools": [
73
4
  "eval",
74
5
  "exec",
75
6
  "system"
76
7
  ]
77
- }
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kenhkl/agent-moss",
3
- "version": "0.15.4",
3
+ "version": "0.15.5",
4
4
  "description": "Multi-layer security analysis engine for AI agents (TypeScript)",
5
5
  "type": "module",
6
6
  "main": "dist/server.js",
@@ -49,4 +49,4 @@
49
49
  "vitest": "^4.1.10"
50
50
  },
51
51
  "license": "MIT"
52
- }
52
+ }