Private Data Disclosure Affecting express-restify-mongoose package, versions < 2.5.0 >= 3.0.0 <3.1.0


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    EPSS
    0.11% (45th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID npm:express-restify-mongoose:20160419
  • published 22 Jun 2016
  • disclosed 19 Apr 2016
  • credit Stefan Mirea

How to fix?

Update to version 3.1.0 or newer on the 3.x branch, or to version 2.5.0 or newer on the 2.x branch.

Overview

express-restify-mongoose is a module to easily create a flexible REST interface for mongoose models.

It supports marking certain fields as private, to keep from exposing them to users, but fails to remove those fields from certain output scenarios, resulting in potential private data exposure.

For instance, if you have the following User model:

const User = mongoose.model('User', new mongoose.Schema({
    name: String,
    password: String,
}));

To keep from exposing the password, you'll likely to want to call it out as a private field like so:

restify.serve(router, User, {
    private: ['password'],
})

This will indeed result in the password field not showing when you request an item, for instance via GET /User or GET /User/some-id.

However, when querying on that field, using GET /User?distinct=password, ALL passwords for ALL the users in the DB would be shown.

References

CVSS Scores

version 3.1
Expand this section

Snyk

Recommended
8.2 high
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    Low
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    None
  • Scope (S)
    Unchanged
  • Confidentiality (C)
    High
  • Integrity (I)
    Low
  • Availability (A)
    None