Unsafe Object Deserialization Affecting angularjs.core package, versions [1.2.19,1.2.24)



    Exploit Maturity Proof of concept
    Attack Complexity High
    Confidentiality High
    Integrity High

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
  • published 23 Jan 2017
  • disclosed 8 Sep 2014
  • credit Chirayu Krishnappa

How to fix?

Upgrade AngularJS.Core to version 1.2.24 or higher.


AngularJS.Core is an AngularJS.* package for other Angular modules within .NET.

Affected versions of this package are vulnerable to Unsafe Object Deserialization.


The exploitable code:

hasOwnProperty.constructor.prototype.valueOf = valueOf.call;
    ["a", "alert(1)"].sort(hasOwnProperty.constructor);

The exploit:

    1. Array.sort takes a comparison function and passes it 2 parameters to compare.
    2. It then calls .valueOf() if the result is not a primitive.
  • The Function object conveniently accepts two string arguments so so it can be used to construct a function. However, this doesn't do much unless it can be executed.
  • The valueOf function on Function.prototype was set to Function.prototype.call. This causes the function constructed to be executed when sort calls .valueOf() on the result of the comparison.


Serialization is a process of converting an object into a sequence of bytes which can be persisted to a disk or database or can be sent through streams. The reverse process of creating object from sequence of bytes is called deserialization. Serialization is commonly used for communication (sharing objects between multiple hosts) and persistence (store the object state in a file or a database). It is an integral part of popular protocols like Remote Method Invocation (RMI), Java Management Extension (JMX), Java Messaging System (JMS), Action Message Format (AMF), Java Server Faces (JSF) ViewState, etc.

Deserialization of untrusted data (CWE-502) is when the application deserializes untrusted data without sufficiently verifying that the resulting data will be valid, thus allowing the attacker to control the state or the flow of the execution.