Nested Attributes Rejection Bypass Affecting activerecord package, versions < 5.0.0.beta1.1, >= 4.3 < 4.2.5.1, >= 4.2 < 4.1.14.1, >= 3.2.23 < 3.2.22.1, >= 3.1


0.0
medium
  • Attack Complexity

    Low

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • snyk-id

    SNYK-RUBY-ACTIVERECORD-20259

  • published

    24 Jan 2016

  • disclosed

    24 Jan 2016

  • credit

    Justin Coyne

How to fix?

Upgrade ActiveRecord to version 5.0.0.beta1.1, 4.2.5.1, 4.1.14.1, 3.2.22.1 or higher.

Overview

ActiveRecord is the Object-Relational Mapping (ORM) that comes out-of-the-box with Rails. It plays the role of Model in the MVC architecture employed by Rails.

Affected versions of this package are vulnerable to Nested Attributes Rejection Bypass. ActiveRecord handles updates in combination with destroy flags when destroying records is disabled. Attackers could use this do things like set attributes to invalid values and to clear all of the attributes amongst other things.

Details

When using the nested attributes feature in ActiveRecord you can prevent the destruction of associated records by passing the allow_destroy: false option to the accepts_nested_attributes_for method. However due to a change in the commit a9b4b5d the _destroy flag prevents the :reject_if proc from being called because it assumes that the record will be destroyed anyway. However this isn't true if :allow_destroy is false so this leads to changes that would have been rejected being applied to the record.