CVE-2026-40340: libgphoto2 has OOB read in ptp_unpack_OI() in ptp-pack.c via malicious PTP ObjectInfo response

Published Apr 17, 2026
·
Updated

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

12 affected componentsFixes available
gPhoto libgphoto2<=2.5.33
debian/libgphoto2<=2.5.27-1, <=2.5.30-1, <=2.5.31-4, <=2.5.33-1
ubuntu/libgphoto2*
ubuntu/libgphoto2*
ubuntu/libgphoto2*
ubuntu/libgphoto2*
ubuntu/libgphoto2<2.5.27-1ubuntu0.1
2.5.27-1ubuntu0.1
ubuntu/libgphoto2<2.5.31-2.1ubuntu1.1
2.5.31-2.1ubuntu1.1
ubuntu/libgphoto2*
ubuntu/libgphoto2<2.5.33-1ubuntu1.1
2.5.33-1ubuntu1.1
All of the following
azurelinux/libgphoto2<0:2.5.34-5.azl4
0:2.5.34-5.azl4
Microsoft Azure Linux=4.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade ubuntu/libgphoto2 to a version that resolves this vulnerability.

    Fixed in 2.5.27-1ubuntu0.1
  2. Upgrade

    Upgrade ubuntu/libgphoto2 to a version that resolves this vulnerability.

    Fixed in 2.5.31-2.1ubuntu1.1
  3. Upgrade

    Upgrade ubuntu/libgphoto2 to a version that resolves this vulnerability.

    Fixed in 2.5.33-1ubuntu1.1
  4. Upgrade

    Upgrade azurelinux/libgphoto2 to a version that resolves this vulnerability.

    Fixed in 0:2.5.34-5.azl4
  5. Upgrade

    Upgrade libgphoto2 to a version that resolves this vulnerability.

    Patch 7c7f515bc88c3d0c4098ac965d313518e0ccbe33

Event History

Apr 17, 2026
CVE Published
via MITRE·11:45 PM
Data Sourced
via MITRE·11:45 PM
DescriptionSeverityWeakness
Apr 18, 2026
Data Sourced
via OSV·12:16 AM
DescriptionSeverityAffected Software
Data Sourced
via NVD·12:16 AM
DescriptionSeverityWeakness
Nov 17, 2026
Data Sourced
via Microsoft·06:52 AM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

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.

2

How do I fix CVE-2026-40340?

To mitigate CVE-2026-40340, upgrade libgphoto2 to version 2.5.34 or later.

3

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.

4

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.

5

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.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203