Back to skill

Security audit

Quark Netdisk

Security checks for vulnerabilities and agentic risk

Overview

This Quark Drive skill is mostly coherent, but it needs Review because its allowlist protections can be bypassed and it stores account cookies without enforcing private file permissions.

Install only if you are comfortable giving the skill an authenticated Quark Drive session and file-management authority. Before use, fix the allowlist enforcement to use path-aware containment, remove or strongly gate folder-id/root listing, store session files with owner-only permissions, prefer expiring passcode-protected shares, and update flagged dependencies.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (3)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/quark_drive.py:403
Finding

Local Upload Allowlist Can Be Bypassed Through String-Prefix Matching

Content
View full analysis
int: cfg = load_config() local_allow = cfg.get("localAllowlist", []) remote_allow = cfg.get("remoteAllowlist", []) # auto-login if needed ensure_logged_in(timeout=int(cfg.get("loginTimeoutSeconds", 300)), progress_mode="terminal") # simple checks src = Path(args.file).expanduser().resolve() if not any(str(src).startswith(str(Path(a).expanduser().resolve())) for a in local_allow): raise PermissionError(f"本地路径不在 allowlist: {src}") ``` ### Technical Analysis The local upload authorization check compares normalized paths using `str.startswith()`. String prefixes do not enforce filesystem path-component boundaries. For example, if the configured allowed directory is: ```text /path/to/Uploads ``` then all of the following pass the string-prefix test: ```text /path/to/Uploads/file.zip /path/to/Uploads-private/secret.zip /path/to/Uploads_backup/credentials.tar ``` The latter two paths are sibling directories, not descendants of the allowed directory. Consequently, the implementation does not enforce the declared constraint that the Skill may read and upload files only from configured local path prefixes. Calling `Path.resolve()` prevents some symbolic-link tricks, but it does not correct the sibling-prefix authorization flaw. ### Attack Path 1. The Skill is configured with a local allowlist entry such as `/home/user/Uploads`. 2. A file containing sensitive data exists at a similarly prefixed path, such as `/home/user/Uploads-private/secrets.zip`. 3. An attacker or untrusted agent instruction invokes: ```bash python3 scripts/quark_drive.py upload /home/user/Uploads-private/secrets.zip ``` 4. Both paths are resolved. 5. The string `/home/user/Uploads-private/secre ...[truncated 652 chars]
Remediation
View remediation
bool: resolved_src = src.expanduser().resolve(strict=True) for entry in allowed_roots: root = Path(entry).expanduser().resolve(strict=True) try: resolved_src.relative_to(root) return True except ValueError: continue return False ``` Then enforce it before opening or hashing the file: ```python src = Path(args.file).expanduser().resolve(strict=True) if not src.is_file(): raise FileNotFoundError(src) if not is_path_allowed(src, local_allow): raise PermissionError(f"Local path is outside the allowlist: {src}") ``` Additional hardening should include: - Reject an empty local allowlist. - Define whether an allowlisted file itself is valid or only descendants of an allowlisted directory. - Revalidate the path immediately before opening it to reduce time-of-check/time-of-use risk. - Where practical, open files relative to a pre-opened allowlisted directory descriptor. - Add regression tests for sibling paths such as `Allowed-private`, `Allowed2`, and `Allowed_backup`. ]]>

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/quark_drive.py:624
Finding

Folder-ID Listing Bypasses the Remote Path Allowlist and Root-Listing Confirmation

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/quark_drive.py:80
Finding

Authentication Cookies and Login Tokens Are Persisted Without Restrictive File Permissions

Content
View full analysis
Path: out = REF / "session_api.json" out.write_text(json.dumps(login, ensure_ascii=False, indent=2), encoding="utf-8") # Also persist QuarkPan-compatible cookies.json for portability/debugging. # Format aligns with external/QuarkPan/config/cookies.json. try: cookies = login.get("cookies") if isinstance(login, dict) else None if isinstance(cookies, list): import time # compute expires_at as min positive expires expires_at = None for c in cookies: try: exp = c.get("expires") if isinstance(exp, int) and exp > 0: expires_at = exp if expires_at is None else min(expires_at, exp) except Exception: pass if expires_at is None: expires_at = int(time.time()) + 7 * 24 * 3600 qp = { "cookies": [ {"name": c.get("name"), "value": c.get("value"), "domain": c.get("domain", ".quark.cn"), "path": c.get("path", "/")} for c in cookies if isinstance(c, dict) and c.get("name") and c.get("value") ], "timestamp": int(time.time()), "expires_at": expires_at, } (REF / "cookies.json").write_text(json.dumps(qp, ensure_ascii=False, indent=2), encoding="utf-8") except Exception: pass return out def save_login_token(data: dict[str, Any]) -> Path: out = REF / "login_token.json" out.write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8") return out ``` Session creation also persists a service ticket and dup ...[truncated 2833 chars]
Remediation
View remediation
None: path.parent.mkdir(parents=True, exist_ok=True, mode=0o700) fd, temp_name = tempfile.mkstemp( dir=str(path.parent), prefix=f".{path.name}.", text=True, ) try: os.fchmod(fd, 0o600) with os.fdopen(fd, "w", encoding="utf-8") as f: json.dump(data, f, ensure_ascii=False, indent=2) f.flush() os.fsync(f.fileno()) os.replace(temp_name, path) os.chmod(path, 0o600) except Exception: try: os.unlink(temp_name) except FileNotFoundError: pass raise ``` Apply the helper to: - `references/session_api.json` - `references/cookies.json` - `references/login_token.json` - `references/index.json`, when persistence is explicitly requested Further hardening should include: - Store only the minimum authentication material necessary. - Do not persist the service ticket after it has been exchanged. - Avoid maintaining duplicate cookie files unless explicitly requested. - Delete `login_token.json` and `qr_code.png` immediately after successful login, timeout, or cancellation. - Store credentials in an OS credential manager or host-provided secret store where available. - Check existing file ownership before overwriting sensitive files. - Refuse to use session files owned by another user or readable by group/others. - Add runtime permission checks and fail closed if modes are broader than `0600`. - Document session revocation and cleanup procedures. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (27)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- Dependencies are expected to be installed by the host (often via OS packages). `requirements.txt` exists for portability/reference.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
## Commands (scripts/quark_drive.py)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
## Commands (scripts/quark_drive.py)

Known Vulnerable Dependency: click==8.3.1 — 1 advisory(ies): CVE-2026-7246 (Pallets Click, versions 8.3.2 and below, contain a command injection vulnerabili)

High
Category
Supply Chain
Confidence
94% confidence
Finding

The dependency is pinned to a version reported as vulnerable to command injection. In a CLI-driven skill that likely parses user-controlled inputs and may invoke Click command handling paths, a command injection flaw can lead to arbitrary command execution on the host running the skill.

Content

No source excerpt is available for this finding.

Known Vulnerable Dependency: h2==4.3.0 — 2 advisory(ies): CVE-2026-71554 (h2: Duplicate Host header could facilitate request smuggling); CVE-2026-71554 (h2: Duplicate Host header could facilitate request smuggling)

High
Category
Supply Chain
Confidence
87% confidence
Finding

The pinned h2 version is reported as vulnerable to duplicate Host header handling that may enable HTTP request smuggling in affected deployments. This skill automates remote network interactions with a cloud drive service, so malformed upstream or proxied HTTP traffic could cause request confusion, bypasses, or unintended actions against backend services.

Content

No source excerpt is available for this finding.

Known Vulnerable Dependency: idna==3.11 — 2 advisory(ies): CVE-2026-45409 (Internationalized Domain Names in Applications (IDNA): Specially crafted inputs ); CVE-2026-45409 (Internationalized Domain Names in Applications (IDNA) for Python provides suppor)

High
Category
Supply Chain
Confidence
80% confidence
Finding

The pinned idna version is flagged for issues handling specially crafted internationalized domain inputs. Because this skill performs network operations and may process URLs or hostnames related to shared links, incorrect IDNA parsing could enable hostname confusion, validation bypass, or connection to unintended endpoints.

Content

No source excerpt is available for this finding.

Known Vulnerable Dependency: pillow==12.1.1 — 16 advisory(ies): CVE-2026-55379 (Pillow `BdfFontFile`: `Image.new()` called without `_decompression_bomb_check()`); CVE-2026-55798 (Pillow: WindowsViewer.get_command() OS command injection via unescaped shell pat); CVE-2026-54060 (Pillow: `FontFile.compile()`: `Image.new()` called without `_decompression_bomb_) +13 more

High
Category
Supply Chain
Confidence
92% confidence
Finding

The pinned Pillow version carries multiple reported vulnerabilities, including decompression bomb protection gaps and potential command injection on certain platform-specific paths. This skill generates QR codes and may process image content as part of login or file workflows, so image parsing or rendering bugs could be triggered by attacker-controlled files and lead to denial of service or worse depending on code paths and platform.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
91% confidence
Finding

The --allow-root parameter explicitly bypasses the privacy default and permits listing /, which can expose all top-level folders in the user's drive. In an agent-mediated tool, such bypass flags are dangerous because they can be triggered by prompt manipulation or orchestration mistakes to widen data access beyond the intended allowlisted workspace.

Content

Scanner excerpt · scripts/quark_drive.py (reported line 456)May include surrounding context.

python
pls.add_argument("path", nargs="?", default="/")
    pls.add_argument("--folder-id", default=None)
    pls.add_argument("--json", action="store_true", help="Output raw JSON (debug) instead of pretty list")
    pls.add_argument("--allow-root", action="store_true", help="Allow listing '/' (privacy: disabled by default)")

    ps = sub.add_parser("search")
    ps.add_argument("keyword")

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

This logic instructs the caller to re-run with --allow-root, effectively turning a soft privacy guard into an easy escalation path for broader enumeration. In the skill context, providing a machine-readable recipe for bypassing the restriction increases the chance that an agent will automatically widen scope and expose unrelated private drive metadata.

Content

Scanner excerpt · scripts/quark_drive.py (reported line 642)May include surrounding context.

python
"need_confirm": True,
                    "op": "ls",
                    "path": "/",
                    "reason": "Listing '/' may expose private top-level folder names. Re-run with --allow-root if you really want it.",
                    "how_to_confirm": "Re-run with: ls / --allow-root",
                })
                return EXIT_NEED_CONFIRM

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

The emitted confirmation guidance includes the exact ls / --allow-root command, which lowers the barrier to expanding scope from the default protected area to the user's whole drive namespace. In an autonomous or semi-autonomous agent workflow, such self-describing escalation instructions can be abused to harvest sensitive metadata without meaningful policy friction.

Content

Scanner excerpt · scripts/quark_drive.py (reported line 643)May include surrounding context.

python
"op": "ls",
                    "path": "/",
                    "reason": "Listing '/' may expose private top-level folder names. Re-run with --allow-root if you really want it.",
                    "how_to_confirm": "Re-run with: ls / --allow-root",
                })
                return EXIT_NEED_CONFIRM

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The README documents creating Quark share links, including permanent links and optional passcodes, but does not warn that these links may expose files to anyone possessing the URL or code. In a file-sharing automation skill, normalizing link creation without disclosure guidance increases the chance of unintended public or long-lived data exposure by users or downstream agents.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill describes capabilities that involve shell execution, filesystem access, network access, and handling sensitive authentication artifacts, but it declares no explicit tool/permission scope. Without a restrictive permission declaration, a host agent may grant broader access than intended, increasing the chance of overreach, misuse of local files, or unintended remote operations if the skill is invoked in an unsafe environment.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
80% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

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

md
#### Conversation contract (important)
When the user asks to “生成分享链接/创建分享/分享某个文件(夹)”:
1) **Search candidates first** (do not ask user to provide full remote path).
   - Default: use server search.
   - If server search is insufficient and the user wants stronger fuzzy search, use a **client-side fuzzy index** and rank results by fuzzy score.
     - Privacy default: build the index **in-memory** (ephemeral) and do not write it to disk.

Known Vulnerable Dependency: Pygments==2.19.2 — 2 advisory(ies): CVE-2026-4539 (Pygments has Regular Expression Denial of Service (ReDoS) due to Inefficient Reg); CVE-2026-4539 (Pygments has Regular Expression Denial of Service (ReDoS) due to Inefficient Reg)

Medium
Category
Supply Chain
Confidence
84% confidence
Finding

The pinned Pygments version is reported vulnerable to ReDoS via inefficient regular expressions. If the skill ever syntax-highlights or parses attacker-controlled text in logs, diagnostics, or generated output, crafted input could consume excessive CPU and degrade availability.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The module-level documentation states that delete operations are soft-delete to /OpenClaw/.trash, implying deletion is non-destructive. However, the code later defines delete_file() to call the backend file/delete endpoint directly, which is a hard delete, while soft_delete_to_trash() is only a separate helper and not the only deletion mechanism.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This code file defines a direct permanent deletion helper via file/delete, but the surrounding docstring only labels it 'Hard delete' and does not provide any user disclosure, confirmation step, or visible warning about the destructive effect. Under the code-file criteria, destructive or irreversible operations should have some explicit warning unless clearly covered elsewhere, and this helper is more dangerous than the nearby soft-delete path.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/quark_drive.py (reported line 147)May include surrounding context.

python
# Best-effort: open QR PNG locally for immediate scanning.
        try:
            import subprocess
            subprocess.Popen(["xdg-open", str(qr_png)], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
        except Exception:
            pass

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/quark_drive.py (reported line 378)May include surrounding context.

python
# Best-effort: open QR PNG locally for immediate scanning.
        try:
            import subprocess
            subprocess.Popen(["xdg-open", str(qr_png)], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
        except Exception:
            pass

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/quark_drive.py (reported line 554)May include surrounding context.

python
# Best-effort: open QR PNG locally for immediate scanning.
        try:
            import subprocess
            subprocess.Popen(["xdg-open", str(qr_png)], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
        except Exception:
            pass

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill description says file management is limited to an allowlisted remote folder, but the CLI exposes mechanisms to list or search broader drive content, including root listing with --allow-root and search modes that can extend outside /OpenClaw. In an agent setting, this mismatch can enable unauthorized discovery of private filenames and folder structure beyond the user-expected scope.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest does not disclose destructive operations, yet the code implements rm and purge-trash, including hard deletion of trash entries. In an agent context, hidden destructive capability is dangerous because orchestrators or users may invoke a seemingly benign file-management skill without understanding that it can permanently remove data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The README documents saving other people's Quark share links directly into the user's drive without warning that imported content comes from an external, potentially untrusted source. This can lead users or orchestrating agents to ingest unwanted, sensitive, infringing, or maliciously misleading content into their managed storage without an explicit trust decision.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

The default headers hard-code accept-language to zh-CN,zh;q=0.9, which imposes a specific locale on all API requests. The file does not offer user opt-in or configuration for locale selection, and no region-specific justification is documented.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The module documentation advertises a narrower command surface than the code actually provides, omitting rename, move, delete, purge, indexing, and share-related operations. This documentation/behavior gap is risky in agent systems because reviewers and policy engines may approve the skill based on an incomplete understanding of its real capabilities.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

Opening a local file/application with xdg-open is a host-side capability not described by the skill purpose, so it increases the skill's effective privileges and side effects. While not directly exploitable here, this can surprise users, interfere with headless environments, and violate least-privilege expectations for an automation skill.

Content

No source excerpt is available for this finding.