CVE-2020-25039: Github.com/sylabs/singularity Insecure Permissions On User Namespace Vulnerability

HIGH
Advisory Identifier: GHSA-w6v2-qchm-grj7
CVSS 8.1
CWE-668 CWE-732
Published
Advisory Summary

CVE-2020-25039 is a HIGH (CVSS 8.1) insecure permissions on user namespace vulnerability (CWE-668: Exposure of Resource to Wrong Sphere) affecting Github.com/sylabs/singularity libraries in the Go ecosystem. The issue involves insecure permissions on user namespace / fakeroot temporary rootfs in singularity. Remediation is available by upgrading affected packages to version 3.6.3.

CVE-2020-25039 at a Glance

CVE Identifier CVE-2020-25039
GHSA Identifier GHSA-w6v2-qchm-grj7
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-668: Exposure of Resource to Wrong Sphere
Affected Product Github.com/sylabs/singularity
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 8.1

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

Attack Vector Network (AV:N)
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 None (A:N)

How to Fix CVE-2020-25039

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

github.com/sylabs/singularity fixed: 3.6.3
Upgrade github.com/sylabs/singularity to 3.6.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 github.com/sylabs/singularity

How to Check if You Are Affected

To determine whether your application is affected by CVE-2020-25039, inspect your project dependencies for Github.com/sylabs/singularity:

inspect dependencies for github.com/sylabs/singularity

Analyze the terminal output to locate any version of Github.com/sylabs/singularity in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.6.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-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 Github.com/sylabs/singularity, 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 Insecure permissions on temporary directories used in fakeroot or user namespace container execution. When a Singularity action command (run, shell, exec) is run with the fakeroot or user namespace option, Singularity will extract a container image to a temporary sandbox directory. Due to insecure permissions on the temporary directory it is possible for any user with access to the system to read the contents of the image. Additionally, if the image contains a world-writable file or directory, it is possible for a user to inject arbitrary content into the running container. ### Patches This issue is addressed in Singularity 3.6.3. All users are advised to upgrade to 3.6.3. ### Workarounds The issue is mitigated if `TMPDIR` is set to a location that is only accessible to the user, as any subdirectories directly under `TMPDIR` cannot then be accessed by others. However, this is difficult to enforce so it is not recommended to rely on this as a mitigation. ### For more information General questions about the impact of the advisory / changes made in the 3.6.0 release can be asked in the: * [Singularity Slack Channel](https://bit.ly/2m0g3lX) * [Singularity Mailing List](https://groups.google.com/a/lbl.gov/forum/??sdf%7Csort:date#!forum/singularity) Any sensitive security concerns should be directed to: security@sylabs.io See our Security Policy here: https://sylabs.io/security-policy

CVE-2020-25039 Affected Github.com/sylabs/singularity Versions

1 component(s)
Fixed Versions:
3.6.3
Product / Package Ecosystem Affected Versions Fixed Version
github.com/sylabs/singularity
Go
≥ 3.2.0
< 3.6.3
3.6.3

References

Frequently Asked Questions

What is CVE-2020-25039?
CVE-2020-25039 is a security vulnerability in Github.com/sylabs/singularity involving Insecure permissions on user namespace / fakeroot temporary rootfs in Singularity under CWE-668: Exposure of Resource to Wrong Sphere.
Which Github.com/sylabs/singularity versions are affected?
Affected versions include releases prior to 3.6.3 across affected packages: github.com/sylabs/singularity.
What version fixes CVE-2020-25039?
Upgrading to 3.6.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/sylabs/singularity affected?
Yes, github.com/sylabs/singularity is affected in releases prior to 3.6.3. Upgrade your dependency to 3.6.3 or later.
What is the CVSS score of CVE-2020-25039?
CVE-2020-25039 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2020-25039?
CVE-2020-25039 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 Go dependencies for CVE-2020-25039?
Run the dependency tree command: 'inspect dependencies for github.com/sylabs/singularity'. 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-w6v2-qchm-grj7",
  "modified" : "2021-05-24T17:12:01Z",
  "published" : "2021-12-20T18:25:46Z",
  "aliases" : [ "CVE-2020-25039" ],
  "summary" : "Insecure permissions on user namespace / fakeroot temporary rootfs in Singularity",
  "details" : "### Impact\n\nInsecure permissions on temporary directories used in fakeroot or user namespace container execution.\n\nWhen a Singularity action command (run, shell, exec) is run with the fakeroot or user namespace option, Singularity will extract a container image to a temporary sandbox directory. Due to insecure permissions on the temporary directory it is possible for any user with access to the system to read the contents of the image. Additionally, if the image contains a world-writable file or directory, it is possible for a user to inject arbitrary content into the running container.\n\n### Patches\n\nThis issue is addressed in Singularity 3.6.3.\n\nAll users are advised to upgrade to 3.6.3.\n\n### Workarounds\n\nThe issue is mitigated if `TMPDIR` is set to a location that is only accessible to the user, as any subdirectories directly under `TMPDIR` cannot then be accessed by others. However, this is difficult to enforce so it is not recommended to rely on this as a mitigation.\n\n### For more information\n\nGeneral questions about the impact of the advisory / changes made in the 3.6.0 release can be asked in the:\n\n* [Singularity Slack Channel](https://bit.ly/2m0g3lX)\n* [Singularity Mailing List](https://groups.google.com/a/lbl.gov/forum/??sdf%7Csort:date#!forum/singularity)\n\nAny sensitive security concerns should be directed to: security@sylabs.io\n\nSee our Security Policy here: https://sylabs.io/security-policy",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/sylabs/singularity"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.2.0"
      }, {
        "fixed" : "3.6.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/hpcng/singularity/security/advisories/GHSA-w6v2-qchm-grj7"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-25039"
  }, {
    "type" : "WEB",
    "url" : "https://medium.com/sylabs"
  }, {
    "type" : "WEB",
    "url" : "http://lists.opensuse.org/opensuse-security-announce/2020-09/msg00070.html"
  }, {
    "type" : "WEB",
    "url" : "http://lists.opensuse.org/opensuse-security-announce/2020-09/msg00088.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-668", "CWE-732" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-24T17:12:01Z",
    "nvd_published_at" : "2020-09-16T18:15:00Z"
  }
}