Vulnerabilities in pkg:npm/st

PACKAGE
Advisory Identifier: GHSA-72fg-jqhx-c68p
Advisory Summary

CVE-2017-16224 is a MODERATE (CVSS 6.1) open redirect vulnerability (CWE-601: URL Redirection to Untrusted Site ('Open Redirect')) affecting St libraries in the npm ecosystem. The issue involves open redirect in st. Remediation is available by upgrading affected packages to version 1.2.2.

2 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/st

2 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/st. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-72fg-jqhx-c68p CVE-2017-16224 MODERATE Open Redirect in st
GHSA-69rr-wvh9-6c4q CVE-2014-3744 HIGH Directory Traversal in st

CVE-2017-16224 at a Glance

CVE Identifier CVE-2017-16224
GHSA Identifier GHSA-72fg-jqhx-c68p
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-601: URL Redirection to Untrusted Site ('Open Redirect')
Affected Product St
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2017-16224

To remediate this vulnerability, upgrade all affected St dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

st fixed: 1.2.2
npm install st@1.2.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls st

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2017-16224, inspect your project dependencies using npm:

npm ls st

Analyze the terminal output to locate any version of St in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.2.2), your application is affected.

Note: The npm ls st command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-601: URL Redirection to Untrusted Site ('Open Redirect'), where the web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a redirect. In St, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

st is a module for serving static files. An attacker is able to craft a request that results in an `HTTP 301` (redirect) to an entirely different domain. A request for: `http://some.server.com//nodesecurity.org/%2e%2e` would result in a 301 to `//nodesecurity.org/%2e%2e` which most browsers treat as a proper redirect as `//` is translated into the current schema being used. **Mitigating factor:** In order for this to work, `st` must be serving from the root of a server (`/`) rather than the typical sub directory (`/static/`) and the redirect URL will end with some form of URL encoded `..` ("%2e%2e", "%2e.", ".%2e"). Code example (provided by Xin Gao): [example.js] ```js var st = require('st') var http = require('http') http.createServer(st(process.cwd())).listen(1337) ``` ```shell $ curl -v http://localhost:1337//cve.mitre.com/%2e%2e * Trying ::1... * TCP_NODELAY set * Connected to localhost (::1) port 1337 (#0) > GET //cve.mitre.com/%2e%2e HTTP/1.1 > Host: localhost:1337 > User-Agent: curl/7.54.0 > Accept: */* > < HTTP/1.1 301 Moved Permanently < cache-control: public, max-age=600 < last-modified: Fri, 13 Oct 2017 22:56:33 GMT < etag: "16777220-46488904-1507935393000" < location: //cve.mitre.com/%2e%2e/ < Date: Fri, 13 Oct 2017 22:56:41 GMT < Connection: keep-alive < Content-Length: 30 < * Connection #0 to host localhost left intact ``` ## Recommendation Update to version 1.2.2 or later.

CVE-2017-16224 Affected St Versions

1 component(s)
Fixed Versions:
1.2.2
Product / Package Ecosystem Affected Versions Fixed Version
st
npm
< 1.2.2
1.2.2

References

Frequently Asked Questions

What is CVE-2017-16224?
CVE-2017-16224 is a security vulnerability in St involving Open Redirect in st under CWE-601: URL Redirection to Untrusted Site ('Open Redirect').
Which St versions are affected?
Affected versions include releases prior to 1.2.2 across affected packages: st.
What version fixes CVE-2017-16224?
Upgrading to 1.2.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is st affected?
Yes, st is affected in releases prior to 1.2.2. Upgrade your dependency to 1.2.2 or later.
What is the CVSS score of CVE-2017-16224?
CVE-2017-16224 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2017-16224?
CVE-2017-16224 is classified under CWE-601: URL Redirection to Untrusted Site ('Open Redirect') (The web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a redirect.).
How can I check npm dependencies for CVE-2017-16224?
Run the dependency tree command: 'npm ls st'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-72fg-jqhx-c68p",
  "modified" : "2023-09-11T18:37:42Z",
  "published" : "2018-08-06T21:33:31Z",
  "aliases" : [ "CVE-2017-16224" ],
  "summary" : "Open Redirect in st",
  "details" : "st is a module for serving static files.\n\nAn attacker is able to craft a request that results in an `HTTP 301` (redirect) to an entirely different domain. \n\nA request for: `http://some.server.com//nodesecurity.org/%2e%2e` would result in a 301 to `//nodesecurity.org/%2e%2e` which most browsers treat as a proper redirect as `//` is translated into the current schema being used.\n\n**Mitigating factor:** \n\nIn order for this to work, `st` must be serving from the root of a server (`/`) rather than the typical sub directory (`/static/`) and the redirect URL will end with some form of URL encoded `..` (\"%2e%2e\", \"%2e.\", \".%2e\"). \n\nCode example (provided by Xin Gao): \n\n[example.js]\n\n```js\nvar st = require('st') \nvar http = require('http') \nhttp.createServer(st(process.cwd())).listen(1337)\n```\n\n```shell\n$ curl -v http://localhost:1337//cve.mitre.com/%2e%2e\n*   Trying ::1...\n* TCP_NODELAY set\n* Connected to localhost (::1) port 1337 (#0)\n> GET //cve.mitre.com/%2e%2e HTTP/1.1\n> Host: localhost:1337\n> User-Agent: curl/7.54.0\n> Accept: */*\n>\n< HTTP/1.1 301 Moved Permanently\n< cache-control: public, max-age=600\n< last-modified: Fri, 13 Oct 2017 22:56:33 GMT\n< etag: \"16777220-46488904-1507935393000\"\n< location: //cve.mitre.com/%2e%2e/\n< Date: Fri, 13 Oct 2017 22:56:41 GMT\n< Connection: keep-alive\n< Content-Length: 30\n<\n* Connection #0 to host localhost left intact\n```\n\n\n## Recommendation\n\nUpdate to version 1.2.2 or later.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "st"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.2.2"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.2.1"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2017-16224"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-72fg-jqhx-c68p"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/547"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-601" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T21:20:52Z",
    "nvd_published_at" : null
  }
}