How to Fix Vulnerable JavaScript Libraries on Your Site
Your audit found one or more JavaScript libraries loaded on the page at a version with publicly known security vulnerabilities, such as jQuery below 3.5.0 or Bootstrap below 3.4.1. By the end of this guide you will know exactly where each library comes from, have upgraded or replaced it with a patched version, and have confirmed the page now passes the check.

Why it matters
Known-vulnerable libraries are published in CVE databases with working exploit details, so attackers and automated scanners look for them first. Old jQuery versions, for example, allow cross-site scripting through HTML-manipulation methods (CVE-2020-11022 and CVE-2020-11023), which can be used to steal sessions, inject spam links or skim checkout forms. 3 covers payment-page scripts) and enterprise buyers flag these versions.
Browsers may also start warning users if your site is compromised and blocklisted, which removes it from search results.
What you need
Step-by-step fix
Confirm each flagged library and its version
Open the affected page, press F12 and go to the Console tab. Paste the lines below to print the version of each library actually running on the page (lines for libraries you don't use will show undefined). Write down every name and version, since one page can load several copies of the same library.
window.jQuery && jQuery.fn.jquery window.jQuery && jQuery.ui && jQuery.ui.version window.bootstrap && bootstrap.Tooltip && bootstrap.Tooltip.VERSION window.jQuery && jQuery.fn.tooltip && jQuery.fn.tooltip.Constructor && jQuery.fn.tooltip.Constructor.VERSION window._ && _.VERSION window.moment && moment.version window.angular && angular.version.full window.Handlebars && Handlebars.VERSION
Find which file, theme or plugin loads it
In DevTools open Network, reload, and filter by the library name (for example jquery). Click the request and check the Initiator column to see which file or script tag requested it. Then search your code for the filename:
- Static sites and custom themes: search templates for the
<script src=line - Bundled apps: run
npm ls <package>to see which dependency pulls it in - CMS sites: the file path usually names the plugin, for example
/wp-content/plugins/example-slider/js/jquery.min.js
npm ls jquery lodash moment bootstrap
Choose a patched target version and check breaking changes
Pick at least the minimum safe version, ideally the current stable release. Common minimums:
- jQuery 3.5.0+ (current 3.7.1; 4.x is available but drops old browser support and some deprecated APIs)
- jQuery UI 1.13.2+
- Bootstrap 3.4.1+ or 4.3.1+ (5.3.x recommended)
- Lodash 4.17.21+
- Moment.js 2.29.4+ (in maintenance mode, so consider Day.js or native
Intl) - Handlebars 4.7.7+
AngularJS 1.x is end-of-life and has no patched version, so plan a migration away from it rather than an upgrade. Read the library's upgrade guide for major version jumps.
Replace CDN or hardcoded script tags
Swap the old <script> tag for the patched version and add Subresource Integrity (integrity) plus crossorigin, so a tampered CDN file is rejected. Delete any second, older copy rather than leaving both in place. If you self-host, download the new file and replace the old one, then change the filename or query string so browsers and CDNs don't serve the cached old file.
<!-- Before --> <script src="https://example.com/js/jquery-1.12.4.min.js"></script> <!-- After --> <script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
Upgrade bundled npm dependencies
For sites built with webpack, Vite, Next.js or similar, upgrade the package directly. If the old version is pulled in by another package (a transitive dependency), add an overrides entry in package.json (npm 8.3+; Yarn uses resolutions, pnpm uses pnpm.overrides). Then rebuild and redeploy, because the live site only changes after a new build.
npm install jquery@^3.7.1 bootstrap@^5.3.3 lodash@^4.17.21
npm audit
// package.json — force a patched transitive version
"overrides": {
"lodash": "^4.17.21"
}Update or remove the theme, plugin or app that ships it
If a theme, plugin or third-party widget bundles the old library, update it to its latest release first. If the newest release still ships a vulnerable version, contact the vendor, switch to a maintained alternative, or remove it. Do not edit vendor files by hand, because the next update overwrites your change.
Test the site and re-run the audit
browser is undefined`. Once clean, deploy and purge your CDN and page cache. Then run the console check from step 1 again on the live page and re-run the audit.
The check passes when no detected library is at a known-vulnerable version.
Platform-specific notes
WordPress
Since WordPress 6.4, core bundles jQuery 3.7.1 and jQuery UI 1.13.x, so old versions almost always come from a theme or plugin that deregisters core jQuery or loads its own copy. Update core, themes and plugins under **Dashboard › Updates**. Then search the theme for `wp_deregister_script( 'jquery' )` and remove that line along with the bundled file. Don't install plugins that 'restore' old jQuery for compatibility; fix or replace the plugin that needs it instead.
Shopify
Go to **Online Store › Themes › … › Edit code** and search `theme.liquid` and the `assets` folder for `jquery`. Older vintage themes (pre-Online Store 2.0) often load jQuery 1.x or 2.x; moving to a current Online Store 2.0 theme removes it entirely. Scripts injected by apps can't be edited in the theme. Update the app, ask the developer to upgrade, or uninstall it.
Next.js
Libraries are bundled, so run `npm ls <package>` and `npm audit`, upgrade, and use `overrides` for transitive dependencies. Check for any external tags added with `next/script` or in `app/layout.tsx` / `pages/_document.tsx`. Redeploy so the new chunks are served; old hashed chunks may stay cached at the CDN until purged.
Webflow
Webflow injects its own jQuery (3.5.1 at the time of writing), which is above the vulnerable threshold. Flagged versions usually come from embeds you added under **Site settings › Custom code**, page-level custom code, or Embed elements. Update or remove those script tags and republish.
Cloudflare
After deploying, purge the old file with **Caching › Configuration › Purge Cache › Custom Purge** (enter the script URL), or Purge Everything. If Rocket Loader or Zaraz loads third-party tools, check those settings too, since they can inject their own script versions.
Check that it worked
✅ How to verify
- In the browser console on the live page, run `jQuery.fn.jquery` (and the other version checks from step 1) and confirm each shows the patched version.
- In DevTools › Network, filter by the library name and confirm only one copy loads, from the new URL, with a 200 status and no SRI errors in the Console.
- Run `npm audit` (for bundled sites) and confirm no high or critical advisories remain for the flagged packages.
- Re-run the audit; the check should pass and list the detected libraries with no known-vulnerable versions.
⚠️ Common mistakes
- Upgrading the main jQuery tag but leaving a second, older copy loaded by a plugin, slider or widget, so the vulnerable version is still on the page.
- Updating package.json but not rebuilding, redeploying or purging the CDN, so visitors still get the old bundled file.
- Keeping jQuery Migrate or a 'compatibility' plugin in production permanently, which restores deprecated behavior and can pin old versions.
- Editing a vendor's bundled file by hand, which is overwritten at the next theme or plugin update.
Is this still an issue on your site? Run a free audit — ZORO checks this and 294 other SEO, AI-visibility, accessibility and security signals, with fixes for your platform.
Check my site freeFAQ
Which jQuery version is safe to use in 2026?
Use jQuery 3.5.0 or later; 3.7.1 is the widely used patched 3.x release. jQuery 4.x is also maintained but removes deprecated APIs and support for very old browsers, so test before switching. Anything in 1.x or 2.x has known XSS vulnerabilities and no further security fixes.
Will upgrading jQuery break my website?
It can if your code or plugins use APIs removed in 3.x, such as `.live()`, `.size()` or `$.browser`. Load jQuery Migrate on a staging site to log every deprecated call, fix or update the code responsible, then remove Migrate before going live.
Is it really a risk if the vulnerable function isn't used on my site?
The risk is lower but not zero: other scripts, plugins or future code can call the vulnerable method, and scanners and compliance reviews flag the version regardless of usage. Upgrading is usually quicker than proving the vulnerable code path can never be reached.
How do I fix a vulnerable library loaded by a third-party widget?
Update the widget or app to its latest version and check whether the library version changes. If it doesn't, report it to the vendor and ask for a timeline, or replace or remove the widget. You can't safely patch code served from someone else's domain.
How to Fix Server Version Disclosure in HTTP Headers
How to Fix a Missing Permissions-Policy Header on Your Site
How to Add Subresource Integrity (SRI) to CDN Scripts
How to Fix Missing Clickjacking Protection (frame-ancestors)
How to Disable TLS 1.0 and 1.1 and Allow Only TLS 1.2+
How to Fix Cookies Missing the SameSite Attribute