A vulnerability was found in rgb2hex up to 0.1.5. It has been rated as problematic. This issue affects some unknown processing. The manipulation leads to inefficient regular expression complexity. The attack may be initiated remotely. Upgrading to version 0.1.6 is able to address this issue. The patch is named 9e0c38594432edfa64136fdf7bb651835e17c34f. It is recommended to upgrade the affected component. The associated identifier of this vulnerability is VDB-217151.
rgb2hex versions up to 0.1.5 are vulnerable to a Regular Expression Denial of Service (ReDoS) attack. This allows a remote attacker to cause a denial of service by sending specially crafted input to the affected application, leading to excessive resource consumption and potential service unavailability.
Step 1: Input Submission: The attacker crafts a malicious RGB color string designed to trigger the ReDoS vulnerability. This string is likely to contain a pattern that causes the regular expression engine to backtrack extensively.
Step 2: Input Processing: The vulnerable rgb2hex library receives the malicious input string and attempts to parse it using the problematic regular expression.
Step 3: Catastrophic Backtracking: The regular expression engine begins to evaluate the input. Due to the inefficient regex pattern and the crafted input, the engine enters a state of catastrophic backtracking, exploring a vast number of possibilities.
Step 4: Resource Exhaustion: The backtracking process consumes significant CPU time and memory resources on the server or application hosting the vulnerable library.
Step 5: Denial of Service: The excessive resource consumption leads to a denial of service. The server or application becomes unresponsive or crashes, preventing legitimate users from accessing the service.
The vulnerability lies within the regular expression used by the rgb2hex library to parse and convert RGB color values. Specifically, the regex is crafted in a way that allows for catastrophic backtracking when processing certain malicious inputs. This leads to exponential time complexity, allowing an attacker to cause a denial of service by providing a carefully constructed input string. The root cause is an inefficient regular expression pattern that allows for excessive backtracking, a common characteristic of ReDoS vulnerabilities. The specific regex pattern is not provided in the CVE, but it can be inferred that it likely involves nested quantifiers or other constructs that lead to exponential backtracking.