Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. @strapi/strapi
  4. ›
  5. CVE-2023-39345

CVE-2023-39345: Unauthorized Access to Private Fields in User Registration API

November 3, 2023

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. 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 does 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 does 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;

References

  • github.com/advisories/GHSA-gc7p-j5xm-xxh2
  • github.com/strapi/strapi/security/advisories/GHSA-gc7p-j5xm-xxh2
  • strapi.io/blog/security-disclosure-of-vulnerabilities-sept-2023

Code Behaviors & Features

Detect and mitigate CVE-2023-39345 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →

Affected versions

All versions starting from 4.0.0 before 4.13.1

Fixed versions

  • 4.13.1

Solution

Upgrade to version 4.13.1 or above.

Source file

npm/@strapi/strapi/CVE-2023-39345.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sun, 08 Nov 2026 00:15:44 +0000.