CVE-2020-8162: Activestorage Circumvention Of File Size Limits Vulnerability

HIGH
Advisory Identifier: GHSA-m42x-37p3-fv5w
CVSS 7.5
CWE-434 CWE-602
Published
Advisory Summary

CVE-2020-8162 is a HIGH (CVSS 7.5) circumvention of file size limits vulnerability (CWE-434: Unrestricted Upload of File with Dangerous Type) affecting Activestorage libraries in the RubyGems ecosystem. The issue involves circumvention of file size limits in activestorage. Remediation is available by upgrading affected packages to version 5.2.4.3, 6.0.3.1.

CVE-2020-8162 at a Glance

CVE Identifier CVE-2020-8162
GHSA Identifier GHSA-m42x-37p3-fv5w
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-434: Unrestricted Upload of File with Dangerous Type
Affected Product Activestorage
Package Ecosystem RubyGems
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:N/I:H/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 None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2020-8162

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

activestorage fixed: 5.2.4.3
Upgrade activestorage to 5.2.4.3
activestorage fixed: 6.0.3.1
Upgrade activestorage to 6.0.3.1
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 activestorage

How to Check if You Are Affected

To determine whether your application is affected by CVE-2020-8162, inspect your project dependencies for Activestorage:

inspect dependencies for activestorage

Analyze the terminal output to locate any version of Activestorage in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.2.4.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-434: Unrestricted Upload of File with Dangerous Type, where the product allows the upload or transfer of dangerous file types that are automatically processed within its environment. In Activestorage, 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

There is a vulnerability in ActiveStorage's S3 adapter that allows the Content-Length of a direct file upload to be modified by an end user. Versions Affected: rails < 5.2.4.2, rails < 6.0.3.1 Not affected: Applications that do not use the direct upload functionality of the ActiveStorage S3 adapter. Fixed Versions: rails >= 5.2.4.3, rails >= 6.0.3.1 Impact ------ Utilizing this vulnerability, an attacker can control the Content-Length of an S3 direct upload URL without receiving a new signature from the server. This could be used to bypass controls in place on the server to limit upload size. Workarounds ----------- This is a low-severity security issue. As such, no workaround is necessarily until such time as the application can be upgraded.

CVE-2020-8162 Affected Activestorage Versions

2 component(s)
Fixed Versions:
5.2.4.36.0.3.1
Product / Package Ecosystem Affected Versions Fixed Version
activestorage
RubyGems
≥ 5.0.0
< 5.2.4.3
5.2.4.3
activestorage
RubyGems
≥ 6.0.0
< 6.0.3.1
6.0.3.1

References

Frequently Asked Questions

What is CVE-2020-8162?
CVE-2020-8162 is a security vulnerability in Activestorage involving Circumvention of file size limits in ActiveStorage under CWE-434: Unrestricted Upload of File with Dangerous Type.
Which Activestorage versions are affected?
Affected versions include releases prior to 5.2.4.3, 6.0.3.1 across affected packages: activestorage.
What version fixes CVE-2020-8162?
Upgrading to 5.2.4.3, 6.0.3.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is activestorage affected?
Yes, activestorage is affected in releases prior to 5.2.4.3, 6.0.3.1. Upgrade your dependency to 5.2.4.3, 6.0.3.1 or later.
What is the CVSS score of CVE-2020-8162?
CVE-2020-8162 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:N/I:H/A:N.
What CWE is associated with CVE-2020-8162?
CVE-2020-8162 is classified under CWE-434: Unrestricted Upload of File with Dangerous Type (The product allows the upload or transfer of dangerous file types that are automatically processed within its environment.).
How can I check RubyGems dependencies for CVE-2020-8162?
Run the dependency tree command: 'inspect dependencies for activestorage'. 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-m42x-37p3-fv5w",
  "modified" : "2023-07-05T19:19:29Z",
  "published" : "2020-05-26T15:09:48Z",
  "aliases" : [ "CVE-2020-8162" ],
  "summary" : "Circumvention of file size limits in ActiveStorage",
  "details" : "There is a vulnerability in ActiveStorage's S3 adapter that allows the Content-Length of a direct file upload to be modified by an end user.\n\nVersions Affected:  rails < 5.2.4.2, rails < 6.0.3.1\nNot affected:       Applications that do not use the direct upload functionality of the ActiveStorage S3 adapter.\nFixed Versions:     rails >= 5.2.4.3, rails >= 6.0.3.1\n\nImpact\n------\n\nUtilizing this vulnerability, an attacker can control the Content-Length of an S3 direct upload URL without receiving a new signature from the server. This could be used to bypass controls in place on the server to limit upload size.\n\nWorkarounds\n-----------\n\nThis is a low-severity security issue. As such, no workaround is necessarily until such time as the application can be upgraded.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "activestorage"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0"
      }, {
        "fixed" : "5.2.4.3"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.2.4.2"
    }
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "activestorage"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0"
      }, {
        "fixed" : "6.0.3.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 6.0.3"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-8162"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/aws/aws-sdk-ruby/issues/2098"
  }, {
    "type" : "WEB",
    "url" : "https://hackerone.com/reports/789579"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/aws/aws-sdk-ruby"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/activestorage/CVE-2020-8162.yml"
  }, {
    "type" : "WEB",
    "url" : "https://groups.google.com/forum/#!topic/rubyonrails-security/PjU3946mreQ"
  }, {
    "type" : "WEB",
    "url" : "https://groups.google.com/g/rubyonrails-security/c/PjU3946mreQ"
  }, {
    "type" : "WEB",
    "url" : "https://www.debian.org/security/2020/dsa-4766"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-434", "CWE-602" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-05-26T15:06:42Z",
    "nvd_published_at" : "2020-06-19T17:15:00Z"
  }
}