GHSA-chmr-rg2f-9jmf

Suggest an improvement
Source
https://github.com/advisories/GHSA-chmr-rg2f-9jmf
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2023/07/GHSA-chmr-rg2f-9jmf/GHSA-chmr-rg2f-9jmf.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-chmr-rg2f-9jmf
Aliases
Related
Published
2023-07-25T17:17:12Z
Modified
2023-11-08T04:12:43.996066Z
Severity
  • 4.8 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:L/A:N CVSS Calculator
Summary
Making all attributes on a content-type public without noticing it
Details

Summary

Anyone (Strapi developers, users, plugins) can make every attribute of a Content-Type public without knowing it.

Details

When dealing with content-types inside a Strapi instance, we can extend those using the appropriate container:

strapi.container.get('content-types').extend(contentTypeUID, (contentType) => newContentType);

The vulnerability only affects the handling of content types by Strapi, not the actual content types themselves. Users can use plugins or modify their own content types without realizing that the privateAttributes getter is being removed, which can result in any attribute becoming public. This can lead to sensitive information being exposed or the entire system being taken control of by an attacker(having access to password hashes).

PoC

Extend any content type on runtime (like in the bootstrap functions) and do a copy of the content-type object.

strapi.container.get('content-types').extend(contentTypeUID, (contentType) => {
  const newCT = { ... contentType, attributes: { ...contentType.attributes, newAttr: {} } };
  return newCT;
});

This will have as effect to remove the getter and as we rely on it in sanitization, every attributes will be considered as public.

Impact

Everyone can be impacted. Depending on how people are using/extending content-types. If the users are mutating the content-type, they will not be affected.

Database specific
{
    "nvd_published_at": "2023-07-25T15:15:13Z",
    "cwe_ids": [
        "CWE-200"
    ],
    "severity": "MODERATE",
    "github_reviewed": true,
    "github_reviewed_at": "2023-07-25T17:17:12Z"
}
References

Affected packages

npm / @strapi/strapi

Package

Name
@strapi/strapi
View open source insights on deps.dev
Purl
pkg:npm/%40strapi/strapi

Affected ranges

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

npm / @strapi/utils

Package

Name
@strapi/utils
View open source insights on deps.dev
Purl
pkg:npm/%40strapi/utils

Affected ranges

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

npm / @strapi/database

Package

Name
@strapi/database
View open source insights on deps.dev
Purl
pkg:npm/%40strapi/database

Affected ranges

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