T09 · Insecure Skill Coding Practices
- Location
security_report.py:15- Finding
Hard-Coded XDR API Credential
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill appears intended for security-event reporting, but it embeds an XDR API key, disables TLS verification, and saves sensitive raw event data locally.
Review this skill carefully before installing. It should not be used as published unless the exposed XDR API key has been revoked and replaced with a user-provided secret, TLS verification is enabled, the XDR destination is configurable and authorized, and raw data retention is documented or disabled by default.
security_report.py:15Hard-Coded XDR API Credential
security_report.py:45TLS Certificate Verification Disabled for Authenticated XDR Requests
security_report.py:103Security Event Totals and Trends Use Aggregate Record Counts Instead of Event Counts
The declared purpose says the skill summarizes security events, but the behavior includes actively querying external or internal security platforms and, per the finding, authenticating with hardcoded credentials and accessing undeclared resources. That mismatch is dangerous because it conceals privileged data access behind an innocuous summary skill, reducing informed consent and increasing the chance of unauthorized collection or credential exposure.
The skill executes another Python script as a subprocess, which introduces code-execution capability beyond simple summary generation. In this context, that is more dangerous because a summarization skill should not need shell-mediated execution of auxiliary scripts, and compromise of the sibling script or execution path could lead to unintended code execution.
This is a true tool-parameter abuse issue because user-controlled or runtime-derived data is interpolated into a shell command. Even though argparse enforces int for the CLI path, shell=True remains a fragile and unnecessary execution pattern that can become exploitable through future code changes, alternate call paths, or path/argument manipulation.
# 执行命令
import subprocess
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
if result.returncode != 0:
raise Exception(f"执行安全报告脚本失败: {result.stderr}")
The code globally disables TLS warnings and then connects with certificate verification disabled, which allows interception or spoofing of the XDR API connection. Because this code handles security-event data and API authentication, a man-in-the-middle attacker could tamper with results or capture credentials and sensitive telemetry.
A hardcoded API key is embedded directly in the source and used automatically for requests. If the file is shared, logged, committed, or reused by another system, the credential can be extracted and used to access the XDR API, potentially exposing sensitive security-event data or enabling further abuse depending on the API's permissions.
The skill declares no explicit tool or permission scope, yet its instructions direct execution of local Python scripts, network access to XDR data sources, and report/output file generation. In an agent environment, this overbroad undeclared capability increases the risk of unintended shell execution, filesystem writes, and network access without policy visibility or user consent.
The file describes the skill entirely in Chinese and the reporting template mandates a fixed Chinese output structure, but it does not indicate that language selection is optional or user-controlled. This can violate language/locale policy when users have not opted into Chinese-only responses.
The trigger phrases are broad enough to match common requests for security summaries, which can cause the skill to activate in contexts where the user did not intend this specific workflow. Because the skill may execute scripts and fetch security data, accidental invocation has greater consequences than a normal text-only skill.
This Python file hard-codes Chinese-language docstrings, CLI descriptions, exceptions, headings, and status messages throughout the skill. That creates a language-policy issue because the skill mandates a specific language for interaction and output without any user opt-in, locale selection, or stated region-specific justification.
The code builds a shell command string and executes it with shell=True, even though part of the command includes a runtime parameter (days). This creates command-injection risk if the parameter validation is ever weakened, bypassed, or influenced indirectly, and it is unnecessary because the script path and arguments can be passed safely as an argument list.
# 执行命令
import subprocess
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
if result.returncode != 0:
raise Exception(f"执行安全报告脚本失败: {result.stderr}")
The skill claims to generate concise summaries, but it also writes raw security event data to persistent local storage. Raw security logs often contain sensitive operational details, internal IPs, incident metadata, and potentially regulated data, so this expands the data exposure surface beyond the stated function.
The skill is described as a summarization/reporting utility, but it also initiates direct remote collection from an internal XDR endpoint. This expands its privileges and data-access scope beyond passive summarization, increasing the risk of unauthorized data retrieval, unexpected network access, and misuse in environments where users may assume only local processing occurs.
The skill performs an external network request that transmits security-event query parameters and retrieves sensitive event data without any explicit user-facing disclosure. In the context of a summarization skill, this is riskier because users may reasonably expect analysis of supplied data rather than silent remote collection from an internal security platform.
Using verify=False disables server certificate validation for this specific HTTPS request, making the connection vulnerable to man-in-the-middle attacks. Since the request includes an API key and accesses security telemetry, an attacker on the network path could intercept credentials, observe queries, or alter returned event data.
API_URL,
headers=HEADERS,
params=params,
verify=False,
timeout=120
)
response.raise_for_status()
The manifest description states the skill is specifically for generating security incident summary reports in Chinese, using Chinese-only phrasing without indicating user opt-in or alternative language support. This creates a natural-language locale policy concern because it appears to enforce a specific language by default rather than offering a choice or documenting a region-specific justification.
The stated purpose is to generate a concise abstract report from security events, which does not inherently require writing artifacts to the user's filesystem. Persisting the report as a file is an additional operational behavior beyond the manifest's narrowly described summarization scope.