Back to skill

Security audit

Linux 服务排障(分层自底向上)

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent Linux troubleshooting skill, but it includes root commands that persistently change firewall and Bluetooth startup settings without clearly requiring user confirmation.

Install only if you are comfortable with an agent advising or running administrative Linux troubleshooting commands. Before applying fixes, confirm the exact port, subnet, service name, and whether changes should persist after reboot; ask for rollback commands such as removing the firewalld rule or disabling Bluetooth autostart.

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

T06 · System Persistence

Note
Location
SKILL.md:60
Finding
Bluetooth Service Persistently Enabled Without Explicit User Consent<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 60–65 **Vulnerability Type**: Persistent startup-service configuration beyond the minimum necessary for immediate recovery **Risk Level**: Low ```bash sudo systemctl start bluetooth sudo systemctl enable bluetooth bluetoothctl list # Controller <MAC> <host> [default] bluetoothctl show # Powered: yes (and HCI/LMP version, supported profiles) ``` ### Technical Analysis The documented recovery procedure runs both `systemctl start bluetooth` and `systemctl enable bluetooth` with root privileges. Starting the service is sufficient to restore Bluetooth during the current boot. Enabling it separately changes the host's boot-time service configuration so that Bluetooth starts automatically in future sessions. This persistent change may be legitimate on a system intended to use Bluetooth regularly, but it is not strictly required to diagnose or immediately repair an inactive service. The instructions do not distinguish temporary recovery from persistent configuration and do not require confirmation before making the lasting change. Consequently, an agent following the Skill literally could exceed the user's intended scope. This is a system-persistence concern rather than evidence of a backdoor: the command enables the standard operating-system Bluetooth service and does not install attacker-controlled code. ### Attack Path 1. A user invokes the Skill to diagnose a temporary Bluetooth failure. 2. The agent follows the documented fix and executes the commands with `sudo`. 3. `systemctl start bluetooth` restores the service for the current boot. 4. `systemctl enable bluetooth` additionally modifies system service configuration. 5. On subsequent boots, the Bluetooth service starts automatically even if the user intended only a temporary repair. No external attacker-controlled payload or privilege-escalation mechanism is present. Exploitation depends on an agent applying the persistent comm ...[truncated 715 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Separate immediate recovery from optional persistence: ```bash sudo systemctl start bluetooth bluetoothctl list bluetoothctl show ``` Before enabling startup persistence, explain its effect and obtain explicit user confirmation: ```bash # Run only if the user wants Bluetooth to start automatically after reboot. sudo systemctl enable bluetooth ``` Additional hardening measures: 1. Check the existing state with `systemctl is-enabled bluetooth` before changing it. 2. Ask whether the requested repair should apply only to the current boot or persist across reboots. 3. Avoid combining `start` and `enable` into a single unconditional procedure. 4. Document rollback using `sudo systemctl disable bluetooth`. 5. If Bluetooth is needed only temporarily, stop it after use with `sudo systemctl stop bluetooth`. ]]>
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Rogue AgentSelf-Modification, Session Persistence
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (12)

Session Persistence

Medium
Category
Rogue Agent
Content
1. **Hardware present?** `lsusb | grep -i <type>`, `lspci`
2. **Kernel driver loaded + initialized?** `lsmod | grep <mod>`, `dmesg | grep -i <subsys>`
3. **Radio/firewall unblocked?** `rfkill list` (bt/wifi), `firewall-cmd --list-all`, `nft list ruleset`
4. **Service running + enabled?** `systemctl status <svc>`, `systemctl is-active <svc>`, `is-enabled <svc>`
5. **Effective config value?** use the tool's OWN probe (`sshd -T`, `bluetoothctl show`), not manual `grep` of a config file.

## SSH reachability on a custom port — the firewalld trap
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.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
Fix + verify:
```bash
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" port port="50022" protocol="tcp" accept'
sudo firewall-cmd --reload
sudo firewall-cmd --list-rich-rules | grep 50022   # confirm persisted
sudo nft list ruleset | grep 50022                 # confirm in the live ruleset
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
Fix + verify:
```bash
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" port port="50022" protocol="tcp" accept'
sudo firewall-cmd --reload
sudo firewall-cmd --list-rich-rules | grep 50022   # confirm persisted
sudo nft list ruleset | grep 50022                 # confirm in the live ruleset
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
Fix + verify:
```bash
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" port port="50022" protocol="tcp" accept'
sudo firewall-cmd --reload
sudo firewall-cmd --list-rich-rules | grep 50022   # confirm persisted
sudo nft list ruleset | grep 50022                 # confirm in the live ruleset
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
Fix + verify:
```bash
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" port port="50022" protocol="tcp" accept'
sudo firewall-cmd --reload
sudo firewall-cmd --list-rich-rules | grep 50022   # confirm persisted
sudo nft list ruleset | grep 50022                 # confirm in the live ruleset
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
Fix + verify:
```bash
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" port port="50022" protocol="tcp" accept'
sudo firewall-cmd --reload
sudo firewall-cmd --list-rich-rules | grep 50022   # confirm persisted
sudo nft list ruleset | grep 50022                 # confirm in the live ruleset
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
Fix + verify:
```bash
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" port port="50022" protocol="tcp" accept'
sudo firewall-cmd --reload
sudo firewall-cmd --list-rich-rules | grep 50022   # confirm persisted
sudo nft list ruleset | grep 50022                 # confirm in the live ruleset
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
Fix + verify:
```bash
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" port port="50022" protocol="tcp" accept'
sudo firewall-cmd --reload
sudo firewall-cmd --list-rich-rules | grep 50022   # confirm persisted
sudo nft list ruleset | grep 50022                 # confirm in the live ruleset
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
Fix + verify:
```bash
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" port port="50022" protocol="tcp" accept'
sudo firewall-cmd --reload
sudo firewall-cmd --list-rich-rules | grep 50022   # confirm persisted
sudo nft list ruleset | grep 50022                 # confirm in the live ruleset
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
Fix + verify:
```bash
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" port port="50022" protocol="tcp" accept'
sudo firewall-cmd --reload
sudo firewall-cmd --list-rich-rules | grep 50022   # confirm persisted
sudo nft list ruleset | grep 50022                 # confirm in the live ruleset
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
(`prohibit-password` may be reported as `without-password` — same meaning.)
- **`systemctl reload sshd`** applies per-connection settings (PermitRootLogin, PasswordAuthentication, etc.) WITHOUT dropping existing sessions (SIGHUP). Use `restart` only for `Port`/`ListenAddress`-class changes.
- **Remove dead firewalld services**: after moving off a port, `--remove-service=ssh` to avoid a "fake allow" for a port nothing listens on.
- Back up before editing: `sudo cp -a /etc/ssh/sshd_config /etc/ssh/sshd_config.bak.$(date +%Y%m%d)`.

## Bluetooth not working
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Session Persistence

Medium
Category
Rogue Agent
Content
Fix:
```bash
sudo systemctl start bluetooth
sudo systemctl enable bluetooth
bluetoothctl list   # Controller <MAC> <host> [default]
bluetoothctl show   # Powered: yes  (and HCI/LMP version, supported profiles)
```
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.

Static analysis

No suspicious patterns detected.