CVE-2017-7540: Safemode Safemode Gem Has Incomplete List Vulnerability

CRITICAL
Advisory Identifier: GHSA-5vx5-9q73-wgp4
CVSS 9.8
CWE-184
Published
Advisory Summary

CVE-2017-7540 is a CRITICAL (CVSS 9.8) safemode gem has incomplete list vulnerability (CWE-184: Incomplete List of Disallowed Inputs) affecting Safemode libraries in the RubyGems ecosystem. The issue involves safemode gem has incomplete list of disallowed inputs. Remediation is available by upgrading affected packages to version 1.3.2.

CVE-2017-7540 at a Glance

CVE Identifier CVE-2017-7540
GHSA Identifier GHSA-5vx5-9q73-wgp4
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-184: Incomplete List of Disallowed Inputs
Affected Product Safemode
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 9.8

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

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 High (I:H)
Availability High (A:H)

How to Fix CVE-2017-7540

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

safemode fixed: 1.3.2
Upgrade safemode 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 safemode

How to Check if You Are Affected

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

inspect dependencies for safemode

Analyze the terminal output to locate any version of Safemode in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.3.2), 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-184: Incomplete List of Disallowed Inputs, where the product implements a protection mechanism that relies on a list of inputs (or properties of inputs) that are not allowed by policy or otherwise require other action to neutralize before additional processing takes place, but the list is incomplete. In Safemode, 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

rubygem-safemode, as used in Foreman, versions 1.3.1 and earlier are vulnerable to bypassing safe mode limitations via special Ruby syntax. This can lead to deletion of objects for which the user does not have delete permissions or possibly to privilege escalation.

CVE-2017-7540 Affected Safemode Versions

1 component(s)
Fixed Versions:
1.3.2
Product / Package Ecosystem Affected Versions Fixed Version
safemode
RubyGems
< 1.3.2
1.3.2

References

Frequently Asked Questions

What is CVE-2017-7540?
CVE-2017-7540 is a security vulnerability in Safemode involving Safemode Gem Has Incomplete List of Disallowed Inputs under CWE-184: Incomplete List of Disallowed Inputs.
Which Safemode versions are affected?
Affected versions include releases prior to 1.3.2 across affected packages: safemode.
What version fixes CVE-2017-7540?
Upgrading to 1.3.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is safemode affected?
Yes, safemode is affected in releases prior to 1.3.2. Upgrade your dependency to 1.3.2 or later.
What is the CVSS score of CVE-2017-7540?
CVE-2017-7540 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2017-7540?
CVE-2017-7540 is classified under CWE-184: Incomplete List of Disallowed Inputs (The product implements a protection mechanism that relies on a list of inputs (or properties of inputs) that are not allowed by policy or otherwise require other action to neutralize before additional processing takes place, but the list is incomplete.).
How can I check RubyGems dependencies for CVE-2017-7540?
Run the dependency tree command: 'inspect dependencies for safemode'. 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-5vx5-9q73-wgp4",
  "modified" : "2023-09-05T21:30:18Z",
  "published" : "2017-10-24T18:33:35Z",
  "aliases" : [ "CVE-2017-7540" ],
  "summary" : "Safemode Gem Has Incomplete List of Disallowed Inputs",
  "details" : "rubygem-safemode, as used in Foreman, versions 1.3.1 and earlier are vulnerable to bypassing safe mode limitations via special Ruby syntax. This can lead to deletion of objects for which the user does not have delete permissions or possibly to privilege escalation.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "safemode"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.3.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2017-7540"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/svenfuchs/safemode/pull/23"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/safemode/CVE-2017-7540.yml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/svenfuchs/safemode"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-184" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T21:17:24Z",
    "nvd_published_at" : "2017-07-21T22:29:00Z"
  }
}