Code Injection Affecting @blakeembrey/template package, versions <1.2.0


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    Exploit Maturity
    Proof of concept
    EPSS
    0.09% (41st 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 ID SNYK-JS-BLAKEEMBREYTEMPLATE-7888169
  • published 4 Sep 2024
  • disclosed 3 Sep 2024
  • credit filipeom, Miguel Coimbra

How to fix?

Upgrade @blakeembrey/template to version 1.2.0 or higher.

Overview

@blakeembrey/template is a Fast and simple string template library

Affected versions of this package are vulnerable to Code Injection due to untrusted input passed as the template display name, if the attacker has access to write the template name.

PoC


const { template } = require('@blakeembrey/template');

template("Hello {{name}}!", "exploit() {} && ((()=>{ console.log('success'); })()) && function pwned");

References

CVSS Scores

version 4.0
version 3.1
Expand this section

Snyk

Recommended
6.3 medium
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    Low
  • Attack Requirements (AT)
    Present
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    None
  • Confidentiality (VC)
    None
  • Integrity (VI)
    Low
  • Availability (VA)
    None
  • Confidentiality (SC)
    None
  • Integrity (SI)
    None
  • Availability (SA)
    None