
Cloud Vulnerability DB
A community-led vulnerabilities database
CVE-2026-40339 is an out-of-bounds read vulnerability in libgphoto2, a camera access and control library, affecting versions up to and including 2.5.33. The flaw resides in the ptp_unpack_Sony_DPD() function in camlibs/ptp2/ptp-pack.c (line 842), where the FormFlag byte is read without a prior bounds check — an oversight absent in the standard ptp_unpack_DPD() counterpart. The vulnerability was published on April 17–18, 2026, and assigned by GitHub Security. It carries a CVSS v3.1 base score of 5.2 (Medium) with a physical attack vector (GitHub Advisory, Red Hat Bugzilla).
The root cause is CWE-125 (Out-of-bounds Read): ptp_unpack_Sony_DPD() calls dtoh8o(data, *poffset) to read the FormFlag byte without first validating that *poffset + sizeof(uint8_t) > dpdlen, a check that the standard ptp_unpack_DPD() correctly performs at lines 686–687 of the same file. An attacker exploits this by presenting a rogue PTP/IP server or a malicious USB device that sends a crafted Sony Device Property Descriptor with a truncated buffer; when the host enumerates device properties, the missing bounds check causes one byte of adjacent heap memory to be read beyond the buffer boundary. Physical or local access to connect a malicious device is required as a precondition. The fix, committed as 09f8a940b1e418b5693f5c11e3016a1ad2cea62d, inserts the missing bounds check immediately before the dtoh8o call (GitHub Advisory, Fix Commit).
Successful exploitation results in the disclosure of one byte of adjacent heap memory per Sony device property enumeration, potentially leaking sensitive in-memory data such as pointers, keys, or other application state. A secondary impact is a potential denial of service through application crash if the out-of-bounds read triggers a fault. Because the attack vector is physical and the scope is unchanged, lateral movement or remote data exfiltration are not direct consequences, but heap memory disclosure could assist in chaining further exploitation (GitHub Advisory, Red Hat Bugzilla).
There is no public proof-of-concept exploit and no evidence of in-the-wild exploitation at this time. The EPSS score is approximately 0.007% (0.000070), reflecting very low probability of near-term exploitation. The vulnerability is not listed in the CISA Known Exploited Vulnerabilities catalog. No threat actor attribution has been reported (GitHub Advisory).
gphoto2 --list-config or any photo management application), causing ptp_unpack_Sony_DPD() to be invoked.ptp_unpack_Sony_DPD() to call dtoh8o(data, *poffset) without bounds validation, reading one byte beyond the buffer boundary and exposing adjacent heap memory.ptp_unpack_Sony_DPD or ptp-pack.c.gphoto2 or photo management daemons (e.g., gvfs-gphoto2-volume-monitor) triggered by newly connected USB devices without user initiation.Upgrade libgphoto2 to a version newer than 2.5.33 that includes the fix introduced in commit 09f8a940b1e418b5693f5c11e3016a1ad2cea62d. Distribution-specific patches are being tracked via Red Hat Bugzilla (BZ#2459357) and an openSUSE security announcement has also been issued. As a workaround, restrict physical access to systems running libgphoto2 and disable automatic camera enumeration or USB auto-mount for untrusted devices; if Sony camera support is not required, consider disabling the PTP2 camera library module (Fix Commit, Red Hat Bugzilla).
The vulnerability was reported by researcher Sebastián Alba (credited as "Sebasteuo" in the GitHub advisory) and published by the libgphoto2 maintainer msmeissn on April 15, 2026. Red Hat triaged it as medium severity and opened a tracking bug. No significant broader media coverage or notable social media discussion has been observed, consistent with the physical-access-only attack vector and moderate severity rating (GitHub Advisory, Red Hat Bugzilla).
Fix availability across major Linux distributions and their releases.
bionic (esm-infra)
libgphoto2
devel
libgphoto2
focal (esm-infra)
libgphoto2
jammy
libgphoto2: 2.5.27-1ubuntu0.1
noble
libgphoto2: 2.5.31-2.1ubuntu1.1
resolute
libgphoto2: 2.5.33-1ubuntu1.1
trusty (esm-infra-legacy)
libgphoto2
xenial (esm-infra-legacy)
libgphoto2
Source: This report was generated using AI
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."