CVE-2022-31367: Strapi Strapi Mishandles Hidden Attributes Within Vulnerability

HIGH
Advisory Identifier: GHSA-4phg-hpqm-c3j4
CVSS 8.8
CWE-89
Published
Advisory Summary

CVE-2022-31367 is a HIGH (CVSS 8.8) strapi mishandles hidden attributes within vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Strapi libraries in the npm ecosystem. The issue involves strapi mishandles hidden attributes within admin api responses. Remediation is available by upgrading affected packages to version 3.6.10, 4.1.10.

CVE-2022-31367 at a Glance

CVE Identifier CVE-2022-31367
GHSA Identifier GHSA-4phg-hpqm-c3j4
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Strapi
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2022-31367

To remediate this vulnerability, upgrade all affected Strapi dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

strapi fixed: 3.6.10
npm install strapi@3.6.10
@strapi/strapi fixed: 4.1.10
npm install @strapi/strapi@4.1.10
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls strapi

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2022-31367, inspect your project dependencies using npm:

npm ls strapi

Analyze the terminal output to locate any version of Strapi in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.6.10), your application is affected.

Note: The npm ls strapi command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Strapi, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

Strapi before 3.6.10 and 4.x before 4.1.10 mishandles hidden attributes within admin API responses.

CVE-2022-31367 Affected Strapi Versions

2 component(s)
Fixed Versions:
3.6.104.1.10
Product / Package Ecosystem Affected Versions Fixed Version
strapi
npm
< 3.6.10
3.6.10
@strapi/strapi
npm
≥ 4.0.0-next.0
< 4.1.10
4.1.10

References

Frequently Asked Questions

What is CVE-2022-31367?
CVE-2022-31367 is a security vulnerability in Strapi involving Strapi mishandles hidden attributes within admin API responses under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Strapi versions are affected?
Affected versions include releases prior to 3.6.10, 4.1.10 across affected packages: strapi, @strapi/strapi.
What version fixes CVE-2022-31367?
Upgrading to 3.6.10, 4.1.10 (or the latest patched release for your respective branch) resolves the vulnerability.
Is strapi affected?
Yes, strapi is affected in releases prior to 3.6.10. Upgrade your dependency to 3.6.10 or later.
Is @strapi/strapi affected?
Yes, @strapi/strapi is affected in releases prior to 4.1.10. Upgrade your dependency to 4.1.10 or later.
What is the CVSS score of CVE-2022-31367?
CVE-2022-31367 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-31367?
CVE-2022-31367 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.).
How can I check npm dependencies for CVE-2022-31367?
Run the dependency tree command: 'npm ls strapi'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-4phg-hpqm-c3j4",
  "modified" : "2022-10-03T19:45:15Z",
  "published" : "2022-09-28T00:00:17Z",
  "aliases" : [ "CVE-2022-31367" ],
  "summary" : "Strapi mishandles hidden attributes within admin API responses",
  "details" : "Strapi before 3.6.10 and 4.x before 4.1.10 mishandles hidden attributes within admin API responses.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "strapi"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.6.10"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@strapi/strapi"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0-next.0"
      }, {
        "fixed" : "4.1.10"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-31367"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/strapi/strapi/pull/13185"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/strapi/strapi/pull/13189"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/kos0ng/CVEs/tree/main/CVE-2022-31367"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/strapi/strapi"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/strapi/strapi/releases/tag/v3.6.10"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/strapi/strapi/releases/tag/v4.1.10"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-09-30T05:17:55Z",
    "nvd_published_at" : "2022-09-27T23:15:00Z"
  }
}