Common Weakness Enumeration

CWE-242

Allowed

Use of Inherently Dangerous Function

Abstraction: Base · Status: Draft

The product calls a function that can never be guaranteed to work safely.

11 vulnerabilities reference this CWE, most recent first.

CVE-2017-0904 (GCVE-0-2017-0904)

Vulnerability from cvelistv5 – Published: 2017-11-13 17:00 – Updated: 2024-09-17 01:56
VLAI
Summary
The private_address_check ruby gem before 0.4.0 is vulnerable to a bypass due to use of Ruby's Resolv.getaddresses method, which is OS-dependent and should not be relied upon for security measures, such as when used to blacklist private network addresses to prevent server-side request forgery.
Severity
No CVSS data available.
CWE
  • CWE-242 - Use of Inherently Dangerous Function (CWE-242)
Assigner
hackerone CNA
Impacted products
Vendor Product Version
jtdowney private_address_check ruby gem Affected: Versions before 0.4.0
Create a notification for this product.
Date Public
2017-11-05 00:00
Show details on NVD website

{
  "containers": {
    "adp": [
      {
        "providerMetadata": {
          "dateUpdated": "2024-08-05T13:25:16.406Z",
          "orgId": "af854a3a-2127-422b-91ae-364da2661108",
          "shortName": "CVE"
        },
        "references": [
          {
            "tags": [
              "x_refsource_MISC",
              "x_transferred"
            ],
            "url": "https://hackerone.com/reports/287245"
          },
          {
            "tags": [
              "x_refsource_MISC",
              "x_transferred"
            ],
            "url": "https://edoverflow.com/2017/ruby-resolv-bug/"
          },
          {
            "tags": [
              "x_refsource_CONFIRM",
              "x_transferred"
            ],
            "url": "https://github.com/jtdowney/private_address_check/issues/1"
          },
          {
            "tags": [
              "x_refsource_MISC",
              "x_transferred"
            ],
            "url": "https://hackerone.com/reports/287835"
          },
          {
            "tags": [
              "x_refsource_CONFIRM",
              "x_transferred"
            ],
            "url": "https://github.com/jtdowney/private_address_check/commit/58a0d7fe31de339c0117160567a5b33ad82b46af"
          }
        ],
        "title": "CVE Program Container"
      }
    ],
    "cna": {
      "affected": [
        {
          "product": "private_address_check ruby gem",
          "vendor": "jtdowney",
          "versions": [
            {
              "status": "affected",
              "version": "Versions before 0.4.0"
            }
          ]
        }
      ],
      "datePublic": "2017-11-05T00:00:00.000Z",
      "descriptions": [
        {
          "lang": "en",
          "value": "The private_address_check ruby gem before 0.4.0 is vulnerable to a bypass due to use of Ruby\u0027s Resolv.getaddresses method, which is OS-dependent and should not be relied upon for security measures, such as when used to blacklist private network addresses to prevent server-side request forgery."
        }
      ],
      "problemTypes": [
        {
          "descriptions": [
            {
              "cweId": "CWE-242",
              "description": "Use of Inherently Dangerous Function (CWE-242)",
              "lang": "en",
              "type": "CWE"
            }
          ]
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2017-11-13T16:57:01.000Z",
        "orgId": "36234546-b8fa-4601-9d6f-f4e334aa8ea1",
        "shortName": "hackerone"
      },
      "references": [
        {
          "tags": [
            "x_refsource_MISC"
          ],
          "url": "https://hackerone.com/reports/287245"
        },
        {
          "tags": [
            "x_refsource_MISC"
          ],
          "url": "https://edoverflow.com/2017/ruby-resolv-bug/"
        },
        {
          "tags": [
            "x_refsource_CONFIRM"
          ],
          "url": "https://github.com/jtdowney/private_address_check/issues/1"
        },
        {
          "tags": [
            "x_refsource_MISC"
          ],
          "url": "https://hackerone.com/reports/287835"
        },
        {
          "tags": [
            "x_refsource_CONFIRM"
          ],
          "url": "https://github.com/jtdowney/private_address_check/commit/58a0d7fe31de339c0117160567a5b33ad82b46af"
        }
      ],
      "x_legacyV4Record": {
        "CVE_data_meta": {
          "ASSIGNER": "support@hackerone.com",
          "DATE_PUBLIC": "2017-11-05T00:00:00",
          "ID": "CVE-2017-0904",
          "STATE": "PUBLIC"
        },
        "affects": {
          "vendor": {
            "vendor_data": [
              {
                "product": {
                  "product_data": [
                    {
                      "product_name": "private_address_check ruby gem",
                      "version": {
                        "version_data": [
                          {
                            "version_value": "Versions before 0.4.0"
                          }
                        ]
                      }
                    }
                  ]
                },
                "vendor_name": "jtdowney"
              }
            ]
          }
        },
        "data_format": "MITRE",
        "data_type": "CVE",
        "data_version": "4.0",
        "description": {
          "description_data": [
            {
              "lang": "eng",
              "value": "The private_address_check ruby gem before 0.4.0 is vulnerable to a bypass due to use of Ruby\u0027s Resolv.getaddresses method, which is OS-dependent and should not be relied upon for security measures, such as when used to blacklist private network addresses to prevent server-side request forgery."
            }
          ]
        },
        "problemtype": {
          "problemtype_data": [
            {
              "description": [
                {
                  "lang": "eng",
                  "value": "Use of Inherently Dangerous Function (CWE-242)"
                }
              ]
            }
          ]
        },
        "references": {
          "reference_data": [
            {
              "name": "https://hackerone.com/reports/287245",
              "refsource": "MISC",
              "url": "https://hackerone.com/reports/287245"
            },
            {
              "name": "https://edoverflow.com/2017/ruby-resolv-bug/",
              "refsource": "MISC",
              "url": "https://edoverflow.com/2017/ruby-resolv-bug/"
            },
            {
              "name": "https://github.com/jtdowney/private_address_check/issues/1",
              "refsource": "CONFIRM",
              "url": "https://github.com/jtdowney/private_address_check/issues/1"
            },
            {
              "name": "https://hackerone.com/reports/287835",
              "refsource": "MISC",
              "url": "https://hackerone.com/reports/287835"
            },
            {
              "name": "https://github.com/jtdowney/private_address_check/commit/58a0d7fe31de339c0117160567a5b33ad82b46af",
              "refsource": "CONFIRM",
              "url": "https://github.com/jtdowney/private_address_check/commit/58a0d7fe31de339c0117160567a5b33ad82b46af"
            }
          ]
        }
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "36234546-b8fa-4601-9d6f-f4e334aa8ea1",
    "assignerShortName": "hackerone",
    "cveId": "CVE-2017-0904",
    "datePublished": "2017-11-13T17:00:00.000Z",
    "dateReserved": "2016-11-30T00:00:00.000Z",
    "dateUpdated": "2024-09-17T01:56:09.414Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.1"
}

Mitigation MIT-58
Build and Compilation Implementation

Identify a list of prohibited API functions and prohibit developers from using these functions, providing safer alternatives. In some cases, automatic code analysis tools or the compiler can be instructed to spot use of prohibited functions, such as the "banned.h" include file from Microsoft's SDL. [REF-554] [REF-1009] [REF-7]

Mitigation
Testing

Use grep or static analysis tools to spot usage of dangerous functions.

No CAPEC attack patterns related to this CWE.