7.6high
Unauthorized Access to Private Fields in User Registration API in strapi
- Severity
- 7.6high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.60% (higher than 43% of CVEs)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-gc7p-j5xm-xxh2
Description
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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| strapi strapi | >= 4.0.0, < 4.13.1, from 4.0.0 before 4.13.1 | CVE List, NVD |
| @strapi/plugin-users-permissions (npm) | from 4.0.0 before 4.13.1 | GitHub Advisory Database |
| @strapi/strapi (npm) | from 4.0.0 before 4.13.1 | GitHub Advisory Database |
All scores
| GitHub_M | 7.6high CVSS:3.1 | CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:L |
| GitHub | 7.6high CVSS:3.1 | CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:L |
| NVD | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N |
Classification
SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.
What each source says
CVE List
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.
GitHub Advisory Database
System Details
| Name | Value |
|---|---|
| OS | Windows 11 |
| Version | 4.11.1 (node v16.14.2) |
| Database | mysql |
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.
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;
NVD (es)
Strapi es un CMS sin cabeza de código abierto. Las versiones anteriores a la 4.13.1 no restringían adecuadamente el acceso de escritura a los campos marcados como privados en el endpoint de registro de usuario. Como tal, los usuarios malintencionados pueden modificar erróneamente sus registros de usuario. Este problema se solucionó en la versión 4.13.1. Se recomienda a los usuarios que actualicen. No se conocen workarounds para esta vulnerabilidad.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2023-39345 changed 2024-09-04 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-gc7p-j5xm-xxh2 changed 2023-11-08 | CC-BY-4.0 |
| NVD | CVE-2023-39345 changed 2026-06-17 | Public domain |