CVE-2022-24897: Xwiki commons velocity Arbitrary Filesystem Write Access From Vulnerability

HIGH
Advisory Identifier: GHSA-cvx5-m8vg-vxgc
CVSS 7.5
CWE-668 CWE-22
Published
Advisory Summary

CVE-2022-24897 is a HIGH (CVSS 7.5) arbitrary filesystem write access from vulnerability (CWE-668: Exposure of Resource to Wrong Sphere) affecting Xwiki commons velocity libraries in the Maven ecosystem. The issue involves arbitrary filesystem write access from velocity.. Remediation is available by upgrading affected packages to version 12.6.7, 12.10.3.

CVE-2022-24897 at a Glance

CVE Identifier CVE-2022-24897
GHSA Identifier GHSA-cvx5-m8vg-vxgc
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-668: Exposure of Resource to Wrong Sphere
Affected Product Xwiki commons velocity
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 7.5

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

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
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-24897

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

org.xwiki.commons:xwiki-commons-velocity fixed: 12.6.7
<dependency>
    <groupId>org.xwiki.commons</groupId>
    <artifactId>xwiki-commons-velocity</artifactId>
    <version>12.6.7</version>
</dependency>
org.xwiki.commons:xwiki-commons-velocity fixed: 12.10.3
<dependency>
    <groupId>org.xwiki.commons</groupId>
    <artifactId>xwiki-commons-velocity</artifactId>
    <version>12.10.3</version>
</dependency>
Verify Direct and Transitive Dependencies

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

mvn dependency:tree -Dincludes=org.xwiki.commons

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2022-24897, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=org.xwiki.commons

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

Note: The mvn dependency:tree -Dincludes=org.xwiki.commons command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-668: Exposure of Resource to Wrong Sphere, where the product exposes a resource to the wrong control sphere, providing unintended actors with inappropriate access to the resource. In Xwiki commons velocity, 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

### Impact The velocity scripts is not properly sandboxed against using the Java File API to perform read or write operations on the filesystem. Now writing an attacking script in velocity requires the Script rights in XWiki so not all users can use it, and it also requires finding an XWiki API which returns a File. ### Patches The problem has been patched on versions 12.6.7, 12.10.3 and 13.0RC1. ### Workarounds There's no easy workaround for fixing this vulnerability other than upgrading and being careful when giving Script rights. ### References https://jira.xwiki.org/browse/XWIKI-5168 ### For more information If you have any questions or comments about this advisory: * Open an issue in [Jira XWiki](https://jira.xwiki.org) * Email us at [XWiki Security mailing-list](mailto:security@xwiki.org)

CVE-2022-24897 Affected Xwiki commons velocity Versions

2 component(s)
Fixed Versions:
12.6.712.10.3
Product / Package Ecosystem Affected Versions Fixed Version
org.xwiki.commons:xwiki-commons-velocity
Maven
≥ 2.3.0
< 12.6.7
12.6.7
org.xwiki.commons:xwiki-commons-velocity
Maven
≥ 12.7.0
< 12.10.3
12.10.3

References

Frequently Asked Questions

What is CVE-2022-24897?
CVE-2022-24897 is a security vulnerability in Xwiki commons velocity involving Arbitrary filesystem write access from velocity. under CWE-668: Exposure of Resource to Wrong Sphere.
Which Xwiki commons velocity versions are affected?
Affected versions include releases prior to 12.6.7, 12.10.3 across affected packages: org.xwiki.commons:xwiki-commons-velocity.
What version fixes CVE-2022-24897?
Upgrading to 12.6.7, 12.10.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is xwiki-commons-velocity affected?
Yes, org.xwiki.commons:xwiki-commons-velocity is affected in releases prior to 12.6.7, 12.10.3. Upgrade your dependency to 12.6.7, 12.10.3 or later.
What is the CVSS score of CVE-2022-24897?
CVE-2022-24897 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-24897?
CVE-2022-24897 is classified under CWE-668: Exposure of Resource to Wrong Sphere (The product exposes a resource to the wrong control sphere, providing unintended actors with inappropriate access to the resource.).
How can I check Maven dependencies for CVE-2022-24897?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.xwiki.commons'. 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-cvx5-m8vg-vxgc",
  "modified" : "2022-04-28T21:16:40Z",
  "published" : "2022-04-28T21:16:40Z",
  "aliases" : [ "CVE-2022-24897" ],
  "summary" : "Arbitrary filesystem write access from velocity.",
  "details" : "### Impact\n\nThe velocity scripts is not properly sandboxed against using the Java File API to perform read or write operations on the filesystem. Now writing an attacking script in velocity requires the Script rights in XWiki so not all users can use it, and it also requires finding an XWiki API which returns a File. \n\n### Patches\nThe problem has been patched on versions 12.6.7, 12.10.3 and 13.0RC1.\n\n### Workarounds\nThere's no easy workaround for fixing this vulnerability other than upgrading and being careful when giving Script rights.\n\n### References\nhttps://jira.xwiki.org/browse/XWIKI-5168\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [Jira XWiki](https://jira.xwiki.org)\n* Email us at [XWiki Security mailing-list](mailto:security@xwiki.org)\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.xwiki.commons:xwiki-commons-velocity"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.3.0"
      }, {
        "fixed" : "12.6.7"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.xwiki.commons:xwiki-commons-velocity"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "12.7.0"
      }, {
        "fixed" : "12.10.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/xwiki/xwiki-commons/security/advisories/GHSA-cvx5-m8vg-vxgc"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-24897"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/xwiki/xwiki-commons/pull/127"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/xwiki/xwiki-commons/commit/215951cfb0f808d0bf5b1097c9e7d1e503449ab8"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/xwiki/xwiki-commons"
  }, {
    "type" : "WEB",
    "url" : "https://jira.xwiki.org/browse/XWIKI-5168"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22", "CWE-668" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-04-28T21:16:40Z",
    "nvd_published_at" : "2022-05-02T22:15:00Z"
  }
}