CVE-2021-43853: Deserialization of Untrusted Data (CWE-502)
value: Ajax.NET Professional (AjaxPro) is an AJAX framework available for Microsoft ASP.NET. Affected versions of this package are vulnerable to JavaScript object injection which may result in cross site scripting when leveraged by a malicious user. The affected core relates to JavaScript object creation when parsing json input. Releases before version 21.12.22.1 are affected. A workaround exists that replaces one of the core JavaScript files embedded in the library. See the GHSA-5q7q-qqw2-hjq7 for workaround details.
CWE description: The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
CVSS v3 base score: 5.4
Published: 2021-12-22T21:15Z
Repository: https://github.com/michaelschwarz/Ajax.NET-Professional
Language: C#
Files changed: AjaxPro/Utilities/Constant.cs, AjaxPro/core.js
Commit date: 2021-12-22 09:24:12 +0100
Commit message: fixed another XSS issue

Diff: diff --git a/AjaxPro/Utilities/Constant.cs b/AjaxPro/Utilities/Constant.cs
index 42cf933..4b3c46c 100644
--- a/AjaxPro/Utilities/Constant.cs
+++ b/AjaxPro/Utilities/Constant.cs
@@ -50,8 +50,8 @@ namespace AjaxPro
 #endif
 
         /// <summary>
 		/// The assembly version.
 		/// </summary>
-        public const string AssemblyVersion = "21.12.21.2";
+        public const string AssemblyVersion = "21.12.22.1";
 	}
 }
diff --git a/AjaxPro/core.js b/AjaxPro/core.js
index dfe4698..aeeade2 100644
--- a/AjaxPro/core.js
+++ b/AjaxPro/core.js
@@ -177,11 +177,11 @@ Object.extend(AjaxPro, {
 		var date = str.substring(1).replace('"', '');
 		if (date.substring(0, 7) == "\\\/Date(") {
 			var d = date.match(/Date\((.*?)\)/)[1];
 			return "new Date(" + parseInt(d) + ")";
 		}
-		else { // ISO Date 2007-12-31T23:59:59Z                                     
+		/*else { // ISO Date 2007-12-31T23:59:59Z
 			var matches = date.split(/[-,:,T,Z]/);
 			if (matches.length == 7) {
 				matches[1] = (parseInt(matches[1], 0) - 1).toString();
 				var isDate = true;
 				var s = "";
@@ -192,25 +192,21 @@ Object.extend(AjaxPro, {
 					}
 					if (i > 0) {
 						s += ",";
                     }
 					s += parseInt(matches[i], 10);
+					console.log(s);
 				}
 				if (isDate) {
 					return "new Date(Date.UTC(" + s + "))";
 				}
 			}
-		}
+		}*/
 		return str;
 	},
 	parse: function (text) {
-		// not yet possible as we still return new type() JSON
-		//		if (!(!(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(
-		//		text.replace(/"(\\.|[^"\\])*"/g, '')))  ))
-		//			throw new Error("Invalid characters in JSON parse string.");                 
-		var regEx = /(\"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}.*?\")|(\"\\\/Date\(.*?\)\\\/")/g;
-		text = text.replace(regEx, this.regExDate);
+		text = text.replace(/(\"\\\/Date\(\d+\)\\\/")/g, this.regExDate);
 		return eval('(' + text + ')');
 	},
 	m: {
 		'\b': '\\b',
 		'\t': '\\t',

Vulnerable code:         public const string AssemblyVersion = "21.12.21.2";
		else { // ISO Date 2007-12-31T23:59:59Z                                     
		}
		// not yet possible as we still return new type() JSON
		//		if (!(!(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(
		//		text.replace(/"(\\.|[^"\\])*"/g, '')))  ))
		//			throw new Error("Invalid characters in JSON parse string.");                 
		var regEx = /(\"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}.*?\")|(\"\\\/Date\(.*?\)\\\/")/g;
		text = text.replace(regEx, this.regExDate);
Fixed code:         public const string AssemblyVersion = "21.12.22.1";
		/*else { // ISO Date 2007-12-31T23:59:59Z
					console.log(s);
		}*/
		text = text.replace(/(\"\\\/Date\(\d+\)\\\/")/g, this.regExDate);