T03 · Remote Payload Retrieval and Execution
Error
- Location
- scripts/extractor_ppt.py:160
- Finding
- Unverified Remote Executable Retrieval and Execution<![CDATA[ ## Vulnerability Details **File Location**: `scripts/extractor_ppt.py`, lines 61 and 160-185; related LibreOffice download and execution at lines 239-303 and 332-340 **Vulnerability Type**: Remote payload retrieval and execution **Risk Level**: Critical ### Vulnerable Code ```python POPPLER_URLS = { "windows": "https://github.com/oschwartz10612/poppler-windows/releases/download/v25.12.0-0/Release-25.12.0-0.zip", } ``` ```python def download_poppler_windows(): """Download Windows Poppler into BIN_DIR.""" url = POPPLER_URLS["windows"] zip_path = CACHE_DIR / "poppler.zip" CACHE_DIR.mkdir(parents=True, exist_ok=True) print(f"Downloading poppler from {url}") r = requests.get(url, stream=True) r.raise_for_status() with open(zip_path, "wb") as f: for chunk in r.iter_content(chunk_size=8192): f.write(chunk) print("Extracting poppler...") with zipfile.ZipFile(zip_path, "r") as zf: zf.extractall(CACHE_DIR) extracted = list(CACHE_DIR.glob("poppler-*/bin")) if not extracted: extracted = list(CACHE_DIR.glob("poppler-*/Library/bin")) if not extracted: raise Exception("Poppler bin directory not found") poppler_bin = extracted[0] BIN_DIR.mkdir(parents=True, exist_ok=True) for exe in poppler_bin.glob("*"): shutil.copy(exe, BIN_DIR / exe.name) ``` The same pattern is used for LibreOffice: ```python r = requests.get(url, stream=True) r.raise_for_status() with open(archive_path, "wb") as f: for chunk in r.iter_content(chunk_size=8192): f.write(chunk) ``` The downloaded LibreOffice executable is subsequently invoked during conversion: ```python cmd = [ soffice_cmd, "--headless", "--convert-to", "pdf", "--outdir", str(output_dir), str(ppt_path) ] subprocess.run(cmd, check=True, capture_output=True, text=True) ``` ### Technical Analysis The Skill downloads executable Poppler and LibreOffice artifacts without veri ...[truncated 2210 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove automatic executable downloads from normal document-processing execution. 2. Prefer dependencies installed by an administrator through trusted operating-system package repositories. 3. If downloads are unavoidable: - Use official upstream distribution locations. - Pin every artifact to an immutable version and SHA-256 or stronger digest. - Verify vendor signatures using a separately distributed, pinned public key. - Reject artifacts when the digest, signature, filename, platform, or expected directory layout differs. - Restrict redirects to an explicit host allowlist. - Configure connection and read timeouts and enforce maximum download sizes. 4. Store downloaded components in an isolated, user-scoped directory that is not globally added to `PATH`. 5. Invoke validated executables by an exact absolute path. 6. Run document converters in a sandbox with no network access, minimal filesystem access, resource limits, and no elevated privileges. 7. Do not reuse an existing cached package merely because its filename exists; verify it on every use. ]]>
