Back to skill

Security audit

数字宠物

Security checks for vulnerabilities and agentic risk

Overview

This is a mostly coherent digital-pet skill, but it needs review because its helper server is exposed beyond localhost and its web views run third-party JavaScript without integrity checks.

Install only if you are comfortable with a toy pet that starts a local web server and depends on a live CDN. Prefer running it on a trusted network, binding the server to 127.0.0.1, removing wildcard CORS, and bundling Three.js locally or adding SRI/CSP before regular use.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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 (3)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/serve.py:13
Finding
Development HTTP Server Listens on All Network Interfaces with Permissive CORS<![CDATA[ ## Vulnerability Details **File Location**: `scripts/serve.py:13-20,35` **Vulnerability Type**: Externally exposed development server and overly permissive cross-origin access **Risk Level**: Medium ### Vulnerable Code ```python PORT = 8888 DIRECTORY = os.path.dirname(os.path.abspath(__file__)) class MyHTTPRequestHandler(http.server.SimpleHTTPRequestHandler): def __init__(self, *args, **kwargs): super().__init__(*args, directory=DIRECTORY, **kwargs) def end_headers(self): # Add CORS headers for local development self.send_header('Access-Control-Allow-Origin', '*') super().end_headers() ``` ```python with socketserver.TCPServer(("", PORT), MyHTTPRequestHandler) as httpd: print(f"Server started") httpd.serve_forever() ``` ### Technical Analysis Passing an empty host string to `TCPServer` causes the server to listen on all available network interfaces rather than only the loopback interface. This conflicts with the documented local-only address, `http://localhost:8888`. The server also returns `Access-Control-Allow-Origin: *` for every response. Consequently, any website visited by the user may issue browser requests to the service and read the responses. No authentication, origin validation, or access-control mechanism protects the server. The configured document root is the `scripts` directory. The currently reviewed directory contains Python source files rather than credentials; however, every file subsequently placed under this directory and readable by the process would also become remotely retrievable. ### Attack Path 1. A user starts the application using `python3 scripts/serve.py`. 2. The server binds to port 8888 on every available interface. 3. An attacker on a network that can reach the host connects to `<victim-address>:8888`. 4. The attacker enumerates and downloads files exposed by `SimpleHTTPRequestHandler`. 5. Alternatively, an attacker causes the user to visit a malicious webpag ...[truncated 707 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Bind the server explicitly to the loopback interface: ```python HOST = "127.0.0.1" with socketserver.TCPServer((HOST, PORT), MyHTTPRequestHandler) as httpd: httpd.serve_forever() ``` 2. Remove the wildcard CORS header unless cross-origin access is necessary. 3. If CORS is required, validate the `Origin` header against a narrow allowlist rather than returning `*`. 4. Serve a dedicated static-assets directory containing only files intended for browser access. 5. Do not place secrets, configuration files, logs, or executable administration scripts beneath the web root. 6. Consider adding explicit host-header validation and a minimal security-header policy. 7. Update the startup message to display the actual bound interface. ]]>

T08 · Insecure Dependencies

Warning
Location
index.html:7
Finding
Unverified Third-Party JavaScript Execution in the Main Web Interface<![CDATA[ ## Vulnerability Details **File Location**: `index.html:7` **Vulnerability Type**: Third-party JavaScript loaded without Subresource Integrity **Risk Level**: Medium ### Vulnerable Code ```html <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script> ``` ### Technical Analysis The main page downloads and executes Three.js from a third-party CDN at runtime. Although the URL includes a fixed library version, the application does not provide a Subresource Integrity hash, so it does not verify that the returned bytes match a reviewed release. The page also lacks a restrictive Content Security Policy. If the CDN response, CDN account, TLS trust chain, or an installed local trust component is compromised, modified JavaScript can execute with the same browser-page privileges as the application's own scripts. This is a supply-chain trust issue. The reviewed repository may remain unchanged while the effective executable code delivered to users changes externally. ### Attack Path 1. A user opens `index.html` or accesses it through a web server. 2. The browser requests `three.min.js` from `cdnjs.cloudflare.com`. 3. An attacker capable of compromising or altering the trusted CDN response returns modified JavaScript. 4. Because no `integrity` attribute is present, the browser accepts the modified response. 5. The malicious script executes before the application's local scripts initialize. 6. The script can manipulate the application, observe page interactions, use browser APIs allowed in the context, and send accessible information to an attacker-controlled endpoint. ### Impact Assessment Successful exploitation permits arbitrary JavaScript execution within the origin and browser context of the main interface. The attacker could alter the displayed application, capture interactions, perform network requests allowed by the browser, consume system resources, or prevent the application from functioning. This finding does no ...[truncated 67 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Prefer bundling a reviewed copy of Three.js within the project and loading it from the same trusted origin. 2. If the CDN must be retained, calculate and pin the official SHA-384 or SHA-512 Subresource Integrity hash: ```html <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js" integrity="sha384-REPLACE_WITH_VERIFIED_HASH" crossorigin="anonymous"></script> ``` 3. Verify the hash directly against the expected upstream artifact before deployment. 4. Add a restrictive Content Security Policy that limits scripts and connections to necessary sources. 5. Establish a dependency-update process that reviews security advisories and verifies new artifacts before changing versions. ]]>

T08 · Insecure Dependencies

Warning
Location
pet_widget.html:7
Finding
Unverified Third-Party JavaScript Execution in the Desktop Pet WebView<![CDATA[ ## Vulnerability Details **File Location**: `pet_widget.html:7` **Vulnerability Type**: Third-party JavaScript loaded without Subresource Integrity **Risk Level**: Medium ### Vulnerable Code ```html <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script> ``` ### Technical Analysis The desktop widget downloads and executes Three.js from a third-party CDN without a Subresource Integrity hash. The desktop application loads this page in `QWebEngineView`, so externally delivered JavaScript becomes part of the executable content of the embedded browser interface. Pinning the version in the URL does not cryptographically pin the response body. An altered CDN response would be accepted and executed because neither SRI nor an equivalent application-level artifact verification mechanism is configured. The page also does not define a restrictive Content Security Policy. This increases the potential capabilities of malicious JavaScript delivered through the dependency channel. ### Attack Path 1. The desktop pet initializes its embedded Qt WebEngine page. 2. `pet_widget.html` requests Three.js from the external CDN. 3. A compromised CDN, trust chain, or trusted network interception component supplies a modified response. 4. Qt WebEngine executes the response because the page does not provide an integrity requirement. 5. The modified dependency runs inside the desktop widget's web context. 6. The malicious code can manipulate the widget, monitor interactions available to the page, initiate browser-permitted network traffic, or disrupt the desktop application. ### Impact Assessment Successful exploitation provides arbitrary JavaScript execution inside the embedded web-rendering context. Potential effects include application spoofing, interaction monitoring, unauthorized network requests from the web context, resource exhaustion, and loss of widget availability. The reviewed evidence does not demonstrate a direct path from ...[truncated 89 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Store a reviewed Three.js build locally and load it from the packaged application resources. 2. If remote loading is unavoidable, add a verified Subresource Integrity hash and `crossorigin="anonymous"`. 3. Configure a restrictive Content Security Policy for the widget, including narrow `script-src`, `connect-src`, `img-src`, and `media-src` directives. 4. Disable unnecessary Qt WebEngine capabilities and remote-content permissions. 5. Keep any native bridge surface minimal and ensure that untrusted or remote pages cannot access privileged bridge objects. 6. Verify dependency updates against trusted upstream release artifacts before packaging. ]]>
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (15)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
描述把该技能定位为支持互动喂食、玩耍、抚摸以及宠物养成游戏的 3D 数字宠物。但当前代码块实际只展示了桌面宠物壳层与窗口行为:创建透明置顶窗口、系统托盘、加载本地 HTML、通过定时器让窗口跟随鼠标、支持拖拽和模式切换。虽然这与“桌面宠物陪伴/3D 展示”部分部分一致,但描述中的关键互动玩法和养成能力并未在该代码中体现,因此描述对功能有明显夸大,属于描述与实际行为不符。

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The file’s natural-language content, including the manifest description and user instructions, is predominantly in Chinese. Under the language/locale policy, forcing a specific language without opt-in or justification is a policy concern, especially since no alternative language option or locale constraint is stated.

Context-Inappropriate Capability

Medium
Confidence
95% confidence
Finding
The page loads Three.js from a third-party CDN at runtime, which introduces a supply-chain and network trust dependency outside the local skill package. If the CDN response is tampered with, unavailable, or replaced with malicious code, that script executes with full privileges in the page context and can alter behavior beyond the stated digital pet functionality.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
At L429-L451, `playAnimation(time)` is implemented as the actual per-frame animation routine, but at L478-L481 another `playAnimation()` method is declared that only sets `this.state = 'playing'`. In a JavaScript class, the later method overrides the earlier one, so the switch at L352-L353 will call the trigger method instead of the documented rotating/jumping/waving animation logic.

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
The document declares `lang="zh-CN"`, and the visible UI text throughout the file is Chinese-only. Under the policy criteria, forcing a specific language without user opt-in can be a natural-language policy violation when no language choice or justification is provided.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
Multiple user-facing strings, dialogs, and console messages are presented in Chinese, and the file does not indicate any user opt-in, language selection, or region-specific justification. Under the language/locale policy, forcing a specific language without user choice is a policy concern.

Natural-Language Policy Violations

Medium
Confidence
87% confidence
Finding
The module docstring is entirely in Chinese and presents the skill as a Chinese-language server utility without offering any language choice. Under the policy, forcing a specific language or locale without user opt-in is a natural-language policy violation unless the locale restriction is documented and justified.

Natural-Language Policy Violations

Low
Confidence
91% confidence
Finding
The entire skill description and usage guidance are written in Chinese, and there is no indication that users may choose another language or that the skill is intended only for a Chinese-speaking or region-specific audience. Under the policy, a fixed language without opt-in is a natural-language locale constraint.

Natural-Language Policy Violations

Low
Confidence
89% confidence
Finding
The document declares `lang="zh-CN"` and the visible UI text throughout the page is presented in Simplified Chinese, with no indication that users can choose another language. This can violate the language/locale policy when a skill imposes a specific locale without user opt-in or a documented regional justification.

Natural-Language Policy Violations

Low
Confidence
87% confidence
Finding
SQP-3 applies to all file types and includes language or locale policy violations in comments or string literals. This file presents its descriptive natural-language content entirely in Chinese and does not offer an opt-in, alternative language, or documented region-specific justification.

Natural-Language Policy Violations

Low
Confidence
82% confidence
Finding
The natural-language description is written entirely in Chinese, which can impose a specific language on users without any indication of language choice or opt-in. Under the language/locale policy, this is a potential policy violation unless the locale restriction is explicitly justified or alternatives are offered.

Natural-Language Policy Violations

Low
Confidence
89% confidence
Finding
The file uses Chinese-only natural-language content in comments and user-facing button labels, such as the scene description and rotation toggle text. Under the stated policy, forcing a specific language without opt-in can be a locale-policy violation when no alternative or justification is provided.

Missing User Warnings

Low
Confidence
80% confidence
Finding
This code continuously reads the global cursor position to make the pet follow the mouse, which is a form of ongoing user-input monitoring. While the startup prints mention that the pet follows the mouse, they do not clearly disclose that the application continuously tracks cursor position in the background, including while resident in the system tray.

Natural-Language Policy Violations

Low
Confidence
91% confidence
Finding
This JavaScript file contains natural-language comments and a console warning exclusively in Chinese, including the user-visible message at L016. Under the policy, forcing a specific language without user opt-in or a documented locale justification is a natural-language policy concern.

Natural-Language Policy Violations

Low
Confidence
82% confidence
Finding
The stylesheet includes natural-language comments in Chinese (e.g. loading animation and responsive section labels), which imposes a specific language in developer-facing documentation within the file. The policy for this audit flags language/locale constraints when a file forces a specific language without offering choice or documenting justification.

Static analysis

No suspicious patterns detected.