# CVE-2016-10549: Sails before 0.12.7 vulnerable to Broken CORS

> Attackers can bypass Same Origin Policy via reflected CORS headers in Sails.js when specific non-default configurations are enabled.

- **Severity:** Medium 4.4 (`CVSS:3.0/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 31 May 2018
- **Updated:** 17 Sep 2024
- **Also known as:** GHSA-qmv4-jgp7-mf68

## What is CVE-2016-10549?

CVE-2016-10549 is a medium-severity vulnerability in HackerOne sails node module, published on 31 May 2018. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.

### Official description

Sails is an MVC style framework for building realtime web applications. Version 0.12.7 and lower 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 would 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. Note that 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. At that point authenticated cross domain requests are possible.

Weakness: CWE-79 (Improper Neutralization of Input During Web Page Generation), CWE-284 (Improper Access Control)

## Which versions are affected by CVE-2016-10549?

2 open source packages ship an affected version, including sails. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `sails` | npm | All versions | 0.12.7 |
| `sails` | npm | All versions | 0.12.7 |

Products: Sailsjs Sails.

## How do I fix CVE-2016-10549?

Upgrade sails to 0.12.7 or later.

## Is CVE-2016-10549 being exploited?

There is no known exploitation of CVE-2016-10549 in the wild and no public exploit code.

## Other vulnerabilities in HackerOne sails node module

- [CVE-2021-44908](https://insights.sbomify.com/CVE-2021-44908/): Prototype Pollution in Sails.js (critical 9.8)
- [CVE-2023-38504](https://insights.sbomify.com/CVE-2023-38504/): Sails DoS vulnerability for apps with sockets enabled (high 7.5)
- [CVE-2018-21036](https://insights.sbomify.com/CVE-2018-21036/): Improper Input Validation in sails-hook-sockets (high 7.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2016-10549 and fix it if it is affected.

What it is: CVE-2016-10549 is a medium-severity vulnerability in HackerOne sails node module, published on 31 May 2018. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2016-10549 in the wild and no public exploit code.

Affected packages and fixed versions:
- sails (npm): affected all versions; fixed in 0.12.7
- sails (npm): affected all versions; fixed in 0.12.7

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2016-10549/ (Markdown: https://insights.sbomify.com/CVE-2016-10549/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2016-10549
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2016-10549
- OSV: https://osv.dev/vulnerability/CVE-2016-10549

---
From sbomify Insights: https://insights.sbomify.com/CVE-2016-10549/
Summaries are generated and may contain mistakes; the official description above is the record.
