CVE-2026-40339: CWE-125: Out-of-bounds Read in gphoto libgphoto2
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.
AI Analysis
Technical Summary
libgphoto2, a camera access and control library, contains an out-of-bounds read vulnerability in versions up to 2.5.33 within the ptp_unpack_Sony_DPD() function in camlibs/ptp2/ptp-pack.c. The function reads the FormFlag byte without validating that the read is within the bounds of the data buffer, unlike the standard ptp_unpack_DPD() function which performs this check. This flaw can cause the application to read memory beyond the allocated buffer, potentially leading to information disclosure or application instability. The issue was corrected in commit 09f8a940b1e418b5693f5c11e3016a1ad2cea62d. The CVSS 3.1 base score is 5.2, reflecting a medium severity with network attack vector requiring no privileges or user interaction, impacting confidentiality and availability.
Potential Impact
The vulnerability allows an out-of-bounds read which can lead to partial disclosure of memory contents or cause application crashes, impacting confidentiality and availability. The CVSS score of 5.2 indicates a medium severity impact. There are no reports of exploitation in the wild. The attack vector is local (physical or logical access to the device running libgphoto2), and no privileges or user interaction are required.
Mitigation Recommendations
A fix for this vulnerability exists as a source code commit (09f8a940b1e418b5693f5c11e3016a1ad2cea62d) that adds the missing bounds check. However, no official patch release or vendor advisory has been provided to confirm patch availability. Users should monitor the official libgphoto2 project for updated releases containing this fix and apply them promptly. Until then, avoid processing untrusted Sony camera data with vulnerable versions of libgphoto2 to reduce risk. Patch status is not yet confirmed — check the vendor advisory for current remediation guidance.
CVE-2026-40339: CWE-125: Out-of-bounds Read in gphoto libgphoto2
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.
CVSS v3.1
Score 5.2medium
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
libgphoto2, a camera access and control library, contains an out-of-bounds read vulnerability in versions up to 2.5.33 within the ptp_unpack_Sony_DPD() function in camlibs/ptp2/ptp-pack.c. The function reads the FormFlag byte without validating that the read is within the bounds of the data buffer, unlike the standard ptp_unpack_DPD() function which performs this check. This flaw can cause the application to read memory beyond the allocated buffer, potentially leading to information disclosure or application instability. The issue was corrected in commit 09f8a940b1e418b5693f5c11e3016a1ad2cea62d. The CVSS 3.1 base score is 5.2, reflecting a medium severity with network attack vector requiring no privileges or user interaction, impacting confidentiality and availability.
Potential Impact
The vulnerability allows an out-of-bounds read which can lead to partial disclosure of memory contents or cause application crashes, impacting confidentiality and availability. The CVSS score of 5.2 indicates a medium severity impact. There are no reports of exploitation in the wild. The attack vector is local (physical or logical access to the device running libgphoto2), and no privileges or user interaction are required.
Mitigation Recommendations
A fix for this vulnerability exists as a source code commit (09f8a940b1e418b5693f5c11e3016a1ad2cea62d) that adds the missing bounds check. However, no official patch release or vendor advisory has been provided to confirm patch availability. Users should monitor the official libgphoto2 project for updated releases containing this fix and apply them promptly. Until then, avoid processing untrusted Sony camera data with vulnerable versions of libgphoto2 to reduce risk. Patch status is not yet confirmed — check the vendor advisory for current remediation guidance.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-04-10T22:50:01.358Z
- Cvss Version
- 3.1
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 69e389f6bdfbbecc59765160
Added to database: 4/18/2026, 1:41:10 PM
Last enriched: 4/26/2026, 2:42:44 AM
Last updated: 6/2/2026, 10:08:50 AM
Views: 114
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.