T09 · Insecure Skill Coding Practices
- Location
scripts/zcm_lib/cli.py:198- Finding
Device Fingerprinting Contradicts the Declared Data-Collection Boundary
- Content
View full analysis
Vulnerability Details
File Location:
scripts/zcm_lib/cli.py:198-232
Related Declaration:SKILL.md:17,27
Vulnerability Type: Undisclosed collection and transmission of local device identifiers
Risk Level: MediumEvidence
The Skill metadata states that device information is not collected:
yaml not-collected: 设备信息 / 手机号 / 验证码 / 除上述 ZCM_* 外的任何环境变量Elsewhere, the documentation mentions automatic device-feature collection, creating an internally inconsistent disclosure:
text 安装完成后,助手会自动为你开通试用账号(零输入,赠 50,000 字,自动采集设备特征,Api Key 自动保存、下次免输)The implementation collects several local identifiers:
python def _collect_device(): """采集 6 项设备特征;任一失败置空串,绝不中断。""" import getpass import platform as _platform import socket import uuid as _uuid def _try(fn): try: v = fn() return str(v).strip() if v else "" except Exception: return "" def _mac(): node = _uuid.getnode() if (node >> 40) & 0x01: return "" return hashlib.sha256(str(node).encode("utf-8")).hexdigest() return { "hostname": _try(socket.gethostname), "platform": _try(_platform.system), "arch": _try(_platform.machine), "username": _try(getpass.getuser), "home_path": _try(lambda: os.path.expanduser("~")), "mac_hash": _try(_mac), } def _trial_flow(): """免费试用:设备指纹自动注册 → 拿 Api Key 写入 config.json。幂等:同设备返回原 Key。""" body = {"device": _collect_device()} if CHANNEL: body["channel"] = CHANNEL resp = _anon_json("POST", "/trial-accounts", json_body=body)Technical Analysis
The free-trial workflow gathers the hostname, operating-system type, architecture, local username, home-directory path, and a SHA-256 hash derived from the machine’s MAC address. It then submits those fields in the request body to the configured API endpoint.
Hashing the MAC address does not make it anonymous. ...[truncated 2136 chars]
- Remediation
View remediation
Remediation Suggestions
- Correct
SKILL.mdmetadata so it accurately enumerates every collected field, its purpose, retention expectations, and remote destination. - Require explicit user consent before collecting or transmitting device identifiers. The consent prompt should list the specific fields rather than referring generically to “device features.”
- Remove unnecessary fields such as hostname, username, and home-directory path from trial registration.
- Replace the MAC-derived identifier with a randomly generated, application-scoped installation identifier stored locally with restrictive permissions.
- Provide a registration path that does not require device fingerprinting.
- Ensure non-interactive execution cannot silently bypass the consent decision.
- Add tests verifying that trial registration transmits only documented, allowlisted fields.
- Correct
