CVE-2020-5258 (published 2020-03-10T18:15Z)

In affected versions of dojo (NPM package), the deepCopy method is vulnerable to Prototype Pollution. Prototype Pollution refers to the ability to inject properties into existing JavaScript language construct prototypes, such as objects. An attacker manipulates these attributes to overwrite, or pollute, a JavaScript application object prototype of the base object by injecting other values. This has been patched in versions 1.12.8, 1.13.7, 1.14.6, 1.15.3 and 1.16.2

Severity: MEDIUM
CVSS v2 base score: 5.0 (AV:N/AC:L/Au:N/C:N/I:P/A:N)
CVSS v3 base score: 7.7, HIGH (CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N)

Weakness information:
cwe_id: CWE-94
cwe_name: Improper Control of Generation of Code ('Code Injection')
description: The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
extended_description: 
            When a product allows a user's input to contain code syntax, it might be possible for an attacker to craft the code in such a way that it will alter the intended control flow of the product. Such an alteration could lead to arbitrary code execution.
            Injection problems encompass a wide variety of issues -- all mitigated in very different ways. For this reason, the most effective way to discuss these weaknesses is to note the distinct features which classify them as injection weaknesses. The most important issue to note is that all injection problems share one thing in common -- i.e., they allow for the injection of control plane data into the user-controlled data plane. This means that the execution of the process may be altered by sending code in through legitimate data channels, using no other mechanism. While buffer overflows, and many other flaws, involve the use of some further issue to gain execution, injection problems need only for the data to be parsed. The most classic instantiations of this category of weakness are SQL injection and format string vulnerabilities.
         
         

Fix information:
repo_url: https://github.com/dojo/dojo
commit_details: repo_url: https://github.com/dojo/dojo
author: Nick Nisi
author_date: 2020-03-10 09:12:16-05:00
msg: Merge pull request from GHSA-jxfh-8wgv-vfr2
repository: repo_url: https://github.com/dojo/dojo
repo_name: dojo/dojo
description: Dojo 1 - the Dojo 1 toolkit core library.
repo_language: JavaScript
owner: dojo
file_changes: filename: util.js
change_type: ModificationType.MODIFY
diff: @@ -44,7 +44,7 @@ define([
 		for (var name in source) {
 			var tval = target[name],
   			    sval = source[name];
-			if (tval !== sval) {
+			if (name !== '__proto__' && tval !== sval) {
 				if (shouldDeepCopy(sval)) {
 					if (Object.prototype.toString.call(sval) === '[object Date]') { // use this date test to handle crossing frame boundaries
 						target[name] = new Date(sval);

programming_language: JavaScript
filename: util.js
change_type: ModificationType.MODIFY
diff: @@ -34,6 +34,12 @@ define([
 			assert.equal(object1.banana.purchased.getTime(), new Date(2017, 0, 1).getTime());
 		},
 
+		'.deepCopy should ignore the __proto__ property': function() {
+			var payload = JSON.parse('{ "__proto__": { "protoPollution": true }}');
+			util.deepCopy({}, payload);
+			assert.isUndefined(({}).protoPollution);
+		},
+
 		'deepCopy with FormData': function(){
 			if (has('native-formdata')) {
 				var formData = new FormData();

programming_language: JavaScript