Advisory

GHSA-q765-wm9j-66qj

Also known as: CVE-2024-45390

Summary

@blakeembrey/template vulnerable to code injection when attacker controls template input

Details

Impact

It is possible to inject and run code within the template if the attacker has access to write the template name.

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

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

Patches

Upgrade to 1.2.0.

Workarounds

Don't pass untrusted input as the template display name, or don't use the display name feature.

References

Fixed by removing in https://github.com/blakeembrey/js-template/commit/b8d9aa999e464816c6cfb14acd1ad0f5d1e335aa.

Severity

Medium Basis: The source's own band: MODERATE

Dates

Published
2024-09-03 19:42 UTC
Modified
2024-11-18 16:27 UTC

Affected packages and fixes

@blakeembrey/template

npm · All systems

Affected

  • introduced 0, fixed 1.2.0 (semver)

Fixed versions

1.2.0

Fix

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences