High severityNVD Advisory· Published Jul 27, 2023· Updated Oct 3, 2024
Sails DoS vulnerability for apps with sockets enabled
CVE-2023-38504
Description
Sails is a realtime MVC Framework for Node.js. In Sails apps prior to version 1.5.7,, an attacker can send a virtual request that will cause the node process to crash. This behavior was fixed in Sails v1.5.7. As a workaround, disable the sockets hook and remove the sails.io.js client.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
sailsnpm | < 1.5.7 | 1.5.7 |
Affected products
1- Range: < 1.5.7
Patches
14a023dc5095aImprove virtual request parsing (#7287)
1 file changed · +17 −12
lib/router/req.js+17 −12 modified@@ -46,22 +46,27 @@ module.exports = function buildRequest (_req) { } else { - // TODO: send a PR to mock-req with a fix for this if (_req.headers && typeof _req.headers === 'object') { - // Strip undefined headers - _.each(_req.headers, function (headerVal, headerKey) { - if (_.isUndefined(headerVal)){ + for (let headerKey of Object.keys(_req.headers)) { + // Strip undefined headers + if (undefined === _req.headers[headerKey]) { delete _req.headers[headerKey]; } - }); - // Make sure all remaining headers are strings - _req.headers = _.mapValues(_req.headers, function (headerVal /*, headerKey*/) { - if (typeof headerVal !== 'string') { - headerVal = ''+headerVal+''; + // Make sure all remaining headers are strings + if (typeof _req.headers[headerKey] !== 'string') { + try { + _req.headers[headerKey] = ''+_req.headers[headerKey]; + // FUTURE: This behavior is likely being relied upon by apps, so we can't just change it. + // But in retrospect, it would probably be better to straight-up reject this here if it's not + // a string, since HTTP header values are always supposed to be strings; or at least primitives. + // So maybe reject non-primitives, reject `null`, and then accept primitives, but be smart about + // this, especially in the context of what the client is doing. + } catch (unusedErr) { + delete _req.headers[headerKey]; + } } - return headerVal; - }); - } + }//∞ + }//fi // Create a mock IncomingMessage stream. req = new MockReq({
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
6- github.com/advisories/GHSA-gpw9-fwm8-7rx7ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2023-38504ghsaADVISORY
- github.com/balderdashy/sails/commit/4a023dc5095a4b30fdc8535f705ed34cd22d2f7dghsax_refsource_MISCWEB
- github.com/balderdashy/sails/pull/7287ghsax_refsource_MISCWEB
- github.com/balderdashy/sails/releases/tag/v1.5.7ghsax_refsource_MISCWEB
- github.com/balderdashy/sails/security/advisories/GHSA-gpw9-fwm8-7rx7ghsax_refsource_CONFIRMWEB
News mentions
0No linked articles in our index yet.