T09 · Insecure Skill Coding Practices
- Location
scripts/_temu_token_store.py:8- Finding
Temu seller access tokens are stored in plaintext without enforced access permissions
- Content
View full analysis
Vulnerability Details
File Location:
scripts/_temu_token_store.py:8, 29-35, 63-68
Vulnerability Type: Plaintext credential storage with unsafe default permissions
Risk Level: HighVulnerable Code
python DEFAULT_STORE_PATH = os.path.expanduser("~/.linkfox/temu-access-tokens.json")python def _save_store(data: dict) -> None: path = store_path() parent = os.path.dirname(path) if parent: os.makedirs(parent, exist_ok=True) with open(path, "w", encoding="utf-8") as f: json.dump(data, f, indent=2, ensure_ascii=False) f.write("\n")python entry = { "site": site, "managementType": management_type, "tokenPurpose": token_purpose, "accessToken": access_token, "updatedAt": _utc_now(), }Technical Analysis
Temu seller access tokens are written directly into a plaintext JSON file. The implementation does not encrypt the credentials, use an operating-system credential manager, or explicitly enforce owner-only directory and file permissions.
File accessibility therefore depends on the process umask and pre-existing filesystem state. The write operation also does not reject symbolic links or use an atomic, securely created temporary file. A permissive umask, exposed home-directory backup, compromised local process, or maliciously prepared token-store path could disclose the credential.
These tokens are particularly sensitive because the declared Skill functionality includes seller order-cancellation operations. Storing them is optional convenience behavior rather than a strict requirement for individual API calls, because the Skill also accepts an access token directly.
Attack Path
- A user invokes
save_temu_access_token.pyand supplies a valid Temu seller token. _save_storewrites that token in plaintext to~/.linkfox/temu-access-tokens.json, or to the path selected through `TEMU_TOKEN_ ...[truncated 1078 chars]
- A user invokes
- Remediation
View remediation
Remediation Suggestions
- Store access tokens in an operating-system credential manager such as macOS Keychain, Windows Credential Manager, or a Linux secret service.
- If file storage must remain available:
- Create
~/.linkfoxwith mode0700. - Create the token file with mode
0600. - Explicitly correct permissions on existing files before use.
- Reject symbolic links and non-regular files.
- Write through a securely created temporary file and atomically replace the destination.
- Create
- Validate
TEMU_TOKEN_STORE_PATHand clearly warn users when it points to a shared or temporary directory. - Avoid exposing unmasked tokens through helper commands unless the user explicitly requests and confirms it.
- Document token rotation and revocation procedures.
- Prefer short-lived, narrowly scoped tokens where supported.
