dsh-blue-team-mode 1.3.0 → 1.3.2

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/CHANGELOG.md ADDED
@@ -0,0 +1,90 @@
1
+ # Changelog
2
+
3
+ ## 1.3.2 — 2026-11-11
4
+
5
+ ### Security
6
+
7
+ - 脱敏覆盖 JSON body 和 query string 中的 password/token/secret/cookie/session。
8
+ - 脱敏同时应用于 User-Agent 和 Referer。
9
+ - 限流表增加过期清理,避免长期运行时无界增长。
10
+
11
+ ### Docs
12
+
13
+ - 新增 `SECURITY.md`:支持范围、私密报告、隐私与安全边界。
14
+ - 新增 GitHub issue 模板,默认禁止公开贴凭据和客户数据。
15
+
16
+ ## 1.3.1 — 2026-11-10
17
+
18
+ ### Security
19
+
20
+ - 诱饵日志不再记录 Cookie / Authorization。
21
+ - body 中的 password、token、secret、cookie、session 等字段自动替换为 `[REDACTED]`。
22
+ - 增加凭证脱敏回归测试。
23
+
24
+ ## 1.3.0 — 2026-11-10
25
+
26
+ ### Added
27
+
28
+ - 可选独立 HTTP 诱饵程序 `scripts/decoy-server.mjs`。
29
+ - 默认只监听 `127.0.0.1`,公开监听必须显式 `--allow-public`。
30
+ - 静态假路径:`/admin`、`/.git/config`、`/phpmyadmin`、`/backup.sql`、`/shell.php`。
31
+ - 本地 JSONL 事件日志,不主动外传。
32
+ - 请求体上限、每 IP 限流、固定长度响应。
33
+
34
+ ### Safety
35
+
36
+ - 不执行 PHP/Shell/命令。
37
+ - 不做无限/10GB 响应。
38
+ - 不抓 WebRTC、Canvas 或硬件指纹。
39
+ - 不自动启动、不自动部署。
40
+
41
+ ## 1.2.0 — 2026-11-10
42
+
43
+ ### Added
44
+
45
+ - `blue_tarpit_plan`:Endlessh、假路径、有界慢响应、fail2ban 7 天 jail 配置。
46
+ - `blue_honeypot_ingest`:蜜罐事件 → 告警 → high 风险待审批封禁任务。
47
+ - 19 个随包技能。
48
+
49
+ ### Safety
50
+
51
+ - 插件不直接调用 `iptables` / `nft` / `fail2ban-client`。
52
+ - 封禁必须人工审批;不按可伪造 UA 自动封禁。
53
+
54
+ ## 1.1.1 — 2026-11-10
55
+
56
+ ### Added
57
+
58
+ - 诱饵自动过期:默认 24 小时,最大 168 小时。
59
+ - 到期自动标记 `retired`,写时间线。
60
+ - 控制台显示到期时间。
61
+
62
+ ### Note
63
+
64
+ - 只更新事实库状态;真实部署的诱饵仍需人工下线。
65
+
66
+ ## 1.1.0 — 2026-11-09
67
+
68
+ ### Added
69
+
70
+ - 欺骗防御工具:`blue_deception_plan`、`blue_decoy_create`、`blue_decoy_hit`、`blue_decoy_list`。
71
+ - SQLite `decoys` / `decoy_hits`。
72
+ - 控制台「诱饵」页签、命中率、来源分布。
73
+ - 金丝雀文件/URL、假管理入口、假凭据、低交互 tarpit。
74
+
75
+ ### Safety
76
+
77
+ - 必须 `authorized=true` 且目标在 scope 内。
78
+ - 不使用真实个人信息、身份证号或伪造执法材料。
79
+ - 不做全屏锁定、无限弹窗、心理恐吓。
80
+ - 不收集 WebRTC/Canvas/硬件指纹。
81
+
82
+ ## 1.0.0 — 2026-11-09
83
+
84
+ ### Added
85
+
86
+ - 蓝队防御模式首个公开版本。
87
+ - 30 个蓝队工具、SQLite 事实库、右侧控制台。
88
+ - 六个执行角色、任务队列、高风险审批。
89
+ - 「防御自检」开局门禁。
90
+ - 不可信数据边界与路径闸。
package/README.md CHANGED
@@ -8,6 +8,10 @@
8
8
  >
9
9
  > **本插件不是 EDR/IPS/WAF/防火墙/备份系统,不承诺拦截或恢复攻击。** 真实服务器使用前请自行完成授权、备份、回滚演练与独立安全评估;不要把它当作唯一防线。详见 `DISCLOSURE`。
10
10
 
11
+ 更新记录:[CHANGELOG](CHANGELOG.md) · [GitHub Releases](https://github.com/FGCGDroid/blue/releases)
12
+
13
+ 支持与安全:[SECURITY](SECURITY.md) · [Issues](https://github.com/FGCGDroid/blue/issues)
14
+
11
15
  ---
12
16
 
13
17
  ## 它解决什么问题
@@ -52,13 +56,13 @@ dsh plugin --profile desktop add dsh-blue-team-mode
52
56
  plugin_manager action=install_bundle target="dsh-blue-team-mode"
53
57
  ```
54
58
 
55
- 包名 `dsh-blue-team-mode`,当前版本 `1.3.0`;`dsh.bundle` 指向包内的 `cordis.patch.yml`。npm 安装不需要 `allowBuilds`,也不依赖本机源码目录。
59
+ 包名 `dsh-blue-team-mode`,当前版本 `1.3.2`;`dsh.bundle` 指向包内的 `cordis.patch.yml`。npm 安装不需要 `allowBuilds`,也不依赖本机源码目录。
56
60
 
57
61
  ### 从本地 tarball 安装
58
62
 
59
63
  ```sh
60
64
  npm pack --pack-destination dist
61
- dsh plugin --profile desktop add .\dist\dsh-blue-team-mode-1.3.0.tgz
65
+ dsh plugin --profile desktop add .\dist\dsh-blue-team-mode-1.3.2.tgz
62
66
  ```
63
67
 
64
68
  ### 从本地目录安装
@@ -198,7 +202,7 @@ node scripts/decoy-server.mjs --host 127.0.0.1 --port 8080
198
202
  npm 安装后:
199
203
 
200
204
  ```powershell
201
- npx dsh-blue-decoy --host 127.0.0.1 --port 8080
205
+ npx --yes --package dsh-blue-team-mode dsh-blue-decoy --host 127.0.0.1 --port 8080
202
206
  ```
203
207
 
204
208
  默认只监听本机;公开/内网监听必须显式:
@@ -207,7 +211,7 @@ npx dsh-blue-decoy --host 127.0.0.1 --port 8080
207
211
  node scripts/decoy-server.mjs --host 0.0.0.0 --port 8080 --allow-public
208
212
  ```
209
213
 
210
- 提供 `/admin`、`/.git/config`、`/phpmyadmin`、`/backup.sql`、`/shell.php` 等静态假路径;`/shell.php` 只返回文本,不执行。事件写 `$DSH_HOME/blue/decoy-events.jsonl`,不主动外传。不会自动启动,是否部署由用户决定。
214
+ 提供 `/admin`、`/.git/config`、`/phpmyadmin`、`/backup.sql`、`/shell.php` 等静态假路径;`/shell.php` 只返回文本,不执行。事件写 `$DSH_HOME/blue/decoy-events.jsonl`,不主动外传;body 中的 password/token/secret/cookie 会脱敏。不会自动启动,是否部署由用户决定。
211
215
 
212
216
  详见 `skills/decoy-server.md`。
213
217
 
package/SECURITY.md ADDED
@@ -0,0 +1,48 @@
1
+ # Security Policy
2
+
3
+ ## 支持范围
4
+
5
+ 当前维护版本:
6
+
7
+ ```text
8
+ 1.3.x
9
+ ```
10
+
11
+ 更早版本只保留升级建议,不保证修复。
12
+
13
+ ## 报告安全问题
14
+
15
+ 请使用 GitHub 的 **Private vulnerability reporting**:
16
+
17
+ ```text
18
+ https://github.com/FGCGDroid/blue/security/advisories/new
19
+ ```
20
+
21
+ 不要在公开 issue 里贴:
22
+
23
+ - 真实 token、Cookie、Authorization
24
+ - 客户/比赛敏感日志
25
+ - 可复现的真实主机地址
26
+ - 未授权的目标信息
27
+
28
+ 如果私密报告入口不可用,请开一个**不含敏感信息**的 issue,只写“需要私密渠道”,维护者会跟进。
29
+
30
+ ## 安全边界
31
+
32
+ - 本项目是蓝队编排、记录和辅助研判工具,不是 EDR/IPS/WAF/防火墙/备份系统。
33
+ - 不承诺拦截、阻断或恢复攻击;生产使用前请自行评估、备份和回滚演练。
34
+ - 高风险动作(隔离、封禁、删除、改防火墙等)必须人工审批;插件不直接调用 root 防火墙。
35
+ - 诱饵程序默认只监听 `127.0.0.1`;公开监听必须显式 `--allow-public`。
36
+ - 诱饵日志不记录 Cookie/Authorization;body/query 中的 password/token/secret/cookie/session 会脱敏。
37
+ - 不收集 WebRTC 真实 IP、Canvas/硬件指纹。
38
+
39
+ ## 不在范围内
40
+
41
+ - 用户对未授权目标的使用
42
+ - 用户自行修改代码、删除审批闸或接入 root 执行器导致的问题
43
+ - 第三方工具(Endlessh/Nginx/fail2ban/EDR 等)的配置错误
44
+ - 真实生产环境的网络、主机和凭据管理
45
+
46
+ ## 隐私
47
+
48
+ 插件默认不主动上传数据;事实库和诱饵日志保存在本机。外部情报查询由用户显式调用,并自行承担合规责任。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-blue-team-mode",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "CTF 网络攻防蓝队防御模式:资产盘点、告警研判、威胁狩猎、应急响应、取证分析与加固修复,内置 SQLite 事实库、独立右侧栏控制台与自主任务派发队列。",
5
5
  "license": "MIT",
6
6
  "author": "FGCGDroid",
@@ -33,6 +33,8 @@
33
33
  "icon.svg",
34
34
  "cordis.patch.yml",
35
35
  "README.md",
36
+ "CHANGELOG.md",
37
+ "SECURITY.md",
36
38
  "LICENSE",
37
39
  "DISCLOSURE"
38
40
  ],
@@ -91,10 +91,21 @@ function notFound() {
91
91
  return '<html><head><title>404 Not Found</title></head><body><h1>404 Not Found</h1><hr>nginx</body></html>'
92
92
  }
93
93
 
94
+ /** 诱饵日志只保留攻击载荷;不把口令、token、Cookie 等凭据原样写盘。 */
95
+ function redactBody(value) {
96
+ return String(value || '').slice(0, 2000)
97
+ .replace(/((?:password|passwd|pwd|token|secret|authorization|cookie|session)[^=:&\s"']*\s*["']?\s*[:=]\s*["']?)([^&\s"']+)/gi, '$1[REDACTED]')
98
+ }
99
+
94
100
  const server = createServer((req, res) => {
95
101
  const started = Date.now()
96
102
  const remote = req.socket.remoteAddress || ''
97
103
  const now = Date.now()
104
+ if (rate.size > 5000) {
105
+ for (const [key, value] of rate) {
106
+ if (now - value.start > RATE_WINDOW_MS) rate.delete(key)
107
+ }
108
+ }
98
109
  const bucket = rate.get(remote)
99
110
  if (bucket === undefined || now - bucket.start > RATE_WINDOW_MS) {
100
111
  rate.set(remote, { start: now, count: 1 })
@@ -154,10 +165,10 @@ function record(req, remote, status, body, started, url = new URL(req.url || '/'
154
165
  remote,
155
166
  method: req.method,
156
167
  path: url.pathname,
157
- query: url.search,
158
- user_agent: String(req.headers['user-agent'] || '').slice(0, 300),
159
- referer: String(req.headers.referer || '').slice(0, 300),
160
- body: String(body || '').slice(0, 2000),
168
+ query: redactBody(url.search),
169
+ user_agent: redactBody(String(req.headers['user-agent'] || '').slice(0, 300)),
170
+ referer: redactBody(String(req.headers.referer || '').slice(0, 300)),
171
+ body: redactBody(body),
161
172
  status,
162
173
  elapsed_ms: Date.now() - started,
163
174
  }
@@ -55,11 +55,28 @@ try {
55
55
  const shellText = await shell.text()
56
56
  if (shell.status !== 200 || !shellText.includes('synthetic decoy') || shellText.includes('exec')) throw new Error('假 shell 不应执行')
57
57
 
58
+ await fetch(base + '/admin', {
59
+ method: 'POST',
60
+ headers: { 'content-type': 'application/x-www-form-urlencoded' },
61
+ body: 'username=admin&password=SuperSecret123&token=abc123',
62
+ })
63
+ await fetch(base + '/admin', {
64
+ method: 'POST',
65
+ headers: { 'content-type': 'application/json' },
66
+ body: JSON.stringify({ username: 'admin', password: 'JsonSecret456', token: 'jsonToken789' }),
67
+ })
68
+ await fetch(base + '/admin?token=QuerySecret321&x=1')
69
+
58
70
  const missing = await fetch(base + '/random-path')
59
71
  if (missing.status !== 404) throw new Error('未知路径应 404')
60
72
 
61
73
  await sleep(100)
62
- const lines = readFileSync(log, 'utf8').trim().split(/\r?\n/).filter(Boolean)
74
+ const logText = readFileSync(log, 'utf8')
75
+ for (const secret of ['SuperSecret123', 'abc123', 'JsonSecret456', 'jsonToken789', 'QuerySecret321']) {
76
+ if (logText.includes(secret)) throw new Error('日志泄露口令/token:' + secret)
77
+ }
78
+ if (!logText.includes('[REDACTED]')) throw new Error('日志未标记脱敏')
79
+ const lines = logText.trim().split(/\r?\n/).filter(Boolean)
63
80
  if (lines.length < 4) throw new Error('事件日志不足:' + lines.length)
64
81
  const event = JSON.parse(lines[0])
65
82
  if (event.decoy !== 'test-decoy' || !event.remote || !event.path) throw new Error('事件字段不完整')
@@ -16,7 +16,7 @@ node scripts/decoy-server.mjs --host 127.0.0.1 --port 8080
16
16
  安装为 npm 包后:
17
17
 
18
18
  ```bash
19
- npx dsh-blue-decoy --host 127.0.0.1 --port 8080
19
+ npx --yes --package dsh-blue-team-mode dsh-blue-decoy --host 127.0.0.1 --port 8080
20
20
  ```
21
21
 
22
22
  默认只监听 `127.0.0.1`。对公网/内网资产监听必须显式:
@@ -50,7 +50,7 @@ node scripts/decoy-server.mjs --host 0.0.0.0 --port 8080 --allow-public
50
50
  $DSH_HOME/blue/decoy-events.jsonl
51
51
  ```
52
52
 
53
- 每条 JSON 包含时间、来源、方法、路径、UA、截断 body、状态码、耗时。不会记录 Cookie/Authorization,不抓 WebRTC/Canvas/硬件指纹。
53
+ 每条 JSON 包含时间、来源、方法、路径、UA、脱敏 body、状态码、耗时。不会记录 Cookie/Authorization;body 中的 password/token/secret/cookie 等字段会替换为 `[REDACTED]`,不抓 WebRTC/Canvas/硬件指纹。
54
54
 
55
55
  把事件交给 Agent:
56
56