VYPR
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.

PackageAffected versionsPatched versions
sailsnpm
< 1.5.71.5.7

Affected products

1

Patches

1
4a023dc5095a

Improve virtual request parsing (#7287)

https://github.com/balderdashy/sailsMike McNeilJul 21, 2023via ghsa
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

News mentions

0

No linked articles in our index yet.