Back to skill

Security audit

linux-performance-analyzer

Security checks for vulnerabilities and agentic risk

Overview

This appears to be a legitimate Linux performance-tuning skill, but it needs review because it can guide broad root-level, persistent system changes without consistently strong safeguards.

Install only for use by experienced Linux administrators. Keep diagnosis read-only by default, require explicit approval before any root or persistent command, test changes outside production first, record current values and backups, protect snapshot and heap-dump outputs as sensitive, and review every /etc, systemd, crontab, /proc, and /sys change before execution.

Vulnerability Patterns
  • System PersistenceInstalls backdoors, hooks, services, or scheduled tasks that survive the run
  • 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
Findings (4)

T06 · System Persistence

Error
Location
references/cpu.md:95
Finding

Persistent Privileged System Tuning Without Sufficient Safety Controls

Content
View full analysis
/etc/systemd/system/cpu-performance.service << 'EOF' [Unit] Description=Set CPU governor to performance After=multi-user.target [Service] Type=oneshot ExecStart=/bin/bash -c "for f in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo performance > $f; done" RemainAfterExit=yes [Install] WantedBy=multi-user.target EOF systemctl enable --now cpu-performance.service ``` Transparent Huge Pages service: ```bash cat > /etc/systemd/system/disable-thp.service << 'EOF' [Unit] Description=Disable Transparent Huge Pages After=network.target [Service] Type=oneshot ExecStart=/bin/sh -c "echo never > /sys/kernel/mm/transparent_hugepage/enabled" ExecStart=/bin/sh -c "echo never > /sys/kernel/mm/transparent_hugepage/defrag" RemainAfterExit=yes [Install] WantedBy=multi-user.target EOF systemctl enable --now disable-thp.service ``` Persistent I/O scheduler rule: ```bash cat > /etc/udev/rules.d/60-ioscheduler.rules << 'EOF' # NVMe SSD ACTION=="add|change", KERNEL=="nvme[0-9]*", ATTR{queue/scheduler}="none" # SATA SSD ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="mq-deadline" # HDD ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq" EOF udevadm control --reload-rules && udevadm trigger ``` Boot script replacement: ```bash cat > /etc/rc.local << 'EOF' #!/bin/bash blockdev --setra 4096 /dev/sda EOF chmod +x /etc/rc.local ``` Recurring disk tasks: ```bash systemctl enable fstrim.timer systemctl start fstrim.timer ``` ```bash systemctl ena ...[truncated 2513 chars]
Remediation
View remediation
` - Removal of the created unit. - `systemctl daemon-reload` - Removal or restoration of cron, udev, sysctl, and module-load entries. - Restoration of all captured runtime values. 9. Avoid appending duplicate entries to shared configuration files. 10. Add a dry-run mode that displays proposed changes and their scope without executing them. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/perf_monitor.sh:13
Finding

Predictable Symlink-Following Log Files in a Shared Temporary Directory

Content
View full analysis
> "$ALERT_LOG" } ``` ### Technical Analysis The monitor creates log paths directly under the globally writable `/tmp` directory. The daily alert filename is completely predictable, while the main filename is predictable to the second. The files are opened in append mode without exclusive creation, ownership validation, symlink rejection, or a private parent directory. Shell redirection and `tee -a` normally follow symbolic links. If the script is run as root, a local attacker can pre-create one of these paths as a symbolic link to a root-writable target. The monitor will then append its output to that target using the monitor's privileges. File confidentiality is also dependent on the caller's `umask`; the script does not enforce mode `0600`. ### Attack Path 1. A local unprivileged attacker determines the current date. 2. The attacker creates a symbolic link such as: ```bash ln -s /path/to/root-owned-target /tmp/perf_alerts_YYYYMMDD.log ``` 3. An administrator starts `perf_monitor.sh` as root. 4. A monitored metric crosses a configured threshold. 5. The shell opens the predictable alert path and follows the attacker's symbolic link. 6. Root-privileged monitoring text is appended to the chosen file. The attacker does not directly control the full appended text, so reliable arbitrary command execution is not established. However, arbitrary root-owned file co ...[truncated 654 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
references/disk_io.md:150
Finding

Unsafe Generic Disk, Memory, and Scheduling Tuning Examples

Content
View full analysis
/oom_score cat /proc//oom_score_adj # Protect a critical process from the OOM killer echo -1000 > /proc//oom_score_adj echo -500 > /proc//oom_score_adj protect_procs=("mysqld" "redis-server" "nginx" "knot-cli") for proc in "${protect_procs[@]}"; do PID=$(pgrep -x "$proc" | head -1) if [[ -n "$PID" ]]; then echo -500 > /proc/$PID/oom_score_adj echo "Protected: $proc (PID=$PID)" fi done ``` Cache dro ...[truncated 2544 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/collect_snapshot.sh:37
Finding

Performance Snapshots May Be Written Without Confidentiality Controls

Content
View full analysis
/var/log/perf-baseline-$(date +%Y%m%d).txt 0 4 1 * * bash /path/to/scripts/collect_snapshot.sh > /var/log/perf-baseline.log ``` ### Technical Analysis The data is legitimately relevant to system diagnosis, and the code does not transmit it over the network. However, the collection is broad and may include: - Hostnames and kernel versions. - Internal IP addresses and network routes. - Usernames and process command lines. - Mounted storage layout. - Kernel events and hardware details. - Service and container resource information. The script does not set `umask 077`, enforce mode `0600`, validate the destination, provide redaction, or warn the user before collecting sensitive identifiers. Output permissions therefore depend on the execution environment and caller umask. A report stored under `/tmp`, a shared support directory, or an inadequately protected `/var/log` path may become readable by u ...[truncated 997 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (35)

Tool Parameter Abuse

High
Category
Tool Misuse
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).

Content

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

sysctl -w 参数名=原始值

持久化回滚

rm /etc/sysctl.d/99-perf-analyzer.conf sysctl --system

text

Tool Parameter Abuse

High
Category
Tool Misuse
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).

Content

Scanner excerpt · references/disk_io.md (reported line 224)May include surrounding context.

md
--runtime=30 --time_based --group_reporting

# 清理测试文件
rm /data/fio_test

# 性能参考(常见磁盘类型):
# ┌─────────────┬──────────────┬──────────────┬────────────┐

Tool Parameter Abuse

High
Category
Tool Misuse
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).

Content

Scanner excerpt · references/kernel_params.md (reported line 210)May include surrounding context.

... 逐一回滚

方案2:删除配置文件并重新加载

rm /etc/sysctl.d/99-perf-master.conf sysctl --system

注意:已通过 sysctl -w 临时设置的值不会自动还原,需手动回滚

text

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

The document includes a destructive file deletion command, 'rm /swapfile', as part of operational guidance without strong safeguards, validation, or confirmation. In an automated agent setting, destructive commands are especially risky because they may be executed out of context, potentially removing active or needed swap configuration and causing availability degradation or boot issues when combined with fstab changes.

Content

Scanner excerpt · references/memory.md (reported line 79)May include surrounding context.

删除 Swap

swapoff /swapfile rm /swapfile sed -i '/swapfile/d' /etc/fstab

text

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill is described entirely as a Chinese-language expert experience (“Linux 系统性能分析与调优全能专家 Skill”) with no indication that users may choose another language. Under the language/locale policy, forcing a specific language without user opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrases are broad, natural-language requests such as general complaints about slowness or asking for help tuning kernel parameters. This can cause the skill to activate in contexts the user did not explicitly intend, increasing the chance that it provides invasive diagnostics or risky system-tuning guidance unexpectedly. In a performance-tuning skill, unintended activation is more dangerous because the skill’s domain includes privileged commands, kernel/sysctl changes, and production-impacting recommendations.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This section presents multiple privileged, system-modifying tuning commands (for memory, CPU, I/O, and network behavior) before clearly and locally warning about prerequisites, persistence, rollback, and service impact. In an agent skill context, users may copy or execute these commands directly, causing instability, degraded performance, or outages if applied to the wrong workload or environment.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The persistence section writes kernel settings into /etc/sysctl.d and later removes that file with rm, but the same section does not prominently warn that these changes affect system-wide behavior across reboots and may break applications or networking. In a skill intended to guide operational actions, this increases the chance of unsafe system-wide configuration drift or accidental rollback of unrelated settings if users adapt the example carelessly.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This section gives root-level memory and kernel tuning commands that persistently modify sysctl settings, transparent huge page behavior, and OOM protection without safety framing. In a performance-tuning skill, users are likely to copy commands directly, and bad fit for workload or environment can cause instability, unexpected memory behavior, or make the system harder to recover under memory pressure.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This section recommends persistent network-stack and file-descriptor tuning by writing directly into /etc/sysctl.d and /etc/security/limits.conf, but does not warn about connectivity regressions, application incompatibility, or the fact that some TCP settings are deprecated or context-dependent. Because these changes affect the whole host and are presented as a straightforward fix for high concurrency, an operator could degrade networking or impact unrelated services.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The document advises changing the block scheduler and VM dirty-page writeback parameters at a low level without warning that the effects are workload-, device-, and kernel-specific. Incorrect tuning here can increase latency, worsen throughput, or create broader system instability, especially since the example also involves a disk already showing hardware faults.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

The heap-dump instruction writes a full JVM memory snapshot to /tmp without warning that heap dumps often contain credentials, tokens, PII, and business data. /tmp is commonly less controlled, may be world-accessible depending on environment, and can expose sensitive contents to other local users or collection pipelines.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This markdown file presents the skill/reference content exclusively in Chinese, starting from the title, and nowhere indicates that the language is optional or limited to a specific region-specific audience. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
80% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/cpu.md (reported line 108)May include surrounding context.

md
[Install]
WantedBy=multi-user.target
EOF
systemctl enable --now cpu-performance.service

# 查看 CPU 当前频率
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq | awk '{s+=$1; n++} END {printf "平均: %.0f MHz\n", s/n/1000}'

Session Persistence

Medium
Category
Rogue Agent
Confidence
80% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/disk_io.md (reported line 254)May include surrounding context.

md
[Install]
WantedBy=multi-user.target
EOF
systemctl enable --now cpu-performance.service

# 查看 CPU 当前频率
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq | awk '{s+=$1; n++} END {printf "平均: %.0f MHz\n", s/n/1000}'

Session Persistence

Medium
Category
Rogue Agent
Confidence
80% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/disk_io.md (reported line 314)May include surrounding context.

md
[Install]
WantedBy=multi-user.target
EOF
systemctl enable --now cpu-performance.service

# 查看 CPU 当前频率
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq | awk '{s+=$1; n++} END {printf "平均: %.0f MHz\n", s/n/1000}'

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The document contains numerous privileged, system-modifying commands that alter I/O schedulers, queue depths, mount options, sysctl settings, udev rules, systemd timers, and cron entries, but it does not begin with a clear safety notice about required privileges, persistence, rollback needs, workload-specific applicability, or risks such as data loss and degraded stability. In a performance-tuning skill, users are likely to copy commands directly, so the absence of upfront warnings materially increases the chance of harmful misconfiguration.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/disk_io.md (reported line 317)May include surrounding context.

systemctl enable --now smartd

配置 /etc/smartd.conf 发现问题时发邮件

添加定期检查到 crontab

echo "0 3 * * 0 smartctl -a /dev/sda > /var/log/smart-sda-$(date +%Y%W).log" >> /etc/crontab

text

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This section provides privileged, system-wide configuration commands that persistently alter kernel and networking behavior, but it does not prominently warn that root access is required, that changes can disrupt connectivity or stability, or that settings are workload-specific. In a performance-tuning skill, users may copy-paste the block directly into production, creating avoidable outage risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This section provides direct system-modifying commands for swap creation, swappiness tuning, and swap deletion without a prominent safety warning, prerequisites, rollback guidance, or validation steps before destructive actions. An agent or user following this guidance blindly could alter memory behavior, corrupt availability expectations, or break boot/runtime configuration through unsafe edits to /etc/fstab and swap state.

Content

No source excerpt is available for this finding.

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 · references/memory.md (reported line 68)May include surrounding context.

md
# 创建 Swap 文件(系统无 Swap 时)
fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo '/swapfile none swap sw 0 0' >> /etc/fstab

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The THP, HugePage, dirty page, cache drop, and memory reclamation guidance includes kernel and memory-management changes that can materially affect latency, throughput, and stability, yet the warnings are inconsistent and not prominent. Commands such as disabling THP, changing dirty ratios, enabling persistent services, or dropping caches can cause immediate service impact if applied in production without qualification.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
84% confidence
Finding

Persistently enabling a new systemd service changes system behavior across reboots and extends the blast radius of a tuning action beyond the current troubleshooting session. In an agent skill context, instructing automatic persistence without explicit user approval can create hard-to-detect configuration drift and prolonged service-impacting behavior.

Content

Scanner excerpt · references/memory.md (reported line 158)May include surrounding context.

md
[Install]
WantedBy=multi-user.target
EOF
systemctl enable --now disable-thp.service

# 验证
cat /sys/kernel/mm/transparent_hugepage/enabled   # 应显示 never

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This section appends persistent sysctl changes to /etc/sysctl.d/99-perf-master.conf, modifying host-wide TCP behavior without clearly warning that the changes affect the entire system and may degrade connectivity, stability, or compatibility for unrelated workloads. In a troubleshooting skill, such commands are contextually relevant, but presenting them as copy-paste guidance without explicit cautions, prerequisites, rollback steps, or environment scoping creates unsafe operational advice.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The complete example writes a broad set of kernel networking parameters and immediately applies them with sysctl -p, causing instant host-wide changes that can disrupt production traffic, weaken reliability assumptions, or create hard-to-diagnose regressions if used blindly. The skill’s performance-tuning context makes such content expected, but bundling many aggressive settings into a ready-to-run block materially increases danger because users may execute it without understanding workload, kernel-version, or environment-specific constraints.

Content

No source excerpt is available for this finding.