Headline
CVE-2023-34093: fix(content-types): remove getter for private attributes · strapi/strapi@2fa8f30
Strapi is an open-source headless content management system. Prior to version 4.10.8, anyone (Strapi developers, users, plugins) can make every attribute of a Content-Type public without knowing it. 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). Anyone 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. Version 4.10.8 contains a patch for this issue.
Expand Up
@@ -153,7 +153,6 @@ describe('Content types utils’, () => {
test('Attribute is private in the model attributes’, () => {
const model = createModelWithPrivates();
global.strapi = { config: createConfig() };
Object.assign(model, { privateAttributes: getPrivateAttributes(model) });
expect(isPrivateAttribute(model, ‘foo’)).toBeTruthy();
expect(isPrivateAttribute(model, ‘bar’)).toBeFalsy();
Expand All
@@ -164,7 +163,6 @@ describe('Content types utils’, () => {
test('Attribute is set to private in the app config’, () => {
const model = createModelWithPrivates();
global.strapi = { config: createConfig([‘bar’]) };
Object.assign(model, { privateAttributes: getPrivateAttributes(model) });
expect(isPrivateAttribute(model, ‘foo’)).toBeTruthy();
expect(isPrivateAttribute(model, ‘bar’)).toBeTruthy();
Expand All
@@ -175,7 +173,6 @@ describe('Content types utils’, () => {
test('Attribute is set to private in the model options’, () => {
const model = createModelWithPrivates([‘foobar’]);
global.strapi = { config: createConfig() };
Object.assign(model, { privateAttributes: getPrivateAttributes(model) });
expect(isPrivateAttribute(model, ‘foo’)).toBeTruthy();
expect(isPrivateAttribute(model, ‘bar’)).toBeFalsy();
Expand Down
Related news
### 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: ```javascript 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. ```javascript strapi.container.get('content-types').extend(contentTypeUID, (con...