T09 · Insecure Skill Coding Practices
- Location
scripts/donguan_login.py:27- Finding
TLS certificate verification is disabled for authentication traffic
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill appears intended to automate an internal monitoring-platform login, but it handles passwords and session cookies in ways that could expose them.
Review before installing. Do not use this with real credentials unless TLS verification is fixed, any example credential is confirmed rotated or replaced, dependencies are pinned, and password/session files are protected and cleaned up. If used at all, run it only in a private trusted environment with a dedicated account and restrict the cookie file permissions.
scripts/donguan_login.py:27TLS certificate verification is disabled for authentication traffic
scripts/donguan_login.py:58Plaintext credentials and reusable session secrets persist in insecure files
SKILL.md:34Documentation contains a realistic plaintext username and password
SKILL.md:25Installation instructions use an unpinned third-party dependency
Using curl with -k disables TLS certificate validation, allowing man-in-the-middle interception or tampering with the login flow. In this skill, that could expose usernames, encrypted-password exchanges, CAPTCHA/SMS workflow data, and especially the resulting session cookie, enabling account compromise even on an internal network.
- Cookie 写入文件后,监控脚本 `acquire_session()` 会优先读取该文件,实现定时任务全自动运行
- 密码以明文作为参数传入,请确保执行环境安全(不要在共享终端暴露命令历史)
- ddddocr 对 `?` 常误识为 `9`、`×` 误识为 `x`,脚本已做算术后处理,答案通常正确,但建议用户看 `_captcha.png` 图片二次确认
- 自签名证书使用 `curl -k` 跳过校验,仅限内网可信环境使用
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).
DEFAULT_BASE = 'https://172.20.251.9:30666'
# ===== curl 封装 =====
def _curl_get(url, CJ):
r = subprocess.run(
['curl', '-k', '-s', '--connect-timeout', '15', '-b', CJ, '-c', CJ, url],
Disabling HTTPS certificate verification without any prominent user warning is especially dangerous in a login automation tool because users may assume transport security is intact while entering credentials and 2FA codes. In this context, the tool handles authentication bootstrapping and cookie capture, so MITM exposure has direct account-compromise implications.
Direct eval() call evaluates arbitrary expressions. This can be exploited to execute malicious code or exfiltrate data.
d1, op, d2, ans = m.groups()
op_norm = '*' if op in ('x', 'X', '*', '×') else op
try:
result = str(int(eval(f'{d1} {op_norm} {d2}')))
except Exception:
result = None
return result, raw
The skill advertises shell execution and file-writing behavior but does not declare any explicit tool scope or permissions boundaries. This weakens least-privilege controls and can cause an agent to invoke powerful capabilities unexpectedly, especially in a login workflow that handles credentials, cookies, and local files.
The trigger phrases are broad enough that an agent may activate this login skill in loosely related contexts, causing unnecessary credential handling or network interaction. In a skill that prompts for passwords, sends SMS codes, and stores session cookies, accidental invocation expands the chance of secret exposure or unintended authentication attempts.
This curl invocation disables TLS certificate verification via '-k', allowing a machine-in-the-middle attacker to intercept or modify authentication traffic, including captcha, public key material, and session cookies. Although subprocess is called safely with an argument list rather than a shell, the transport-layer downgrade is a real security weakness in a login tool handling credentials.
# ===== curl 封装 =====
def _curl_get(url, CJ):
r = subprocess.run(
['curl', '-k', '-s', '--connect-timeout', '15', '-b', CJ, '-c', CJ, url],
capture_output=True, timeout=30)
return r.stdout
This POST helper also uses curl with '-k', so login credentials, RSA public key retrieval, and 2FA requests occur without server identity validation. An active attacker could impersonate the server, supply a malicious public key, capture the encrypted password for offline use, or steal the resulting session.
def _curl_post(url, data, CJ):
body = json.dumps(data, ensure_ascii=False)
r = subprocess.run(
['curl', '-k', '-s', '--connect-timeout', '15', '-b', CJ, '-c', CJ,
'-X', 'POST', url, '-H', 'Content-Type: application/json', '-d', body],
capture_output=True, encoding='utf-8', errors='replace', timeout=30)
The binary fetch helper retrieves captcha images over HTTPS with certificate verification disabled. In this login context, a man-in-the-middle can tamper with the captcha or session establishment flow and facilitate broader credential/session compromise.
def _curl_bin(url, CJ):
r = subprocess.run(
['curl', '-k', '-s', '--connect-timeout', '15', '-b', CJ, '-c', CJ, url],
capture_output=True, timeout=30)
return r.stdout or b''
The script writes the plaintext password to '_pwd.txt' during RSA encryption and later saves session cookie material to disk for reuse. On shared hosts, insecure directories, or systems with backups and endpoint monitoring, these artifacts can expose credentials or reusable authenticated sessions to other users or processes.
The openssl subprocess itself is not shell-injection-prone because arguments are passed as a list, but the function writes the plaintext password and downloaded public key to predictable files in the working directory before encryption. That creates local credential exposure risks through file-system access, backups, or multi-user environments.
pwd_path = os.path.join(workdir, '_pwd.txt')
with open(pwd_path, 'wb') as f:
f.write(plaintext.encode('utf-8'))
enc = subprocess.run([
'openssl', 'pkeyutl', '-encrypt', '-pubin', '-inkey', pub_path,
'-pkeyopt', 'rsa_padding_mode:oaep',
'-pkeyopt', 'rsa_oaep_md:sha256',
The initial session-establishing curl command also uses '-k', so the very first cookie exchange can be intercepted or spoofed by an active network attacker. Because this script ultimately persists session material for reuse, compromise at session setup can directly lead to account hijacking.
CJ = os.path.join(workdir, '_login_cookies.txt')
open(CJ, 'w').close()
# 1. 建立会话
subprocess.run(['curl', '-k', '-s', '--connect-timeout', '15', '-c', CJ, base + '/'],
capture_output=True, timeout=15)
# 2. 下载验证码 + OCR
Detected: suspicious.dynamic_code_execution