Back to skill

Security audit

Systemd Unit Generator

Security checks for vulnerabilities and agentic risk

Overview

This skill is not overtly malicious, but it should be reviewed because it generates systemd files with under-disclosed unsafe defaults that could create privileged or publicly exposed services if deployed.

Review every generated unit before installing it under /etc/systemd/system or enabling it. Avoid feeding untrusted values into the generator, specify an explicit non-root User= where possible, bind sockets to 127.0.0.1 unless public exposure is intended, and do not rely on this linter as a complete systemd security 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 (3)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/systemd-unit-generator.py:71
Finding

Unsanitized CLI values allow systemd unit directive injection

Content
View full analysis
str: lines = ['[Unit]'] lines.append(f"Description={opts.get('description', opts.get('name', 'Service'))}") if opts.get('after'): lines.append(f"After={opts['after']}") if opts.get('wants'): lines.append(f"Wants={opts['wants']}") lines.append('') lines.append('[Service]') lines.append(f"Type={opts.get('type', 'simple')}") if opts.get('user'): lines.append(f"User={opts['user']}") if opts.get('group'): lines.append(f"Group={opts['group']}") if opts.get('workdir'): lines.append(f"WorkingDirectory={opts['workdir']}") # Environment envs = opts.get('env', {}) if isinstance(envs, dict): for k, v in envs.items(): lines.append(f"Environment={k}={v}") elif isinstance(envs, list): for e in envs: lines.append(f"Environment={e}") lines.append(f"ExecStart={opts.get('exec', '/usr/bin/echo hello')}") if opts.get('exec_stop'): lines.append(f"ExecStop={opts['exec_stop']}") if opts.get('exec_reload'): lines.append(f"ExecReload={opts['exec_reload']}") ``` ### Technical Analysis Values received from command-line options are interpolated directly into systemd unit directives without rejecting line breaks, NUL characters, or other control characters. The affected values include descriptions, dependencies, users, groups, working directories, environment variables, and executable directives. Systemd unit files are line-oriented. Consequently, an attacker-controlled newline terminates the intended directive and allows another directive to be inserted into the same section. For example, an environment argument containing a newline followed by ` ...[truncated 1835 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/systemd-unit-generator.py:153
Finding

Numeric socket ports are exposed on all network interfaces by default

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/systemd-unit-generator.py:315
Finding

Incomplete hardening detection suppresses warnings for unsafe root services

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (6)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The code substantially matches the declared purpose in that it generates systemd unit files, validates them, and lints for best practices and hardening. It includes generation for .service, .timer, and .socket files, plus validation/linting logic and hardening directives. However, the declared description explicitly lists .mount among generated unit types, while the code contains no mount generator command or corresponding generation function. Mount appears only in the set of valid section names for parsing/validation, not as a generated output type. This is a material description-to-behavior mismatch in stated coverage, though not a malicious or unrelated capability mismatch.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script writes generated content directly to a user-specified path with open(..., 'w'), which will truncate an existing file if present. Although it prints a success message afterward, there is no prior confirmation prompt, warning comment, or other user disclosure near the write operation about possible overwriting of existing data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

This branch writes timer unit content to a user-specified output file using write mode, which can silently replace an existing file. The code provides only a post-write success message and does not disclose the overwrite risk before performing the operation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The socket-generation path opens the provided output file in 'w' mode and writes content without any pre-write notice that an existing file may be overwritten. This is a safety-relevant file operation and the surrounding code does not provide confirmation or warning before the action.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The preset command writes generated unit content to the requested file path in truncate mode with no prior disclosure that existing contents may be destroyed. A success message after the write does not satisfy the requirement for user warning before the safety-critical operation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.