Strapi Vulnerable to SQL Injection in Content Type Builder
strapi · strapi @strapi/content-type-builder
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| @strapi/content-type-builder npm |
|
|
| @strapi/plugin-content-type-builder npm |
|
|
strapi · strapi @strapi/content-type-builder
| Product | Affected | Fixed in |
|---|---|---|
| @strapi/content-type-builder npm |
|
|
| @strapi/plugin-content-type-builder npm |
|
|
Strapi is an open source headless content management system. In versions on the 4.x branch prior to 4.26.1 and on the 5.x branch prior to 5.33.2, a database-query injection vulnerability existed in the Strapi Content-Type Builder write API. An authenticated administrator could inject arbitrary database statements through the `column.defaultTo` attribute when creating or modifying a content type. Setting `defaultTo` as a tuple `[value, { isRaw: true }]` caused the value to be passed directly into Knex's `db.connection.raw()` during schema migration without sanitization, allowing arbitrary statement execution at the database layer. Depending on the database engine, this enabled arbitrary file read via database utility functions, denial of service via forced server crash on schema-migration error, and on engines that permit external program execution, remote code execution against the database server. The patch in versions 4.26.1 and 5.33.2 addresses this by restricting all Content-Type Builder write APIs to development mode only. Production deployments running v5.33.2 or later return 404 for requests against `/content-type-builder/content-types` and related endpoints, removing the network-reachable attack surface entirely.
From the CVE record · GitHub_M
The Strapi Content-Type Builder write API allows an authenticated administrator to inject database statements through the `column.defaultTo` attribute when creating or modifying a content type. This can cause denial of service or, depending on the database engine, arbitrary file read or remote code execution against the database server.
Teams running npm `@strapi/plugin-content-type-builder` versions >=4.0.0 <4.26.1 or `@strapi/content-type-builder` versions >=5.0.0 <5.33.2 should check their deployments.