# CVE-2026-40339: libgphoto2-6: libgphoto2 is a camera access and control library

CVE-2026-40339 is fixed in 6 products on 1 platform, first by libgphoto2-6 2.5.27-1ubuntu0.1, released April 17, 2026. It is not reported as exploited. Patch Radar priority: Routine.

- Web page: https://patchblox.com/security/cve/CVE-2026-40339
- Priority: Routine
- CVSS: 5.2 (Medium)
- EPSS: 0.0020
- CISA KEV: not listed
- Exploited (vendor report): no
- Publicly disclosed: no
- Published: Apr 17, 2026

## 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) &gt; dpdlen` before this same read, but the Sony variant omits this check entirely. Commit 09f8a940b1e418b5693f5c11e3016a1ad2cea62d fixes the issue.

## Where it's fixed

| Platform | Product | Fixed in | Fix | Released |
|---|---|---|---|---|
| Linux | libgphoto2 Debian 14 | 2.5.34-1 | [DEBIAN-CVE-2026-40339](https://patchblox.com/security/data/fix/linux/debian-cve-2026-40339.md) | Apr 18, 2026 |
| Linux | libgphoto2-6 Ubuntu 22.04.1 LTS (jammy) | 2.5.27-1ubuntu0.1 | [libgphoto2-6 2.5.27-1ubuntu0.1](https://patchblox.com/security/data/fix/linux/ubuntu-jammy-libgphoto2-6-2.5.27-1ubuntu0.1.md) | Apr 17, 2026 |
| Linux | libgphoto2-6t64 Ubuntu 24.04.5 LTS (noble) | 2.5.31-2.1ubuntu1.1 | [libgphoto2-6t64 2.5.31-2.1ubuntu1.1](https://patchblox.com/security/data/fix/linux/ubuntu-noble-libgphoto2-6t64-2.5.31-2.1ubuntu1.1.md) | Apr 17, 2026 |
| Linux | libgphoto2-6t64 Ubuntu 26.04.1 LTS (resolute) | 2.5.33-1ubuntu1.1 | [libgphoto2-6t64 2.5.33-1ubuntu1.1](https://patchblox.com/security/data/fix/linux/ubuntu-resolute-libgphoto2-6t64-2.5.33-1ubuntu1.1.md) | Apr 17, 2026 |
| Linux | libgphoto2-l10n Ubuntu 22.04.1 LTS (jammy) | 2.5.27-1ubuntu0.1 | [libgphoto2-l10n 2.5.27-1ubuntu0.1](https://patchblox.com/security/data/fix/linux/ubuntu-jammy-libgphoto2-l10n-2.5.27-1ubuntu0.1.md) | Apr 17, 2026 |
| Linux | libgphoto2-l10n Ubuntu 24.04.5 LTS (noble) | 2.5.31-2.1ubuntu1.1 | [libgphoto2-l10n 2.5.31-2.1ubuntu1.1](https://patchblox.com/security/data/fix/linux/ubuntu-noble-libgphoto2-l10n-2.5.31-2.1ubuntu1.1.md) | Apr 17, 2026 |
| Linux | libgphoto2-l10n Ubuntu 26.04.1 LTS (resolute) | 2.5.33-1ubuntu1.1 | [libgphoto2-l10n 2.5.33-1ubuntu1.1](https://patchblox.com/security/data/fix/linux/ubuntu-resolute-libgphoto2-l10n-2.5.33-1ubuntu1.1.md) | Apr 17, 2026 |
| Linux | libgphoto2-port12 Ubuntu 22.04.1 LTS (jammy) | 2.5.27-1ubuntu0.1 | [libgphoto2-port12 2.5.27-1ubuntu0.1](https://patchblox.com/security/data/fix/linux/ubuntu-jammy-libgphoto2-port12-2.5.27-1ubuntu0.1.md) | Apr 17, 2026 |
| Linux | libgphoto2-port12t64 Ubuntu 24.04.5 LTS (noble) | 2.5.31-2.1ubuntu1.1 | [libgphoto2-port12t64 2.5.31-2.1ubuntu1.1](https://patchblox.com/security/data/fix/linux/ubuntu-noble-libgphoto2-port12t64-2.5.31-2.1ubuntu1.1.md) | Apr 17, 2026 |
| Linux | libgphoto2-port12t64 Ubuntu 26.04.1 LTS (resolute) | 2.5.33-1ubuntu1.1 | [libgphoto2-port12t64 2.5.33-1ubuntu1.1](https://patchblox.com/security/data/fix/linux/ubuntu-resolute-libgphoto2-port12t64-2.5.33-1ubuntu1.1.md) | Apr 17, 2026 |

---

Data as of 2026-11-08T06:59:42Z UTC. Source: Patchblox Patch Radar (https://patchblox.com/security/patch-radar). Patchblox finds out-of-date software on Windows, macOS and Linux and updates it through release rings: https://patchblox.com/demo

Free to use with attribution: show "Data: Patchblox Patch Radar" with a link to https://patchblox.com/security/patch-radar. Terms, including what needs a written agreement: https://patchblox.com/security/patch-radar/use-the-data

Product names, logos and trademarks shown on Patch Radar belong to their respective owners. They are used only to identify the software each security fix applies to and to help readers find their platform. Their use does not imply any affiliation with, or endorsement by, those owners, and Patchblox is not affiliated with any of them.
