A Regular Expression Denial of Service (ReDoS) vulnerability exists in the cgi gem's CGI::Util#escapeElement method affecting certain versions. Crafted input can cause excessive CPU consumption. This impacts cgi gem versions <=0.3.5, 0.3.6, 0.4.0, and 0.4.1. Fixed versions are 0.3.5.1, 0.3.7, and 0.4.2 or later. The vulnerability affects Ruby 3.1 and 3.2 environments using these gem versions.