Vulnerable JavaScript Library
The application serves a client-side JavaScript library version with publicly known vulnerabilities, such as cross-site scripting or prototype pollution flaws.
| Severity | Medium |
| CVSS 3.1 | 4.7 CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N Open in the calculator |
| CVSS 4.0 | 2.1 CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N Open in the calculator |
| CWE | CWE-1395: Dependency on Vulnerable Third-Party Component |
| OWASP Top 10 | A03:2025 Software Supply Chain Failures |
| MITRE ATT&CK | T1189 Drive-by Compromise |
| Category | Outdated Components |
Description
The application loads a version of a client-side JavaScript library, such as a DOM manipulation library, front-end framework, rich text editor or plugin, for which security flaws have been published. Typical flaws in such libraries are cross-site scripting through functions that turn strings into HTML, prototype pollution in functions that merge objects, and regular expression denial of service.
A published flaw in a library does not by itself make the application exploitable: most require the application to pass attacker-controlled input to a particular function or option, so the impact depends on the flaw and on how the application uses the library. Where a cross-site scripting flaw is reachable, an attacker can run script in a victim's browser in the application's origin, typically by persuading the victim to follow a link or view crafted content, and can then read data, act as the victim or capture what they type. Prototype pollution can lead to the same result or to bypasses of client-side logic, and regular expression flaws can freeze the user's browser tab. Where no vulnerable function is used with untrusted input, the practical risk is low, though later changes to the application can make a flaw reachable.
The finding is therefore established in two steps: identifying the library and version and matching them against published advisories, which is what tools such as Retire.js and dependency scanners do, and, where time allows, showing that a vulnerable function is reachable with input an attacker controls. Version detection can be wrong where a supplier has patched or modified a bundled copy, so the reported version should be checked against the file itself. Several outdated libraries are often found together, which usually indicates that client-side dependencies are not managed or patched.
Remediation
Upgrade each affected library to a current, supported version that fixes the published flaws, and test the application with it, since major upgrades can change behaviour:
- Manage client-side libraries through a package manager and lock file rather than copied files, so that their versions are recorded and can be checked automatically, for example with
npm auditor a software composition analysis tool in the build pipeline. - Remove libraries the application no longer uses, including those pulled in only by old plugins or templates.
- Replace libraries that are no longer maintained, since their flaws will not be fixed.
- Where an upgrade cannot be made at once, check whether the application passes untrusted input to the vulnerable functions, stop doing so or sanitise that input, and apply any workaround the advisory describes.
- Follow security advisories for the libraries in use and include client-side dependencies in the regular patching process.
A Content Security Policy that restricts script sources reduces the impact of any cross-site scripting flaw in the meantime. Confirm the fix by rescanning the pages and checking the version in each library file.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.