CVE-2024-56159: Astro Package Exposes Server Source Code via Sourcemaps

astro Updated 14 Dec 2025

Summary

19/12/2024
Yes i
High
7.8

CVE-2024-56159: Astro's server source code is exposed to the public if sourcemaps are enabled. Affects astro across 2 version ranges.

< 4.16.18 >= 5.0.0-alpha.0, < 5.0.8

Fixed in 4.16.18 or 5.0.8, depending on the release line you run. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

Astro is a modern static site generator that allows developers to build fast websites using components from various frameworks. It supports server-side rendering (SSR) and static site generation (SSG), making it versatile for different project needs. However, a vulnerability exists in certain versions of Astro that can expose server source code if sourcemaps are enabled, potentially leading to unauthorized access to sensitive information.

Vulnerability Detail

A bug in the build process of Astro allows any unauthenticated user to access parts of the server source code when sourcemaps are enabled. During the build, sourcemap files for server code are moved to a publicly accessible folder, making them readable via unauthorized HTTP GET requests. This issue affects Astro versions 5.0.3 to 5.0.6 and all Astro 4 versions 4.16.17 or older. The predictable naming of sourcemap files, such as 'dist/client/pages/index.astro.mjs.map', increases the risk of exposure. Although secrets are not directly exposed, the revealed source code could lead to further vulnerabilities.

How To Fix

Latest published version: 7.4.2 as of 23 Oct 2026

npm install astro@7.4.2

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 4.16.18 4.16.18
    npm install astro@4.16.18
  • >= 5.0.0-alpha.0, < 5.0.8 5.0.8
    npm install astro@5.0.8

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

As a temporary measure, users can disable sourcemaps in their build configuration to prevent the exposure of server source code until they can update to a patched version. This can typically be done by setting the sourcemaps option to false in the Astro configuration file.

Conclusion

The vulnerability CVE-2024-56159 in the Astro package poses a significant risk by exposing server source code through enabled sourcemaps. Users are strongly advised to update to the latest versions to protect their applications. Temporary workarounds are available, but the best course of action is to apply the patches as soon as possible.

See every vulnerability recorded for astro →

Share this vulnerability

FAQ

The vulnerability allows unauthorized access to server source code, which could lead to the discovery of other vulnerabilities or sensitive information if present in the code.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

Astro versions 5.0.3 to 5.0.6 and all Astro 4 versions 4.16.17 or older are affected if sourcemaps are enabled.

While secrets are not directly exposed, any sensitive information present in the source code could be accessed if the code is revealed.

If you cannot update immediately, disable sourcemaps in your build configuration to mitigate the risk until you can apply the patch.

Related vulnerabilities

Recent vulnerabilities recorded for astro.

How To Fix

Latest published version: 7.4.2 as of 23 Oct 2026

npm install astro@7.4.2

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 4.16.18 4.16.18
    npm install astro@4.16.18
  • >= 5.0.0-alpha.0, < 5.0.8 5.0.8
    npm install astro@5.0.8

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback