Improper Control of Generation of Code (‘Code Injection’)

Property
Languageruby
Severityhigh
CWECWE-94: Improper Control of Generation of Code (‘Code Injection’)
OWASPA03:2021 - Injection
Confidence LevelMedium
Impact LevelMedium
Likelihood LevelHigh

Description

Using Ruby’s eval or related methods with input that can be influenced by users allows attackers to execute arbitrary code in your application. Avoid passing user data to eval or similar functions.

Impact

If exploited, an attacker could run malicious code on your server, potentially gaining access to sensitive data, modifying application behavior, or taking full control of the system. This can lead to data breaches, service disruption, and severe compromise of application integrity.

Improper Control of Generation of Code (‘Code Injection’)

Property
Languageruby
Severitylow
CWECWE-94: Improper Control of Generation of Code (‘Code Injection’)
OWASPA03:2021 - Injection
Confidence LevelLow
Impact LevelMedium
Likelihood LevelLow

Description

Checks for unsafe use of Object#send, try, send, and public_send. These only account for unsafe use of a method, not target. This can lead to arbitrary calling of exit, along with arbitrary code execution. Please be sure to sanitize input in order to avoid this.

Improper Control of Generation of Code (‘Code Injection’)

Property
Languageruby
Severitymedium
CWECWE-94: Improper Control of Generation of Code (‘Code Injection’)
OWASPA03:2021 - Injection
Confidence LevelLow
Impact LevelHigh
Likelihood LevelLow

Description

User-controlled input is being passed directly to Open3 pipeline methods without proper validation or sanitization. This allows attackers to inject and execute arbitrary commands on the server.

Impact

If exploited, an attacker could run malicious code on your server, potentially gaining unauthorized access, stealing data, or compromising the entire system. This can lead to data breaches, loss of service, and significant organizational risk.

Improper Control of Generation of Code (‘Code Injection’)

Property
Languageruby
Severitymedium
CWECWE-94: Improper Control of Generation of Code (‘Code Injection’)
OWASPA03:2021 - Injection
Confidence LevelLow
Impact LevelHigh
Likelihood LevelLow

Description

Using the ‘syscall’ method in Ruby is unsafe because it allows direct system call execution, which can lead to serious security risks and is not portable across platforms. Safer alternatives like the Fiddle library should be used instead.

Impact

If exploited, attackers could execute arbitrary system commands, potentially gaining unauthorized access, running malicious code, or compromising the entire server. This can lead to data breaches, service disruption, or full control over the affected application.

Improper Control of Generation of Code (‘Code Injection’)

Property
Languageruby
Severitymedium
CWECWE-94: Improper Control of Generation of Code (‘Code Injection’)
OWASPA03:2021 - Injection
Confidence LevelLow
Impact LevelHigh
Likelihood LevelLow

Description

The code uses the ‘open’ function with a dynamically constructed command, which may include untrusted input. This can allow attackers to inject and execute arbitrary commands if user data is passed in without proper validation.

Impact

If exploited, an attacker could execute arbitrary system commands on the server, potentially leading to data theft, data loss, or a complete system compromise. This could allow unauthorized access, modification, or destruction of critical application or system resources.

Improper Control of Generation of Code (‘Code Injection’)

Property
Languageruby
Severitymedium
CWECWE-94: Improper Control of Generation of Code (‘Code Injection’)
OWASPA03:2021 - Injection
Confidence LevelLow
Impact LevelHigh
Likelihood LevelLow

Description

Using the :marshal or :hybrid cookie serializer allows cookies to be deserialized with Ruby’s Marshal format, which is unsafe. Attackers who can tamper with cookies may exploit this to run malicious code on your server.

Impact

If exploited, an attacker could achieve remote code execution on your server by crafting a malicious cookie. This could lead to full system compromise, data theft, or further attacks against your users and infrastructure.

Improper Control of Generation of Code (‘Code Injection’)

Property
Languageruby
Severitymedium
CWECWE-94: Improper Control of Generation of Code (‘Code Injection’)
OWASPA03:2021 - Injection
Confidence LevelLow
Impact LevelHigh
Likelihood LevelLow

Description

The code executes shell commands using dynamic values inside backticks in Ruby. If user input is included without proper validation, it could allow attackers to inject and run arbitrary commands.

Impact

An attacker exploiting this could execute any command on the server, potentially gaining unauthorized access, stealing data, deleting files, or compromising the entire system. This can lead to data breaches, service outages, or full system takeover.

Improper Control of Generation of Code (‘Code Injection’)

Property
Languageruby
Severitymedium
CWECWE-94: Improper Control of Generation of Code (‘Code Injection’)
OWASPA03:2021 - Injection
Confidence LevelMedium
Impact LevelMedium
Likelihood LevelMedium

Description

The code passes user-controlled input—such as values from cookies, parameters, or request environment—directly to Ruby reflection methods like tap, method, or to_proc. This allows attackers to influence how methods are called or executed, making the application vulnerable to code injection.