Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLXI3NHEtZ3hjZy03M2h4

Improper Input Validation in simple_form

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:

<%= 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:

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:

<%= form.input :avatar, as: :file %>

References

[TDB]

For more information

If you have any questions or comments about this advisory:

Permalink: https://github.com/advisories/GHSA-r74q-gxcg-73hx
JSON: https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLXI3NHEtZ3hjZy03M2h4
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Critical
Classification: General
Published: over 4 years ago
Updated: 8 months ago


CVSS Score: 9.8
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Identifiers: GHSA-r74q-gxcg-73hx, CVE-2019-16676
References: Repository: https://github.com/plataformatec/simple_form
Blast Radius: 48.3

Affected Packages

rubygems:simple_form
Dependent packages: 436
Dependent repositories: 85,278
Downloads: 68,084,778 total
Affected Version Ranges: < 5.0.0
Fixed in: 5.0.0
All affected versions: 0.4.0, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.2.0, 1.2.1, 1.2.2, 1.3.0, 1.3.1, 1.4.0, 1.4.1, 1.4.2, 1.5.0, 1.5.1, 1.5.2, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.1.0, 3.1.1, 3.2.0, 3.2.1, 3.3.0, 3.3.1, 3.4.0, 3.5.0, 3.5.1, 4.0.0, 4.0.1, 4.1.0
All unaffected versions: 5.0.0, 5.0.1, 5.0.2, 5.0.3, 5.1.0, 5.2.0, 5.3.0