T09 · Insecure Skill Coding Practices
- Location
aifei_api.py:115- Finding
OA bearer token disclosure through unrestricted absolute URLs
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This appears to be a real OA client, but it has broad production account access and security weaknesses that could leak session/API keys or cause unintended business changes.
Review before installing. Use only with a dedicated low-privilege OA account and a dedicated model-provider key, avoid the raw command, do not run production write actions without separate confirmation, and fix HTTPS transport plus protected token storage before handling sensitive business, HR, or finance data.
aifei_api.py:115OA bearer token disclosure through unrestricted absolute URLs
aifei_api.py:80Login credentials and bearer tokens transmitted over plaintext HTTP
aifei_api.py:156Reusable OA session tokens stored in plaintext with default file permissions
modules/captcha_solver.py:27CAPTCHA module accesses Agent-wide provider credentials beyond least privilege
requirements.txt:1Third-party dependencies are installed without version or integrity constraints
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
复制 .env.example 为 .env,填入你的云上艾飞账号:
cp .env.example .env
The raw command accepts arbitrary paths and methods and forwards them directly through the authenticated client, effectively exposing a generic API proxy to the operator. In a skill intended for curated business queries, this bypasses any command-level safety, least-privilege scoping, or business logic restrictions and can be used to access or modify unintended resources.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""
云上艾飞 API 客户端(分享版)
SM4 加解密 + Cookie Token 认证
账号密码从 .env 文件读取,不含任何硬编码敏感信息
"""
import sys
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""
云上艾飞 API 客户端(分享版)
SM4 加解密 + Cookie Token 认证
账号密码从 .env 文件读取,不含任何硬编码敏感信息
"""
import sys
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""
云上艾飞 API 客户端(分享版)
SM4 加解密 + Cookie Token 认证
账号密码从 .env 文件读取,不含任何硬编码敏感信息
"""
import sys
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""
云上艾飞 API 客户端(分享版)
SM4 加解密 + Cookie Token 认证
账号密码从 .env 文件读取,不含任何硬编码敏感信息
"""
import sys
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""
云上艾飞 API 客户端(分享版)
SM4 加解密 + Cookie Token 认证
账号密码从 .env 文件读取,不含任何硬编码敏感信息
"""
import sys
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""
云上艾飞 API 客户端(分享版)
SM4 加解密 + Cookie Token 认证
账号密码从 .env 文件读取,不含任何硬编码敏感信息
"""
import sys
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
from dotenv import load_dotenv
# 加载 .env
load_dotenv(Path(__file__).parent / '.env')
# 确保 UTF-8 输出
if sys.stdout.encoding != 'utf-8':
Direct eval() call evaluates arbitrary expressions. This can be exploited to execute malicious code or exfiltrate data.
# 验算
op_map = {'+': '+', '-': '-', '×': '*', 'x': '*', 'X': '*', '*': '*', '÷': '/', '/': '/'}
try:
calc = str(int(eval(f'{num1}{op_map.get(op, op)}{num2}')))
if calc != model_answer:
print(f'[验证码] ⚠️ 模型={model_answer} 计算={calc},使用计算结果')
return calc
The README states that captcha solving is performed automatically via an AI model and references use of a third-party API key, but it does not clearly disclose what data is transmitted to that external service during login. Even if only the captcha image is sent, this occurs in an authentication flow and may expose sensitive login-adjacent data or create compliance/privacy concerns for users who assume the tool is fully internal.
Line L003 explicitly claims the skill has 'zero browser dependency' as a pure API client. Later, the documented file structure lists login.py as 'Playwright 登录(备用)', which contradicts that claim because Playwright is a browser automation dependency.
The top-level description states there is no browser dependency. However, the dependency section explicitly lists Playwright for fallback login, which directly contradicts the claim of zero browser dependence rather than merely omitting an implementation detail.
The skill documents write-capable operations such as weekly comments and task creation against a production OA system without any warning, confirmation requirement, or safety guidance. In an agent setting, that materially increases the risk of unintended remote state changes, spam, workflow disruption, or unauthorized business actions.
The skill is presented as an OA system API client, but it also documents a DingTalk robot webhook push that sends content to an external third-party service. This expands the skill's data-flow surface and creates a clear exfiltration/notification channel for internal OA data without any stated guardrails, consent prompts, or scope limitation.
The DingTalk webhook example transmits message content and user mentions to an external service, yet the documentation provides no warning about outbound data sharing or notification impact. This can lead to accidental disclosure of internal information and unsolicited paging of real users.
The documented requests.post(webhook, json=...) performs a direct external network transmission to DingTalk, creating an outbound channel that can carry OA-derived content, mentions, and potentially sensitive business data. In the context of an internal OA client, this is especially risky because it bridges internal system access with external messaging in a single skill.
import requests
webhook = 'https://oapi.dingtalk.com/robot/send?access_token=daf5fd...'
requests.post(webhook, json={
'msgtype': 'markdown',
'markdown': {'title': '标题', 'text': '@康楠 内容...'},
'at': {'atMobiles': ['手机号'], 'isAtAll': False}
The top-level CLI docstring lists several read-only business commands but omits the raw subcommand that can perform arbitrary API calls, including state-changing requests. This mismatch hides a materially more powerful capability from users and reviewers, increasing the risk of misuse and reducing informed consent around what the tool can do.
The raw subcommand allows arbitrary POST and PUT requests with user-supplied JSON and executes them immediately, with no warning, dry-run mode, or confirmation prompt. That makes accidental or impulsive state-changing operations much more likely, especially against production because the default environment is prod.
The module docstring explicitly claims there is no hardcoded sensitive information, but the file contains a fixed SM4 key in source code. A hardcoded cryptographic key is sensitive because anyone with code access can decrypt protected payloads or forge encrypted requests, and the misleading comment may cause reviewers to overlook the exposure.
The client writes the bearer token to a local JSON file in the script directory without setting restrictive permissions, encryption, or warning the user. If another local user, process, backup system, or accidental commit accesses that file, the token can be reused to impersonate the account until expiry.
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
{
"method": "POST",
"path": "/contractRecoupPlan/recoupPlanList",
"methodName": "recoupList",
"comment": "查询合同回款计划列表"
},
{
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
{
"method": "POST",
"path": "/contractRecoupPlan/recoupPlanList",
"methodName": "recoupList",
"comment": "查询合同回款计划列表"
},
{
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
{
"method": "POST",
"path": "/contractRecoupPlan/recoupPlanList",
"methodName": "recoupList",
"comment": "查询合同回款计划列表"
},
{
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
{
"method": "POST",
"path": "/contractRecoupPlan/recoupPlanList",
"methodName": "recoupList",
"comment": "查询合同回款计划列表"
},
{