lib/simple_form/form_builder.rb; a user-supplied string is invoked as a method call
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:
By manipulation that input, an attacker could do any of the following:
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.
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 %>