T09 · Insecure Skill Coding Practices
- Location
scripts/quark_cli.py:100- Finding
Quark Session Cookie Stored in a Plaintext File Without Enforced Access Restrictions
- Content
View full analysis
None: """保存 Cookie 到配置文件""" cls.CONFIG_DIR.mkdir(parents=True, exist_ok=True) config = {} if cls.CONFIG_FILE.exists(): try: with open(cls.CONFIG_FILE, 'r') as f: config = json.load(f) except: pass config["cookie"] = cookie config["updated_at"] = int(time.time()) with open(cls.CONFIG_FILE, 'w') as f: json.dump(config, f, indent=2) ``` ### Technical Analysis The QR login flow obtains a reusable Quark authentication cookie and writes it in plaintext to: ```text ~/.hermes/skills/cloud-drive/quark/config.json ``` The implementation does not explicitly create the containing directory with owner-only permissions, create the credential file with mode `0600`, or correct the permissions of an existing file. The effective permissions therefore depend on the user's umask and any pre-existing filesystem object. The code also follows an existing path without checking whether the configuration file is a symbolic link. In an environment where another local principal can manipulate the parent directory or pre-create the target, this could expose the credential or redirect the write. This cookie authorizes sensitive cloud-drive operations, including reading file metadata, downloading and uploading files, creating public shares, and deleting data. ### Attack Path 1. The user invokes `pytho ...[truncated 1088 chars]- Remediation
View remediation
