Back to skill

Security audit

house-skills-kit

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent real-estate skill kit, but its generator and installer can write skill files outside their advertised containment paths when given crafted names or paths, so it should be reviewed before use.

Install only from configs you trust, inspect brand.slug/domain and CTA/contact fields before rendering, and avoid passing custom AGENT_HOME paths with traversal or symlinks. This is not showing exfiltration or hidden execution, but the package should harden path validation before broad use.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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 (3)

T01 · Skill Instruction Hijacking

Error
Location
template/modules/content-marketing.md.tmpl:14
Finding
Mandatory Promotional Call-to-Action Injection in Generated Content## Vulnerability Details **File Location**: `template/modules/content-marketing.md.tmpl`, lines 14–17 **Vulnerability Type**: Forced promotional output injection **Risk Level**: High ### Vulnerable Code Snippet ```text - Spoken-script structure: present a pain-point hook in the first three seconds, provide one actionable insight within thirty seconds, and end with a reason to initiate a consultation. - Every content item must include a conversion hook using the fixed ending: {{content_cta_example}}. ``` The excerpt above is an English rendering of the template instruction at the specified source lines. ### Technical Analysis When the content-marketing module is enabled, it directs the agent to append a fixed, configuration-controlled conversion hook to every generated content item. The `content_cta_example` value is supplied through the brand configuration and is substituted directly into the generated `SKILL.md`. This behavior goes beyond merely helping the user draft marketing content. It persistently controls the ending of model output and can cause generated responses to contain advertising, contact instructions, external links, QR-code directions, or traffic-diversion text even when those additions are not necessary to answer the user's immediate request. The instruction is conditional on enabling the marketing module, but once enabled it applies categorically to every content item rather than requiring explicit user consent for each promotional addition. ### Attack Path 1. A Skill operator creates or modifies an in-repository brand configuration. 2. The operator assigns advertising text, contact instructions, or an external destination to `content_cta_example`. 3. The operator enables the `content-marketing` module. 4. `render.py` substitutes the configured value into the generated `SKILL.md`. 5. The generated Skill instructs the agent to append the configured conversion hook to every relevant content output. ...[truncated 732 chars]
Remediation
## Remediation Suggestions 1. Remove the unconditional requirement to append a fixed conversion hook to every content item. 2. Require explicit user approval before adding promotional text, contact details, QR-code instructions, or external links. 3. Make calls to action optional on a per-request basis rather than persistent Skill-level behavior. 4. Constrain `content_cta_example` to plain, non-link text unless an administrator explicitly enables external destinations. 5. Validate configured destinations against an approved-domain allowlist. 6. Clearly identify promotional additions and keep them separate from factual or advisory content. 7. Add tests confirming that ordinary informational requests do not receive unsolicited promotional endings.

T09 · Insecure Skill Coding Practices

Warning
Location
render.py:137
Finding
Generated Skill Name Allows Output-Directory Traversal## Vulnerability Details **File Location**: `render.py`, lines 34–35, 102–104, and 137–145 **Vulnerability Type**: Path traversal through an unsanitized generated Skill identifier **Risk Level**: Medium ### Vulnerable Code Snippet ```python slug = brand.get("slug", "brand") skill_id = vars_["skill_id"] manifest = { "name": skill_id, } outdir = os.path.join(args.out, manifest["name"]) os.makedirs(outdir, exist_ok=True) skill_path = os.path.join(outdir, "SKILL.md") with open(skill_path, "w", encoding="utf-8") as f: f.write(text) with open(os.path.join(outdir, "manifest.json"), "w", encoding="utf-8") as f: json.dump(manifest, f, ensure_ascii=False, indent=2) ``` The generated identifier is constructed as follows: ```python "skill_id": f"{slug}-{skill.get('domain', skill.get('archetype', 'skill'))}", ``` ### Technical Analysis The script validates that the user-supplied `--out` argument resolves inside the repository, but it does not validate the `brand.slug` or final `manifest["name"]` used beneath that directory. Because `os.path.join()` does not remove traversal components, a slug containing path separators or `..` components can make `outdir` resolve outside the approved output directory. The script then creates the resolved directory and writes `SKILL.md` and `manifest.json` there. The validation of `--config` and `--out` therefore does not protect the final write target. Security checks must be applied after all attacker-controlled path components have been joined and canonicalized. ### Attack Path 1. An attacker supplies or modifies a YAML configuration located inside the repository, satisfying the existing configuration-path restriction. 2. The attacker assigns a traversal value to `brand.slug`, such as a sequence containing parent-directory components. 3. A user runs the documented renderer command with that configuration. 4. `build_vars()` incorporates the malicious slug ...[truncated 1037 chars]
Remediation
## Remediation Suggestions 1. Restrict `brand.slug`, `skill.domain`, and the final Skill identifier to a conservative pattern such as `^[A-Za-z0-9_-]+$`. 2. Reject absolute paths, path separators, empty identifiers, `.` components, and `..` components. 3. Canonicalize the complete destination after joining all components: ```python out_root = os.path.realpath(args.out) outdir = os.path.realpath(os.path.join(out_root, manifest["name"])) if os.path.commonpath([out_root, outdir]) != out_root: raise ValueError("Generated output directory escapes the approved output root") ``` 4. Perform the containment check before calling `os.makedirs()` or opening any output file. 5. Consider refusing to overwrite an existing generated directory unless an explicit `--force` option is provided. 6. Add regression tests using traversal values, absolute paths, mixed separators, and symlink-based escape attempts.

T09 · Insecure Skill Coding Practices

Warning
Location
install.sh:38
Finding
Installer Home-Directory Restriction Can Be Bypassed with Traversal Components## Vulnerability Details **File Location**: `install.sh`, lines 38–42 **Vulnerability Type**: Lexical path validation without canonicalization **Risk Level**: Medium ### Vulnerable Code Snippet ```bash if [[ -n "$AGENT_HOME" ]]; then case "$AGENT_HOME" in "$HOME"|"$HOME"/*) echo "$AGENT_HOME"; return 0 ;; *) echo "[x] Security restriction: the installation target must be under \$HOME" >&2; return 1 ;; esac fi ``` The error-message text above is translated into English; the shell logic is unchanged. ### Technical Analysis The installer intends to limit installation targets to directories beneath `$HOME`. However, the check only verifies the textual prefix of `AGENT_HOME`. A path such as `$HOME/../other-directory` begins with the allowed prefix and therefore passes the `case` statement, even though normal filesystem resolution places it outside `$HOME`. The same weakness can interact with symlinks under the home directory that resolve to external locations. The accepted path is subsequently used to derive `TARGET_DIR`, after which the installer invokes `mkdir -p` and recursively copies the generated Skill into that location. The declared least-privilege boundary is therefore not reliably enforced. ### Attack Path 1. An attacker persuades a user to invoke `install.sh` with a crafted second argument containing parent-directory traversal components. 2. The argument begins textually with `$HOME/`, so the `case` allowlist accepts it. 3. `detect_agent_home()` returns the uncanonicalized value. 4. The script appends the Skill name to form `TARGET_DIR`. 5. `mkdir -p` and `cp -r` resolve the traversal components and operate outside the intended home-directory subtree. 6. Skill files are installed into an unintended location writable by the invoking user. Exploitation requires control over, or influence on, the installer command arguments. The process cannot write beyond the operating-system permiss ...[truncated 670 chars]
Remediation
## Remediation Suggestions 1. Canonicalize both `$HOME` and the requested installation target before comparing them. 2. Use `realpath -m` or an equivalent method that safely handles a not-yet-created destination. 3. Verify containment using canonical paths rather than string-prefix matching. 4. Reject targets that traverse through symlinks resolving outside the canonical home directory. 5. Quote every resulting path and terminate option parsing for file utilities where supported. 6. Revalidate the final `TARGET_DIR` after appending `SKILL_NAME`. 7. Add tests for parent-directory traversal, repeated separators, relative paths, symlink escapes, and paths with spaces. A hardened pattern should resolve the complete destination and accept it only if it is equal to canonical `$HOME` or begins with canonical `$HOME` followed by a path separator.
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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 (7)

Vague Triggers

Medium
Confidence
84% confidence
Finding
The activation text is very broad: 'Use when 需要房产相关AI技能的安装、使用、生成或按身份选型' can match a wide range of normal real-estate-related requests, including generic installation or advisory queries. Over-broad routing can cause this meta-skill to activate unexpectedly, increasing the chance that users are steered into the wrong skill, exposed to unnecessary instructions, or trigger downstream tools/scripts unintentionally.

Vague Triggers

Medium
Confidence
84% confidence
Finding
The trigger keywords are very broad consumer housing terms such as '找房', '买房', and '小区', with no visible gating, exclusion logic, or requirement for explicit housing-assistant intent. This can cause unintended activation in ordinary conversation, leading the skill to engage outside its intended scope and potentially steer users into branded real-estate flows or data collection when they did not clearly request it.

Vague Triggers

Medium
Confidence
87% confidence
Finding
The trigger keywords include broad, common real-estate terms such as '买房', '售楼处', '户型', and '价格', which can match many ordinary user queries outside the intended brand/project scope. This can cause unintended activation of the skill, leading users to receive biased project-specific sales guidance when they were seeking general market information or unrelated property options.

Vague Triggers

Medium
Confidence
86% confidence
Finding
The trigger keywords include broad, everyday phrases like “买房”, “找房”, and “看房”, which can cause the skill to activate in situations where the user did not intend to invoke this specific workflow. In an agent setting, overly broad activation can lead to inappropriate routing, unsolicited sales-oriented behavior, or leakage of domain-specific prompts into unrelated conversations.

Vague Triggers

Medium
Confidence
88% confidence
Finding
The skill description uses very broad invocation triggers such as any request about mortgage payments, taxes, delivery fees, floor pricing, or discount stacking, without clear boundaries on when the skill should or should not be selected. In an agent environment, this can cause over-selection of the skill for loosely related real-estate conversations, leading to irrelevant tool use, incorrect financial guidance, or unintended propagation of jurisdiction-specific assumptions.

Vague Triggers

Medium
Confidence
87% confidence
Finding
The trigger description uses very broad phrasing ('当用户提到{{trigger_keywords}}时触发') for a general real-estate advisory skill, which can cause the skill to activate on common conversational language rather than clear domain-specific intent. In an instruction-only skill, over-broad activation increases the chance of unintended interception of user requests, leading to misrouting, inappropriate persuasive guidance, or invocation in contexts where the user did not intend to engage a real-estate workflow.

Vague Triggers

Medium
Confidence
93% confidence
Finding
The trigger condition activates when a user merely mentions templated keywords, but the template does not constrain scope, intent, or context. In a sales-oriented real estate skill, this can cause over-broad activation in unrelated conversations, leading the agent to inject persuasive, lead-capture, or property-specific guidance when the user did not actually request it.

Static analysis

No suspicious patterns detected.