Back to skill

Security audit

shared-patterns

Security checks for vulnerabilities and agentic risk

Overview

This is a documentation-only shared-patterns skill with some generic triggers and a weak sample validation snippet, but no hidden execution, persistence, credential access, or exfiltration behavior.

This skill is reasonable to install as a reference library, but treat its code blocks as templates to review before copying. In particular, harden the path-validation example before using it in real tooling, and be aware that broad triggers may load this skill in more contexts than expected.

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

Note
Location
modules/validation-patterns.md:47
Finding

Unrestricted Path Traversal in Reference Validation

Content
View full analysis

Vulnerability Details

File Location: modules/validation-patterns.md, lines 47–55
Vulnerability Type: Path traversal and local file-existence disclosure
Risk Level: Low

Vulnerable Code:

python
def validate_references(skill_path: Path, references: list[str]) -> dict:
    """Validate that referenced files exist."""
    results = {'valid': [], 'missing': []}
    for ref in references:
        ref_path = skill_path.parent / ref
        if ref_path.exists():
            results['valid'].append(ref)
        else:
            results['missing'].append(ref)
    return results

Technical Analysis

The validation template treats each reference as a trusted relative path. It does not reject absolute paths, remove .. path components, resolve symbolic links, or verify that the resolved target remains inside the expected skill directory.

In Python, joining a pathlib.Path with an absolute path discards the preceding base path. Relative references containing ../ can likewise escape skill_path.parent. Calling Path.exists() on the resulting path therefore creates a local file-existence oracle outside the validator's intended scope.

This is a documentation template rather than directly executable project code, so exploitation requires another component to adopt the template and pass attacker-controlled references to it.

Attack Path

  1. A validator implements the documented validate_references() template.
  2. An attacker supplies a skill or document containing a crafted reference, such as ../../.env, ../../../etc/passwd, or an absolute path.
  3. The validator joins the reference with skill_path.parent without containment validation.
  4. Path.exists() checks the external target.
  5. The function places the supplied reference in either valid or missing.
  6. If these results are returned or displayed, the attacker learns whether the probed local path exists.

Impact As

...[truncated 356 chars]

Remediation
View remediation

Remediation Suggestions

  • Reject absolute references before constructing a candidate path.
  • Resolve both the trusted root and candidate path using Path.resolve().
  • Confirm that the resolved candidate is contained within the trusted root using Path.is_relative_to() on supported Python versions.
  • Decide explicitly whether symbolic links are permitted. If not, reject references whose path components traverse symlinks.
  • Return a validation error for out-of-bound references without probing or exposing the external target's existence.
  • Add tests for absolute paths, ../ traversal, nested traversal, and symlink-based escapes.

Example hardened implementation:

python
from pathlib import Path

def validate_references(skill_path: Path, references: list[str]) -> dict:
    """Validate references while enforcing the skill-directory boundary."""
    root = skill_path.parent.resolve()
    results = {
        "valid": [],
        "missing": [],
        "invalid": [],
    }

    for ref in references:
        supplied = Path(ref)

        if supplied.is_absolute():
            results["invalid"].append(ref)
            continue

        candidate = (root / supplied).resolve()

        if not candidate.is_relative_to(root):
            results["invalid"].append(ref)
            continue

        if candidate.exists():
            results["valid"].append(ref)
        else:
            results["missing"].append(ref)

    return results
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (7)

Anti-Refusal Statement

High
Category
Anti-Refusal
Confidence
80% confidence
Finding

Skill instructs the agent to omit warnings, disclaimers, or ethical commentary. Stripping safety caveats hides risk from the user and is a common jailbreak preamble.

Content

Scanner excerpt · modules/editing.md (reported line 118)May include surrounding context.

md
## Anti-Patterns

- **Silent semantic change**: Same function name, same
  signature, different behavior. No warning, no version bump.
  Callers break in production.
- **Soft delete**: Removing a function but leaving the docs
  pointing at it. New callers waste time before discovering it

Self-Modification

High
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Content

Scanner excerpt · modules/workflow-patterns.md (reported line 173)May include surrounding context.

md
**Goal**: Create minimal skill that addresses failures

1. [ ] Write SKILL.md addressing failures
2. [ ] Test with skill present
3. [ ] Verify improvement

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The triggers are extremely generic terms like 'patterns', 'templates', 'shared', and 'validation', which are likely to match ordinary user conversations and cause this skill to activate unintentionally. Over-broad activation increases the attack surface for prompt injection and context pollution by bringing in irrelevant instructions or content when the user did not explicitly request this skill.

Content

No source excerpt is available for this finding.

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
80% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

Scanner excerpt · modules/error-handling.md (reported line 44)May include surrounding context.

Good:

text
[ERROR] E001: Missing required field 'description'
  Location: skills/my-skill/SKILL.md
  Details: The YAML frontmatter must include a 'description' field
  Suggestion: Add 'description: <what it does and when to use it>'

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
80% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

Scanner excerpt · modules/editing.md (reported line 46)May include surrounding context.

bash
# Verify versions match
rg "^version:" plugins/abstract/skills/shared-patterns/SKILL.md
rg "^version:" plugins/abstract/openpackage.yml

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
80% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

Scanner excerpt · modules/troubleshooting.md (reported line 22)May include surrounding context.

bash
# Verify versions match
rg "^version:" plugins/abstract/skills/shared-patterns/SKILL.md
rg "^version:" plugins/abstract/openpackage.yml

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The skill is described throughout the file as a documentation-only shared patterns resource, with references to markdown modules for validation, error handling, testing, and workflow templates. The instruction at L66 says to 'Run the command with --help flag,' which contradicts the documented nature of this skill because no command is defined anywhere in the manifest or body.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.