CVE-2017-1000052: Plug Null Byte Injection Vulnerability

HIGH
Advisory Identifier: GHSA-2q6v-32mr-8p8x
CVSS 7.8
CWE-74
Published
Advisory Summary

CVE-2017-1000052 is a HIGH (CVSS 7.8) null byte injection vulnerability (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')) affecting Plug libraries in the Hex ecosystem. The issue involves null byte injection in plug.static. Remediation is available by upgrading affected packages to version 1.0.4, 1.1.7, 1.2.3, 1.3.2.

CVE-2017-1000052 at a Glance

CVE Identifier CVE-2017-1000052
GHSA Identifier GHSA-2q6v-32mr-8p8x
Severity HIGH
CVSS v3.1 Base Score 7.8
CWE Classification CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
Affected Product Plug
Package Ecosystem Hex
Published Date
Last Updated

Security Impact

CVSS: 7.8

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

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
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-2017-1000052

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

plug fixed: 1.0.4
Upgrade plug to 1.0.4
plug fixed: 1.1.7
Upgrade plug to 1.1.7
plug fixed: 1.2.3
Upgrade plug to 1.2.3
plug fixed: 1.3.2
Upgrade plug to 1.3.2
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 plug

How to Check if You Are Affected

To determine whether your application is affected by CVE-2017-1000052, inspect your project dependencies for Plug:

inspect dependencies for plug

Analyze the terminal output to locate any version of Plug in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.4), 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-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection'), where the product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. In Plug, 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

Plug.Static is used for serving static assets, and is vulnerable to null byte injection. If file upload functionality is provided, this can allow users to bypass filetype restrictions. We recommend all applications that provide file upload functionality and serve those uploaded files locally with Plug.Static to upgrade immediately or include the fix below. If uploaded files are rather stored and served from S3 or any other cloud storage, you are not affected.

CVE-2017-1000052 Affected Plug Versions

4 component(s)
Fixed Versions:
1.0.41.1.71.2.31.3.2
Product / Package Ecosystem Affected Versions Fixed Version
plug
Hex
< 1.0.4
1.0.4
plug
Hex
≥ 1.1.0
< 1.1.7
1.1.7
plug
Hex
≥ 1.2.0
< 1.2.3
1.2.3
plug
Hex
≥ 1.3.0
< 1.3.2
1.3.2

References

Frequently Asked Questions

What is CVE-2017-1000052?
CVE-2017-1000052 is a security vulnerability in Plug involving Null Byte Injection in Plug.Static under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection').
Which Plug versions are affected?
Affected versions include releases prior to 1.0.4, 1.1.7, 1.2.3, 1.3.2 across affected packages: plug.
What version fixes CVE-2017-1000052?
Upgrading to 1.0.4, 1.1.7, 1.2.3, 1.3.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is plug affected?
Yes, plug is affected in releases prior to 1.0.4, 1.1.7, 1.2.3, 1.3.2. Upgrade your dependency to 1.0.4, 1.1.7, 1.2.3, 1.3.2 or later.
What is the CVSS score of CVE-2017-1000052?
CVE-2017-1000052 has a CVSS v3.1 base score of 7.8 (HIGH) with vector string CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2017-1000052?
CVE-2017-1000052 is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') (The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.).
How can I check Hex dependencies for CVE-2017-1000052?
Run the dependency tree command: 'inspect dependencies for plug'. 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-2q6v-32mr-8p8x",
  "modified" : "2022-04-12T21:20:20Z",
  "published" : "2022-04-12T21:20:20Z",
  "aliases" : [ "CVE-2017-1000052" ],
  "summary" : "Null Byte Injection in Plug.Static",
  "details" : "Plug.Static is used for serving static assets, and is vulnerable to null\n  byte injection. If file upload functionality is provided, this can allow\n  users to bypass filetype restrictions.\n  We recommend all applications that provide file upload functionality and\n  serve those uploaded files locally with Plug.Static to upgrade immediately\n  or include the fix below. If uploaded files are rather stored and served\n  from S3 or any other cloud storage, you are not affected.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Hex",
      "name" : "plug"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.0.4"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Hex",
      "name" : "plug"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.1.0"
      }, {
        "fixed" : "1.1.7"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Hex",
      "name" : "plug"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.2.0"
      }, {
        "fixed" : "1.2.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Hex",
      "name" : "plug"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.3.0"
      }, {
        "fixed" : "1.3.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2017-1000052"
  }, {
    "type" : "WEB",
    "url" : "https://elixirforum.com/t/security-releases-for-plug/3913"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/elixir-plug/plug"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-74" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-04-12T21:20:20Z",
    "nvd_published_at" : null
  }
}