Back to skill

Security audit

ESLint Config Generator

Security checks for vulnerabilities and agentic risk

Overview

This ESLint helper has a clear developer purpose, but its bundled script can silently overwrite an existing ESLint config and writes unvalidated input into that config.

Review before installing or running. Use it only in a disposable or backed-up project directory, and do not pass untrusted preset values. The script should be changed to parse documented options, allowlist presets, escape JSON safely, and refuse to overwrite an existing `.eslintrc.json` unless the user explicitly confirms.

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
eslint-config-generator.sh:2
Finding

Unvalidated Preset Injection and Unconditional ESLint Configuration Overwrite

Content
View full analysis

Vulnerability Details

File Location: eslint-config-generator.sh, lines 2–9
Vulnerability Type: Unvalidated input injection into generated JSON and unsafe file overwrite
Risk Level: Medium

Vulnerable Code

bash
PRESET="${1:-airbnb}"

cat > .eslintrc.json << JSON
{
  "extends": ["$PRESET"],
  "rules": {}
}
JSON

Technical Analysis

The script accepts its first positional argument without validating it against the documented presets or escaping it for use as a JSON string. Because PRESET is expanded directly inside a heredoc, quotation marks, backslashes, and newline characters can modify the structure of the resulting .eslintrc.json file.

This is not direct shell-command injection: shell syntax introduced through the value of PRESET is not reparsed as executable shell code during parameter expansion. However, an attacker-controlled value can corrupt the JSON or inject additional ESLint configuration properties.

ESLint configurations can reference executable JavaScript configuration files and plugins. A maliciously generated extends value, or injected configuration property, could therefore cause a subsequent ESLint invocation to load attacker-controlled local code. Exploitation requires the referenced malicious component to be available in the project or resolvable through the environment.

In addition, cat > .eslintrc.json unconditionally truncates any existing configuration without confirmation or backup. Running the script in an established project can therefore destroy existing configuration and replace it with attacker-influenced content.

Attack Path

  1. An attacker persuades a developer or automation process to invoke the generator with a crafted preset argument.
  2. The script interpolates the argument directly into .eslintrc.json without JSON escaping or preset validation.
  3. The redirection silently replaces any existing .eslintrc.json.
  4. The crafted value ...[truncated 1049 chars]
Remediation
View remediation

Remediation Suggestions

  1. Parse the documented command-line options explicitly instead of treating the first positional argument as an unrestricted preset.
  2. Allowlist supported preset names, such as airbnb, standard, prettier, react, vue, and typescript, and reject all other values.
  3. Generate the configuration through a JSON-aware serializer rather than interpolating input into a heredoc. This ensures that quotation marks, backslashes, and control characters are escaped correctly.
  4. Reject control characters and unexpected path-like values even if additional custom presets are supported.
  5. Check whether .eslintrc.json already exists and refuse to overwrite it by default.
  6. Require an explicit option such as --force before replacing an existing file, and consider creating a backup or writing to a temporary file followed by an atomic rename.
  7. Return a nonzero exit status with a clear error message when validation fails or the destination cannot be written.
Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (4)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The natural-language description forces a specific language/locale for user-facing content, and the file does not indicate that Chinese is optional or that the skill is intentionally region-specific. Under SQP-3, language-specific behavior without user opt-in or justification is a policy violation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script unconditionally redirects output to .eslintrc.json, which will overwrite any existing configuration file in the current directory without prompting, backing up, or checking for existence. In the context of a developer utility skill, this can cause accidental loss of user configuration or project policy settings, especially if run in the wrong directory or against an existing repository.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill description advertises '自动安装依赖' as a feature, which implies running package installation commands that modify the user's project or environment. The markdown does not provide any caution, confirmation note, or warning about these changes, despite SQP-2 requiring disclosure for behaviors that affect user data or system integrity.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The manifest description uses Chinese only ("生成 ESLint 配置"), which indicates a fixed language/locale presentation. The policy requires flagging language constraints when there is no user opt-in or documented justification for the locale choice.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.