CVE-2026-40339 libgphoto2 has OOB read in ptp_unpack_Sony_DPD() FormFlag parsing in ptp-pack.c
MediumCVSS 5.2
EPSS 0.21%
- Published
- Updated
- Exploit status
- No public exploit known
- CISA SSVC
- No known exploitation · automatable: no · technical impact: partial
- Technology
- UbuntuDebianRed Hat
Description
libgphoto2 is a camera access and control library. Versions up to and including 2.5.33 have an out-of-bounds read in ptp_unpack_Sony_DPD() in camlibs/ptp2/ptp-pack.c (line 842). The function reads the FormFlag byte via dtoh8o(data, *poffset) without a prior bounds check. The standard ptp_unpack_DPD() at lines 686–687 correctly validates *offset + sizeof(uint8_t) > dpdlen before this same read, but the Sony variant omits this check entirely. Commit 09f8a940b1e418b5693f5c11e3016a1ad2cea62d fixes the issue.
Upgrade path
12 packages: 4 fixed, 7 with no fix yet.
| Package | Affected | Fixed in | Status |
|---|---|---|---|
| debian/libgphoto2(Debian 12) | = 2.5.30-1; = 2.5.31-1; = 2.5.31-2; = 2.5.31-2.1 +8 more | No fix listed | No fix yet |
| debian/libgphoto2(Debian 13) | = 2.5.31-4; = 2.5.32-1; = 2.5.33-1; = 2.5.34-1 +2 more | No fix listed | No fix yet |
| redhat/libgphoto2(Red Hat enterprise_linux 10) | All versions | No fix listed | No fix yet |
| redhat/libgphoto2(Red Hat enterprise_linux 8) | All versions | No fix listed | No fix yet |
| redhat/libgphoto2(Red Hat enterprise_linux 9) | All versions | No fix listed | No fix yet |
| redhat/libgphoto2(Red Hat rhel_els 6) | All versions | No fix listed | No fix yet |
| redhat/libgphoto2(Red Hat rhel_els 7) | All versions | No fix listed | No fix yet |
| debian/libgphoto2(Debian 14) | < 2.5.34-1; = 2.5.31-4; = 2.5.32-1; = 2.5.33-1 | 2.5.34-1 | Fixed |
| ubuntu/libgphoto2(Ubuntu 22.04) | < 2.5.27-1ubuntu0.1 | 2.5.27-1ubuntu0.1 | Fixed |
| ubuntu/libgphoto2(Ubuntu 24.04) | < 2.5.31-2.1ubuntu1.1 | 2.5.31-2.1ubuntu1.1 | Fixed |
| ubuntu/libgphoto2(Ubuntu 26.04) | < 2.5.33-1ubuntu1.1 | 2.5.33-1ubuntu1.1 | Fixed |
| gphoto libgphoto2 | = <= 2.5.33 | No fix listed | Versions listed |
Affected products
| Product | Affected versions | Fixed in |
|---|---|---|
| gphoto libgphoto2 | = <= 2.5.33 | No fix listed |
| debian/libgphoto2(Debian:12) | All versions | No fix listed |
| debian/libgphoto2(Debian:12) | = 2.5.30-1 | No fix listed |
| debian/libgphoto2(Debian:12) | = 2.5.31-1 | No fix listed |
| debian/libgphoto2(Debian:12) | = 2.5.31-2 | No fix listed |
| debian/libgphoto2(Debian:12) | = 2.5.31-2.1 | No fix listed |
| debian/libgphoto2(Debian:12) | = 2.5.31-2.1~exp1 | No fix listed |
| debian/libgphoto2(Debian:12) | = 2.5.31-3 | No fix listed |
| debian/libgphoto2(Debian:12) | = 2.5.31-4 | No fix listed |
| debian/libgphoto2(Debian:12) | = 2.5.32-1 | No fix listed |
| debian/libgphoto2(Debian:12) | = 2.5.33-1 | No fix listed |
| debian/libgphoto2(Debian:12) | = 2.5.34-1 | No fix listed |
| debian/libgphoto2(Debian:12) | = 2.5.34-2 | No fix listed |
| debian/libgphoto2(Debian:13) | All versions | No fix listed |
| debian/libgphoto2(Debian:13) | = 2.5.31-4 | No fix listed |
| debian/libgphoto2(Debian:13) | = 2.5.32-1 | No fix listed |
| debian/libgphoto2(Debian:13) | = 2.5.33-1 | No fix listed |
| debian/libgphoto2(Debian:13) | = 2.5.34-1 | No fix listed |
| debian/libgphoto2(Debian:13) | = 2.5.34-2 | No fix listed |
| debian/libgphoto2(Debian:14) | < 2.5.34-1 | 2.5.34-1 |
| debian/libgphoto2(Debian:14) | = 2.5.31-4 | No fix listed |
| debian/libgphoto2(Debian:14) | = 2.5.32-1 | No fix listed |
| debian/libgphoto2(Debian:14) | = 2.5.33-1 | No fix listed |
| redhat/libgphoto2(Red Hat:enterprise_linux:10) | All versions | No fix listed |
| redhat/libgphoto2(Red Hat:rhel_els:6) | All versions | No fix listed |
Show 6 more
| Product | Affected versions | Fixed in |
|---|---|---|
| redhat/libgphoto2(Red Hat:rhel_els:7) | All versions | No fix listed |
| redhat/libgphoto2(Red Hat:enterprise_linux:8) | All versions | No fix listed |
| redhat/libgphoto2(Red Hat:enterprise_linux:9) | All versions | No fix listed |
| ubuntu/libgphoto2(Ubuntu:22.04) | < 2.5.27-1ubuntu0.1 | 2.5.27-1ubuntu0.1 |
| ubuntu/libgphoto2(Ubuntu:24.04) | < 2.5.31-2.1ubuntu1.1 | 2.5.31-2.1ubuntu1.1 |
| ubuntu/libgphoto2(Ubuntu:26.04) | < 2.5.33-1ubuntu1.1 | 2.5.33-1ubuntu1.1 |
References
- https://github.com/gphoto/libgphoto2/security/advisories/GHSA-42cm-m9hc-r7q8
- https://github.com/gphoto/libgphoto2/commit/09f8a940b1e418b5693f5c11e3016a1ad2cea62d
- Debian Security Tracker CVE-2026-40339 vendor-advisory
- Red Hat CVE page mitigation vendor-advisory
- Red Hat Bugzilla 2459357 issue-tracking
- www.cve.org
- nvd.nist.gov
- Ubuntu CVE tracker vendor-advisory
- USN-8586-1 vendor-advisory
- bugs.debian.org issue-tracking