GHSA-rgj7-g3m4-5g8c
GHSA-rgj7-g3m4-5g8c is a remote code execution vulnerability in sharp. O3 Security confirms whether GHSA-rgj7-g3m4-5g8c is actually reachable in your code before you act, and blocks exploitation at runtime until you patch.
sharp: Vulnerabilities in libheif: GHSA-g89c-p67h-r497 and GHSA-2jg2-4ch7-h545
Real-World Exposure
sharpReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects npm packages — download data is not available via public APIs for these ecosystems.
Description
Impact
A number of vulnerabilities, two rated as "Critical" severity using CVSSv3, have been discovered and fixed in the upstream libheif dependency. These can lead to possible remote code execution (RCE) on glibc-based Linux when run under certain conditions.
The attack vector for these claims to be "network" however sharp does not provide any networking features so this vulnerability is down-rated to a "High" severity using CVSSv4 but please note its Subsequent System Impact.
Those processing untrusted input with versions of sharp prior to 0.35.4 are affected.
Patches
Using prebuilt binaries provided by sharp?
Most people rely on the prebuilt binaries provided by sharp.
Please upgrade sharp to the latest version, currently 0.35.4, which provides libheif 1.23.2.
Using a globally-installed libheif?
Please ensure you are using the latest libheif 1.23.2.
Workarounds
Add the following to your code to prevent sharp from decoding AVIF images.
sharp.block({ operation: ["VipsForeignLoadHeif"] });
Ensure you are using a node executable binary compiled as a Position Independent Executable (PIE). Most Linux package managers already do this for protection against RCE however be warned that the "official" Node.js binaries do not.
References
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | sharp | all versions | 0.35.4 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for sharp. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.
Fix
Update sharp to 0.35.4 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-rgj7-g3m4-5g8c is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 pinpoints whether GHSA-rgj7-g3m4-5g8c is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.
Tailored to GHSA-rgj7-g3m4-5g8c. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is GHSA-rgj7-g3m4-5g8c in your dependencies?
O3 detects GHSA-rgj7-g3m4-5g8c across npm dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.