Back to skill

Security audit

Sentiment Analyzer

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent local sentiment tracker, but it stores customer-message excerpts in an unsafe temporary path and lets session IDs control file paths.

Review before installing. This skill does not show evidence of exfiltration or hidden remote execution, but it should be fixed before use with real customer data: validate session IDs, store only minimal derived sentiment data, use a private directory with restrictive permissions, define retention and deletion behavior, and replace the raw rm cleanup example with a safer deletion path.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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 (2)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/track.py:20
Finding

Path Traversal Through Unvalidated Session Identifier

Content
View full analysis
list: """Load session history.""" ensure_track_dir() path = os.path.join(TRACK_DIR, f"{session_id}.json") if os.path.exists(path): with open(path, "r", encoding="utf-8") as f: return json.load(f) return [] def save_session(session_id: str, history: list): """Save session history.""" ensure_track_dir() path = os.path.join(TRACK_DIR, f"{session_id}.json") with open(path, "w", encoding="utf-8") as f: json.dump(history, f, ensure_ascii=False, indent=2) ``` ### Technical Analysis The externally supplied `session_id` is inserted directly into a filesystem path without validation, normalization, or containment checks: ```python os.path.join(TRACK_DIR, f"{session_id}.json") ``` An identifier containing parent-directory components such as `../../target` causes the resulting path to escape `/tmp/sentiment_tracking`. Both `load_session()` and `save_session()` use the unsafe path, providing read and write primitives for JSON files accessible to the process. The automatically appended `.json` suffix restricts targets to paths ending in `.json`, but it does not prevent traversal. For successful history processing, an existing target must contain a JSON list because the program subsequently invokes `history.append(...)`. An attacker can also create a new JSON file when its parent directory exists and is writable by the process. No canonical path comparison is performed, and regular `open()` calls follow symbolic links. ### Attack Path 1. The attacker supplies a malicious session identifier through the command-line interface: ```bash python3 scripts/track.py --session-id "../../target" "attacker-controlled message" ``` 2. The program constructs: ...[truncated 1363 chars]
Remediation
View remediation
str: if not SESSION_ID_PATTERN.fullmatch(session_id): raise ValueError("Invalid session identifier") return session_id ``` 2. Prefer deriving filenames from a cryptographic hash rather than using identifiers directly: ```python import hashlib filename = hashlib.sha256(session_id.encode("utf-8")).hexdigest() + ".json" ``` 3. Resolve and verify the final path before access: ```python base = os.path.realpath(TRACK_DIR) path = os.path.realpath(os.path.join(base, filename)) if os.path.commonpath([base, path]) != base: raise ValueError("Session path escapes tracking directory") ``` 4. Reject or safely handle symbolic links. On supported platforms, open files with no-follow semantics such as `os.O_NOFOLLOW`. 5. Create files atomically and avoid time-of-check/time-of-use sequences involving `exists()` followed by `open()`. 6. Validate loaded JSON data before use, including confirming that the root value is a list and that every entry has the expected schema. 7. Run the tracker under a dedicated, minimally privileged operating-system account so that any remaining filesystem flaw has limited scope. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/track.py:12
Finding

Customer Message Data Stored Insecurely in a Shared Temporary Directory

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (13)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
89% confidence
Finding

The documented command interpolates {session_id} directly into an rm path, creating a dangerous pattern if callers ever substitute untrusted session IDs without strict validation. In practice this can enable path traversal or unintended file deletion, and the skill context makes it more dangerous because session identifiers may originate from external systems or user-influenced conversation state.

Content

Scanner excerpt · references/emotion_tracking.md (reported line 49)May include surrounding context.

会话结束后,删除追踪文件:

bash
rm /tmp/sentiment_tracking/{session_id}.json

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill instructs users to run local scripts and references capabilities consistent with file read/write, but it does not declare any tool scope or permissions boundaries. This creates an authorization and transparency gap: an agent or operator may invoke a skill with broader filesystem access than expected, increasing the chance of unintended file access or modification.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The skill describes tracking customer emotion across multiple messages using a session ID, which implies storage or correlation of potentially sensitive conversational data, yet it provides no warning, consent language, retention policy, or handling guidance. In a customer service context, this can expose personal or behavioral profiling data and lead to privacy, compliance, or misuse risks.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The entire skill document is written only in Chinese and provides no indication that users may choose another language or that the language restriction is required by a region-specific context. Under the policy, forcing a specific language without opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The document specifies storing full customer messages, sentiment labels, scores, and timestamps in a session file under /tmp, but provides no privacy notice, retention policy, minimization guidance, or access-control considerations. In a customer-service context this can expose sensitive personal or complaint data to other local users/processes or leave residual data on disk longer than intended.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This markdown file is entirely framed as a Chinese reply-tone guide, with tone labels and example utterances all prescribing Chinese-language responses. There is no indication that the user can opt into another language or that the skill is intentionally limited to a Chinese-only context, which creates a language/locale policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The module docstring and CLI error/output strings are written only in Chinese, which imposes a specific language on users. The policy allows locale constraints only when they are explicitly justified or when the user is given a language/locale choice, neither of which is present here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The natural-language description and user-facing strings are entirely in Chinese, including the error message, without offering a language or locale choice. Under the stated policy, forcing a specific language without user opt-in is a locale-policy violation unless clearly justified.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The code persists per-session customer message excerpts and sentiment history to /tmp on disk, even though the skill’s stated purpose is sentiment analysis rather than durable transcript storage. In a customer-service context this can expose potentially sensitive user content and behavioral metadata to other local users/processes, and /tmp storage is especially risky because it is commonly shared, world-accessible by default on many systems, and not designed for confidential data retention.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

Session history is written to disk silently with no user-facing notice, consent, or operator warning, which creates a privacy and compliance risk when processing customer-service messages. Because the stored data includes message excerpts, sentiment labels, scores, and timestamps, undisclosed collection increases the chance of improper handling of personal or sensitive information.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The description and all operating instructions are written exclusively in Chinese, and the skill is framed for a specific Chinese-language customer service context without stating that this locale is optional or required for compliance. Under the policy, forcing a specific language without user opt-in can be a natural-language policy issue.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The document presents all instructions and operational guidance only in Chinese. Under the policy criteria, forcing a specific language without user opt-in or a documented locale-specific justification is a natural-language policy issue.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The file instructs operators to delete session data with rm /tmp/sentiment_tracking/{session_id}.json, which is a destructive action. The surrounding text provides no caution about verifying the session ID/path or the permanence of deletion, so the skill description omits a user-facing warning for a system-affecting operation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.