Attack Simulation & Response

Red TeamEnd-to-end simulation using real adversary tradecraft Blue TeamThreat hunting, monitoring and incident response Purple TeamGrow your offensive and defensive teams together Ransomware Response24/7 emergency response for encrypted systems

Security Testing

Penetration TestingFinding flaws in web, network and mobile applications Enterprise Penetration TestingRegulation-aligned testing for finance and large enterprises Vulnerability ScanningContinuous scanning, prioritised with CVSS
A free scoping call tailored to your organisation.
All services Get a quote

Forensic Threat Hunting

PotreX VestigeHidden threat scanning across disk, memory and forensic traces

Threat Intelligence

PotreX ArgosDark web and leak-focused threat intelligence

Penetration Testing

PotreX BallistaEnterprise penetration testing platform with finding management
Every product can be deployed on-premises or in the cloud.
All products Request a demo
Services
Products
Blog Contact Us Sign In
Home / Blog / CVE-2019-10768
Vulnerability Analysis

Prototype Pollution in AngularJS: One Line, Every Object

Summary

In JavaScript every object inherits from a common ancestor through Object.prototype. If an attacker can write properties onto that ancestor, every object in the application is affected at once. That is prototype pollution.

CVE-2019-10768 is exactly that: before AngularJS 1.7.9, angular.merge() did not filter the __proto__ key. Any code path that merges user-supplied JSON into a configuration object hands the attacker global reach.

Advisory details

CVECVE-2019-10768
ComponentAngularJS — angular.merge()
ClassCWE-1321 · Prototype pollution
SeverityCRITICAL · CVSS 9.8
Affected versionsAngularJS < 1.7.9
NoteAngularJS 1.x left long term support in January 2022

Root cause: a special key treated as ordinary

Deep merge helpers copy every key from the source object onto the target. When the __proto__ key is copied, the write lands on the target's prototype rather than the object itself. The affected release had no deny list for key names.

The consequence is that a single request can change default values across the entire application: permission flags, template settings, security options. The pollution persists in process memory long after the request is gone.

Live pollution demo

First, determine which AngularJS version the target serves. The distributed file states it in its opening lines.

analyst@ubuntu: ~/labs/angular –□✕
analyst@ubuntu:~/labs/angular$ curl -s http://lab.local/vendor/angular.min.js | head -c 90
/*
 AngularJS v1.7.8
 (c) 2010-2018 Google, Inc. http://angularjs.org
 License: MIT

#  below 1.7.9 — within CVE-2019-10768

Figure 1 — Identifying the AngularJS version in use

The dependency side tells the same story: npm audit lists the advisory and the affected path directly.

analyst@ubuntu: ~/labs/angular –□✕
analyst@ubuntu:~/labs/angular$ npm audit --omit=dev
angular  <=1.8.3
Severity: critical
Prototype pollution in angular.merge - GHSA-prc3-vjfx-vhm9
fix available via `npm audit fix --force`

1 critical severity vulnerability

Figure 2 — The advisory surfacing on the dependency side

The pollution itself can be demonstrated in a few lines in the Node REPL. The important detail is that the polluted property appears on a brand new, unrelated object.

analyst@ubuntu: ~/labs/angular –□✕
analyst@ubuntu:~/labs/angular$ node -e "require('angular'); const p=JSON.parse('{\"__proto__\":{\"isAdmin\":true}}'); angular.merge({}, p); console.log('new object:', {}.isAdmin)"
new object: true

#  the polluted property shows up on an empty object that never touched merge
#  every object in the process now reports isAdmin=true

Figure 3 — Proving prototype pollution in the Node REPL

From pollution to XSS

Pollution on its own is a capability; the impact depends on where the application reads the polluted property. In AngularJS there are two typical chains:

  • Overriding permission flags: default reads such as options.isAdmin || false start returning true, and client-side interface restrictions fall away.
  • Template injection (CSTI): if a polluted property reaches the compile step, user input is evaluated as an Angular expression and turns into stored XSS.

The second chain needs no additional escape technique, because the expression sandbox was removed in AngularJS 1.6 — an evaluated expression reaches the JavaScript context directly.

Server side is affected too

The same class of bug can rewrite business logic through Object.prototype in SSR or Node-based toolchains, and in some cases reaches command execution (for example by polluting child_process options).

Remediation

The durable answer is migrating off AngularJS; in the meantime, upgrade and freeze the prototype.

analyst@ubuntu: ~/labs/angular –□✕
analyst@ubuntu:~/labs/angular$ npm i angular@1.8.3 && node -e "Object.freeze(Object.prototype); require('angular'); angular.merge({}, JSON.parse('{\"__proto__\":{\"isAdmin\":true}}')); console.log('new object:', {}.isAdmin)"
added 1 package in 3s
new object: undefined

#  the prototype is frozen — the pollution attempt failed silently

Figure 4 — Pollution neutralised by upgrading and freezing the prototype

Conclusion

Prototype pollution is easy to dismiss as “just a client-side bug”, yet a single JSON body can rewrite defaults everywhere in an application. Every deep merge helper needs key name validation — and on end-of-life frameworks the real risk is that findings like this never get a patch at all.

Sources

Test it in your own environment

We inventory your legacy JavaScript dependencies and prove whether they are actually exploitable.

Call now · 0850 551 01 01 WhatsApp · Send a message Email · info@potrex.com