CVE-2021-22968: Concrete5/core Improper File Handling Vulnerability

HIGH
Advisory Identifier: GHSA-g3p2-hfqr-9m25
CVSS 7.2
CWE-98 CWE-330
Published
Advisory Summary

CVE-2021-22968 is a HIGH (CVSS 7.2) improper file handling vulnerability (CWE-98: Improper Control of Filename for Include/Require Statement in PHP Program ('PHP Remote File Inclusion')) affecting Concrete5/core libraries in the Packagist ecosystem. The issue involves improper file handling in concrete5/core. Remediation is available by upgrading affected packages to version 8.5.7.

CVE-2021-22968 at a Glance

CVE Identifier CVE-2021-22968
GHSA Identifier GHSA-g3p2-hfqr-9m25
Severity HIGH
CVSS v3.1 Base Score 7.2
CWE Classification CWE-98: Improper Control of Filename for Include/Require Statement in PHP Program ('PHP Remote File Inclusion')
Affected Product Concrete5/core
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 7.2

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

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
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-2021-22968

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

concrete5/core fixed: 8.5.7
Upgrade concrete5/core to 8.5.7
Verify Direct and Transitive Dependencies

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

inspect dependencies for concrete5/core

How to Check if You Are Affected

To determine whether your application is affected by CVE-2021-22968, inspect your project dependencies for Concrete5/core:

inspect dependencies for concrete5/core

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

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-98: Improper Control of Filename for Include/Require Statement in PHP Program ('PHP Remote File Inclusion'), where the php application receives input from an upstream component, but it does not restrict or incorrectly restricts the input before its usage in "require," "include," or similar functions. In Concrete5/core, 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

A bypass of adding remote files in Concrete CMS (previously concrete5) File Manager leads to remote code execution in Concrete CMS (concrete5) versions 8.5.6 and below. The external file upload feature stages files in the public directory even if they have disallowed file extensions. They are stored in a directory with a random name, but it's possible to stall the uploads and brute force the directory name. You have to be an admin with the ability to upload files, but this bug gives you the ability to upload restricted file types and execute them depending on server configuration. To fix this, a check for allowed file extensions was added before downloading files to a tmp directory

CVE-2021-22968 Affected Concrete5/core Versions

1 component(s)
Fixed Versions:
8.5.7
Product / Package Ecosystem Affected Versions Fixed Version
concrete5/core
Packagist
< 8.5.7
8.5.7

References

Frequently Asked Questions

What is CVE-2021-22968?
CVE-2021-22968 is a security vulnerability in Concrete5/core involving Improper file handling in concrete5/core under CWE-98: Improper Control of Filename for Include/Require Statement in PHP Program ('PHP Remote File Inclusion').
Which Concrete5/core versions are affected?
Affected versions include releases prior to 8.5.7 across affected packages: concrete5/core.
What version fixes CVE-2021-22968?
Upgrading to 8.5.7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is concrete5/core affected?
Yes, concrete5/core is affected in releases prior to 8.5.7. Upgrade your dependency to 8.5.7 or later.
What is the CVSS score of CVE-2021-22968?
CVE-2021-22968 has a CVSS v3.1 base score of 7.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2021-22968?
CVE-2021-22968 is classified under CWE-98: Improper Control of Filename for Include/Require Statement in PHP Program ('PHP Remote File Inclusion') (The PHP application receives input from an upstream component, but it does not restrict or incorrectly restricts the input before its usage in "require," "include," or similar functions.).
How can I check Packagist dependencies for CVE-2021-22968?
Run the dependency tree command: 'inspect dependencies for concrete5/core'. 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-g3p2-hfqr-9m25",
  "modified" : "2023-06-30T20:31:40Z",
  "published" : "2021-11-23T17:54:26Z",
  "aliases" : [ "CVE-2021-22968" ],
  "summary" : "Improper file handling in concrete5/core",
  "details" : "A bypass of adding remote files in Concrete CMS (previously concrete5) File Manager leads to remote code execution in Concrete CMS (concrete5) versions 8.5.6 and below. The external file upload feature stages files in the public directory even if they have disallowed file extensions. They are stored in a directory with a random name, but it's possible to stall the uploads and brute force the directory name. You have to be an admin with the ability to upload files, but this bug gives you the ability to upload restricted file types and execute them depending on server configuration. To fix this, a check for allowed file extensions was added before downloading files to a tmp directory",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "concrete5/core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "8.5.7"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-22968"
  }, {
    "type" : "WEB",
    "url" : "https://hackerone.com/reports/1350444"
  }, {
    "type" : "WEB",
    "url" : "https://documentation.concretecms.org/developers/introduction/version-history/857-release-notes"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/olsgreen/concrete5-core"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-330", "CWE-98" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-11-22T19:41:50Z",
    "nvd_published_at" : "2021-11-19T19:15:00Z"
  }
}