CVE-2019-16676: Simple form Improper Input Validation Vulnerability

CRITICAL
Advisory Identifier: GHSA-r74q-gxcg-73hx
CVSS 9.8
CWE-20
Published
Advisory Summary

CVE-2019-16676 is a CRITICAL (CVSS 9.8) improper input validation vulnerability (CWE-20: Improper Input Validation) affecting Simple form libraries in the RubyGems ecosystem. The issue involves improper input validation in simple_form. Remediation is available by upgrading affected packages to version 5.0.0.

CVE-2019-16676 at a Glance

CVE Identifier CVE-2019-16676
GHSA Identifier GHSA-r74q-gxcg-73hx
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-20: Improper Input Validation
Affected Product Simple form
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.1/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-2019-16676

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

simple_form fixed: 5.0.0
Upgrade simple_form to 5.0.0
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 simple_form

How to Check if You Are Affected

To determine whether your application is affected by CVE-2019-16676, inspect your project dependencies for Simple form:

inspect dependencies for simple_form

Analyze the terminal output to locate any version of Simple form in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.0.0), 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-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Simple form, 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

## Incorrect Access Control in `file_method?` in `lib/simple_form/form_builder.rb`; a user-supplied string is invoked as a method call ### Impact For pages that build a form using user input, it is possible for an attacker to manipulate the input and send any method present in the form object. For example: ```erb <%= simple_form_for @user do |f| %> <%= f.label @user_supplied_string %> ... <% end %> ``` The string provided in the variable `@user_supplied_string` would be invoked as a method call inside the `@user` object (unless the string contains any of the following: `password`, `time_zone`, `country`, `email`, `phone` and `url`). By manipulation that input, an attacker could do any of the following: - Code execution (call actions like `#destroy`) - Denial of Service (by executing a computation intensive method) - Information Disclosure (check the presence of methods, leak user information) ### Patches The problem was fixed in version `5.0`. Although it's a major version, there should be no issues with upgrading for `4.x`. The reason it was released in a major version is that the configuration `SimpleForm.file_methods` was deprecated in order to fix the problem. ### Workarounds The issue only happens with pages that build forms based on user-provided input. If your application doesn't do that, you're not affected. A workaround is to explicitly pass which type you want for an input since the issue lies on Simple Form's automatically discovery of input types. This can be done using the `as` option, like the following: ```erb <%= form.input :avatar, as: :file %> ``` ### References [TDB] ### For more information If you have any questions or comments about this advisory: * Open an issue in [https://github.com/plataformatec/simple_form](https://github.com/plataformatec/simple_form) * Email us at [opensource@plataformatec.com.br](mailto:opensource@plataformatec.com.br)

CVE-2019-16676 Affected Simple form Versions

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

References

Frequently Asked Questions

What is CVE-2019-16676?
CVE-2019-16676 is a security vulnerability in Simple form involving Improper Input Validation in simple_form under CWE-20: Improper Input Validation.
Which Simple form versions are affected?
Affected versions include releases prior to 5.0.0 across affected packages: simple_form.
What version fixes CVE-2019-16676?
Upgrading to 5.0.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is simple_form affected?
Yes, simple_form is affected in releases prior to 5.0.0. Upgrade your dependency to 5.0.0 or later.
What is the CVSS score of CVE-2019-16676?
CVE-2019-16676 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2019-16676?
CVE-2019-16676 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check RubyGems dependencies for CVE-2019-16676?
Run the dependency tree command: 'inspect dependencies for simple_form'. 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-r74q-gxcg-73hx",
  "modified" : "2023-08-28T10:44:04Z",
  "published" : "2019-09-30T19:41:15Z",
  "aliases" : [ "CVE-2019-16676" ],
  "summary" : "Improper Input Validation in simple_form",
  "details" : "## Incorrect Access Control in `file_method?` in `lib/simple_form/form_builder.rb`; a user-supplied string is invoked as a method call\n\n### Impact\nFor pages that build a form using user input, it is possible for an attacker to manipulate the input and send any method present in the form object. For example:\n\n```erb\n<%= simple_form_for @user do |f| %>\n  <%= f.label @user_supplied_string %>\n  ...\n<% end %>\n```\n\nThe string provided in the variable `@user_supplied_string` would be invoked as a method call inside the `@user` object (unless the string contains any of the following: `password`, `time_zone`, `country`, `email`, `phone` and `url`).\n\nBy manipulation that input, an attacker could do any of the following:\n\n- Code execution (call actions like `#destroy`)\n- Denial of Service (by executing a computation intensive method)\n- Information Disclosure (check the presence of methods, leak user information)\n\n### Patches\nThe problem was fixed in version `5.0`. Although it's a major version, there should be no issues with upgrading for `4.x`. The reason it was released in a major version is that the configuration `SimpleForm.file_methods` was deprecated in order to fix the problem.\n\n### Workarounds\nThe issue only happens with pages that build forms based on user-provided input. If your application doesn't do that, you're not affected.\nA workaround is to explicitly pass which type you want for an input since the issue lies on Simple Form's automatically discovery of input types. This can be done using the `as` option, like the following:\n```erb\n<%= form.input :avatar, as: :file %>\n```\n\n### References\n[TDB]\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [https://github.com/plataformatec/simple_form](https://github.com/plataformatec/simple_form)\n* Email us at [opensource@plataformatec.com.br](mailto:opensource@plataformatec.com.br)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "simple_form"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/plataformatec/simple_form/security/advisories/GHSA-r74q-gxcg-73hx"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2019-16676"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/heartcombo/simple_form/commit/8c91bd76a5052ddf3e3ab9fd8333f9aa7b2e2dd6"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-r74q-gxcg-73hx"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/heartcombo/simple_form"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/plataformatec/simple_form/commits/master"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/simple_form/CVE-2019-16676.yml"
  }, {
    "type" : "WEB",
    "url" : "http://blog.plataformatec.com.br/2019/09/incorrect-access-control-in-simple-form-cve-2019-16676"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T21:53:49Z",
    "nvd_published_at" : null
  }
}