CVE-2026-40338libgphoto2 has OOB read in ptp_unpack_Sony_DPD() enumeration count parsing in ptp-pack.c
libgphoto2 is a camera access and control library. Versions up to and including 2.5.33 have an out-of-bounds read in the PTP_DPFF_Enumeration case of `ptp_unpack_Sony_DPD()` in `camlibs/ptp2/ptp-pack.c` (line 856). The function reads a 2-byte enumeration count N via `dtoh16o(data, *poffset)` without verifying that 2 bytes remain in the buffer. The standard `ptp_unpack_DPD()` at line 704 has this exact check, confirming the Sony variant omitted it by oversight. Commit 3b9f9696be76ae51dca983d9dd8ce586a2561845 fixes the issue.
What to do
Fixed builds are available from Debian, Ubuntu: see the table below for the fixed version per release.
Debian, Red Hat, Ubuntu have not shipped a fix for every release yet.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 26.04 | libgphoto2 | Fixed | 2.5.33-1ubuntu1.1 | UBUNTU-CVE-2026-40338 |
| Ubuntu 25.10 | libgphoto2 | Will not fix Ubuntu decided not to fix this in this release | UBUNTU-CVE-2026-40338 | |
| Ubuntu 24.04 | libgphoto2 | Fixed | 2.5.31-2.1ubuntu1.1 | UBUNTU-CVE-2026-40338 |
| Ubuntu 22.04 | libgphoto2 | Fixed | 2.5.27-1ubuntu0.1 | UBUNTU-CVE-2026-40338 |
| Ubuntu 20.04 | libgphoto2 | Fix pending | UBUNTU-CVE-2026-40338 | |
| Ubuntu 18.04 | libgphoto2 | Fix pending | UBUNTU-CVE-2026-40338 | |
| Ubuntu 16.04 | libgphoto2 | Fix pending | UBUNTU-CVE-2026-40338 | |
| Ubuntu 14.04 | libgphoto2 | Fix pending | UBUNTU-CVE-2026-40338 | |
| Debian 14 | libgphoto2 | Fixed | 2.5.34-1 | DEBIAN-CVE-2026-40338 |
| Debian 13 | libgphoto2 | Fix pending | DEBIAN-CVE-2026-40338 | |
| Debian 12 | libgphoto2 | Fix pending | DEBIAN-CVE-2026-40338 | |
| Red Hat Enterprise Linux 10 | libgphoto2 | Fix pending Fix deferred | ||
| Red Hat Enterprise Linux 10 | libgphoto2-devel | Fix pending Fix deferred | ||
| Red Hat Enterprise Linux 9 | libgphoto2 | Fix pending Fix deferred | ||
| Red Hat Enterprise Linux 9 | libgphoto2-devel | Fix pending Fix deferred | ||
| Red Hat Enterprise Linux 8 | libgphoto2 | Fix pending Fix deferred | ||
| Red Hat Enterprise Linux 8 | libgphoto2-devel | Fix pending Fix deferred | ||
| Red Hat Enterprise Linux 7 | libgphoto2 | Fix pending Fix deferred | ||
| Red Hat Enterprise Linux 7 | libgphoto2-devel | Fix pending Fix deferred | ||
| Red Hat Enterprise Linux 6 | libgphoto2 | Fix pending Fix deferred | ||
| Red Hat Enterprise Linux 6 | libgphoto2-devel | Fix pending Fix deferred |
What the vendor says
As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- gphoto libgphoto2: affected: <= 2.5.33
References
- https://github.com/gphoto/libgphoto2/security/advisories/GHSA-2hwp-w84q-27hf
- https://github.com/gphoto/libgphoto2/commit/3b9f9696be76ae51dca983d9dd8ce586a2561845
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.