Back to skill

Security audit

Makefile Generator

Security checks for vulnerabilities and agentic risk

Overview

This skill is a simple Makefile generator, but it can silently replace an existing Makefile and its documented language options do not match what the script actually does.

Review before installing. Use this only in a version-controlled project or an empty test directory, and do not run it where an existing Makefile matters unless you have a backup. Expect it to generate only a basic Node/npm Makefile despite the Python, Go, package-manager, custom-target, and deployment claims.

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
makefile-generator.sh:4
Finding

Unconditional Overwrite of an Existing Makefile

Content
View full analysis

Vulnerability Details

File Location: makefile-generator.sh, lines 4–19
Vulnerability Type: Unsafe destructive file overwrite
Risk Level: Low

Vulnerable Code

bash
cat > Makefile << 'MK'
.PHONY: install test build clean dev

install:
	npm install

test:
	npm test

build:
	npm run build

dev:
	npm run dev

clean:
	rm -rf node_modules dist
MK

Technical Analysis

The script writes generated content directly to Makefile using truncating shell redirection. If a file with that name already exists in the current working directory, its contents are silently and immediately destroyed. The script does not check for an existing file, request confirmation, create a backup, or perform an atomic replacement.

Because the output path is relative, the affected file depends entirely on the directory from which the user invokes the script. This is an insecure coding practice that can cause local data loss, although it does not independently enable privilege escalation or execution with permissions beyond those already held by the invoking user.

Attack Path

  1. A user has an existing project containing a customized Makefile.
  2. The user invokes makefile-generator.sh from the project root, expecting generation behavior consistent with the documentation.
  3. Shell redirection opens the existing Makefile with truncation before writing the static template.
  4. The original build, test, deployment, or maintenance targets are irreversibly replaced unless they are recoverable through version control or a separate backup.
  5. Subsequent automation may fail or behave differently because it now uses the replacement Makefile.

Impact Assessment

The issue can destroy an existing Makefile accessible to the invoking account and disrupt local or CI build workflows. Lost content may include project-specific build, test, cleanup, or deployment procedures. The effect is limited to files writable by the current user; no additional privileges, r ...[truncated 61 chars]

Remediation
View remediation

Remediation Suggestions

  • Check whether Makefile already exists and refuse to overwrite it by default.
  • Require an explicit --force option before replacing an existing file.
  • Support an explicit output path rather than relying solely on the current working directory.
  • Write generated content to a securely created temporary file in the destination directory, validate successful generation, and then rename it atomically.
  • If forced replacement is requested, optionally preserve the original as a backup.
  • Return a nonzero exit status with a clear message when generation cannot proceed safely.

Example guard:

bash
output="Makefile"

if [[ -e "$output" && "$force" != "true" ]]; then
    printf 'Error: %s already exists; use --force to overwrite it.\n' "$output" >&2
    exit 1
fi
Vulnerability Patterns
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (5)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill advertises support for Node.js, Python, Go, and deployment-related Makefile generation, but the provided content only demonstrates a Node.js Makefile and does not substantiate the claimed multi-language or deploy functionality. This can mislead users into trusting generated automation in build or release workflows, causing incorrect commands, broken CI/CD behavior, or unsafe manual workarounds when the promised behavior is absent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The manifest description and introductory text are written as direct product behavior in Chinese, with no indication that language is selectable or that the skill is intended only for a Chinese-speaking context. Under the policy, language constraints should be opt-in or clearly justified when a skill effectively enforces a locale.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The manifest description is overly generic ('生成 Makefile') and does not clearly define the skill's scope, trigger conditions, or supported project contexts. This can cause the agent to invoke the skill in unintended situations, increasing the chance of misuse or inappropriate automation, though it is not by itself evidence of malicious behavior.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest description states that the skill supports Node.js, Python, and Go projects and provides common development, test, build, and deployment commands. In the code, the LANG argument is read but ignored, and the generated Makefile hardcodes npm-based commands and Node.js directories, so the actual behavior only supports Node.js projects.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The description is written only in Chinese ("生成 Makefile"), which may indicate a language-specific presentation without any stated user opt-in or justification. For a general-purpose skill manifest, this can create a locale/language policy concern if users are not offered a language choice.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.