CVE-2026-40340: libgphoto2 has OOB read in ptp_unpack_OI() in ptp-pack.c via malicious PTP ObjectInfo response
Last updated 16 July 2026
Other sources
libgphoto2 has OOB read in ptpunpackOI() in ptp-pack.c via malicious PTP ObjectInfo response
— Microsoft
libgphoto2 is a camera access and control library. Versions up to and including 2.5.33 have an out-of-bounds read vulnerability in ptpunpackOI() in camlibs/ptp2/ptp-pack.c (lines 530–563). The function validates len < PTPoiSequenceNumber (i.e., len < 48) but subsequently accesses offsets 48–56, up to 9 bytes beyond the validated boundary, via the Samsung Galaxy 64-bit objectsize detection heuristic. Commit 7c7f515bc88c3d0c4098ac965d313518e0ccbe33 fixes the issue.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
ubuntu/libgphoto2to a version that resolves this vulnerability.Fixed in 2.5.27-1ubuntu0.1 - Upgrade
Upgrade
ubuntu/libgphoto2to a version that resolves this vulnerability.Fixed in 2.5.31-2.1ubuntu1.1 - Upgrade
Upgrade
ubuntu/libgphoto2to a version that resolves this vulnerability.Fixed in 2.5.33-1ubuntu1.1 - Upgrade
Upgrade
azurelinux/libgphoto2to a version that resolves this vulnerability.Fixed in 0:2.5.34-5.azl4 - Upgrade
Upgrade
libgphoto2to a version that resolves this vulnerability.Patch 7c7f515bc88c3d0c4098ac965d313518e0ccbe33
Event History
Frequently Asked Questions
What is the severity of CVE-2026-40340?
CVE-2026-40340 is classified as a moderate severity vulnerability due to the potential for information disclosure from an out-of-bounds read.
How do I fix CVE-2026-40340?
To mitigate CVE-2026-40340, upgrade libgphoto2 to version 2.5.34 or later.
What versions of libgphoto2 are affected by CVE-2026-40340?
CVE-2026-40340 affects all versions of libgphoto2 up to and including 2.5.33.
What is the impact of CVE-2026-40340 on libgphoto2?
The impact of CVE-2026-40340 in libgphoto2 can lead to potential information leakage due to an out-of-bounds read.
Is CVE-2026-40340 exploitable remotely?
CVE-2026-40340 can be exploited remotely if a user interacts with a malicious PTP ObjectInfo response while using the vulnerable version of libgphoto2.