CVE-2021-43795: Armeria Armeria Vulnerability

HIGH
Advisory Identifier: GHSA-8fp4-rp6c-5gcv
CVSS 7.5
CWE-22
Published
Advisory Summary

CVE-2021-43795 is a HIGH (CVSS 7.5) armeria vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Armeria libraries in the Maven ecosystem. The issue involves armeria. Remediation is available by upgrading affected packages to version 1.13.4.

CVE-2021-43795 at a Glance

CVE Identifier CVE-2021-43795
GHSA Identifier GHSA-8fp4-rp6c-5gcv
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Armeria
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:L/PR:N/UI:N/S:U/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 Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2021-43795

To remediate this vulnerability, upgrade all affected Armeria 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.linecorp.armeria:armeria fixed: 1.13.4
<dependency>
    <groupId>com.linecorp.armeria</groupId>
    <artifactId>armeria</artifactId>
    <version>1.13.4</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.linecorp.armeria

How to Check if You Are Affected

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

mvn dependency:tree -Dincludes=com.linecorp.armeria

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

Note: The mvn dependency:tree -Dincludes=com.linecorp.armeria 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-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Armeria, 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 An attacker can access an Armeria server's local file system beyond its restricted directory by sending an HTTP request whose path contains `%2F` (encoded `/`), such as `/files/..%2Fsecrets.txt`, bypassing Armeria's path validation logic. ### Patches Armeria 1.13.4 or above contains the hardened path validation logic that handles `%2F` properly. ### Workarounds This vulnerability can be worked around by inserting a decorator that performs an additional validation on the request path, e.g. ```java Server .builder() .serviceUnder( "/files", FileService .of(...) .decorate((delegate, ctx, req) -> { String path = req.headers().path(); if (path.contains("%2f") || path.contains("%2F")) { return HttpResponse.of(HttpStatus.BAD_REQUEST); } return delegate.serve(ctx, req); }) ) .build() ``` ### For more information If you have any questions or comments about this advisory: * Open an issue in [line/armeria](https://github.com/line/armeria) * Chat with us at [Slack](https://armeria.dev/s/slack) ### Credits This vulnerability was originally reported by Abdallah Zaher ([elcayser-0x0a](https://hackerone.com/elcayser-0x0a?type=user)).

CVE-2021-43795 Affected Armeria Versions

1 component(s)
Fixed Versions:
1.13.4
Product / Package Ecosystem Affected Versions Fixed Version
com.linecorp.armeria:armeria
Maven
≥ 1.12.0
< 1.13.4
1.13.4

References

Frequently Asked Questions

What is CVE-2021-43795?
CVE-2021-43795 is a security vulnerability in Armeria involving armeria under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Armeria versions are affected?
Affected versions include releases prior to 1.13.4 across affected packages: com.linecorp.armeria:armeria.
What version fixes CVE-2021-43795?
Upgrading to 1.13.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is armeria affected?
Yes, com.linecorp.armeria:armeria is affected in releases prior to 1.13.4. Upgrade your dependency to 1.13.4 or later.
What is the CVSS score of CVE-2021-43795?
CVE-2021-43795 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2021-43795?
CVE-2021-43795 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check Maven dependencies for CVE-2021-43795?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=com.linecorp.armeria'. 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-8fp4-rp6c-5gcv",
  "modified" : "2021-12-02T21:28:29Z",
  "published" : "2021-12-02T22:25:54Z",
  "aliases" : [ "CVE-2021-43795" ],
  "summary" : "Path Traversal in com.linecorp.armeria:armeria",
  "details" : "### Impact\n\nAn attacker can access an Armeria server's local file system beyond its restricted directory by sending an HTTP request whose path contains `%2F` (encoded `/`), such as `/files/..%2Fsecrets.txt`, bypassing Armeria's path validation logic.\n\n### Patches\n\nArmeria 1.13.4 or above contains the hardened path validation logic that handles `%2F` properly. \n\n### Workarounds\n\nThis vulnerability can be worked around by inserting a decorator that performs an additional validation on the request path, e.g.\n\n```java\nServer\n  .builder()\n  .serviceUnder(\n    \"/files\",\n    FileService\n      .of(...)\n      .decorate((delegate, ctx, req) -> {\n        String path = req.headers().path();\n        if (path.contains(\"%2f\") || path.contains(\"%2F\")) {\n          return HttpResponse.of(HttpStatus.BAD_REQUEST);\n        }\n        return delegate.serve(ctx, req);\n      })\n  )\n  .build()\n```\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n* Open an issue in [line/armeria](https://github.com/line/armeria)\n* Chat with us at [Slack](https://armeria.dev/s/slack)\n\n### Credits\n\nThis vulnerability was originally reported by Abdallah Zaher ([elcayser-0x0a](https://hackerone.com/elcayser-0x0a?type=user)).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.linecorp.armeria:armeria"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.12.0"
      }, {
        "fixed" : "1.13.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/line/armeria/security/advisories/GHSA-8fp4-rp6c-5gcv"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-43795"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/line/armeria/pull/3855"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/line/armeria/commit/e2697a575e9df6692b423e02d731f293c1313284"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/line/armeria"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-12-02T21:28:29Z",
    "nvd_published_at" : "2021-12-02T18:15:00Z"
  }
}