T09 · Insecure Skill Coding Practices
- Location
scripts/tcloud_api.py:45- Finding
TLS Certificate Verification Is Disabled When certifi Is Unavailable
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is a real Tencent Cloud Smart Advisor utility, but it asks for durable cloud credentials and includes overbroad IAM, console-login, and cleanup behaviors that need careful review before use.
Install only if you are comfortable giving the skill Tencent Cloud API credentials and letting it create or use console-login roles. Prefer a least-privilege sub-account and short-lived credentials, avoid storing AK/SK in shell startup files, do not share generated console links, and review or remove the role-creation and cloud-cleanup scripts before running them in a production account.
scripts/tcloud_api.py:45TLS Certificate Verification Is Disabled When certifi Is Unavailable
scripts/tcloud_api.py:86Generic API Client Sends Authentication Material to a Caller-Controlled Host
scripts/create_role.py:40Created CAM Role Receives Excessive Full-Access Policies
scripts/login_url.py:267Credential-Bearing Console Login URLs Are Printed into Durable Agent Output
scripts/login_url.py:302Console Login Redirect Target Is Not Validated
scripts/setup_role.py:388Role Setup Can Select Arbitrary Console Roles Without Permission Validation
scripts/cleanup.py:282Cleanup Can Delete an Unrelated Pre-Existing CAM Role Without Ownership Verification
SKILL.md:24Documentation Directs Users to Persist Long-Lived Cloud Credentials in Plaintext Shell Files
check_env.py:73Read-Only and Network Security Declarations Contradict Actual Side Effects
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 skill also enumerates roles, tests role assumption, writes local configuration, and performs IAM-related setup while being framed mainly as a TSA inspection utility. This mismatch is risky because it obscures the real privilege footprint and operational effects of the tool, especially in environments where cloud IAM changes require heightened scrutiny.
The skill also enumerates roles, tests role assumption, writes local configuration, and performs IAM-related setup while being framed mainly as a TSA inspection utility. This mismatch is risky because it obscures the real privilege footprint and operational effects of the tool, especially in environments where cloud IAM changes require heightened scrutiny.
The skill also enumerates roles, tests role assumption, writes local configuration, and performs IAM-related setup while being framed mainly as a TSA inspection utility. This mismatch is risky because it obscures the real privilege footprint and operational effects of the tool, especially in environments where cloud IAM changes require heightened scrutiny.
The skill also enumerates roles, tests role assumption, writes local configuration, and performs IAM-related setup while being framed mainly as a TSA inspection utility. This mismatch is risky because it obscures the real privilege footprint and operational effects of the tool, especially in environments where cloud IAM changes require heightened scrutiny.
The skill also enumerates roles, tests role assumption, writes local configuration, and performs IAM-related setup while being framed mainly as a TSA inspection utility. This mismatch is risky because it obscures the real privilege footprint and operational effects of the tool, especially in environments where cloud IAM changes require heightened scrutiny.
YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).
��变量配置密钥:
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 角色。角色配置分为 检测 和 创建 两个独立步骤,角色创
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:
The script contains cloud-side destructive capability to delete a CAM role named "advisor" when run with --cloud and valid credentials. In a skill advertised primarily as architecture risk inspection, adding IAM-role deletion increases blast radius and could remove legitimate access configuration if a user runs cleanup with broad AK/SK credentials, especially because the role name is generic and not strongly bound to resources created by this tool.
This script performs IAM write operations by creating a CAM role and attaching broad managed policies, which exceeds the skill’s stated read-only architecture risk-inspection purpose. In an agent-skill context, bundled privilege-granting automation is dangerous because it can modify a user’s cloud access model and create persistent access paths if invoked with available credentials.
If certifi is unavailable, the script disables TLS certificate validation and hostname checking for outbound HTTPS requests. This permits man-in-the-middle interception or tampering of STS responses, which could expose temporary credentials, alter returned data, or redirect the authentication flow.
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
This setup script performs privileged CAM/IAM state changes—creating a role and modifying policy attachments—even though the skill metadata describes a read/query-oriented advisor tool. That mismatch is dangerous because users may authorize credentialed execution expecting inspection only, while the script actually persists new access pathways and changes cloud identity configuration.
The code auto-creates a console-login role and attaches broad managed policies (QcloudTAGFullAccess, QcloudAdvisorFullAccess), expanding privileges beyond the minimum needed for simple advisor queries. If run with sufficiently privileged credentials, this can create durable, unnecessary access that increases blast radius and could be abused later for reconnaissance or administrative misuse.
If certifi is unavailable, the code disables hostname checking and certificate validation entirely, causing HTTPS connections to trust any certificate. Because this client sends signed cloud API requests carrying sensitive authentication material, an on-path attacker could intercept or redirect requests, capture metadata, and potentially replay or abuse temporary credentials.
Without declared permissions the skill's intent is opaque and cannot be validated.
The skill explicitly instructs users to persist long-lived cloud API secrets in shell startup files and user-level environment settings. Persisting high-value credentials in broadly readable or routinely sourced profile locations increases the risk of credential theft via local compromise, backups, shell history mishandling, shared-user systems, or accidental disclosure during troubleshooting.
The role-creation guidance is internally inconsistent: one section claims the role only grants Advisor read-only access, while another later proposes attaching broader TAG/Advisor FullAccess permissions. Such contradictory security documentation can mislead users into approving overprivileged IAM changes under the false impression that access is narrowly limited.
This markdown file defines invocation trigger phrases, so SQP-1 applies. Among the listed triggers for DescribeStrategies, "安全检查" is generic and could match many unrelated security-check requests, increasing the chance of unintended activation without clear exclusion conditions or tighter scope.
The file header claims the script is read-only and does not modify configuration, but the code later writes ~/.tsa-risk/config.json when it detects an existing role. This misleading behavior can cause users or calling automation to grant trust or execute the script under assumptions that no local state will be changed, which is dangerous in security-sensitive setup tooling.
The file-level docstring and all user-facing operational messages are written exclusively in Chinese, which imposes a language choice on users without any opt-in or alternative locale. The policy explicitly calls for flagging language or locale constraints when the skill does not offer a user choice or clearly justify the restriction.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
"""
import subprocess
try:
result = subprocess.run(
["clawhub", "inspect", slug, "--json"],
capture_output=True, text=True, timeout=VERSION_CHECK_TIMEOUT,
)
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
login_url_path = SCRIPT_DIR / "login_url.py"
import subprocess
test_result = subprocess.run(
[sys.executable, str(login_url_path),
"https://console.cloud.tencent.com/advisor"],
capture_output=True, text=True, timeout=30,
The skill handles a user identifier and explicitly instructs generation of passwordless console login links for architecture resources, but provides no warning, consent, scope limitation, or safe-handling guidance. In this context, the returned architecture details may expose sensitive cloud topology and resource identifiers, and the mandatory regeneration/display of direct-access links increases the chance of unintended privileged access or link leakage.
No suspicious patterns detected.