CVE-2022-30999: Fof/upload Cross-Site Scripting Vulnerability

HIGH
Advisory Identifier: GHSA-fm53-mpmp-7qw2
CVSS 8.7
CWE-79
Published
Advisory Summary

CVE-2022-30999 is a HIGH (CVSS 8.7) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Fof/upload libraries in the Packagist ecosystem. The issue involves possible cross-site scripting attack via unsanitized svg files in fof upload. Remediation is available by upgrading affected packages to version 1.2.3.

CVE-2022-30999 at a Glance

CVE Identifier CVE-2022-30999
GHSA Identifier GHSA-fm53-mpmp-7qw2
Severity HIGH
CVSS v3.1 Base Score 8.7
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Fof/upload
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 8.7

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:R/S:C/C:H/I:H/A:N).

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

How to Fix CVE-2022-30999

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

fof/upload fixed: 1.2.3
Upgrade fof/upload to 1.2.3
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 fof/upload

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-30999, inspect your project dependencies for Fof/upload:

inspect dependencies for fof/upload

Analyze the terminal output to locate any version of Fof/upload in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.2.3), 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-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Fof/upload, 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 If FoF Upload is configured to allow the uploading of SVG files (`image/svg+xml`), navigating directly to an SVG file URI could execute arbitrary Javascript code decided by an attacker. This Javascript code could include the execution of HTTP web requests to Flarum, or any other web service. This could allow data to be leaked by an authenticated Flarum user, or, possibly, for data to be modified maliciously. ### Patches This has been patched with v1.2.3, which now sanitizes uploaded SVG files. ### Workarounds Upgrade to `1.2.3` (requires Flarum 1.2 or later), or remove the ability for users to upload SVG files through FoF Upload. ### References Thank you to Safwat Refaat for the responsible disclosure of this vulnerability.

CVE-2022-30999 Affected Fof/upload Versions

1 component(s)
Fixed Versions:
1.2.3
Product / Package Ecosystem Affected Versions Fixed Version
fof/upload
Packagist
< 1.2.3
1.2.3

References

Frequently Asked Questions

What is CVE-2022-30999?
CVE-2022-30999 is a security vulnerability in Fof/upload involving Possible cross-site scripting attack via unsanitized SVG files in FoF Upload under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Fof/upload versions are affected?
Affected versions include releases prior to 1.2.3 across affected packages: fof/upload.
What version fixes CVE-2022-30999?
Upgrading to 1.2.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is fof/upload affected?
Yes, fof/upload is affected in releases prior to 1.2.3. Upgrade your dependency to 1.2.3 or later.
What is the CVSS score of CVE-2022-30999?
CVE-2022-30999 has a CVSS v3.1 base score of 8.7 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N.
What CWE is associated with CVE-2022-30999?
CVE-2022-30999 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check Packagist dependencies for CVE-2022-30999?
Run the dependency tree command: 'inspect dependencies for fof/upload'. 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-fm53-mpmp-7qw2",
  "modified" : "2022-05-25T22:55:25Z",
  "published" : "2022-05-25T22:55:25Z",
  "aliases" : [ "CVE-2022-30999" ],
  "summary" : "Possible cross-site scripting attack via unsanitized SVG files in FoF Upload",
  "details" : "### Impact\nIf FoF Upload is configured to allow the uploading of SVG files (`image/svg+xml`), navigating directly to an SVG file URI could execute arbitrary Javascript code decided by an attacker.\n\nThis Javascript code could include the execution of HTTP web requests to Flarum, or any other web service. This could allow data to be leaked by an authenticated Flarum user, or, possibly, for data to be modified maliciously.\n\n### Patches\nThis has been patched with v1.2.3, which now sanitizes uploaded SVG files.\n\n### Workarounds\nUpgrade to `1.2.3` (requires Flarum 1.2 or later), or remove the ability for users to upload SVG files through FoF Upload.\n\n### References\nThank you to Safwat Refaat for the responsible disclosure of this vulnerability.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "fof/upload"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.2.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/FriendsOfFlarum/upload/security/advisories/GHSA-fm53-mpmp-7qw2"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-30999"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/FriendsOfFlarum/upload/issues/68"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/FriendsOfFlarum/upload/pull/318"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/FriendsOfFlarum/upload"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/FriendsOfFlarum/upload/releases/tag/1.2.3"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-05-25T22:55:25Z",
    "nvd_published_at" : "2022-06-02T14:15:00Z"
  }
}