T09 · Insecure Skill Coding Practices
- Location
scripts/generate.js:15- Finding
Hard-Coded Authentication Session Token
- Content
View full analysis
Vulnerability Details
File Location:
scripts/generate.js, line 15
Vulnerability Type: Hard-coded credential
Risk Level: HighVulnerable Code
javascript let sessionToken = "b79fcda2d907241e773cb52960b39978"; // Default cached authentication sessionThe embedded value is subsequently used as the bearer credential for the local video-generation API:
javascript headers: { 'Authorization': 'Bearer ' + sessionToken, ...form.getHeaders() }Technical Analysis
The source code contains a reusable authentication session token as its default configuration. The script uses this value unless the caller supplies a replacement through
--session.Source packages are not appropriate secret-storage mechanisms. Anyone able to download the skill, inspect a deployed copy, access source archives, or read logs containing the source can recover the credential. The fact that the audited request targets
localhostdoes not protect the credential itself: it is still passed to the local API as authorization material and may represent a session for the underlying Jimeng service.The audit cannot establish whether the exposed token is still active or what account it belongs to. Nevertheless, committing a token creates a concrete credential-disclosure vulnerability and should be treated as exposure.
Attack Path
- An attacker obtains or downloads a copy of the skill package.
- The attacker inspects
scripts/generate.jsand extracts the default session token. - The attacker submits the token to a compatible local or underlying API implementation.
- If the session remains valid, the API accepts requests under the associated account.
- The attacker consumes available generation credits or performs other operations authorized for that session.
Impact Assessment
Successful exploitation is limited to the permissions granted to the exposed session. Based on the documented behavio ...[truncated 511 chars]
- Remediation
View remediation
Remediation Suggestions
- Immediately revoke and rotate the exposed session token.
- Remove the default credential from the source code and all package or repository history where feasible.
- Require authentication material to be supplied through a protected environment variable, operating-system credential store, or dedicated secret manager.
- Fail securely when no credential is configured instead of falling back to an embedded value.
- Avoid exposing credentials in command-line arguments where other local users may inspect process listings. Prefer a protected environment variable or file descriptor.
- Add automated secret scanning to source-control and release pipelines.
- Apply least privilege, short expiration periods, rotation, and usage limits to service credentials.
- A safer pattern would be:
javascript const sessionToken = process.env.JIMENG_SESSION_TOKEN; if (!sessionToken) { console.error("JIMENG_SESSION_TOKEN is required."); process.exit(1); }
