CVE-2026-47167: Generic Ruby Eval Regex Injection

Evaluating a dynamically built regular expression string using 'Kernel.eval' allows an attacker to break out of the regex literal and execute arbitrary Ruby code. Provide the string directly to 'Regexp.new' instead to safely compile the untrusted input into a regex object.

Provally CuratedPublic repositoryHighMedium confidenceVerifiedApache-2.0Generic
greprules fetch cve-2026-47167-generic-ruby-eval-regex-injection --engine opengrep

Description

Evaluating a dynamically built regular expression string using 'Kernel.eval' allows an attacker to break out of the regex literal and execute arbitrary Ruby code. Provide the string directly to 'Regexp.new' instead to safely compile the untrusted input into a regex object.