T03 · Remote Payload Retrieval and Execution
- Location
templates/report_template.html:326- Finding
Mutable Remote JavaScript Is Retrieved and Executed During PDF Rendering
- Content
View full analysis
``` `scripts/to_pdf.py:26-35`: ```python with sync_playwright() as p: browser = p.chromium.launch() page = browser.new_page(viewport={"width": 860, "height": 1200}) page.goto(f"file://{abs_html}", wait_until="networkidle", timeout=timeout * 1000) page.wait_for_timeout(5000) page.pdf( path=pdf_path, format="A4", print_background=True, margin={"top": "0", "right": "0", "bottom": "0", "left": "0"}, ) ``` The template also retrieves remote map data during rendering: ```javascript d3.json('https://cdn.jsdelivr.net/npm/world-atlas@2/countries-110m.json').then(function(world){ ``` ```javascript d3.json('https://cdn.jsdelivr.net/npm/us-atlas@3/states-10m.json').then(function(us){ ``` ### Technical Analysis The generated report imports JavaScript directly from third-party CDNs. Several URLs use mutable major-version selectors such as `d3@7`, `topojson-client@3`, and `world-atlas@2`. None of the script elements include Subresource Integrity hashes. The PDF converter opens the HTML in Chromium and allows the imported scripts to execute. Consequently, the effective code executed during report generation ...[truncated 2186 chars]- Remediation
View remediation
