Back to skill

Security audit

Douyin Mini Game Server Api

Security checks for vulnerabilities and agentic risk

Overview

This is a documentation-only Douyin mini-game server API reference with sensitive examples that users should handle carefully, but no hidden execution or persistence was found.

Install this as a reference skill, not as production-ready security guidance. Keep AppSecret, access_token, session_key, login codes, signatures, and user identifiers server-side; do not log them; use secret storage; confirm user consent for messaging and cloud storage; and treat remove/reset operations as sensitive changes requiring user-directed control.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:67
Finding

AppSecret and Login Code Exposed Through URL Query Parameters

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:67-69
Vulnerability Type: Sensitive credentials in a URL query string and unsafe query construction
Risk Level: Medium

javascript
// 2. code2Session 校验登录
const loginRes = await fetch(
  `https://minigame.zijieapi.com/mgplatform/api/apps/jscode2session?appid=ttxxx&secret=xxx&code=${code}`
);

Technical Analysis

The example places the application's AppSecret and a one-time login code directly in the request URL. Although the request uses HTTPS, query strings may be recorded by reverse proxies, API gateways, application servers, APM products, tracing platforms, exception reports, or request-history tools. HTTPS only protects the request in transit and does not prevent endpoint URLs from being logged.

The example also interpolates code directly into the query string without URL encoding. A value containing reserved characters such as &, =, #, or ? can alter the request structure, produce malformed requests, or inject additional query parameters.

The network request itself is consistent with the Skill's declared purpose: exchanging Douyin mini-game login credentials with the documented platform endpoint. The issue is therefore not unauthorized network transmission, but insecure handling of credentials within that necessary request.

Attack Path

  1. A developer copies the documented example into a backend service.
  2. The backend sends the AppSecret and login code in the request URL.
  3. A reverse proxy, APM agent, tracing platform, application logger, or error-reporting service records the complete URL.
  4. An attacker or lower-privileged operator with access to those logs retrieves the AppSecret.
  5. The attacker uses the AppSecret and AppID to request application access tokens from the documented token endpoint.
  6. Subject to the application's platform permissions, the attacker invokes Douyin mini-game server APIs as the affected application. A captured login code ...[truncated 793 chars]
Remediation
View remediation

Remediation Suggestions

  1. Prefer the official SDK or a platform-supported method that transmits credentials in an HTTPS request body or authorization header.
  2. If the platform requires code2Session to use GET query parameters:
    • Construct the URL with URL and URLSearchParams rather than string interpolation.
    • Redact secret, code, anonymous_code, access_token, session_key, and signature from logs, traces, metrics, and error reports.
    • Disable query-string logging for the endpoint at proxies, gateways, load balancers, and application middleware.
    • Restrict access to operational logs and minimize their retention period.
  3. Load the AppSecret from a managed secret store or protected server environment variable rather than embedding it in source code.
  4. Never return AppSecret, access tokens, or session keys to clients.
  5. Rotate the AppSecret and invalidate affected tokens if URL or telemetry exposure is suspected.
  6. Use encoded query construction, for example:
javascript
const url = new URL(
  'https://minigame.zijieapi.com/mgplatform/api/apps/jscode2session'
);
url.search = new URLSearchParams({
  appid: process.env.DOUYIN_APP_ID,
  secret: process.env.DOUYIN_APP_SECRET,
  code
}).toString();

const loginRes = await fetch(url, {
  headers: { accept: 'application/json' }
});

T09 · Insecure Skill Coding Practices

Warning
Location
llms-full.txt:201
Finding

Documentation Encourages Sending AppSecret and Login Code in a Logged URL

Content
View full analysis

Vulnerability Details

File Location: llms-full.txt:201
Vulnerability Type: Sensitive credentials in a URL query string
Risk Level: Medium

text
GET https://minigame.zijieapi.com/mgplatform/api/apps/jscode2session?appid=tt1234567890&secret=your_secret&code=CODE_FROM_CLIENT

Technical Analysis

The consolidated API reference explicitly demonstrates an AppSecret and a user login code inside a GET URL. Developers or AI agents relying on this reference may reproduce the pattern without implementing URL redaction or safe query construction.

Query strings are frequently captured in infrastructure and observability logs. Consequently, using HTTPS does not fully protect these values after the request reaches local middleware, proxies, monitoring agents, or the destination service.

This call is necessary for the Skill's declared login-reference functionality and targets the declared Douyin HTTPS domain. No evidence indicates transmission to an unrelated party. The vulnerability is the omission of operational safeguards around a credential-bearing URL.

Attack Path

  1. A developer or generated implementation follows the documented request example.
  2. Production infrastructure records the full request URL.
  3. A user with log, trace, support-bundle, or monitoring access reads the AppSecret and possibly an unconsumed login code.
  4. The exposed AppSecret is used with the associated AppID to obtain application access tokens.
  5. The attacker invokes APIs available under the application's authorized Douyin scope.

Impact Assessment

Successful exploitation may grant application-level API access under the affected mini-game identity. The precise capabilities depend on the platform permissions associated with the application. Potential consequences include unauthorized API requests involving user data, messages, generated links, QR codes, group metadata, or gift operations.

The issue does not provide local code execution, system per ...[truncated 143 chars]

Remediation
View remediation

Remediation Suggestions

  1. Add a prominent warning immediately beside the example stating that the query contains secrets and must never be logged.
  2. Recommend the official SDK where possible.
  3. Document mandatory redaction rules for secret, code, anonymous_code, access_token, session_key, and signature.
  4. Instruct developers to disable query-string capture for this route across proxies, APM systems, tracing systems, and application logs.
  5. Provide a safe implementation using URLSearchParams so all parameters are correctly encoded.
  6. Require AppSecrets to be retrieved from a managed secret store and rotated following suspected telemetry exposure.
  7. If the platform introduces a POST or header-based alternative, update the documentation to use it instead of a credential-bearing GET URL.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (14)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 3)May include surrounding context.

md
---
name: douyin-mini-game-server-api
description: Comprehensive skill reference for Douyin (TikTok China) mini-game server-side OpenAPI. Covers HTTPS API interfaces for backend developers — access token management, login credential verification, user data storage, QR code generation, subscription messages, gift redemption, Link/Schema generation, dynamic sharing, game group tags, and all server-side `mgplatform/api` endpoints. Use when developing, debugging, or asking questions about Douyin mini-game backend APIs — especially the server-side login flow (code2Session/checkSessionKey/resetSessionKey), access token (getAccessToken/genStableAccessToken), user cloud storage (setUserStorage/removeUserStorage), QR codes (createQRCode), subscription notifications, gift reward verification, or any OpenAPI SDK integration.
---

> 基于抖音小游戏服务端 OpenAPI 官方文档生成,生成时间 2026-06-24

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 59)May include surrounding context.

javascript
// 1. 获取 access_token
const tokenRes = await fetch('https://minigame.zijieapi.com/mgplatform/api/apps/v2/token', {
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify({ appid: 'ttxxx', secret: 'xxx', grant_type: 'client_credential' })

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 82)May include surrounding context.

md
// 4. 写用户数据(带签名)
const signature = sign(session_key, 'post', '/mgplatform/api/apps/set_user_storage', body);
await fetch('https://minigame.zijieapi.com/mgplatform/api/apps/set_user_storage?...', {
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify({ kv_list: [{ key: 'score', value: '100' }] })

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The file title and all instructional content are written entirely in Chinese, but the document does not state that it is intentionally region-specific or offer any language/locale alternative. Under the natural-language policy rule, forcing a single language without user opt-in can be a policy violation unless the locale constraint is clearly documented and justified.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This documentation instructs developers to use highly sensitive credentials such as app secrets and access tokens, but it does not include basic security guidance about keeping them server-side only, avoiding logging them, and preventing storage in client code or other insecure locations. In an authentication-focused server API skill, that omission is materially risky because readers may copy examples directly into insecure implementations, leading to credential leakage and unauthorized API access.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This markdown file documents an API that stores user data in a cloud storage service and explains how it can later be retrieved, but it does not include an explicit warning about handling personal data, privacy implications, or obtaining appropriate user authorization. Because SQP-2 applies to markdown files, omission of a clear warning about user-data impact is a reportable safety concern.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The removeUserStorage section describes deleting stored user key-value data, but it does not clearly warn readers that this is a destructive action and may permanently remove user information. For markdown skill documentation, destructive behavior affecting user data should be accompanied by an explicit warning.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This markdown file describes API requests that require highly sensitive values such as secret, code, anonymous_code, and later access_token and signature, but it does not include any warning about secure handling, storage, or avoiding client-side exposure of these credentials. Under the markdown-file criteria for missing user warnings, documentation that could affect user data, privacy, or system integrity should disclose such risks.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
79% confidence
Finding

The resetSessionKey section describes an operation that invalidates and replaces a user's existing login session key, which can affect authentication state and system integrity. Although the API behavior is described, the markdown lacks any explicit warning that this is a sensitive operation that should be invoked carefully and may invalidate existing signed requests or sessions.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/server-qrcode.md (reported line 70)May include surrounding context.

请求示例

bash
curl --location 'https://minigame.zijieapi.com/mgplatform/api/apps/qrcode' \
--header 'Content-Type: application/json' \
--data '{
  "access_token": "0801121847...",

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The file's user-facing natural-language documentation is entirely in Chinese, and there is no indication that users may choose another language or that the skill is intentionally restricted to Chinese-speaking users. The policy requires flagging language or locale constraints when they are imposed without user opt-in or explicit justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

A natural-language policy issue exists when a skill or reference forces a single language without user opt-in or justification. This file contains only Chinese-language instructions and does not state that the content is intentionally region-specific or provide an alternative language option.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This markdown file documents APIs that send subscription and customer-service messages to users and requires sensitive values such as access_token and open_id. The description includes operational details, but it does not explicitly warn that use of these endpoints affects user communications and involves handling user identifiers and credentials.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

This markdown file uses only Chinese for headings, instructions, and examples, which can constitute a language/locale policy issue when no user opt-in or alternative language is offered. The content does not explain that the document is intentionally region-specific or limited to Chinese-speaking users.

Content

No source excerpt is available for this finding.