Back to skill

Security audit

vispatrol-alram-query

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent alarm-query purpose, but it needs review because it reads and decrypts a local VisPatrol session token and can forward that token while downloading snapshots from unvalidated URLs.

Install only on a trusted Windows VisPatrol host after confirming vpup.json is expected and current. Before broad use, require script-enforced per-run approval, restrict snapshot downloads to the configured VisPatrol media-service origin, avoid forwarding tokens to arbitrary URLs or nonlocal HTTP services, pin all dependencies, and define a cleanup policy for saved snapshot images.

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

Error
Location
scripts/alarm_query.py:750
Finding

Bearer token disclosure through unvalidated snapshot URLs

Content
View full analysis
str: """Normalize the snapshot address into an absolute downloadable URL.""" if not snapshot_url: return snapshot_url parsed = urlparse(snapshot_url) if parsed.scheme and parsed.netloc: return snapshot_url return urljoin( f"{self._build_service_base_url(self.config.media_service_port).rstrip('/')}/", snapshot_url.lstrip("/") ) ``` ```python def _materialize_snapshot_from_url(self, snapshot: Dict[str, Any]) -> Optional[str]: """Download a snapshot URL locally so the upper layer can send the image.""" local_path = snapshot.get("local_path") if local_path not in (None, ""): return None snapshot_url = snapshot.get("url") if snapshot_url in (None, ""): return None resolved_url = self._resolve_snapshot_url(str(snapshot_url)) headers = {} if self.token: headers["Authorization"] = f"Bearer {self.token}" try: response = self.session.get( resolved_url, headers=headers, timeout=self.config.timeout ) response.raise_for_status() except requests.exceptions.RequestException as exc: message = f"Snapshot URL download failed: {exc}" logger.warning(message) return message ``` ### Technical Analysis The media API can return a snapshot record containing a URL. When that URL is absolute, `_resolve_snapshot_url()` accepts it without validating its scheme, hostname, or port. `_materialize_snapshot_from_url()` then attaches the local VisPatrol bearer token to the resulting request regardless of its destination. Consequently, a compromised or malicious media service can cause the ...[truncated 1718 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/alarm_query.py:257
Finding

Credential file is read without script-enforced per-run approval

Content
View full analysis
Dict[str, Any]: """Load the service address, token, and token key from Windows TEMP/vpup.json.""" if self.runtime_config_loaded and not force_reload: return { "success": True, "message": "vpup configuration loaded", "data": { "base_url": self.config.base_url, "alarm_service_port": self.config.alarm_service_port, "media_service_port": self.config.media_service_port, "token_loaded": bool(self.token), } } vpup_path = _resolve_vpup_config_path(self.config.vpup_config_path) try: raw_text = vpup_path.read_text(encoding="utf-8-sig") payload = json.loads(raw_text) ``` ### Technical Analysis `SKILL.md` and `SECURITY.md` state that every execution must be preceded by explicit user approval to read `%TEMP%/vpup.json` and use its session token. The script does not enforce that requirement. Constructing `AlarmQuery` immediately calls `_load_runtime_config_from_vpup()`, which reads the credential file and subsequently decrypts its token. There is no required command-line approval parameter, trusted approval token, callback, or other fail-closed check before the read occurs. The metadata setting may prevent the Skill from being loaded ...[truncated 1263 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
SKILL.md:69
Finding

Unpinned and incomplete third-party dependency installation

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
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (25)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

Although the description mentions querying alarms and requiring user approval before reading vpup.json, the documented behavior expands into automatic local config access, token handling/decryption tied to host identity, local snapshot downloads, and even WSL-to-Windows host path access. This creates a broader trust boundary than the headline description suggests, increasing the risk of credential misuse, unintended host file access, and data exfiltration from the Windows environment.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- 该 token 只允许用于 scripts/alarm_query.py 已实现的只读报警查询和抓拍读取;禁止将其用于登录、账号管理、设备控制、配置修改或其他无关接口。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- 该 token 只允许用于 scripts/alarm_query.py 已实现的只读报警查询和抓拍读取;禁止将其用于登录、账号管理、设备控制、配置修改或其他无关接口。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- 该 token 只允许用于 scripts/alarm_query.py 已实现的只读报警查询和抓拍读取;禁止将其用于登录、账号管理、设备控制、配置修改或其他无关接口。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- 该 token 只允许用于 scripts/alarm_query.py 已实现的只读报警查询和抓拍读取;禁止将其用于登录、账号管理、设备控制、配置修改或其他无关接口。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- 该 token 只允许用于 scripts/alarm_query.py 已实现的只读报警查询和抓拍读取;禁止将其用于登录、账号管理、设备控制、配置修改或其他无关接口。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- 该 token 只允许用于 scripts/alarm_query.py 已实现的只读报警查询和抓拍读取;禁止将其用于登录、账号管理、设备控制、配置修改或其他无关接口。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- 该 token 只允许用于 scripts/alarm_query.py 已实现的只读报警查询和抓拍读取;禁止将其用于登录、账号管理、设备控制、配置修改或其他无关接口。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- 该 token 只允许用于 scripts/alarm_query.py 已实现的只读报警查询和抓拍读取;禁止将其用于登录、账号管理、设备控制、配置修改或其他无关接口。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- 该 token 只允许用于 scripts/alarm_query.py 已实现的只读报警查询和抓拍读取;禁止将其用于登录、账号管理、设备控制、配置修改或其他无关接口。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- 该 token 只允许用于 scripts/alarm_query.py 已实现的只读报警查询和抓拍读取;禁止将其用于登录、账号管理、设备控制、配置修改或其他无关接口。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- 该 token 只允许用于 scripts/alarm_query.py 已实现的只读报警查询和抓拍读取;禁止将其用于登录、账号管理、设备控制、配置修改或其他无关接口。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- 该 token 只允许用于 scripts/alarm_query.py 已实现的只读报警查询和抓拍读取;禁止将其用于登录、账号管理、设备控制、配置修改或其他无关接口。

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill requires sensitive capabilities including shell execution, local file reads/writes, environment access, and network access, but it does not declare an explicit tool scope such as permissions or allowed-tools. That omission weakens policy enforcement and reviewability, making it easier for the skill to access local secrets like %TEMP%/vpup.json and download/write snapshot files without a machine-enforced least-privilege boundary.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

From WSL, the script reaches into the Windows host by spawning cmd.exe and powershell.exe to discover the host TEMP directory and then read a host-side configuration file. That cross-boundary access is broader than the stated alarm-query purpose and increases risk because it silently expands filesystem and process interaction with the Windows host.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/alarm_query.py (reported line 69)May include surrounding context.

python
for command in commands:
        try:
            completed = subprocess.run(
                command,
                capture_output=True,
                text=True,

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill claims that execution requires consent to read vpup.json, but it also gathers a host MAC address and derives a decryption key from it. That expands data collection beyond the stated purpose and uses a sensitive device identifier for authentication without clearly informing the user, which is a privacy and trust-boundary issue in this skill context.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/alarm_query.py (reported line 154)May include surrounding context.

python
return None

    try:
        completed = subprocess.run(
            ["getmac", "/fo", "csv", "/nh"],
            capture_output=True,
            text=True,

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script accesses a sensitive hardware identifier and uses it in authentication-related token decryption without a clear user-facing warning. In this skill context, that matters because the declared consent requirement only mentions reading vpup.json, not collecting additional device identity data.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill description focuses on querying alarms and snapshots, but the code persistently downloads and stores snapshot images on local disk. In a surveillance context, those images may contain sensitive personal or environmental data, so undisclosed retention materially increases privacy and data-handling risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Downloaded surveillance snapshots are written to a persistent local directory without an explicit warning at the point of use. This creates avoidable exposure of potentially sensitive images to other local processes or future users of the machine.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The code sends a bearer token in network requests without a clear user-facing warning, while the base URL is constructed as plain HTTP. In this context, transmitting authentication data over unauthenticated transport can expose credentials to interception on non-local or misconfigured networks.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

User-facing strings, help text, logs, and natural-language parsing are all hard-coded in Chinese, including query parsing for terms like '今天', '昨天', and '设备'. This effectively forces a specific language/locale without any opt-in, fallback, or explicit documentation that the skill is region- or language-specific.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
98% confidence
Finding

The function name and compatibility framing suggest CPU identity semantics, yet the implementation simply returns get_mac_address(). This is an active documentation mismatch around what host identifier is being accessed and used for authentication-related processing.

Content

No source excerpt is available for this finding.

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/alarm_query.py (reported line 1529)May include surrounding context.

python
def configure_console_output():
    """尽量启用 UTF-8 控制台输出,避免 Windows 默认编码导致打印失败。"""
    for stream_name in ("stdout", "stderr"):
        stream = getattr(sys, stream_name, None)
        reconfigure = getattr(stream, "reconfigure", None)
        if callable(reconfigure):
            try: