Skip to content

A5 Security Misconfig Modification

cktricky edited this page Jul 10, 2015 · 1 revision

Description

Security misconfiguration can happen at any level of an application stack, including the platform, web server, application server, database, framework, and custom code. Developers and system administrators need to work together to ensure that the entire stack is configured properly. Automated scanners are useful for detecting missing patches, misconfigurations, use of default accounts, unnecessary services, etc.

Bug

Rails has quite a few security related configurations. One of which relates to enforcing mass assignment protection.

config.active_record.whitelist_attributes=false

This configuration forces an application developer to whitelist attributes that can be modified with mass-assignment. When this configuration is set to false any attribute can be mass-assigned.

Solution

The solution for this issue is quite simple. In your application.rb file set the configuration as follows.

config.active_record.whitelist_attributes=true

Once this configuration is updated to true and the application is restarted, any attributes to be mass-assigned will have to be defined as attr_accessible.

Hint

It has to do with mass-assignment, whitelisting and configuration.

Sections are divided by their OWASP Top Ten label (A1-A10) and marked as R4 and R5 for Rails 4 and 5.

Clone this wiki locally