Back to skill

Security audit

小红书违禁词离线检测

Security checks for vulnerabilities and agentic risk

Overview

This is a local Xiaohongshu content-checking skill with no network, credential, persistence, or destructive behavior, but its checker may miss some rules documented in its own word list.

Reasonable to install for local Xiaohongshu copy review, but do not treat a passing exit code as a complete guarantee until the documented word list and script are synchronized; manually review platform names and repeated sensitive terms before publishing.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/check_prohibited.py:17
Finding
Documented P0 Rules Are Not Fully Enforced by the Mandatory Publication Gate<![CDATA[ ## Vulnerability Details **File Locations**: - `scripts/check_prohibited.py:17-44` - `scripts/check_prohibited.py:121-129` - `references/prohibited-words.md:45,52-55,79-83` - `SKILL.md:14,37` **Vulnerability Type**: Security-control enforcement mismatch caused by duplicated and divergent rule sources **Risk Level**: Medium ### Vulnerable Code The scanner maintains an internal P0 rule list that does not include all terms identified as prohibited in the documented canonical list: ```python # ============ 离线词库(与 references/prohibited-words.md 同步维护)============ # 每个词条: (正则, 级别, 说明, 替代建议) P0_HARD = [ (r"白嫖", "P0", "9/12 两次实测触发'仅自己可见'软限流", "直接删,靠结果感钩子"), (r"0\s*元|¥\s*0|零元", "P0", "价格诱导词,封面OCR尤其敏感", "删,免费靠'登录就能学'暗示"), (r"免费(领取|白拿|白送|获得|获取)", "P0", "价格诱导组合", "删或改'登录就能学'"), (r"官方.{0,6}(免费|白嫖).{0,6}(拿证|证书|徽章)", "P0", "'免费+官方+拿证'三词连用触发营销标签", "三词拆开"), (r"答案.{0,4}(合集|PDF|文档).{0,4}(主页群|群|自取)", "P0", "答案+资料+主页群 导流诱导高危", "改'攻略整理成文档,主页可看'"), (r"免费证书|AI证书|免费课程|白嫖快乐", "P0", "营销诱导敏感标签/词", "删,保留中性词"), (r"LinkedIn|领英学习|领英", "P0", "外部平台名,导流站外", "只写出品方"), (r"微信号|vx|卫星|加V|私我|私信我", "P0", "站外导流", "不写,转化走主页简介"), ] ``` The documented P0 threshold for two or more occurrences of the relevant term is calculated only as an informational message. It does not add a P0 hit or affect the exit status: ```python # 免费出现次数统计 free_count = len(re.findall(r"免费", all_text)) print(f"\n[提示] 「免费」全文出现 {free_count} 次(≥2 次建议削减到 1 次)") print("\n" + "=" * 50) if hits_p0: print("结论:❌ 有 P0 硬词,需修改后再发布") return 1 else: print("结论:✅ 无 P0 硬词,可发布(P1/P2 若命中建议顺手改)") return 0 ``` The canonical documentation identifies additional external-platform terms and the occurrence threshold as prohibited rules: ```markdown | 免费(全文≥2次) | P0 | 「免费+官方+拿证」组合触发营销标签 | 全篇最多留 1 次,其余删或改"不用付费→登录就能学" | 2026-09-13 | ``` ```markdown | GitHub / ClawHub / 公众号 | 不写平台名,只写工具/作品名 | ``` ### Technical Analysis The Skill describes `references/prohibited-words.md` as its single source of t ...[truncated 2222 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Establish one machine-readable source of truth** - Move every rule into a structured format such as JSON, YAML, TOML, or a Python data module. - Include the pattern, severity, context, explanation, replacement guidance, and admission date. - Generate the human-readable Markdown documentation from this source. 2. **Eliminate manual duplication** - Load the canonical rules directly at runtime or generate the scanner's rule module during the build process. - Fail closed if the canonical rule file is missing, malformed, or contains unsupported entries. 3. **Enforce the documented occurrence threshold** - Add a P0 finding whenever the count reaches the documented threshold: ```python free_count = len(re.findall(r"免费", all_text)) if free_count >= 2: hits_p0.append( ("免费×2+", "P0", "The documented occurrence threshold was reached", "Reduce usage to at most one occurrence") ) ``` 4. **Synchronize all documented prohibited terms** - Add or explicitly reclassify `GitHub`, `ClawHub`, `公众号`, plain `微信`, and every other documented term absent from the executable rules. - Record intentional differences explicitly instead of relying on implicit omissions. 5. **Add rule-parity regression tests** - Verify that every canonical P0 rule produces exit status `1`. - Test exact boundary conditions, including zero, one, and two occurrences. - Test each external-platform term independently. - Verify that malformed rule data produces exit status `2`, not a PASS. 6. **Add consistency validation** - Include a CI check that compares documented rules with executable rules. - Reject releases when a documented P0 rule lacks an executable test or implementation. ]]>
Vulnerability Patterns
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (3)

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
The skill description is written as a Chinese-only workflow requirement and presents the skill as mandatory for publication in that context, without offering any language or locale choice. Under the policy rule, forcing a specific language or locale without user opt-in is a natural-language policy violation.

Lp3

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding
Without declared permissions the skill's intent is opaque and cannot be validated.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
This code file contains natural-language instructions, descriptions, and console output entirely in Chinese, which imposes a specific language on users. The file does not offer an alternative language, opt-in, or a documented reason that the skill must be Chinese-only, so it matches the locale-policy violation criteria.

Static analysis

No suspicious patterns detected.