CVE-2021-23390 (published 2021-07-12T16:15Z)

The package total4 before 0.0.43 are vulnerable to Arbitrary Code Execution via the U.set() and U.get() functions.

Severity: HIGH
CVSS v2 base score: 7.5 (AV:N/AC:L/Au:N/C:P/I:P/A:P)
CVSS v3 base score: 9.8, CRITICAL (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H)

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/totaljs/framework4
commit_details: repo_url: https://github.com/totaljs/framework4
author: Peter Širka
author_date: 2021-06-04 11:37:12+02:00
msg: Removed useless methods.
repository: repo_url: https://github.com/totaljs/framework4
repo_name: totaljs/framework4
description: Total.js framework v4
repo_language: JavaScript
owner: totaljs
file_changes: filename: changelog.txt
change_type: ModificationType.MODIFY
diff: @@ -3,6 +3,10 @@
 ========================
 
 - improved `flowinstance.newmessage(data)` method
+- removed method `U.set()`
+- removed method `U.get()`
+- removed method `U.sync()` and `global.sync()`
+- removed method `U.sync2()` and `global.sync2()`
 
 ========================
 0.0.42

programming_language: Markdown
filename: utils.js
change_type: ModificationType.MODIFY
diff: @@ -5203,64 +5203,6 @@ FLP.next = function() {
 	self.onComplete(self.file, self.directory);
 };
 
-exports.sync = function(fn, owner) {
-	return function() {
-
-		var args = [].slice.call(arguments);
-		var params;
-		var callback;
-		var executed = false;
-		var self = owner || this;
-
-		args.push(function() {
-			params = arguments;
-			if (!executed && callback) {
-				executed = true;
-				callback.apply(self, params);
-			}
-		});
-
-		fn.apply(self, args);
-
-		return function(cb) {
-			callback = cb;
-			if (!executed && params) {
-				executed = true;
-				callback.apply(self, params);
-			}
-		};
-	};
-};
-
-exports.sync2 = function(fn, owner) {
-	return (function() {
-
-		var params;
-		var callback;
-		var executed = false;
-		var self = owner || this;
-		var args = [].slice.call(arguments);
-
-		args.push(function() {
-			params = arguments;
-			if (!executed && callback) {
-				executed = true;
-				callback.apply(self, params);
-			}
-		});
-
-		fn.apply(self, args);
-
-		return function(cb) {
-			callback = cb;
-			if (!executed && params) {
-				executed = true;
-				callback.apply(self, params);
-			}
-		};
-	})();
-};
-
 exports.async = function(fn, isApply) {
 	var context = this;
 	return function(complete) {
@@ -5475,92 +5417,6 @@ exports.parseTheme = function(value) {
 	return value === '?' ? CONF.default_theme : value;
 };
 
-exports.set = function(obj, path, value) {
-	var cachekey = 'S+' + path;
-
-	if (F.temporary.other[cachekey])
-		return F.temporary.other[cachekey](obj, value);
-
-	var arr = parsepath(path);
-	var builder = [];
-
-	for (var i = 0; i < arr.length - 1; i++) {
-		var type = arr[i + 1] ? (REGISARR.test(arr[i + 1]) ? '[]' : '{}') : '{}';
-		var p = 'w' + (arr[i][0] === '[' ? '' : '.') + arr[i];
-		builder.push('if(typeof(' + p + ')!==\'object\'||' + p + '==null)' + p + '=' + type + ';');
-	}
-
-	var v = arr[arr.length - 1];
-	var ispush = v.lastIndexOf('[]') !== -1;
-	var a = builder.join(';') + ';var v=typeof(a)===\'function\'?a(U.get(b)):a;w' + (v[0] === '[' ? '' : '.') + (ispush ? v.replace(REGREPLACEARR, '.push(v)') : (v + '=v')) + ';return v';
-
-	if ((/__proto__|constructor|prototype|eval/).test(a))
-		throw new Error('Potential vulnerability');
-
-	var fn = new Function('w', 'a', 'b', a);
-	F.temporary.other[cachekey] = fn;
-	fn(obj, value, path);
-};
-
-exports.get = function(obj, path) {
-
-	var cachekey = 'G=' + path;
-
-	if (F.temporary.other[cachekey])
-		return F.temporary.other[cachekey](obj);
-
-	var arr = parsepath(path);
-	var builder = [];
-
-	for (var i = 0, length = arr.length - 1; i < length; i++)
-		builder.push('if(!w' + (!arr[i] || arr[i][0] === '[' ? '' : '.') + arr[i] + ')return');
-
-	var v = arr[arr.length - 1];
-	var fn = (new Function('w', builder.join(';') + ';return w' + (v[0] === '[' ? '' : '.') + v));
-	F.temporary.other[cachekey] = fn;
-	return fn(obj);
-};
-
-function parsepath(path) {
-
-	var arr = path.split('.');
-	var builder = [];
-	var all = [];
-
-	for (var i = 0; i < arr.length; i++) {
-		var p = arr[i];
-		var index = p.indexOf('[');
-		if (index === -1) {
-			if (p.indexOf('-') === -1) {
-				all.push(p);
-				builder.push(all.join('.'));
-			} else {
-				var a = all.splice(all.length - 1);
-				all.push(a + '[\'' + p + '\']');
-				builder.push(all.join('.'));
-			}
-		} else {
-			if (p.indexOf('-') === -1) {
-				all.push(p.substring(0, index));
-				builder.push(all.join('.'));
-				all.splice(all.length - 1);
-				all.push(p);
-				builder.push(all.join('.'));
-			} else {
-				all.push('[\'' + p.substring(0, index) + '\']');
-				builder.push(all.join(''));
-				all.push(p.substring(index));
-				builder.push(all.join(''));
-			}
-		}
-	}
-
-	return builder;
-}
-
-global.sync = exports.sync;
-global.sync2 = exports.sync2;
-
 // =============================================
 // SHELL SORT IMPLEMENTATION OF ALGORITHM
 // =============================================

programming_language: JavaScript