T09 · Insecure Skill Coding Practices
- Location
scripts/batch_query.py:40- Finding
TLS Server Certificate Verification Is Disabled
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill appears intended for a real CRM lookup workflow, but it handles CRM credentials and client certificates in unsafe, overbroad ways that users should review before installing.
Only install or run this skill if you are authorized to access this CRM data and can accept the credential-handling risk. Before use, replace the workflow with one that does not export all Keychain identities, does not write private keys or cookies to predictable /tmp files, does not pass passwords on the command line or in URLs, and does not disable TLS verification.
scripts/batch_query.py:40TLS Server Certificate Verification Is Disabled
SKILL.md:25All Exportable Login Keychain Identities Are Exported
scripts/extract_cert.py:38Private Keys Are Extracted Unencrypted and Written Without Enforced Permissions
scripts/batch_query.py:61CRM Passwords and Session Cookies Are Exposed Through Unsafe Interfaces
The declared purpose is querying CRM pseudocodes, but the documented behavior also includes exporting identities from the macOS keychain, extracting private keys from PKCS#12, and writing key material to disk. That is materially more sensitive than the user-facing description and can lead to credential exposure or misuse of client certificates.
The referenced keychain operation enables credential export from a trusted local secret store into a less protected file format. Even if intended for legitimate mTLS use, this transforms a protected authentication factor into portable secret material that could be copied or abused.
# 导出 HexinCA 根证书并添加为受信任根
security find-certificate -c "HexinCA" -p > /tmp/hexin_ca.pem
security add-trusted-cert -r trustRoot -k ~/Library/Keychains/login.keychain-db /tmp/hexin_ca.pem
# 导出身份为 PKCS12(会弹出系统对话框,点击"始终允许")
security export -k ~/Library/Keychains/login.keychain-db -t identities -f pkcs12 -P "temppass" -o /tmp/client_cert.p12
The referenced keychain operation enables credential export from a trusted local secret store into a less protected file format. Even if intended for legitimate mTLS use, this transforms a protected authentication factor into portable secret material that could be copied or abused.
# 导出 HexinCA 根证书并添加为受信任根
security find-certificate -c "HexinCA" -p > /tmp/hexin_ca.pem
security add-trusted-cert -r trustRoot -k ~/Library/Keychains/login.keychain-db /tmp/hexin_ca.pem
# 导出身份为 PKCS12(会弹出系统对话框,点击"始终允许")
security export -k ~/Library/Keychains/login.keychain-db -t identities -f pkcs12 -P "temppass" -o /tmp/client_cert.p12
The skill combines keychain export with downstream private-key extraction, creating a complete credential-unwrapping workflow. In the context of CRM access, that meaningfully raises the risk of credential theft and unauthorized access because the exported certificate can authenticate as the user.
security add-trusted-cert -r trustRoot -k ~/Library/Keychains/login.keychain-db /tmp/hexin_ca.pem
# 导出身份为 PKCS12(会弹出系统对话框,点击"始终允许")
security export -k ~/Library/Keychains/login.keychain-db -t identities -f pkcs12 -P "temppass" -o /tmp/client_cert.p12
# 从 PKCS12 提取个人证书+私钥
python3 scripts/extract_cert.py --email <your_email> --p12 /tmp/client_cert.p12 --output /tmp/my_cert.pem
The skill combines keychain export with downstream private-key extraction, creating a complete credential-unwrapping workflow. In the context of CRM access, that meaningfully raises the risk of credential theft and unauthorized access because the exported certificate can authenticate as the user.
security add-trusted-cert -r trustRoot -k ~/Library/Keychains/login.keychain-db /tmp/hexin_ca.pem
# 导出身份为 PKCS12(会弹出系统对话框,点击"始终允许")
security export -k ~/Library/Keychains/login.keychain-db -t identities -f pkcs12 -P "temppass" -o /tmp/client_cert.p12
# 从 PKCS12 提取个人证书+私钥
python3 scripts/extract_cert.py --email <your_email> --p12 /tmp/client_cert.p12 --output /tmp/my_cert.pem
This duplicate finding flags the same unsafe curl parameter. In the context of a CRM skill that authenticates with both a client certificate and password, disabling TLS verification meaningfully increases the chance of credential theft and session compromise.
curl -k --cert ~/my_cert.pem --key ~/my_cert.pem \
--noproxy '*' -c jar.txt \
"https://crm.10jqka.com.cn/gb_v3/default/index/login"
This duplicate finding flags the same unsafe curl parameter. In the context of a CRM skill that authenticates with both a client certificate and password, disabling TLS verification meaningfully increases the chance of credential theft and session compromise.
curl -k --cert ~/my_cert.pem --key ~/my_cert.pem \
--noproxy '*' -c jar.txt \
"https://crm.10jqka.com.cn/gb_v3/default/index/login"
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
HexinCA 需添加为受信任根证书(一次性操作):
security add-trusted-cert -r trustRoot -k ~/Library/Keychains/login.keychain-db assets/hexin_ca.pem
验证:
This duplicate finding points to the same identity-export workflow from the login keychain. The danger is the same: extracting and persisting private key material outside the keychain weakens credential protection and enables impersonation if the files are exposed.
前置操作(需要用户在系统弹窗点击"始终允许"):
security export -k ~/Library/Keychains/login.keychain-db -t identities -f pkcs12 \
-P "temppass" -o /tmp/client_cert.p12
This duplicate finding points to the same identity-export workflow from the login keychain. The danger is the same: extracting and persisting private key material outside the keychain weakens credential protection and enables impersonation if the files are exposed.
前置操作(需要用户在系统弹窗点击"始终允许"):
security export -k ~/Library/Keychains/login.keychain-db -t identities -f pkcs12 \
-P "temppass" -o /tmp/client_cert.p12
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
示例: python3 batch_query.py --cert ~/my_cert.pem --password <你的CRM密码> 11010686 485462305
前置条件:
1. mTLS 客户端证书已从 macOS Keychain 导出(详见 SKILL.md)
2. HexinCA 根证书已添加为受信任根
3. curl 命令行工具可用
"""
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
示例: python3 batch_query.py --cert ~/my_cert.pem --password <你的CRM密码> 11010686 485462305
前置条件:
1. mTLS 客户端证书已从 macOS Keychain 导出(详见 SKILL.md)
2. HexinCA 根证书已添加为受信任根
3. curl 命令行工具可用
"""
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
示例: python3 batch_query.py --cert ~/my_cert.pem --password <你的CRM密码> 11010686 485462305
前置条件:
1. mTLS 客户端证书已从 macOS Keychain 导出(详见 SKILL.md)
2. HexinCA 根证书已添加为受信任根
3. curl 命令行工具可用
"""
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
前置条件:
1. mTLS 客户端证书已从 macOS Keychain 导出(详见 SKILL.md)
2. HexinCA 根证书已添加为受信任根
3. curl 命令行工具可用
"""
import subprocess
import re
The script sends the CRM password in the URL query string during login. Query-string credentials can be exposed via process listings, proxy/server logs, browser or intermediary logging, and other telemetry, causing credential disclosure beyond the intended TLS channel.
This duplicate finding points to the same Keychain export guidance that encourages extracting protected identities into portable form. That workflow increases the chance of credential theft, persistence, and unauthorized reuse of the client certificate outside the intended trust boundary.
前置条件:
1. HexinCA 已添加为受信任根证书:
security find-certificate -c "HexinCA" -p > /tmp/hexin_ca.pem
security add-trusted-cert -r trustRoot -k ~/Library/Keychains/login.keychain-db /tmp/hexin_ca.pem
2. 已从 Keychain 导出 PKCS12 (需要用户在系统弹窗中点击"始终允许"):
security export -k ~/Library/Keychains/login.keychain-db -t identities -f pkcs12 -P "temppass" -o /tmp/client_cert.p12
This duplicate finding points to the same Keychain export guidance that encourages extracting protected identities into portable form. That workflow increases the chance of credential theft, persistence, and unauthorized reuse of the client certificate outside the intended trust boundary.
前置条件:
1. HexinCA 已添加为受信任根证书:
security find-certificate -c "HexinCA" -p > /tmp/hexin_ca.pem
security add-trusted-cert -r trustRoot -k ~/Library/Keychains/login.keychain-db /tmp/hexin_ca.pem
2. 已从 Keychain 导出 PKCS12 (需要用户在系统弹窗中点击"始终允许"):
security export -k ~/Library/Keychains/login.keychain-db -t identities -f pkcs12 -P "temppass" -o /tmp/client_cert.p12
The guidance to add a root certificate as trusted in the user's login keychain modifies local trust settings for the CRM environment. While not malicious on its own, changing trust anchors without strong justification can broaden trust and weaken assurance if users are encouraged to perform it casually.
1. HexinCA 已添加为受信任根证书:
security find-certificate -c "HexinCA" -p > /tmp/hexin_ca.pem
security add-trusted-cert -r trustRoot -k ~/Library/Keychains/login.keychain-db /tmp/hexin_ca.pem
2. 已从 Keychain 导出 PKCS12 (需要用户在系统弹窗中点击"始终允许"):
security export -k ~/Library/Keychains/login.keychain-db -t identities -f pkcs12 -P "temppass" -o /tmp/client_cert.p12
用法: python3 extract_cert.py [--email <email>] [--p12 <path>] [--output <path>]
This duplicate finding highlights the same identity-export step from Keychain to a temporary PKCS12 file with a predictable password. In this skill's context, that behavior is especially dangerous because the resulting credential can authenticate to an internal CRM service protected by mutual TLS.
security find-certificate -c "HexinCA" -p > /tmp/hexin_ca.pem
security add-trusted-cert -r trustRoot -k ~/Library/Keychains/login.keychain-db /tmp/hexin_ca.pem
2. 已从 Keychain 导出 PKCS12 (需要用户在系统弹窗中点击"始终允许"):
security export -k ~/Library/Keychains/login.keychain-db -t identities -f pkcs12 -P "temppass" -o /tmp/client_cert.p12
用法: python3 extract_cert.py [--email <email>] [--p12 <path>] [--output <path>]
示例: python3 extract_cert.py --email <你的邮箱>@myhexin.com --p12 /tmp/client_cert.p12 --output /tmp/my_cert.pem
This duplicate finding highlights the same identity-export step from Keychain to a temporary PKCS12 file with a predictable password. In this skill's context, that behavior is especially dangerous because the resulting credential can authenticate to an internal CRM service protected by mutual TLS.
security find-certificate -c "HexinCA" -p > /tmp/hexin_ca.pem
security add-trusted-cert -r trustRoot -k ~/Library/Keychains/login.keychain-db /tmp/hexin_ca.pem
2. 已从 Keychain 导出 PKCS12 (需要用户在系统弹窗中点击"始终允许"):
security export -k ~/Library/Keychains/login.keychain-db -t identities -f pkcs12 -P "temppass" -o /tmp/client_cert.p12
用法: python3 extract_cert.py [--email <email>] [--p12 <path>] [--output <path>]
示例: python3 extract_cert.py --email <你的邮箱>@myhexin.com --p12 /tmp/client_cert.p12 --output /tmp/my_cert.pem
This duplicate finding refers to the same error-path guidance that tells the user to export identities from Keychain. Embedding credential-export instructions directly into the tool encourages insecure operational behavior and makes credential extraction seem routine for ordinary CRM tasks.
if not pem_data.strip():
print(f"ERROR: 无法读取 PKCS12 文件 {PKCS12_FILE}")
print("请先运行:")
print(f' security export -k ~/Library/Keychains/login.keychain-db -t identities -f pkcs12 -P "{PKCS12_PASS}" -o {PKCS12_FILE}')
sys.exit(1)
# Split into individual PEM blocks
This duplicate finding refers to the same error-path guidance that tells the user to export identities from Keychain. Embedding credential-export instructions directly into the tool encourages insecure operational behavior and makes credential extraction seem routine for ordinary CRM tasks.
if not pem_data.strip():
print(f"ERROR: 无法读取 PKCS12 文件 {PKCS12_FILE}")
print("请先运行:")
print(f' security export -k ~/Library/Keychains/login.keychain-db -t identities -f pkcs12 -P "{PKCS12_PASS}" -o {PKCS12_FILE}')
sys.exit(1)
# Split into individual PEM blocks
The skill clearly instructs shell execution and file writing, including exporting certificates and saving results, but it declares no tool scope or execution boundaries. This increases the chance an agent can invoke sensitive local operations without explicit permission constraints or user awareness.
The skill automates extraction and storage of CRM-derived customer identifiers/pseudocode data and writes results to a local text file, but it does not provide an explicit warning about handling potentially sensitive customer data. In a CRM context, even pseudocode and phone-related fields may be regulated internal data whose bulk export increases privacy and data-loss risk.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
curl -k --cert ~/my_cert.pem --key ~/my_cert.pem \
--noproxy '*' -c jar.txt \
"https://crm.10jqka.com.cn/gb_v3/default/index/login"
Detected: suspicious.exposed_secret_literal