Back to skill

Security audit

Labor Law

Security checks for vulnerabilities and agentic risk

Overview

This skill needs Review because it is advertised as a Chinese labor-law helper but its main documented command flow is a generic plaintext local logging tool that could retain sensitive legal or employment notes.

Review carefully before installing. Do not store contracts, employee identifiers, wage records, dispute facts, or privileged legal notes in this skill unless you are comfortable with plaintext files being written locally under the invoking user's permissions. The publisher should align the documentation and entrypoint with the labor-law script or reclassify the package as a logging utility, then add clear storage controls and safer file permissions.

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/script.sh:6
Finding

Plaintext Storage of Potentially Sensitive Data with Permissive Default Permissions

Content
View full analysis

Vulnerability Details

File Location: scripts/script.sh, lines 6-8, 30, and 53-55
Vulnerability Type: Insecure storage and insufficient filesystem permission hardening
Risk Level: Medium

Vulnerable Code

bash
DATA_DIR="${LABOR_LAW_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/labor-law}"
DB="$DATA_DIR/data.log"
mkdir -p "$DATA_DIR"
bash
_log() { echo "$(date '+%m-%d %H:%M') $1: $2" >> "$DATA_DIR/history.log"; }
bash
cmd_add() {
    echo "$(date +%Y-%m-%d) $*" >> "$DB"; echo "  Added: $*"
    _log "add" "${1:-}"
}

Technical Analysis

The script persistently records arbitrary user-supplied entries in data.log and command activity in history.log. These files are stored as unencrypted plaintext. The script creates the storage directory and files using the caller's ambient umask, without explicitly enforcing owner-only permissions.

Under a commonly used 022 umask, the directory can be created with mode 0755 and log files with mode 0644. This may allow other local users to traverse the directory and read its files. Because the tool is presented for labor-law and employment-related use, stored entries may contain compensation details, employment disputes, contract information, or other personal data.

The LABOR_LAW_DIR and XDG_DATA_HOME environment variables also control the storage location. Although this is documented functionality, the script does not validate whether the selected directory or destination files are symbolic links, privately owned, or otherwise safe for sensitive storage.

Attack Path

  1. A user runs labor-law add with sensitive employment or personal information.
  2. scripts/script.sh creates the data directory using mkdir -p without setting an explicit restrictive mode.
  3. The shell creates data.log and history.log through append redirection, inheriting permissions from the ambient umask.
  4. On a shared system with a pe ...[truncated 1270 chars]
Remediation
View remediation

Remediation Suggestions

  1. Set a restrictive process umask before creating any storage:

    bash
    umask 077
    
  2. Create and verify an owner-only directory:

    bash
    mkdir -p -m 700 -- "$DATA_DIR"
    chmod 700 -- "$DATA_DIR"
    
  3. Create log files with mode 0600 before appending:

    bash
    install -m 600 /dev/null "$DB"
    install -m 600 /dev/null "$DATA_DIR/history.log"
    

    Existing regular files should be preserved rather than overwritten, while their ownership and permissions should still be validated.

  4. Reject unsafe destinations. Before writing, verify that the directory is owned by the current user and that data.log and history.log are regular files rather than symbolic links. Use canonical-path validation when accepting LABOR_LAW_DIR or XDG_DATA_HOME.

  5. Avoid recording unnecessary user content in activity history. Document exactly what is retained and provide a command for securely clearing retained records.

  6. Warn users that entries are stored locally in plaintext and should not include credentials, identity numbers, privileged legal documents, or unnecessary personal information. If highly sensitive records are an intended use case, use an authenticated encryption mechanism and a secure key-management design.

Vulnerability Patterns
  • 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
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (13)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill metadata advertises a Chinese labor-law query capability, but the documented functionality is a generic local data logging CLI with persistence, history tracking, and export features. This mismatch is dangerous because agents or users may invoke the skill in sensitive legal-review contexts while unknowingly storing confidential employment or legal data to disk in plain text under a misleading name.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The front matter presents the skill as a labor-law reference tool, while the body describes a separate utility for data entry and logging. In an agent ecosystem, this kind of deceptive or inconsistent interface can cause unintended invocation and mishandling of sensitive inputs because downstream selection logic may trust the metadata rather than the body.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The documented commands manage arbitrary entries, local logs, and exports rather than legal research. That means the skill can be used as a covert or accidental persistence mechanism for sensitive case notes, employee data, or contract details under the guise of a harmless legal lookup tool.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The implementation materially deviates from the declared labor-law purpose and instead provides a generic local data store and logging utility. This kind of skill/implementation mismatch is dangerous because it can mislead users and reviewers about what data is collected and what actions are performed, creating an opportunity for unauthorized persistence of user input under the guise of a legal-reference tool.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

Internally inconsistent descriptions and broad usage cues can cause an agent to select this skill for legal analysis tasks when it is actually a generic logging tool. That increases the chance of sensitive prompts being routed into a persistence mechanism, producing unintended data collection and weakening user control over tool use.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

Persistent local logging and history tracking are not justified by the stated purpose of querying labor law, and they create unnecessary data retention. In this context, stored entries may include sensitive HR, employment-dispute, or severance information that remains on disk and could later be exposed to other local users, backups, or support tooling.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill stores entries and command history in plain-text local files, but the warning about this risk is not sufficiently prominent for a legal/HR context. Users may input contracts, severance notes, dispute facts, or employee identifiers without realizing they are creating durable plaintext records, leading to confidentiality and compliance issues.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The statement 'No data leaves your machine' attempts to reassure users, but within a mislabeled skill it may further lower suspicion while normalizing local retention of sensitive data unrelated to the declared purpose. The danger is not exfiltration here; it is misleading trust signaling that obscures persistence and the true function of the tool.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This file contains user-facing help and guidance exclusively in Chinese, including all command output and examples. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly documented and justified, which is not present here.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The inline label 'Multi-purpose utility tool' directly contradicts the declared domain-specific labor-law function. This inconsistency is a security concern because deceptive or inaccurate labeling reduces reviewer trustworthiness and may conceal broader capabilities than users expect from the skill context.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The add/list/remove/search/export functions create a general-purpose local data-management surface unrelated to labor-law assistance. In the context of a legal-reference skill, these extra capabilities are dangerous because they can collect, retain, and expose user-provided content without a clear business need, expanding the attack surface and privacy risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The script creates a data directory and writes history/data files automatically, but does not explicitly warn users that their actions and inputs may be persisted locally. While not an exploit by itself, undisclosed persistence can expose sensitive employment or legal information on shared systems and is more concerning given the expected labor-law advisory context.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file’s instructional content and warnings are written in Chinese, but there is no indication that the user can opt into this language or that the skill is intentionally limited to a Chinese-speaking audience. The policy requires flagging language or locale constraints when they are imposed without user choice or clear justification.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.