Code Injection Affecting lodash-rails package, versions <4.17.21


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.46% (65th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Code Injection vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-RUBY-LODASHRAILS-1088056
  • published15 Feb 2021
  • disclosed17 Nov 2020
  • creditMarc Hassan

Introduced: 17 Nov 2020

CVE-2021-23337  (opens in a new tab)
CWE-94  (opens in a new tab)
First added by Snyk

How to fix?

Upgrade lodash-rails to version 4.17.21 or higher.

Overview

lodash-rails is a lodash for the Rails asset pipeline.

Affected versions of this package are vulnerable to Code Injection due the improper validation of options.variable key names in _.template. An attacker can execute arbitrary code at template compilation time by injecting malicious expressions. If Object.prototype has been polluted, inherited properties may also be copied into the imports object and executed.

PoC

var _ = require('lodash');

_.template('', { variable: '){console.log(process.env)}; with(obj' })()

CVSS Base Scores

version 3.1