Back to skill

Security audit

pc operation security check

Security checks for vulnerabilities and agentic risk

Overview

This skill is a straightforward local risk-classification aid, with no evidence of hidden access, persistence, network activity, or destructive behavior.

Reasonable to install if you want a Chinese-language PC operation risk checklist/classifier. Treat the shell helper as advisory only, and avoid passing untrusted strings containing terminal control characters until the output is escaped or sanitized.

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

Warning
Location
evaluate.sh:58
Finding

Terminal Output Injection Through Unsanitized Operation Description

Content
View full analysis

Vulnerability Details

File Location: evaluate.sh, lines 53–62; vulnerable output at line 58
Vulnerability Type: Terminal control-sequence injection
Risk Level: Medium

Vulnerable Code

bash
# 输出结果
echo ""
echo "═════════════════════════════════════════════════"
echo "         PC-OCS v1.0 操作风险评估结果"
echo "═════════════════════════════════════════════════"
echo ""
echo "📋 操作描述: $OPERATION"
echo ""
echo -e "🔒 风险等级: ${COLOR}${LEVEL} (${NAME})\033[0m"
echo ""
echo "💡 建议措施: $ADVICE"
echo ""
echo "═════════════════════════════════════════════════"

Technical Analysis

The OPERATION variable originates directly from the first command-line argument and is emitted to the terminal without validation or escaping. Although the affected statement does not use echo -e, input can contain literal terminal control bytes, including ANSI escape sequences.

When a compatible terminal receives these bytes, it may interpret them as commands rather than visible text. An attacker can consequently clear the screen, reposition the cursor, overwrite displayed content, manipulate terminal titles, insert misleading text, or obscure the genuine risk result.

This is terminal output injection, not shell command injection. Shell metacharacters contained in OPERATION are not evaluated as commands because the variable is quoted. The confirmed effect is limited to terminal presentation and any additional behavior supported by the terminal emulator.

Attack Path

  1. An attacker prepares an operation description containing literal ANSI escape bytes or other terminal control characters.
  2. The attacker convinces a user or an integrating process to invoke evaluate.sh with that description.
  3. Line 58 expands $OPERATION and writes the attacker-controlled bytes to the active terminal.
  4. The terminal interprets those bytes as control instructions.
  5. The attacker-controlled display can clear or overwrite authentic output and present a forged risk level or ...[truncated 745 chars]
Remediation
View remediation

Remediation Suggestions

  1. Reject or encode control characters before displaying user-provided input, including C0, DEL, C1, and escape characters.
  2. Use printf with a fixed format string instead of echo for predictable output behavior.
  3. Preserve a separate raw value for classification if required, but use only the sanitized value for terminal presentation.
  4. Consider rendering non-printable bytes visibly, such as \x1b, so users can inspect malicious input safely.
  5. Add regression tests covering ESC, carriage return, backspace, newline, tab, and other terminal-control bytes.

A hardening approach is:

bash
# Render non-printable input safely for terminal output.
SAFE_OPERATION=$(printf '%s' "$OPERATION" | LC_ALL=C sed -n 'l' | sed 's/\$$//')

printf '\n'
printf '%s\n' '═════════════════════════════════════════════════'
printf '%s\n' '         PC-OCS v1.0 Operation Risk Assessment'
printf '%s\n' '═════════════════════════════════════════════════'
printf '\n'
printf 'Operation description: %s\n' "$SAFE_OPERATION"

For stricter handling, terminate with an error when prohibited control bytes are detected rather than merely encoding them.

Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (2)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The description and document content are entirely in Chinese, and the skill presents itself as the evaluation tool without indicating that users may interact in other languages. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

This shell script presents its title, usage examples, risk labels, and advice entirely in Chinese. That imposes a specific language on all users without offering an alternative or documenting a locale-specific constraint, which matches the language/locale policy concern.

Content

No source excerpt is available for this finding.