CWE

Common Weakness Enumeration

A Community-Developed Dictionary of Software Weakness Types

Common Weakness Scoring System
Common Weakness Risk Analysis Framework
Home > CWE List > CWE- Individual Dictionary Definition (2.8)  

Presentation Filter:

CWE-915: Improperly Controlled Modification of Dynamically-Determined Object Attributes

 
Improperly Controlled Modification of Dynamically-Determined Object Attributes
Weakness ID: 915 (Weakness Base)Status: Incomplete
+ Description

Description Summary

The software receives input from an upstream component that specifies multiple attributes, properties, or fields that are to be initialized or updated in an object, but it does not properly control which attributes can be modified.

Extended Description

If the object contains attributes that were only intended for internal use, then their unexpected modification could lead to a vulnerability.

This weakness is sometimes known by the language-specific mechanisms that make it possible, such as mass assignment, autobinding, or object injection.

+ Alternate Terms
Mass Assignment:

"Mass assignment" is the name of a feature in Ruby on Rails that allows simultaneous modification of multiple object attributes.

AutoBinding:

The "Autobinding" term is used in frameworks such as Spring MVC and ASP.NET MVC.

Object injection:

This term seems to be preferred by some PHP application researchers who attack unsafe use of the unserialize() function.

+ Time of Introduction
  • Architecture and Design
  • Implementation
+ Applicable Platforms

Languages

Ruby

ASP.NET

PHP

Python

Language-independent

+ Common Consequences
ScopeEffect
Integrity

Technical Impact: Modify application data

An attacker could modify sensitive data or program variables.

Integrity

Technical Impact: Execute unauthorized code or commands

Other
Integrity

Technical Impact: Varies by context; Alter execution logic

+ Observed Examples
ReferenceDescription
Mass assignment allows modification of arbitrary attributes using modified URL.
Source version control product allows modification of trusted key using mass assignment.
Attackers can bypass payment step in e-commerce software.
Use of PHP unserialize function on untrusted input allows attacker to modify application configuration.
Use of PHP unserialize function on untrusted input in content management system might allow code execution.
Use of PHP unserialize function on untrusted input in content management system allows code execution using a crafted cookie value.
Content management system written in PHP allows unserialize of arbitrary objects, possibly allowing code execution.
Content management system written in PHP allows code execution through page comments.
Use of PHP unserialize function on cookie value allows remote code execution or upload of arbitrary files.
Content management system written in Python interprets untrusted data as pickles, allowing code execution.
Python script allows local users to execute code via pickled data.
Python script allows remote attackers to execute arbitrary code using pickled objects.
Ruby on Rails allows deserialization of untrusted YAML to execute arbitrary code.
Spring framework allows deserialization of objects from untrusted sources to execute arbitrary code.
Grails allows binding of arbitrary parameters to modify arbitrary object properties.
Incorrect deserialization in web browser allows escaping the sandbox.
Media library allows deserialization of objects by untrusted Java applets, leading to arbitrary code execution.
+ Potential Mitigations

Phase: Implementation

If available, use features of the language or framework that allow specification of white lists of attributes or fields that are allowed to be modified. If possible, prefer white lists over black lists.

For applications written with Ruby on Rails, use the attr_accessible (white list) or attr_protected (black list) macros in each class that may be used in mass assignment.

Phases: Architecture and Design; Implementation

If available, use the signing/sealing features of the programming language to assure that deserialized data has not been tainted. For example, a hash-based message authentication code (HMAC) could be used to ensure that data has not been modified.

Phase: Implementation

Strategy: Input Validation

For any externally-influenced input, check the input against a white list of internal object attributes or fields that are allowed to be modified.

Phases: Implementation; Architecture and Design

Strategy: Refactoring

Refactor the code so that object attributes or fields do not need to be dynamically identified, and only expose getter/setter functionality for the intended attributes.

+ Weakness Ordinalities
OrdinalityDescription
Primary
(where the weakness exists independent of other weaknesses)
+ Relationships
NatureTypeIDNameView(s) this relationship pertains toView(s)
ChildOfWeakness ClassWeakness Class913Improper Control of Dynamically-Managed Code Resources
Development Concepts (primary)699
Research Concepts (primary)1000
PeerOfWeakness VariantWeakness Variant502Deserialization of Untrusted Data
Research Concepts1000
+ References
Stefan Esser. "Shocking News in PHP Exploitation". 2009. <http://www.suspekt.org/downloads/POC2009-ShockingNewsInPHPExploitation.pdf>.
Dinis Cruz. ""Two Security Vulnerabilities in the Spring Framework's MVC" pdf (from 2008)". <http://blog.diniscruz.com/2011/07/two-security-vulnerabilities-in-spring.html>.
Ryan Berg and Dinis Cruz. "Two Security Vulnerabilities in the Spring Framework's MVC". <http://o2platform.files.wordpress.com/2011/07/ounce_springframework_vulnerabilities.pdf>.
ASPNETUE . "Best Practices for ASP.NET MVC". 2010-09-17. <http://blogs.msdn.com/b/aspnetue/archive/2010/09/17/second_2d00_post.aspx>.
Michael Hartl. "Mass assignment in Rails applications". 2008-09-21. <http://blog.mhartl.com/2008/09/21/mass-assignment-in-rails-applications/>.
Tobi. "Secure your Rails apps!". 2012-03-06. <http://pragtob.wordpress.com/2012/03/06/secure-your-rails-apps/>.
Heiko Webers. "Ruby On Rails Security Guide". <http://guides.rubyonrails.org/security.html#mass-assignment>.
Josh Bush. "Mass Assignment Vulnerability in ASP.NET MVC". 2012-03-05. <http://freshbrewedcode.com/joshbush/2012/03/05/mass-assignment-aspnet-mvc/ >.
K. Scott Allen. "6 Ways To Avoid Mass Assignment in ASP.NET MVC". 2012-03-12. <http://odetocode.com/blogs/scott/archive/2012/03/11/complete-guide-to-mass-assignment-in-asp-net-mvc.aspx>.
Egidio Romano. "PHP Object Injection". 2013-01-22. <https://www.owasp.org/index.php/PHP_Object_Injection>.
Heine Deelstra. "Unserializing user-supplied data, a bad idea". 2010-08-25. <http://heine.familiedeelstra.com/security/unserialize>.
Nadia Alramli. "Why Python Pickle is Insecure". 2009-09-09. <http://nadiana.com/python-pickle-insecure>.
+ Maintenance Notes

The relationships between CWE-502 and CWE-915 need further exploration. CWE-915 is more narrowly scoped to object modification, and is not necessarily used for deserialization.

+ Content History
Submissions
Submission DateSubmitterOrganizationSource
2013-01-26MITREInternal CWE Team
Contributions
Contribution DateContributorOrganizationSource
2013-01-26Dan Amodio, Dave WichersAspect SecurityFeedback
Suggested adding mass assignment, provided references, and clarified relationship with AutoBinding.
Modifications
Modification DateModifierOrganizationSource
2013-07-17CWE Content TeamMITREInternal
updated References
Page Last Updated: July 30, 2014