CVE-2021-31407: Flow server Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-25xc-jwfq-39jw
CVSS 8.6
CWE-668 CWE-402
Published
Advisory Summary

CVE-2021-31407 is a HIGH (CVSS 8.6) remote code execution vulnerability (CWE-668: Exposure of Resource to Wrong Sphere) affecting Flow server libraries in the Maven ecosystem. The issue involves osgi applications using vaadin 12-14 and 19 vulnerable to server classes and resources exposure. Remediation is available by upgrading affected packages to version 2.4.8, 6.0.1.

CVE-2021-31407 at a Glance

CVE Identifier CVE-2021-31407
GHSA Identifier GHSA-25xc-jwfq-39jw
Severity HIGH
CVSS v3.1 Base Score 8.6
CWE Classification CWE-668: Exposure of Resource to Wrong Sphere
Affected Product Flow server
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 8.6

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

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

How to Fix CVE-2021-31407

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

com.vaadin:flow-server fixed: 2.4.8
<dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>flow-server</artifactId>
    <version>2.4.8</version>
</dependency>
com.vaadin:flow-server fixed: 6.0.1
<dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>flow-server</artifactId>
    <version>6.0.1</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=com.vaadin

How to Check if You Are Affected

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

mvn dependency:tree -Dincludes=com.vaadin

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

Note: The mvn dependency:tree -Dincludes=com.vaadin 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 Flow server, 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

Vulnerability in OSGi integration in `com.vaadin:flow-server` versions 1.2.0 through 2.4.7 (Vaadin 12.0.0 through 14.4.9), and 6.0.0 through 6.0.1 (Vaadin 19.0.0) allows attacker to access application classes and resources on the server via crafted HTTP request. - https://vaadin.com/security/cve-2021-31407

CVE-2021-31407 Affected Flow server Versions

2 component(s)
Fixed Versions:
2.4.86.0.1
Product / Package Ecosystem Affected Versions Fixed Version
com.vaadin:flow-server
Maven
≥ 1.2.0
< 2.4.8
2.4.8
com.vaadin:flow-server
Maven
≥ 6.0.0
< 6.0.1
All 1 versions
6.0.0
6.0.1

References

Frequently Asked Questions

What is CVE-2021-31407?
CVE-2021-31407 is a security vulnerability in Flow server involving OSGi applications using Vaadin 12-14 and 19 vulnerable to server classes and resources exposure under CWE-668: Exposure of Resource to Wrong Sphere.
Which Flow server versions are affected?
Affected versions include releases prior to 2.4.8, 6.0.1 across affected packages: com.vaadin:flow-server.
What version fixes CVE-2021-31407?
Upgrading to 2.4.8, 6.0.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is flow-server affected?
Yes, com.vaadin:flow-server is affected in releases prior to 2.4.8, 6.0.1. Upgrade your dependency to 2.4.8, 6.0.1 or later.
What is the CVSS score of CVE-2021-31407?
CVE-2021-31407 has a CVSS v3.1 base score of 8.6 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N.
What CWE is associated with CVE-2021-31407?
CVE-2021-31407 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-2021-31407?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=com.vaadin'. 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-25xc-jwfq-39jw",
  "modified" : "2022-08-15T20:03:44Z",
  "published" : "2021-04-19T14:50:49Z",
  "aliases" : [ "CVE-2021-31407" ],
  "summary" : "OSGi applications using Vaadin 12-14 and 19 vulnerable to server classes and resources exposure",
  "details" : "Vulnerability in OSGi integration in `com.vaadin:flow-server` versions 1.2.0 through 2.4.7 (Vaadin 12.0.0 through 14.4.9), and 6.0.0 through 6.0.1 (Vaadin 19.0.0) allows attacker to access application classes and resources on the server via crafted HTTP request.\n\n- https://vaadin.com/security/cve-2021-31407",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.vaadin:flow-server"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.2.0"
      }, {
        "fixed" : "2.4.8"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.4.7"
    }
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.vaadin:flow-server"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0"
      }, {
        "fixed" : "6.0.1"
      } ]
    } ],
    "versions" : [ "6.0.0" ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/vaadin/flow/security/advisories/GHSA-25xc-jwfq-39jw"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-31407"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vaadin/osgi/issues/50"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vaadin/flow/pull/10229"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vaadin/flow/pull/10269"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/vaadin/flow"
  }, {
    "type" : "WEB",
    "url" : "https://vaadin.com/security/cve-2021-31407"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-402", "CWE-668" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-04-16T23:15:42Z",
    "nvd_published_at" : "2021-04-23T16:15:00Z"
  }
}