T09 · Insecure Skill Coding Practices
- Location
scripts/tcloud_api.py:45- Finding
TLS Certificate Validation Is Disabled When certifi Is Unavailable
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This appears to be a real Tencent Cloud Smart Advisor helper, but it should be reviewed carefully because it handles cloud credentials, creates broad console-enabled roles, and has unsafe transport and scoping gaps.
Install only if you are comfortable giving this skill Tencent Cloud API credentials and allowing it to create or use a console-login CAM role. Prefer a dedicated least-privilege subaccount or temporary credentials, avoid storing long-term AK/SK values in shell profiles, review the role policies before creation, and do not use it in environments where certifi may be missing until the TLS fallback and host allowlisting issues are fixed.
scripts/tcloud_api.py:45TLS Certificate Validation Is Disabled When certifi Is Unavailable
scripts/tcloud_api.py:82Generic API Client Sends Authentication Material to a Caller-Controlled Host
SKILL.md:24Long-Term Cloud Credentials Are Persisted in Plaintext Shell Profiles
scripts/create_role.py:42Created Console Role Receives Excessive Full-Access Policies
check_env.py:346Mandatory “Read-Only” Environment Check Performs Persistent Writes and Role Assumption
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
)
ctx = _get_ssl_context()
with urlopen(req, context=ctx) as resp:
result = json.loads(resp.read().decode("utf-8"))
response_body = result.get("Response", {})
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
try:
ctx = _get_ssl_context()
with urlopen(req, context=ctx, timeout=30) as resp:
response_body = resp.read().decode("utf-8")
except HTTPError as e:
try:
The security claim is materially misleading: AK/SK-authenticated API calls necessarily send signed request material over the network, even if the raw secret key is not directly logged or persisted. Incorrect assurances about secret handling can cause operators to underestimate exposure, deploy the skill in inappropriate environments, and miss needed controls around network egress and credential use.
声明描述强调的是“智能顾问”业务能力本身,即查询架构目录、架构详情、评估结果、风险评估项,以及开通服务等面向用户的腾讯云智能顾问 API 操作。而实际代码块并未实现这些业务查询或开通功能;它的主要用途是环境自检与配置验证。虽然代码确实调用了腾讯云相关 API(如 DescribeArchList、GetCallerIdentity、GetRole),但这些调用仅用于鉴权与环境探测,不是为了提供声明中的核心功能。此外,代码还执行了描述中未提及的本地配置保存、版本更新检查、角色配置探测、以及调用 login_url.py 验证免密登录等能力。这些属于与声明主功能 materially different 的行为,因此应判定为描述与代码行为不匹配。
There is a clear description-behavior mismatch. The declared purpose is a Tencent Cloud Intelligent Advisor assistant for querying and managing cloud architecture and risk assessment data via authenticated API calls. The actual code instead packages the skill into several zip files with altered metadata/branding. It does not implement any cloud architecture queries, risk assessment retrieval, service enablement, AK/SK auth, network access, or Tencent Cloud API usage. Its primary purpose is build/release packaging, which is unrelated to the declared runtime assistant behavior.
声明描述的是“腾讯云智能顾问助手”的业务操作能力,重点在于查询云架构目录、架构详情、评估结果、风险评估项,以及开通服务;而实际代码块的主要目的完全不同,是“配置清理/卸载”工具。它访问和修改的是本地文件系统、环境变量,并可对云端 CAM 角色执行删除操作,这些都未在声明中体现。尤其删除云端角色属于高影响管理能力,与声明中的只读查询/服务开通场景明显不一致。因此该代码与声明存在实质性不匹配。
声明描述的核心能力是“智能顾问业务数据查询/管理”,如云架构图、评估结果、风险项和服务开通;而这段代码并未调用任何智能顾问相关 API,也没有执行架构图或风险评估查询。相反,它执行的是账号与权限初始化相关的 CAM 角色创建和授权操作,属于高敏感 IAM 写入能力。虽然“支持开通智能顾问服务”可能与前置授权存在一定关联,但当前代码的主要目的和实际行为明显偏向权限配置而非智能顾问数据操作,且这一 IAM 写入能力未在描述中被明确表达,因此构成明显不匹配。
声明描述聚焦于“腾讯云智能顾问 API”的业务能力,例如查询云架构目录、架构详情、评估结果和风险评估项,并支持开通服务。但实际代码的核心功能完全不同:它是登录辅助工具,用于基于 AK/SK 和 CAM 角色生成腾讯云控制台免密登录链接。代码中没有任何 Advisor 相关 API 调用、没有云架构/风险评估数据处理逻辑,也没有开通智能顾问服务的实现。相反,它访问的是 STS 与登录回调相关资源,并依赖角色配置、临时凭证和签名算法来构造 SSO URL。这属于与声明主目的 materially different 的行为,且包含未声明的能力,因此应判定为不匹配。
The skill instructs users to persist long-lived cloud credentials by appending them to shell startup files or user-level environment settings. Persisting AK/SK in ~/.bashrc, ~/.zshrc, or user-wide environment storage increases credential exposure to local compromise, accidental disclosure, shell-history mishandling, backups, and downstream tools that inherit the environment.
��变量配置密钥:
TENCENTCLOUD_SECRET_ID — 腾讯云 SecretId(必填)TENCENTCLOUD_SECRET_KEY — 腾讯云 SecretKey(必填)密钥获取地址:https://console.cloud.tencent.com/cam/capi
环境变量必须永久写入 shell 配置文件,确保新会话中仍然生效:
Linux / macOS(写入 ~/.bashrc 或 ~/.zshrc):
echo 'export TENCENTCLOUD_SECRET_ID="your-secret-id"' >> ~/.bashrc
echo 'export TENCENTCLOUD_SECRET_KEY="your-secret-key"' >> ~/.bashrc
source ~/.bashrc
Windows PowerShell(写入用户级环境变量):
[Environment]::SetEnvironmentVariable("TENCENTCLOUD_SECRET_ID", "your-secret-id", "User")
[Environment]::SetEnvironmentVariable("TENCENTCLOUD_SECRET_KEY", "your-secret-key", "User")
为生成控制台免密登录链接,需要配置 CAM 角色。角色配置分为 检测 和 创建 两个独立步骤,角色创
Referenced artifact was not completely inspected
- 插件必须包含 `SKILL.md` 文件,描述插件的功能、调用方式和输出格式
The statement that keys 'will not be transmitted over the network' is inaccurate because authenticated API requests necessarily use those credentials, or derived signatures from them, in remote requests. This is dangerous because it gives users a false sense of secret-handling safety when the skill performs network-authenticated cloud operations.
YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).
nd("TENCENTCLOUD_SECRET_ID")
if not secret_key:
missing.append("TENCENTCLOUD_SECRET_KEY")
log_fail(f"未配置以下环境变量: {', '.join(missing)}")
log_info("")
log_info(" 请将腾讯云 API 密钥永久写入 shell 配置文件:")
log_info("")
log_info(" Linux / macOS(写入 ~/.bashrc 或 ~/.zshrc):")
log_info(' echo \'export TENCENTCLOUD_SECRET_ID="your-secret-id"\' >> ~/.bashrc')
log_info(' echo \'export TENCENTCLOUD_SECRET_KEY="your-secret-key"\' >> ~/.bashrc')
log_info(" source ~/.bashrc")
log_info("")
log_info(" Windows PowerShell(写入用户级环境变量):")
log_info(' [Environment]::SetEnvironmentVariable("TENCENTCLOUD_SECRET_ID", "your-secret-id", "User")')
log_info(' [Environment]::SetEnvironmentVariable("TENCENTCLOUD_SECRET_KEY", "your-secret-key", "User")')
log_info("")
log_info(" 密钥获取地址: https:
This script performs privileged IAM/CAM write operations by creating a role and attaching policies, which exceeds the skill’s stated architecture/risk query focus. In an agent setting, bundling identity-management changes into a helper skill increases the chance of unauthorized privilege changes or surprise side effects if invoked by the model or user without strong approval controls.
The script attaches broad managed policies (QcloudTAGFullAccess and QcloudAdvisorFullAccess) to the created role, granting more access than a read/query-oriented advisor skill should typically need. Overly broad permissions expand blast radius if the role is misused, compromised, or assumed unexpectedly, especially in a cloud environment where tagging and advisor permissions may expose or alter security-relevant resources and metadata.
The script generates passwordless Tencent Cloud console login URLs, which is materially more powerful than the skill's declared advisor-query and architecture/risk-management functionality. This creates an undocumented access-enablement capability that can be abused to pivot from API usage into interactive console access, expanding privileges and attack surface beyond user expectations.
When certifi is unavailable, the code disables certificate and hostname verification entirely, allowing man-in-the-middle interception of STS requests. Because those requests carry signed authentication material and receive temporary credentials, an active network attacker could tamper with responses or redirect sensitive traffic.
os.system() and os exec-family calls run shell commands with the process's full privileges, enabling arbitrary command execution.
if platform.system() == "Windows":
# Windows 10+ 的 cmd/PowerShell 支持 ANSI(需 VT100)
try:
os.system("") # 激活 VT100 模式
return True
except Exception:
return False
If certifi is unavailable, the code disables both certificate validation and hostname verification, allowing man-in-the-middle interception of signed Tencent Cloud API requests. Because this script handles cloud API credentials and management actions, an attacker on the network path could impersonate the API endpoint and capture sensitive request data or manipulate responses.
Disabling TLS certificate and hostname verification removes core transport authentication and makes HTTPS susceptible to interception and spoofing. Since this code sends authenticated cloud-management requests, exploitation could lead to response tampering, request capture, and misuse of sensitive cloud operations.
The instruction is written entirely in Chinese and mandates strict compliance, which effectively imposes a specific language/locale on contributors without offering any language choice or opt-in. This matches the policy category for language or locale constraints expressed in natural language.
The README advertises capabilities beyond the stated skill scope, including passwordless console login generation and role/environment management. Scope expansion in an agent skill is security-relevant because users and reviewers may grant broader trust than intended, and these features can enable account access or IAM changes if invoked.
Documenting passwordless console login link generation without a strong warning understates the account-access implications of the feature. Such links can grant direct console access or facilitate access transfer, so presenting them as a convenience feature without prominent consent and risk language is dangerous in an agent setting.
The example trigger phrases are broad enough to overlap with ordinary cloud-assistant conversations, increasing the chance the skill is invoked in contexts the user did not explicitly intend. In a skill that can query architecture data, generate console login links, or assist with role-related setup, ambiguous activation expands the attack surface and may lead to unintended privileged actions or disclosure.
Without declared permissions the skill's intent is opaque and cannot be validated.
The skill description and invocation guidance are written as mandatory Chinese-language operating instructions and do not indicate that the user may choose another language. Under the policy for natural-language violations, forcing a specific language without opt-in is reportable unless a justified region-specific constraint is documented.