CVE-2018-25077 (published 2023-01-18T01:15Z)

A vulnerability was found in melnaron mel-spintax. It has been rated as problematic. Affected by this issue is some unknown functionality of the file lib/spintax.js. The manipulation of the argument text leads to inefficient regular expression complexity. The name of the patch is 37767617846e27b87b63004e30216e8f919637d3. It is recommended to apply a patch to fix this issue. The identifier of this vulnerability is VDB-218456.

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

Weakness information:
cwe_id: CWE-1333
cwe_name: Inefficient Regular Expression Complexity
description: The product uses a regular expression with an inefficient, possibly exponential worst-case computational complexity that consumes excessive CPU cycles.
extended_description: Some regular expression engines have a feature called "backtracking". If the token cannot match, the engine "backtracks" to a position that may result in a different token that can match.
                Backtracking becomes a weakness if all of these conditions are met:
                
                    The number of possible backtracking attempts are exponential relative to the length of the input.
                    The input can fail to match the regular expression.
                    The input can be long enough.
                
		
		  Attackers can create crafted inputs that
		  intentionally cause the regular expression to use
		  excessive backtracking in a way that causes the CPU
		  consumption to spike.
		
            
            

Fix information:
repo_url: https://github.com/melnaron/mel-spintax
commit_details: repo_url: https://github.com/melnaron/mel-spintax
author: Dmitry Gureev
author_date: 2018-06-01 23:16:20-07:00
msg: Fix possible ReDoS attack
repository: repo_url: https://github.com/melnaron/mel-spintax
repo_name: melnaron/mel-spintax
description: Parse Spintax formatted text (Nested Spintax supported)
repo_language: JavaScript
owner: melnaron
file_changes: filename: .gitignore
change_type: ModificationType.MODIFY
diff: @@ -1,2 +1,3 @@
 .DS_Store
 .idea
+.vscode

programming_language: SQL
filename: .npmignore
change_type: ModificationType.MODIFY
diff: @@ -1,3 +1,4 @@
 .DS_Store
 .idea
+.vscode
 .git*

programming_language: SQL
filename: spintax.js
change_type: ModificationType.MODIFY
diff: @@ -34,7 +34,7 @@
 	 * @return {Boolean}
 	 */
 	exports.isSpintax = function(text) {
-		return text.match(/{.*(\|.*)+}/) !== null;
+		return text.match(/\{[^}]*\|*[^}]*\}/) !== null;
 	};
 
 	/**
@@ -44,7 +44,7 @@
 	 * @return {null|Array}
 	 */
 	exports.findSpintax = function(text) {
-		return text.match(/{([^{}]+?)}/);
+		return text.match(/\{([^{}]+?)\}/);
 	};
 
 	/**
@@ -152,7 +152,7 @@
 		text = exports.unspin(text);
 
 		// Check text for remaining Spintax format sequences: { then | or | then }
-		return text.match(/({[^}]*\|)|(\|[^{]*})/) === null;
+		return text.match(/(\{[^}]*\|)|(\|[^{]*\})/) === null;
 	};
 
 })(typeof exports === 'undefined' ? this['spintax'] = {} : exports);

programming_language: JavaScript
filename: package.json
change_type: ModificationType.MODIFY
diff: @@ -1,6 +1,6 @@
 {
   "name": "mel-spintax",
-  "version": "1.0.2",
+  "version": "1.0.3",
   "description": "Parse Spintax formatted text (Nested Spintax supported)",
   "main": "index.js",
   "directories": {

programming_language: Jupyter Notebook