2204
PeerOf 502 Deserialization of Untrusted Data 1204
PeerOf 502 Deserialization of Untrusted Data 1204
Relevant to the view "Software Development" (CWE-699)
Nature Type ID Name Page
MemberOf 399 Resource Management Errors 2324
Weakness Ordinalities
Primary :
Applicable Platforms
Language : Ruby (Prevalence = Undetermined)
Language : ASP.NET (Prevalence = Undetermined)
Language : PHP (Prevalence = Undetermined)
Language : Python (Prevalence = Undetermined)
Language : Not Language-Specific (Prevalence = Undetermined)
Alternate Terms
CWE Version 4.14
CWE-915: Improperly Controlled Modification of Dynamically-Determined Object Attributes
CWE-915: Improperly Controlled Modification
of Dynamically-Determined Object Attributes 1810
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.
PHP Object Injection : Some PHP application researchers use this term for attacking unsafe use
of the unserialize() function, but it is also used for CWE-502.
Common Consequences
Scope Impact Likelihood
Integrity Modify Application Data
An attacker could modify sensitive data or program
variables.
Integrity Execute Unauthorized Code or Commands
Other
Integrity
Varies by Context
Alter Execution Logic
Detection Methods
Automated Static Analysis
Automated static analysis, commonly referred to as Static Application Security Testing (SAST),
can find some instances of this weakness by analyzing source code (or binary/compiled code)
without having to execute it. Typically, this is done by building a model of data flow and control
flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input)
with "sinks" (destinations where the data interacts with external components, a lower layer such
as the OS, etc.)
Effectiveness = High
Potential Mitigations
Phase: Implementation
If available, use features of the language or framework that allow specification of allowlists of
attributes or fields that are allowed to be modified. If possible, prefer allowlists over denylists.
For applications written with Ruby on Rails, use the attr_accessible (allowlist) or attr_protected
(denylist) macros in each class that may be used in mass assignment.
Phase: Architecture and Design
Phase: 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 an allowlist of internal object
attributes or fields that are allowed to be modified.
Phase: Implementation
Phase: 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.
Demonstrative Examples
CWE Version 4.14
CWE-915: Improperly Controlled Modification of Dynamically-Determined Object Attributes
CWE-915: Improperly Controlled Modification
of Dynamically-Determined Object Attributes