Back to skill

Security audit

swap

Security checks for vulnerabilities and agentic risk

Overview

This skill is purpose-aligned for Linux swap setup, but it tells an agent to make persistent root-level system configuration changes without enough safety checks.

Review this skill carefully before installing. It is not showing malicious behavior, but only use it when you are comfortable letting an agent run sudo commands that change swap, /etc/fstab, and /etc/sysctl.conf. Prefer requiring confirmation before persistent edits, checking for existing entries, backing up config files, and having rollback commands ready.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (21)

Chaining Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

Piping echoed content directly into sudo tee -a /etc/fstab creates a one-step privileged persistence change with no validation, review gate, or idempotency. In an agent setting, this pattern is dangerous because any malformed or repeated content can silently corrupt boot-critical configuration and persist across reboots.

Content

Scanner excerpt · SKILL.md (reported line 112)May include surrounding context.

bash
# Add to /etc/fstab
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

Verify the entry:

Chaining Abuse

High
Category
Tool Misuse
Confidence
94% confidence
Finding

Piping text into sudo tee -a /etc/sysctl.conf is a chained privileged write that bypasses safer configuration management practices and appends blindly. In an automated workflow this can accumulate duplicate or conflicting kernel parameter settings, making system behavior harder to predict and audit.

Content

Scanner excerpt · SKILL.md (reported line 132)May include surrounding context.

sudo sysctl -w vm.swappiness=20

Persist across reboots

echo 'vm.swappiness=20' | sudo tee -a /etc/sysctl.conf sudo sysctl -p

text

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 84)May include surrounding context.

md
# 根据上表确定 SIZE,例如 4G

# Method 1: fallocate (preferred)
sudo fallocate -l <SIZE> /swapfile

# Method 2: dd (fallback)
# 例如 4G = 4096M

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 88)May include surrounding context.

md
# 根据上表确定 SIZE,例如 4G

# Method 1: fallocate (preferred)
sudo fallocate -l <SIZE> /swapfile

# Method 2: dd (fallback)
# 例如 4G = 4096M

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 91)May include surrounding context.

md
# 根据上表确定 SIZE,例如 4G

# Method 1: fallocate (preferred)
sudo fallocate -l <SIZE> /swapfile

# Method 2: dd (fallback)
# 例如 4G = 4096M

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 94)May include surrounding context.

md
# 根据上表确定 SIZE,例如 4G

# Method 1: fallocate (preferred)
sudo fallocate -l <SIZE> /swapfile

# Method 2: dd (fallback)
# 例如 4G = 4096M

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 97)May include surrounding context.

md
# 根据上表确定 SIZE,例如 4G

# Method 1: fallocate (preferred)
sudo fallocate -l <SIZE> /swapfile

# Method 2: dd (fallback)
# 例如 4G = 4096M

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 147)May include surrounding context.

md
# 根据上表确定 SIZE,例如 4G

# Method 1: fallocate (preferred)
sudo fallocate -l <SIZE> /swapfile

# Method 2: dd (fallback)
# 例如 4G = 4096M

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 148)May include surrounding context.

md
# 根据上表确定 SIZE,例如 4G

# Method 1: fallocate (preferred)
sudo fallocate -l <SIZE> /swapfile

# Method 2: dd (fallback)
# 例如 4G = 4096M

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 151)May include surrounding context.

md
# 根据上表确定 SIZE,例如 4G

# Method 1: fallocate (preferred)
sudo fallocate -l <SIZE> /swapfile

# Method 2: dd (fallback)
# 例如 4G = 4096M

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 152)May include surrounding context.

md
# 根据上表确定 SIZE,例如 4G

# Method 1: fallocate (preferred)
sudo fallocate -l <SIZE> /swapfile

# Method 2: dd (fallback)
# 例如 4G = 4096M

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 153)May include surrounding context.

md
# 根据上表确定 SIZE,例如 4G

# Method 1: fallocate (preferred)
sudo fallocate -l <SIZE> /swapfile

# Method 2: dd (fallback)
# 例如 4G = 4096M

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 91)May include surrounding context.

md
sudo dd if=/dev/zero of=/swapfile bs=1M count=<SIZE_IN_MB>

# Set permissions — swap files must be 0600
sudo chmod 600 /swapfile

# Format as swap
sudo mkswap /swapfile

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 151)May include surrounding context.

md
sudo dd if=/dev/zero of=/swapfile bs=1M count=<SIZE_IN_MB>

# Set permissions — swap files must be 0600
sudo chmod 600 /swapfile

# Format as swap
sudo mkswap /swapfile

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill instructs the agent to make persistent system changes by appending to /etc/fstab and /etc/sysctl.conf and by resizing active swap, but it does not require explicit user confirmation, duplicate-entry checks, rollback steps, or warnings about stability and boot-risk. In an automated agent context, this can cause service disruption, swap loss, or misconfiguration that persists across reboots.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
92% confidence
Finding

This command blindly appends a swap entry to /etc/fstab using elevated privileges without checking whether an entry already exists or whether the filesystem and swap file are valid. Repeated execution can create duplicate or conflicting entries that may cause boot-time errors or unreliable persistence.

Content

Scanner excerpt · SKILL.md (reported line 112)May include surrounding context.

bash
# Add to /etc/fstab
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

Verify the entry:

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 129)May include surrounding context.

bash
# Set immediately
sudo sysctl -w vm.swappiness=20

# Persist across reboots
echo 'vm.swappiness=20' | sudo tee -a /etc/sysctl.conf

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 133)May include surrounding context.

bash
# Set immediately
sudo sysctl -w vm.swappiness=20

# Persist across reboots
echo 'vm.swappiness=20' | sudo tee -a /etc/sysctl.conf

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 144)May include surrounding context.

bash
# Set immediately
sudo sysctl -w vm.swappiness=20

# Persist across reboots
echo 'vm.swappiness=20' | sudo tee -a /etc/sysctl.conf

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
91% confidence
Finding

Appending vm.swappiness=20 to /etc/sysctl.conf with sudo is a persistent privileged modification performed without checking for an existing setting or using a drop-in file. Duplicate or conflicting sysctl entries can create configuration drift and unintended behavior across reboots.

Content

Scanner excerpt · SKILL.md (reported line 132)May include surrounding context.

sudo sysctl -w vm.swappiness=20

Persist across reboots

echo 'vm.swappiness=20' | sudo tee -a /etc/sysctl.conf sudo sysctl -p

text

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
98% confidence
Finding

The document is primarily written in English, but key instructional content switches to Chinese in the swap sizing and resize sections. This imposes a language assumption without user opt-in and may violate language/locale policy requiring consistent or user-selectable language.

Content

No source excerpt is available for this finding.