GHSA-r74q-gxcg-73hx

Source
https://github.com/advisories/GHSA-r74q-gxcg-73hx
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2019/09/GHSA-r74q-gxcg-73hx/GHSA-r74q-gxcg-73hx.json
Aliases
Published
2019-09-30T19:41:15Z
Modified
2024-02-18T05:31:50.283788Z
Details

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:

  • 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:

<%= 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 * Email us at opensource@plataformatec.com.br

References

Affected packages

RubyGems / simple_form

Package

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0The exact introduced commit is unknown
Fixed
5.0.0

Affected versions

0.*

0.4.0
0.5

1.*

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.*

2.0.0.rc
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.*

3.0.0.beta1
3.0.0.rc
3.0.0
3.0.1
3.0.2
3.0.3
3.0.4
3.1.0.rc1
3.1.0.rc2
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.*

4.0.0
4.0.1
4.1.0