T05 · Unauthorized Access and Privilege Escalation
- Location
app/api.py:111- Finding
Unauthenticated Administrative API Exposes and Issues Reusable API Keys
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill’s purpose is coherent, but its implementation exposes powerful admin and credential functions without enough protection for a shared paid API proxy.
Treat this as a review-required service, not a plug-and-play skill. Before installing, add authentication and authorization to all admin endpoints, never expose admin routes or databases to untrusted networks, avoid local plaintext .env secrets where possible, hash or otherwise protect user API keys, remove default database credentials, and upgrade or lock dependencies with hashes.
app/api.py:111Unauthenticated Administrative API Exposes and Issues Reusable API Keys
app/proxy.py:41Non-Atomic and Incomplete Quota Enforcement Allows Cost-Control Bypass
app/models.py:17Reusable API Keys Are Stored, Queried, and Printed in Plaintext
start.sh:16Startup Scripts Install Unconstrained Dependencies from the Active Package Index
docker-compose.yml:27Docker Deployment Publishes MySQL and Unauthenticated Redis with Unsafe Defaults
app/config.py:17Network-Wide Default Binding Exposes Administrative Routes
python-jose 3.3.0 is affected by multiple serious advisories including algorithm confusion and denial-of-service issues. For a multi-user proxy service that likely relies on JWTs for authentication and quota attribution, weaknesses in token verification can enable account bypass, impersonation, or service disruption.
Jinja2 3.1.3 is flagged for multiple sandbox breakout and injection-related issues. In a service that may generate admin dashboards, reports, or export views for usage statistics, template vulnerabilities can become dangerous if any user-controlled data influences template names, filters, or rendering context in unsafe ways.
The documentation tells users to create a .env file as part of setup, which is a common and convenient pattern but also a frequent source of credential leakage when files are committed or copied between systems. In this skill's context—a proxy for a shared LLM account—the exposed key could grant broad access to the upstream Bailian account and undermine usage segregation and quota controls.
cd skills/bailian-usage-proxy
# 配置环境变量
cp .env.example .env
# 编辑 .env 填入你的阿里百炼 API Key
# 启动服务
The README specifically instructs the user to edit .env and paste in the Bailian API key, directly encouraging storage of a sensitive credential in plaintext without any accompanying warning. If that file is leaked, an attacker could use the shared upstream account for unauthorized model access, consume quotas, incur cost, and potentially access usage patterns tied to multiple users.
# 配置环境变量
cp .env.example .env
# 编辑 .env 填入你的阿里百炼 API Key
# 启动服务
./start.sh
The declared purpose is a usage-statistics proxy, but the described and inferred behavior includes user creation, API key issuance, request-header-based authentication, sensitive admin reporting, and an OpenAI-compatible proxy layer. This mismatch is dangerous because operators may deploy it under weaker assumptions while unintentionally exposing privileged management and authentication surfaces not clearly disclosed in the skill description.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
pip install -r requirements.txt
cp .env.example .env
This line explicitly instructs operators to place the primary Alibaba Bailian account key into a .env file. In context, that is a sensitive upstream credential for a shared proxy service; if mishandled, leaked, or reused across environments, an attacker could consume paid API resources, access usage data, and operate the proxy as a trusted upstream client.
cp .env.example .env
### 2. 数据库初始化
The administrative endpoints appear entirely unauthenticated: create_user, list_users, get_user, usage reports, and health all lack any admin auth dependency. This allows arbitrary callers to create users, enumerate users, retrieve usage data, and access organization-wide reporting, resulting in unauthorized credential issuance, privacy leakage, and abuse of shared upstream model resources.
Pinning FastAPI to 0.109.0 includes a version with a known security advisory (CVE-2024-24762). In a proxy service that exposes HTTP APIs for shared model-account usage tracking, a vulnerable web framework can increase exposure because it is directly internet- or intranet-facing and processes untrusted requests.
Pinning aiomysql to 0.2.0 retains a version reported as vulnerable to arbitrary client file access via a malicious server. This skill is a usage-proxy service that connects to infrastructure components and may handle credentials and local configuration, so a database client flaw could expose sensitive files from the host if an attacker can influence the MySQL endpoint or traffic.
The documentation exposes a destructive administrative endpoint for deleting users but does not describe any authorization constraints, role separation, confirmation requirements, or audit controls. In a multi-user quota-management proxy, insufficiently protected delete operations could allow unauthorized or accidental account removal, disrupting access and corrupting usage/accounting data.
DELETE /admin/users/{user_key}
Pinning FastAPI to 0.109.0 leaves the service exposed to a known vulnerable dependency per the cited advisory. Because this skill is an internet-facing API proxy for shared LLM usage accounting, framework-layer flaws can directly affect request handling, availability, and possibly security boundaries.
Package name closely resembles a popular package, suggesting possible typosquatting. Attackers publish malicious packages with similar names to trick developers into installing them.
Package name closely resembles a popular package, suggesting possible typosquatting. Attackers publish malicious packages with similar names to trick developers into installing them.
aiomysql 0.2.0 is flagged for a vulnerability that may allow arbitrary access to client files under malicious server interaction. In a proxy service that likely connects to a backend MySQL instance for metering and quota data, this can become serious if database endpoints are compromised, spoofed, or attacker-controlled.
python-multipart 0.0.6 has numerous advisories including ReDoS and malformed multipart parsing denial-of-service issues. Since this service uses FastAPI and may accept uploads or form-based admin requests, an attacker could exploit request parsing to exhaust CPU or memory and take the proxy offline.
The README explicitly instructs users to copy a template into a local .env file and place a production API key there, but provides no guidance on secret handling, file permissions, git exclusion, or rotation. This increases the likelihood of accidental credential exposure through source control commits, backups, shell history, or insecure sharing in a multi-user setup.
The skill documentation describes deployment and operation steps that inherently require environment access, file writes, and network connectivity, but it does not declare any tool scope or permissions boundaries. In an agent setting, missing scope declarations can cause over-broad execution privileges and reduce a reviewer's ability to assess whether the skill's actual capabilities are limited to the stated purpose.
The instructions tell users to place a primary Alibaba Bailian account key into a local .env file without any explicit warning about secret handling, storage protections, rotation, or least-privilege usage. Because this is the master credential for a shared-account proxy, compromise could expose all upstream API usage, billing, and downstream impersonation through the proxy.
The chat completion endpoint forwards the request payload to proxy.forward_request, which is a network transmission of user-supplied data to another service. This file includes no confirmation prompt, logging/print disclosure, or explanatory warning in comments/docstrings that user prompts and related data are being relayed upstream.
The file exposes administrative capabilities beyond simple usage proxying, including creation of users and issuance of API keys. In a shared-account usage tracking service, this materially expands the attack surface because anyone who can reach these endpoints can provision identities and credentials, enabling unauthorized use of the upstream LLM service and undermining quota/accountability controls.
This code file defines administrative routes that create users and return detailed user identity and usage data, but the file contains no visible warning, comment, or docstring disclosing that these endpoints handle potentially sensitive account and activity information. Under the code-file criteria, sensitive operations should have some form of user disclosure unless clearly covered elsewhere in the skill description, which is not present in this file.
The human-readable text in the module docstring and comments is entirely in Chinese, which can constitute a language/locale policy violation when no opt-in or justification is provided. There is no indication that the skill is region-specific or that users may choose another language.
This code file uses Chinese-only natural-language descriptions in the module docstring and class docstring/comments, which indicates a fixed language/locale choice. Under the policy, forcing a specific language without user opt-in or documented justification is a natural-language policy violation.
The user-facing Pydantic response model includes the raw api_key field, which can cause credentials to be returned by API endpoints, logged by clients, or exposed in generated API schemas. In this skill’s context—a shared-account usage proxy handling model API quotas and per-user attribution—exposing API keys directly could let one user impersonate another, consume quota, and access or manipulate usage on their behalf.