serve-static@1.4.3 vulnerabilities

Serve static files

  • latest version

    1.16.2

  • latest non vulnerable version

  • first published

    11 years ago

  • latest version published

    6 months ago

  • licenses detected

  • Direct Vulnerabilities

    Known vulnerabilities in the serve-static package. This does not include vulnerabilities belonging to this package’s dependencies.

    How to fix?

    Automatically find and fix vulnerabilities affecting your projects. Snyk scans for vulnerabilities and provides fixes for free.

    Fix for free
    VulnerabilityVulnerable Version
    • L
    Cross-site Scripting

    serve-static is a server.

    Affected versions of this package are vulnerable to Cross-site Scripting due to improper sanitization of user input in the redirect function. An attacker can manipulate the redirection process by injecting malicious code into the input.

    Note

    To exploit this vulnerability, the following conditions are required:

    1. The attacker should be able to control the input to response.redirect()

    2. express must not redirect before the template appears

    3. the browser must not complete redirection before:

    4. the user must click on the link in the template

    How to fix Cross-site Scripting?

    Upgrade serve-static to version 1.16.0, 2.1.0 or higher.

    <1.16.0>=2.0.0 <2.1.0
    • L
    Open Redirect

    When using serve-static middleware version < 1.7.2 and it's configured to mount at the root, it creates an open redirect on the site.

    Source: Node Security Project

    How to fix Open Redirect?

    • Update to version 1.7.2 or greater (or 1.6.5 if sticking to the 1.6.x line).
      • Disable redirects if not using the feature with 'redirect: false' option and cannot upgrade.

    <1.6.5>=1.7.0 <1.7.2