HackerMe Security — practical guidance for protecting your website

A Library Your Website Uses Has a Known Vulnerability: Patch, Mitigate, or Accept the Risk?

Conceptual illustration for the article “A Library Your Website Uses Has a Known Vulnerability: Patch, Mitigate, or Accept the Risk?”

The answer depends on whether the library's provider has already released a fixed version. If a patched version exists, your developer updates the dependency first in a testing environment, runs the tests, and only then pushes the update to production. If the provider says a fix will take months, the team applies a temporary mitigation and keeps the permanent fix on its plan. Leaving the issue in place is allowed only as a formal risk acceptance made by a senior risk owner, not as a quiet default.

The short answer

This matters for a business website because the code you did not write still shapes how secure your site is. Most sites rely on third-party packages for routine work such as parsing data, generating documents or making HTTP requests. When one of those packages has a flaw, your site inherits it until someone acts. The sections below walk through each situation using OWASP's guidance, so you can follow what your developer or agency is doing and ask the right questions.

Sources: cheatsheetseries.owasp.org [1]

Why dependency flaws reach your site, and why scanners can miss some

OWASP describes the trade-off plainly: third-party dependencies let a development team focus on the business features, but the application's security then rests partly on those dependencies. For a website owner, that means every plugin, library or package in the build is part of your attack surface.

OWASP recommends automated analysis of dependencies from the start of a project. Adding it late can surface a large backlog of issues at once, which places a heavy burden on the team and can block the project's progress. If your site has never had its dependencies checked, expect the first review to find more than one item, and plan time for it rather than treating it as a one-afternoon task.

It also helps to know how vulnerabilities become visible. In responsible disclosure, a researcher works with the provider and a CVE identifier is issued, which lets tools reference the issue and its fix. If the provider does not respond, researchers often publish full details after about 30 days. In full disclosure, a researcher publishes everything, including exploit code, and a CVE is not always created. In that case the issue may be missing from the CVE database, and detection tools that rely on it can be blind to it unless they use other sources. A clean scan report is therefore useful evidence, not proof that no known problem exists.

Sources: cheatsheetseries.owasp.org [1]

Who decides, and where the fix is applied

Accepting the risk is a legitimate option, but OWASP is specific about who may make that call: the Chief Risk Officer, with the Chief Information Security Officer as fallback. The decision rests on the development team's technical analysis and on the CVSS score indicators of the CVE. In a small business those titles may not exist, but the principle carries over: the person accountable for business risk signs off, using the developer's written analysis, instead of the issue being dropped because it is inconvenient.

OWASP also assumes the development team includes, or can call on, someone with application security skills to analyse the vulnerability. If your site is maintained by a freelancer or agency, ask whether that skill is available before relying on their verdict.

A common complication is that the vulnerable code sits in a transitive dependency, a package pulled in by another package you chose. OWASP advises acting on the direct dependency instead, because changing a transitive dependency often affects the application's stability. Doing it properly requires understanding the whole chain from your direct dependency down to the affected one, which is very time consuming. So when a report names a package you have never heard of, the practical question for your developer is which of your direct dependencies brings it in, and whether that one has an update.

Sources: cheatsheetseries.owasp.org [1]

When a patched version exists: update in testing first

This is OWASP's Case 1, and it is the situation you want to be in. All of the work below is done by a developer in the site's code, starting in a testing environment, not on the live site. The approach works best when automated unit, integration, functional or security tests already cover the features that use the affected dependency, because those tests are how the team confirms the feature still works after the update.

Step 1, performed by the developer in the testing environment: update the dependency's version in the project there. The live site is not touched at this stage, so a broken update costs nothing but time.

Step 2, performed by the developer, reading the test results: if all tests succeed, the update can be pushed to production. That passing test run is the outcome to see before anything changes on the live site.

If one or more tests fail, OWASP lists three paths. First, the failure comes from changed function calls, such as a different signature, argument or package; the developer updates the code to fit the new library and re-runs the tests. Second, the fixed version cannot be adopted at all, for example because the fix only ships in a new major version that breaks the application, or because a transitive dependency pins the vulnerable version; then the team moves to OWASP's Case 5 and uses the interim mitigation described in the next section meanwhile. Third, the new release is technically incompatible, for example it needs a newer runtime; the team raises the issue with the provider and applies the interim mitigation while waiting for the provider's response.

For a site owner, the key checkpoint is simple: ask for confirmation that the update passed the tests in testing before it was deployed, and if it could not be adopted, ask which of these three paths applies and what is protecting the site in the meantime.

Sources: cheatsheetseries.owasp.org [1]

When no patch is available yet: what an interim mitigation must achieve

OWASP's Case 2 covers a provider who says a fix will take months. This section explains what a sound temporary measure looks like so you can judge one; it is not a complete runbook, and your developer should work from the OWASP sheet itself. The approach works best when the provider can share the exploit code, the list of affected functions, or a workaround.

If the provider supplies a workaround, it should be applied and validated in the testing environment first, and only then deployed to production. Without one, the developer identifies which calls to the affected functions are reachable in your site and what conditions an attacker would need. A protective wrapper around those calls is acceptable only when its checks block those conditions on every affected path. If that cannot be shown, the safer choice is to disable or isolate the affected feature while pursuing a fix. Either way, the wrapper is temporary, and the upgrade or replacement that removes the vulnerable dependency stays tracked.

OWASP notes that security devices such as a Web Application Firewall can also help, by validating parameters and using detection rules for specific libraries. Its own focus, though, is patching as close to the source as possible, so treat a WAF rule as an addition rather than the fix.

Testing the mitigation needs care. A provider-supplied exploit can serve as a regression test, but blocking that one payload does not prove the library is safe; the team should try alternate inputs and every reachable path to the affected feature. Existing automated tests should also be run to confirm the protection code has not destabilised the site. If the provider has shared nothing beyond the CVE, OWASP points to its Case 3 instead.

Sources: cheatsheetseries.owasp.org [1]

For JavaScript sites: make sure the version you tested is the version you ship

Updating a dependency only helps if production installs exactly what was tested. OWASP's npm guidance explains the risk: when package.json and the lockfile disagree, npm and Yarn install versions based on package.json, which can differ from those recorded in the lockfile. That can pull unintended versions into build and production environments and defeat the purpose of the lockfile.

The remedy is to tell the installer to follow the lockfile strictly, so any mismatch stops the install. With Yarn that is yarn install –frozen-lockfile, and with npm it is npm ci. Ask your developer whether your build uses one of these.

Updates also carry their own risk, because packages can define scripts that run during installation, and attackers can create or alter packages to run arbitrary commands at install time. OWASP's npm sheet lists four practices for reducing that exposure: vet third-party modules for health and credibility before installing them; hold off on upgrading to brand-new versions immediately, giving them time to circulate; review the changelog and release notes before upgrading; and install with –ignore-scripts, or set ignore-scripts=true in the project's .npmrc or global npm configuration, so third-party packages cannot run scripts.

There is a tension here worth naming for a site owner: waiting before adopting new versions reduces the risk of a malicious release, while a published security fix argues for moving promptly. Reviewing the release notes of the specific fixed version is how your developer balances the two.

Sources: cheatsheetseries.owasp.org [2]

Limits of this guide

This article covers two of the situations in OWASP's dependency guidance: a patched version is available, and a patch is months away. It does not cover the other cases in that guidance, the detection tools it lists, or how to document and suppress scanner alerts while a mitigation is in place; your developer should read the full OWASP cheat sheet for those.

The interim mitigation section describes what a good temporary measure must achieve, not a step-by-step procedure, and it is no substitute for a developer who understands the specific vulnerability. The JavaScript section applies only to sites built with npm or Yarn. For a hosted platform or CMS, the equivalent questions are who applies updates, where they are tested first, and who signs off if an update is deferred.

Sources: cheatsheetseries.owasp.org [1]

Questions and answers

What should I do when a library my website uses has a known vulnerability?

If a patched version exists, your developer updates the dependency first in a testing environment, runs the tests, and only then pushes the update to production.

Who can decide to accept the risk of a vulnerable dependency?

the Chief Risk Officer, with the Chief Information Security Officer as fallback

What if the vulnerable package is a transitive dependency?

OWASP advises acting on the direct dependency instead

Does blocking a known exploit prove the mitigation works?

blocking that one payload does not prove the library is safe

How do I make sure production installs the tested package versions?

With Yarn that is yarn install –frozen-lockfile, and with npm it is npm ci.

Ask your developer or agency to walk you through how your site's dependencies are checked and updated, and review the answers together.

Sources

  1. cheatsheetseries.owasp.org — cheatsheets Vulnerable Dependency Management Cheat Sheet.html
  2. cheatsheetseries.owasp.org — cheatsheets NPM Security Cheat Sheet.html