T03 · Remote Payload Retrieval and Execution
Warning
- Location
- assets/wave-scanner.html:6
- Finding
- Remote JavaScript Dependency Loaded Without Integrity Verification<![CDATA[ ## Vulnerability Details **File Location**: `assets/wave-scanner.html:6` **Vulnerability Type**: Remote executable dependency without Subresource Integrity protection **Risk Level**: Medium ### Vulnerable Code ```html <script src="https://unpkg.com/lightweight-charts@4.1.3/dist/lightweight-charts.standalone.production.js"></script> ``` ### Technical Analysis The dashboard loads and executes JavaScript directly from the third-party `unpkg.com` CDN at runtime. Although the dependency version is pinned to `4.1.3`, the page does not specify a Subresource Integrity (`integrity`) hash and does not bundle a reviewed local copy. Consequently, the code that ultimately executes is not fully represented by the audited project. If the CDN, package publication process, hosted artifact, or delivery path is compromised, modified JavaScript could be returned and executed automatically when the dashboard opens. The remote script executes in the browser under the dashboard's HTTP origin. The application also lacks a restrictive Content Security Policy, increasing the freedom available to compromised dependency code. ### Attack Path 1. An attacker compromises the CDN response, upstream package artifact, or package publishing account. 2. The user launches `scripts/serve.py` and opens the dashboard. 3. The browser requests the script from `https://unpkg.com`. 4. Because no integrity hash is present, the browser accepts a modified response. 5. The attacker-controlled JavaScript executes in the dashboard's browser context. 6. The script can manipulate displayed prices and trading signals, issue arbitrary network requests permitted by the browser, and access any non-HttpOnly data subsequently stored under the same dashboard origin. ### Impact Assessment The immediate privilege obtained is JavaScript execution in the user's browser under the dashboard origin, not operating-system-level code execution. A malicious dependency could falsify financial indicators, alte ...[truncated 504 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Download and review the required Lightweight Charts release, then serve it as a local static asset: ```html <script src="./vendor/lightweight-charts-4.1.3.min.js"></script> ``` 2. If remote hosting is unavoidable, calculate and pin the exact cryptographic digest: ```html <script src="https://unpkg.com/lightweight-charts@4.1.3/dist/lightweight-charts.standalone.production.js" integrity="sha384-REPLACE_WITH_VERIFIED_DIGEST" crossorigin="anonymous"></script> ``` The digest must be generated from a separately verified copy of the exact artifact. 3. Add a restrictive Content Security Policy. After moving inline JavaScript into a local file, an appropriate baseline would be: ```html <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; connect-src https://fapi.binance.com; style-src 'self'; img-src 'self' data:; object-src 'none'; base-uri 'none'; frame-ancestors 'none'"> ``` 4. Pin and verify dependency artifacts during development or packaging rather than retrieving executable code dynamically at runtime. 5. Document the dependency version and checksum so future upgrades require an explicit review and checksum update. ]]>
