T08 · Insecure Dependencies
- Location
- campus/install/scripts/fetch_artifacts.py:28
- Finding
- Untrusted Browser Binaries Are Installed from a Nonstandard Mirror Without Independent Integrity Verification<![CDATA[ ## Vulnerability Details **File Location**: `campus/install/scripts/fetch_artifacts.py:28-32, 57-66` **Vulnerability Type**: Supply-chain compromise through an unsafe executable download source **Risk Level**: High ### Vulnerable Code ```python PLAYWRIGHT_HOSTS = [ {"name": "tencent-campus-env", "host": "https://tool.tom-thu.cn/campus-env"}, {"name": "npmmirror", "host": "https://cdn.npmmirror.com/binaries/playwright"}, {"name": "official", "host": None}, ] ``` ```python for src in PLAYWRIGHT_HOSTS: if dry_run: results.append({"source": src["name"], "action": "would use", "host": src["host"] or "official"}) continue env = os.environ.copy() if src["host"]: env["PLAYWRIGHT_DOWNLOAD_HOST"] = src["host"] common.log(f"[fetch] 尝试浏览器源: {src['name']}") try: for b in BROWSERS: r = _run([sys.executable, "-m", "playwright", "install", b], env=env) ``` ### Technical Analysis The installation process prioritizes `https://tool.tom-thu.cn/campus-env`, a nonstandard mirror, over Playwright's official distribution service. The downloaded components include Chromium and FFmpeg binaries that are later executed locally. The repository does not independently pin expected SHA-256 hashes, verify a publisher signature, or compare downloaded artifacts against a repository-controlled manifest. Although Playwright may perform integrity checks based on metadata obtained through its distribution mechanism, that is not equivalent to a project-controlled trust anchor when an alternative download host is selected. This behavior is especially sensitive because the downloaded browser subsequently handles CAS passwords, active session cookies, OTP authentication flows, email-related data, and authenticated campus pages. ### Attack Path 1. An attacker compromises the custom mirror, its hosting account, DNS resolution, or another component in its delivery chain. 2. The attacker serves a modified browser a ...[truncated 1120 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Make Playwright's official CDN the default and preferred source. 2. Remove the custom mirror unless it is operationally indispensable. 3. Maintain a repository-controlled manifest of expected hashes for every supported Playwright version, platform, and artifact. 4. Verify each downloaded artifact before installation or execution. 5. Where available, verify publisher signatures in addition to hashes. 6. Require explicit user approval before falling back to any third-party mirror. 7. Record the selected source, artifact version, expected hash, and observed hash in installation output. 8. Fail closed when integrity verification cannot be completed. 9. Install dependencies in a dedicated virtual environment instead of modifying the active interpreter environment. ]]>
