GHSA-cgjx-mwpx-47jv

Suggest an improvement
Source
https://github.com/advisories/GHSA-cgjx-mwpx-47jv
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2018/10/GHSA-cgjx-mwpx-47jv/GHSA-cgjx-mwpx-47jv.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-cgjx-mwpx-47jv
Aliases
Published
2018-10-23T17:14:57Z
Modified
2023-11-08T03:58:11Z
Summary
Private Data Disclosure in express-restify-mongoose
Details

Affected versions of express-restify-mongoose are susceptible to an information leakage vulnerability which may allow an attacker to access fields on a model even if those fields are marked as private.

Proof of Concept

If you have a user model that you want to protect, such as the following User model:

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

You would normally do something such as:

restify.serve(router, User, {
    private: ['password'], // Set the password part of User as private, so outside people can't read it
})

This would hide the password field from people that send your application a GET /User and GET /User/some-user-id request.

A malicious user can go to your application and send a request for GET /User?distinct=password and get all the passwords for all the users in the database, despite the field being set to private. This could be used for other private data, if the malicious user knew what was set as private for specific routes.

Recommendation

Version 2.x: Update to version 2.5.0 or later. Version 3.x: Update to version 3.1.0 or later.

Database specific
{
    "cwe_ids":  [
        "CWE-200"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2020-06-16T21:31:33Z",
    "nvd_published_at":  null,
    "severity":  "HIGH"
}
References

Affected packages

npm / express-restify-mongoose

Package

Name
express-restify-mongoose
View open source insights on deps.dev
Purl
pkg:npm/express-restify-mongoose

Affected ranges

Type
SEMVER
Events
Introduced
3.0.0
Fixed
3.1.0

Database specific

last_known_affected_version_range
"<= 3.0.1"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2018/10/GHSA-cgjx-mwpx-47jv/GHSA-cgjx-mwpx-47jv.json"

npm / express-restify-mongoose

Package

Name
express-restify-mongoose
View open source insights on deps.dev
Purl
pkg:npm/express-restify-mongoose

Affected ranges

Type
SEMVER
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
2.5.0

Database specific

last_known_affected_version_range
"<= 2.4.2"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2018/10/GHSA-cgjx-mwpx-47jv/GHSA-cgjx-mwpx-47jv.json"