CVE-2026-40336 libgphoto2 has memory leak in ptp_unpack_Sony_DPD() secondary enumeration list in ptp-pack.c

Low 2.4 Published Updated

A memory leak in libgphoto2 allows attackers to cause denial of service by triggering repeated property descriptor parsing.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2026-40336?

CVE-2026-40336 is a low-severity denial of service vulnerability in libgphoto2, published on 17 Apr 2026. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

libgphoto2 is a camera access and control library. Versions up to and including 2.5.33 have a memory leak in `ptp_unpack_Sony_DPD()` in `camlibs/ptp2/ptp-pack.c` (lines 884–885). When processing a secondary enumeration list (introduced in 2024+ Sony cameras), the function overwrites dpd->FORM.Enum.SupportedValue with a new calloc() without freeing the previous allocation from line 857. The original array and any string values it contains are leaked on every property descriptor parse. Commit 404ff02c75f3cb280196fc260a63c4d26cf1a8f6 fixes the issue.

Weakness: CWE-401

Which versions are affected by CVE-2026-40336?

How do I fix CVE-2026-40336?

Apply the vendor's patch.

Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.

Is CVE-2026-40336 being exploited?

There is no known exploitation of CVE-2026-40336 in the wild and no public exploit code.

Sources

Also known as AZL-83009, DEBIAN-CVE-2026-40336, GHSA-g8xw-p5wj-mrxv, UBUNTU-CVE-2026-40336.

Is CVE-2026-40336 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free