Логотип exploitDog
Консоль
Логотип exploitDog

exploitDog

github логотип

GHSA-gc7p-j5xm-xxh2

Опубликовано: 03 нояб. 2023
Источник: github
Github: Прошло ревью
CVSS3: 7.6

Описание

Unauthorized Access to Private Fields in User Registration API

System Details

NameValue
OSWindows 11
Version4.11.1 (node v16.14.2)
Databasemysql

Description

I marked some fields as private fields in user content-type, and tried to register as a new user via api, at the same time I added content to fill the private fields and sent a post request, and as you can see from the images below, I can write to the private fields.

register

user

private_field

table

To prevent this, I went to the extension area and tried to extend the register method, for this I wanted to do it using the sanitizeInput function that I know in the source codes of the strap. But the sanitizeInput function did not filter out private fields.

const { auth } = ctx.state; const data = ctx.request.body; const userSchema = strapi.getModel("plugin::users-permissions.user"); sanitize.contentAPI.input(data, userSchema, { auth });

here's the solution I've temporarily kept to myself, code snippet

const body = ctx.request.body; const { attributes } = strapi.getModel("plugin::users-permissions.user"); const sanitizedData = _.omitBy(body, (data, key) => { const attribute = attributes[key]; if (_.isNil(attribute)) { return false; } //? If you want, you can throw an error for fields that we did not expect. // if (_.isNil(attribute)) // throw new ApplicationError(`Unexpected value ${key}`); // if private value is true, we do not want to send it to the database. return attribute.private; }); return sanitizedData;

Пакеты

Наименование

@strapi/plugin-users-permissions

npm
Затронутые версииВерсия исправления

>= 4.0.0, < 4.13.1

4.13.1

Наименование

@strapi/strapi

npm
Затронутые версииВерсия исправления

>= 4.0.0, < 4.13.1

4.13.1

EPSS

Процентиль: 24%
0.00079
Низкий

7.6 High

CVSS3

Дефекты

CWE-287

Связанные уязвимости

CVSS3: 7.6
nvd
больше 2 лет назад

strapi is an open-source headless CMS. Versions prior to 4.13.1 did not properly restrict write access to fielded marked as private in the user registration endpoint. As such malicious users may be able to errantly modify their user records. This issue has been addressed in version 4.13.1. Users are advised to upgrade. There are no known workarounds for this vulnerability.

EPSS

Процентиль: 24%
0.00079
Низкий

7.6 High

CVSS3

Дефекты

CWE-287