CVE-2016-10549: Sails Sails Before 0.12.7 Vulnerable To Vulnerability

HIGH
Advisory Identifier: GHSA-qmv4-jgp7-mf68
CWE-284
Published
Advisory Summary

CVE-2016-10549 is a HIGH sails before 0.12.7 vulnerable to vulnerability (CWE-284: Improper Access Control) affecting Sails libraries in the npm ecosystem. The issue involves sails before 0.12.7 vulnerable to broken cors. Remediation is available by upgrading affected packages to version 0.12.7.

CVE-2016-10549 at a Glance

CVE Identifier CVE-2016-10549
GHSA Identifier GHSA-qmv4-jgp7-mf68
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-284: Improper Access Control
Affected Product Sails
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2016-10549

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

sails fixed: 0.12.7
npm install sails@0.12.7
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 sails

How to Check if You Are Affected

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

npm ls sails

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

Note: The npm ls sails 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-284: Improper Access Control, where the product does not restrict or incorrectly restricts access to a resource from an unauthorized actor. In Sails, 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

Affected versions of `sails` have an issue with the CORS configuration where the value of the origin header is reflected as the value for the `Access-Control-Allow-Origin` header. This may allow an attacker to make AJAX requests to vulnerable hosts through cross-site scripting or a malicious HTML Document, effectively bypassing the Same Origin Policy. ## Mitigating Factors This is only an issue when `allRoutes` is set to `true` and `origin` is set to `*` or left commented out in the sails CORS config file. The problem can be compounded when the cors `credentials` setting is not provided, because at that point authenticated cross domain requests are possible. ## Recommendation Update to version 0.12.7 or later. As this vulnerability is primarily a user error, the patch for the vulnerability will simply cause the application to write an error message to the console when a vulnerable configuration is used in a production environment. Writing a proper CORS configuration is still the responsibility of the user, so it is necessary to check for the error message after installing the patch. Be sure you are not using `allRoutes: true` with `origin:'*'`, and that you uncomment `origin` and set it to a reasonable value. Ensure that if `origin` is set to `*` that you truly mean for all other websites to be able to make cross-domain requests to your API. Likewise, ensure `credentials` is uncommented out and set to the appropriate value. Make sure to explicitly set which origins may request resources via CORS.

CVE-2016-10549 Affected Sails Versions

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

References

Frequently Asked Questions

What is CVE-2016-10549?
CVE-2016-10549 is a security vulnerability in Sails involving Sails before 0.12.7 vulnerable to Broken CORS under CWE-284: Improper Access Control.
Which Sails versions are affected?
Affected versions include releases prior to 0.12.7 across affected packages: sails.
What version fixes CVE-2016-10549?
Upgrading to 0.12.7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is sails affected?
Yes, sails is affected in releases prior to 0.12.7. Upgrade your dependency to 0.12.7 or later.
What CWE is associated with CVE-2016-10549?
CVE-2016-10549 is classified under CWE-284: Improper Access Control (The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor.).
How can I check npm dependencies for CVE-2016-10549?
Run the dependency tree command: 'npm ls sails'. 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-qmv4-jgp7-mf68",
  "modified" : "2022-08-03T21:27:52Z",
  "published" : "2019-02-18T23:40:10Z",
  "aliases" : [ "CVE-2016-10549" ],
  "summary" : "Sails before 0.12.7 vulnerable to Broken CORS",
  "details" : "Affected versions of `sails` have an issue with the CORS configuration where the value of the origin header is reflected as the value for the `Access-Control-Allow-Origin` header. This may allow an attacker to make AJAX requests to vulnerable hosts through cross-site scripting or a malicious HTML Document, effectively bypassing the Same Origin Policy. \n\n## Mitigating Factors\n\nThis is only an issue when `allRoutes` is set to `true` and `origin` is set to `*` or left commented out in the sails CORS config file. \n\nThe problem can be compounded when the cors `credentials` setting is not provided, because at that point authenticated cross domain requests are possible.\n\n\n## Recommendation\n\nUpdate to version 0.12.7 or later.\n\nAs this vulnerability is primarily a user error, the patch for the vulnerability will simply cause the application to write an error message to the console when a vulnerable configuration is used in a production environment.\n\nWriting a proper CORS configuration is still the responsibility of the user, so it is necessary to check for the error message after installing the patch. Be sure you are not using `allRoutes: true` with `origin:'*'`, and that you uncomment `origin` and set it to a reasonable value. Ensure that if `origin` is set to `*` that you truly mean for all other websites to be able to make cross-domain requests to your API.\n\nLikewise, ensure `credentials` is uncommented out and set to the appropriate value. Make sure to explicitly set which origins may request resources via CORS.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "sails"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.12.7"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2016-10549"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/balderdashy/sails/commit/0057123a0321be6758845abbeb4290bf418ce542"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/balderdashy/sails"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/balderdashy/sails/releases/tag/v0.12.7"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/148"
  }, {
    "type" : "WEB",
    "url" : "http://sailsjs.org/documentation/concepts/security/cors"
  }, {
    "type" : "WEB",
    "url" : "http://sailsjs.org/documentation/reference/configuration/sails-config-cors"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-284" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T21:52:24Z",
    "nvd_published_at" : null
  }
}