Back to skill

Security audit

forensic-audit

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent code-audit helper, but it tells agents to bypass a missing file-write permission by using PowerShell, which needs user review before installation.

Review and edit the permission-handling instruction before installing. The skill should stop or ask for an approved output directory if report writes are not permitted; it should not switch to PowerShell or a general shell command to get the same write done. Also expect it to create persistent Desktop reports and, if using the pipeline template, multiple subagent output files.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Findings (1)

T01 · Skill Instruction Hijacking

Error
Location
SKILL.md:258
Finding

Filesystem Write Permission Gate Bypass Through Shell Command Fallback

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:258
Vulnerability Type: Permission-gate bypass through an alternate tool
Risk Level: High

Complete Snippet:

markdown
- **Permission Handling**: If you do not have permission to write directly to `%USERPROFILE%\Desktop\_Reports`, request it using `ask_permission` for `write_file` with target `C:\Users\relig\Desktop` or execute the file write operations via the `run_command` tool in PowerShell.

Technical Analysis

The Skill explicitly instructs the agent to use PowerShell through run_command as an alternative when direct filesystem write permission is unavailable. This makes shell execution a substitute for the permission mechanism associated with write_file.

A denied or unavailable permission is a security boundary, not merely a tool limitation. Redirecting the same operation through a more general command-execution tool defeats that boundary rather than resolving it through explicit user authorization. The instruction is activated specifically under the condition where direct write permission is absent.

Although the intended destination is the audit report directory, the prescribed fallback undermines tool-level access controls and establishes an unsafe pattern in which a general-purpose shell can bypass restrictions applied to a specialized filesystem tool.

Attack Path

  1. A user invokes the forensic audit Skill.
  2. The Skill attempts to create or write reports beneath %USERPROFILE%\Desktop\_Reports.
  3. The agent determines that it lacks permission to write there using the designated file-writing mechanism.
  4. Instead of stopping or requiring a successful explicit permission grant, the Skill permits the agent to invoke PowerShell through run_command.
  5. PowerShell performs the filesystem write outside the denied or unavailable write_file authorization path.
  6. The operation therefore proceeds without the permission gate intended for direct file writes.

Impact

...[truncated 573 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove the run_command and PowerShell fallback for situations where direct write permission is absent.
  2. Require the agent to use the platform’s explicit permission mechanism before creating or modifying files outside an already authorized location.
  3. If permission is denied, unavailable, or cannot be verified, terminate report generation safely and inform the user that no files were written.
  4. Permit an alternative output directory only when the user explicitly selects and authorizes it.
  5. Clarify that authorization failures must never be bypassed by switching to a more privileged or general-purpose tool.
  6. Constrain report writes to a canonicalized, user-approved directory and reject paths that resolve outside that directory.

A safe replacement would be:

markdown
- **Permission Handling**: If write permission for the report directory is unavailable, request explicit permission using the platform permission mechanism. If permission is not granted, stop without writing files and ask the user to select an authorized output directory. Do not use shell commands or alternate tools to bypass a denied permission.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (18)

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill is described as a read-only forensic audit, but this template directs subagents to write FINAL.md outputs. That mismatch can mislead users and orchestrators into granting or assuming stronger safety properties than actually exist, enabling unauthorized filesystem modifications during an audit workflow.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The orchestrator instructions require generating MERGED.md and AUDIT_FINAL.md artifacts, which exceeds a read-only audit boundary. In a security-sensitive agent environment, capability drift like this is dangerous because a supposedly passive audit skill becomes an active file-writing workflow that can alter the workspace and create persistence points.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The progress log append instructions and directory creation guidance directly contradict a read-only claim. This increases operational risk because downstream systems may invoke the skill under the assumption it cannot mutate state, when in fact it can create folders and modify tracking files across repeated runs.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The prompt template explicitly says READ-ONLY while simultaneously instructing the subagent to save FINAL output to disk. This internal contradiction is dangerous because it can bypass human and system scrutiny: operators may trust the 'READ-ONLY' label while the actual behavior performs writes.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The top-level description claims a three-phase, read-only forensic audit protocol, which implies analysis without filesystem side effects. However, later usage instructions say each phase is written to a timestamped report directory on the Desktop, and the pipeline section describes consolidating output into AUDIT_FINAL.md, so the documented behavior is not actually read-only.

Content

No source excerpt is available for this finding.

Unbounded Resource Access

Medium
Category
Excessive Agency
Confidence
80% confidence
Finding

Skill allows unbounded resource consumption (API calls, storage, compute). Without rate limits or quotas, a compromised or misbehaving agent can cause denial-of-service or cost overruns.

Content

Scanner excerpt · README.md (reported line 23)May include surrounding context.

md
* **Phase 2: Database Integrity, Transactions & Performance**
  * Race conditions: TOCTOU races, atomic transactions for queue acceptance and voucher bookings.
  * Query Optimization: N+1 loops, missing indexes, unbounded queries.
  * Resource leaks: connection pool limits, SSE listener cleanup.

* **Phase 3: Architecture, SOLID, Resilience & Lifecycle**

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 · README.md (reported line 35)May include surrounding context.

md
## How to Use

1. **Install:** Save `SKILL.md` into `~/.claude/skills/forensic-audit/SKILL.md`. Restart your agent session — the skill becomes available as `/forensic-audit`.
2. **Invoke with a defined scope:** One file or tightly-related file group at a time — e.g. `/forensic-audit on src/routes/auth.ts`. See Scope Discipline in SKILL.md — never point it at an entire repository in one pass.
3. **Read the report:** Each phase is written to a timestamped report in `%USERPROFILE%\Desktop\_Reports\<timestamp>\` (Windows) or `~/Desktop/_Reports/<timestamp>/` (Linux/macOS) — never inside the project repository.
4. **Auditing a whole codebase?** See the pipeline section below — generate a task list first, then run it one file at a time.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The trigger phrases are broad enough to match ordinary requests for code review or general security help, causing the skill to activate in contexts the user may not intend. This is dangerous because it can unexpectedly invoke filesystem writes, shell commands, and extensive repository scanning under a generic request.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The Trigger section repeats ambiguous activation phrases without clarifying exclusions or requiring strong user intent. This is dangerous because repeated broad triggers increase the chance of accidental activation and execution of behaviors that carry side effects beyond normal conversational assistance.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill advertises itself as a read-only forensic audit, but it instructs the agent to create directories and write multiple report files to the user's Desktop. This is dangerous because it expands the skill's effective permissions beyond what a user would reasonably infer from the manifest, increasing the risk of unauthorized local filesystem writes and trust-boundary confusion.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill writes reports to the user's Desktop but does not prominently warn in the high-level description that it will perform local filesystem writes. This is dangerous because users may invoke the skill expecting analysis only, not persistent artifact creation in a sensitive or synced location like the Desktop.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation uses strong 'STRICT READ-ONLY' language while still permitting file creation and PowerShell-mediated write operations. This is dangerous because contradictory safety claims can mislead users and reviewers about the skill's real behavior, weakening informed consent and making risky actions easier to smuggle under a benign label.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill authorizes use of broad shell execution via run_command for tasks that are primarily file reading and code search. Allowing general command execution is dangerous because it enlarges the attack surface: a compromised or overly permissive skill could execute unintended commands, access unrelated data, or perform actions beyond the stated audit scope.

Content

No source excerpt is available for this finding.

Unbounded Resource Access

Medium
Category
Excessive Agency
Confidence
80% confidence
Finding

Skill allows unbounded resource consumption (API calls, storage, compute). Without rate limits or quotas, a compromised or misbehaving agent can cause denial-of-service or cost overruns.

Content

Scanner excerpt · SKILL.md (reported line 34)May include surrounding context.

  1. Quick signal scan (run before Phase 1 to orient findings): Use the grep_search tool (or run_command to run rg):
    bash
    # Unbounded queries
    rg "\.findMany\(\)" --type ts -l
    
    # Potential hardcoded secrets
    

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The template describes a "/forensic-audit pipeline" across a codebase, but it does not define specific activation phrases, scope boundaries, or negative examples that clarify when this skill should or should not be invoked. In a markdown skill file, this kind of broad orchestration description can lead to unintended invocation in loosely related auditing contexts.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

The README's guidance creates an intent-level contradiction: it frames the skill as read-only and discourages repository-wide scans in one place, while elsewhere it explicitly supports whole-codebase orchestration and persistent output generation. This is more than incomplete documentation because the operational guidance conflicts with the stated constraints.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

This is a markdown file, so SQP-2 applies to whether the skill description warns about behaviors affecting user data or system integrity. L37 states that each phase writes reports to a Desktop directory, but the README presents this as operational detail rather than an explicit user warning that the skill creates local files and folders outside the project.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
76% confidence
Finding

The manifest describes a forensic audit of the codebase, but the documented procedure also gathers version-control state and embeds it in reports. While related to auditing, this is an additional capability involving repository metadata inspection that is not stated in the manifest description.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.