T09 · Insecure Skill Coding Practices
- Location
SKILL.md:196- Finding
Reusable XingTu Session Cookies Are Persisted in Plaintext
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill matches its stated XingTu QR-code download purpose, but it stores reusable login cookies in plaintext and reuses them across sessions, which creates account-access risk.
Review this skill carefully before installing. It may help automate XingTu QR-code downloads, but it asks the agent to read, save, and reuse your XingTu session cookie from chat or browser state. Only use it in an environment where you are comfortable with a plaintext ~/.xingtuCookie.txt file, and rotate/logout the XingTu session afterward if the cookie may have been exposed.
SKILL.md:196Reusable XingTu Session Cookies Are Persisted in Plaintext
SKILL.md:56General-Purpose Agent File Access Exposes a Reusable Session Credential
The skill tells the agent to inspect the user's message for cookie strings, validate them, and write valid cookies to disk for later reuse. Extracting secrets from conversational input and persisting them as reusable session tokens materially increases the risk of credential theft, replay, accidental logging, and unauthorized account access.
The skill instructs the agent to extract session cookies from an authenticated browser session and save them to a file. This is effectively credential harvesting and persistence: the recovered cookie can be replayed to impersonate the user outside the browser session, broadening compromise from a live browser state to a portable token on disk.
The skill explicitly instructs reading, validating, and reusing an authentication cookie from a file in the user's home directory without requiring an explicit consent or privacy warning. Persisting bearer-style session material on disk increases the chance of unintended disclosure, reuse across sessions, and account compromise if the host or workspace is accessed by another process or user.
This instruction creates deliberate session persistence by storing validated authentication cookies in ~/.xingtuCookie.txt for reuse. Plaintext session persistence weakens the security boundary of the authenticated session and makes token replay possible by local malware, other users on the system, or accidental file exposure.
#### Case B: Cookie file exists but validation fails
1. Output: **【星图后台登录失效】**
2. Check if the user's current message contains a cookie string (look for `sessionid=`, `uid_tt=`, `sid_guard=`, etc.).
- If found: validate it with the same API call. If valid, write to `~/.xingtuCookie.txt` and go to Phase 2. If invalid, warn and go to Step 1.4.
- If not found: go to Step 1.4.
### Step 1.4: Inject Cookie into Agent-Browser (Fast Path)
Writing cookies harvested from the live browser to ~/.xingtuCookie.txt turns a transient browser-authenticated state into a reusable local credential artifact. That materially increases exposure because any process or user with access to the file can replay the session without the original browser context.
5. Once URL no longer contains `sso.oceanengine.com` (redirected to xingtu.cn):
- Extract cookies: `agent-browser eval "document.cookie"`
- Parse the output to get the cookie string (strip any CLI noise, keep the raw cookie text).
- Write the cookie string to `~/.xingtuCookie.txt`.
- Validate the saved cookie with the test API call from Step 1.2.
- If validation still fails: report error and ask user to check login.
The document explicitly instructs storing full XingTu authentication cookies in a plain-text file at a fixed local path. Session cookies are bearer credentials, so any local user, malware, backup system, or accidental file disclosure can reuse them to impersonate the account without needing the password or MFA. In this skill context, the risk is elevated because the same document also explains how to use those cookies directly in authenticated API requests.
The skill performs bulk file downloads and moves files into a fixed output directory, but does not require a clear user-facing confirmation immediately before modifying the filesystem. While this is less severe than credential handling, it can still cause unexpected data writes, overwrite risks, and privacy issues if files are stored in shared or monitored locations.