Back to skill

Security audit

makefile-review

Security checks for vulnerabilities and agentic risk

Overview

This Makefile review skill is not clearly malicious, but it can evaluate or test Makefiles and apply generated changes without enough warning or containment.

Install only if you are comfortable with the agent reviewing Makefiles and potentially running Make-related inspection commands. For untrusted repositories, avoid `make -pn`, `make -n`, target testing, and any `--apply` generation unless you explicitly approve it in a sandbox with secrets removed and a clean diff to review.

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

Error
Location
modules/dependency-graph.md:12
Finding
Unsafe GNU Make Inspection Enables Parse-Time Command Execution<![CDATA[ ## Vulnerability Details **File Location**: `modules/dependency-graph.md`, lines 12–15 **Vulnerability Type**: Unsafe evaluation of untrusted Makefiles **Risk Level**: High ### Vulnerable Code ```markdown Inspect the complete expanded database: ```bash make -pn | less ``` ``` ### Technical Analysis The skill recommends `make -pn` as a Makefile inspection command. Although `-n` prevents ordinary recipes from being executed, GNU Make still parses and expands the Makefile to construct its database. Parse-time expressions such as `$(shell command)` can execute operating-system commands during this process. Consequently, this command is not a safe static-analysis mechanism for repositories whose Makefiles are untrusted. A malicious Makefile can execute a payload merely by being inspected, without requiring the auditor to invoke an explicit build target. For example, an attacker-controlled Makefile could contain: ```makefile AUDIT := $(shell attacker-controlled-command) ``` When the documented inspection command loads that Makefile, GNU Make evaluates the `shell` function and runs the embedded command. ### Attack Path 1. An attacker supplies or modifies a repository containing a malicious `Makefile` or included `.mk` file. 2. The Makefile places an attacker-controlled command in a parse-time GNU Make expression, such as `$(shell ...)`. 3. An agent loads this skill to audit the repository. 4. Following `modules/dependency-graph.md`, the agent runs: ```bash make -pn | less ``` 5. GNU Make parses and expands the malicious Makefile. 6. The parse-time expression executes with the privileges and environment of the auditing agent. ### Impact Assessment Successful exploitation provides arbitrary command execution under the auditing process's existing user account. The payload could: - Read files and environment variables accessible to the agent, including credentials present in its environment. - Modify or delete files writable by the agen ...[truncated 417 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove `make -pn` from the default workflow for untrusted repositories. 2. Perform initial inspection using non-evaluating text-analysis tools or a parser that does not execute Make functions. 3. Treat the main Makefile, recursively included files, generated include files, and command-line-provided makefiles as untrusted input. 4. If semantic GNU Make evaluation is indispensable: - Require explicit user approval before execution. - Run GNU Make in an ephemeral sandbox or container. - Disable network access. - Exclude credentials, SSH agents, cloud tokens, and other secrets from the environment. - Mount the repository read-only and avoid writable host paths. - Run as an unprivileged user with strict CPU, memory, process, and execution limits. 5. Add a prominent warning that `-n` does not prevent parse-time execution through GNU Make functions. 6. Before any semantic evaluation, statically search for dangerous constructs such as `$(shell ...)`, included makefiles, and other expansion-time behavior. This screening should supplement isolation rather than replace it. ]]>
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • 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 (15)

Ae1

High
Category
analysis-evasion
Content
@include modules/deduplication-patterns.md
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
@include modules/portability-checks.md
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
**Plugin Dogfood Checks**: `@include modules/plugin-dogfood-checks.md` - Makefile completeness analysis, target generation, and dogfooding validation.
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Tool Parameter Abuse

High
Category
Tool Misuse
Content
```makefile
# Bad - 'clean' file blocks target
clean:
	rm -rf build/

# Good
.PHONY: clean
Confidence
85% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
```makefile
# Bad - 'clean' file blocks target
clean:
	rm -rf build/

# Good
.PHONY: clean
Confidence
85% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
```makefile
# Bad - not portable
clean:
	rm -rf /home/user/project/build

# Good - variables
BUILD_DIR ?= build
Confidence
90% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
```makefile
# Bad - not portable
clean:
	rm -rf /home/user/project/build

# Good - variables
BUILD_DIR ?= build
Confidence
90% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Shadow Command Trigger

Medium
Category
Trigger Abuse
Confidence
92% confidence
Finding
The trigger "build" overlaps with a common built-in command namespace and can shadow or conflict with expected platform behavior. This may route users into this skill instead of the intended built-in build functionality, leading to incorrect actions, confusion, or execution of review-oriented steps in place of the requested command.

Vague Triggers

Medium
Confidence
97% confidence
Finding
The trigger list includes broad terms like "build," "make," and "automation," which can cause the skill to activate in many unrelated contexts. Unintended invocation increases the chance that the agent follows this skill's workflow when the user did not request a Makefile audit, potentially causing command suggestions or repository inspection in the wrong task context.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
### Delete on Error
```makefile
# Automatically delete targets on error
.DELETE_ON_ERROR:

build/%.o: src/%.c
Confidence
80% confidence
Finding
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The module explicitly states it can 'safely test existing targets' and 'generate missing targets,' which materially exceeds the skill's declared audit-only purpose. That scope expansion is dangerous because reviewing Makefiles is a low-risk read-oriented activity, while testing and generation introduce execution and repository modification behaviors that could run untrusted build logic or alter project files without clear user expectation.

Context-Inappropriate Capability

Medium
Confidence
89% confidence
Finding
Claiming the ability to 'safely test existing targets' is especially risky for Makefiles because target execution can invoke arbitrary shell commands defined by the repository. In this skill context, that makes the issue more dangerous: users may expect a reviewer, but the documented behavior implies execution of untrusted build automation, which can affect the local environment, secrets, network, or filesystem.

Description-Behavior Mismatch

Medium
Confidence
91% confidence
Finding
The workflow sections broaden the skill from Makefile review into functional testing, scoring, and enhancement, including creating new targets. In the context of a security-sensitive agent skill, this mismatch can mislead users and downstream tooling into authorizing actions beyond passive review, increasing the chance of executing unsafe Make recipes or making unintended edits.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The documented `--apply` generation mode says it creates targets but does not explicitly warn that it may modify repository files. In an audit-oriented skill, omission of a write-risk warning is unsafe because users may invoke the mode expecting analysis and instead get persistent Makefile changes, potentially corrupting build logic or introducing unsafe targets.

Overly Broad Trigger

Low
Category
Trigger Abuse
Confidence
96% confidence
Finding
The trigger "make" is a very common word in normal conversation and software discussions, so it is likely to activate the skill unintentionally. In this skill's context, accidental activation is somewhat mitigated because the content is review-focused rather than directly destructive, but it still broadens the attack surface for misrouting agent behavior.

Static analysis

No suspicious patterns detected.