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

- Severity: Medium 6.1 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:P/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.23%, higher than 14% of CVEs (2026-12-01)
- Published: 2026-04-17T23:45:17.467Z
- Modified: 2026-10-26T21:10:00.170Z
- Weaknesses: CWE-125
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: GitHub_M

## Description

libgphoto2 is a camera access and control library. Versions up to and including 2.5.33 have an out-of-bounds read vulnerability in `ptp_unpack_OI()` in `camlibs/ptp2/ptp-pack.c` (lines 530–563). The function validates `len < PTP_oi_SequenceNumber` (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.

(As written by CVE List.)

## Affected

- gphoto libgphoto2: <= 2.5.33

## References

- <https://github.com/gphoto/libgphoto2/security/advisories/GHSA-xfw3-xvjp-5wcv>
- <https://github.com/gphoto/libgphoto2/commit/7c7f515bc88c3d0c4098ac965d313518e0ccbe33>

## Sources

- CVE List: [CVE-2026-40340](https://www.cve.org/CVERecord?id=CVE-2026-40340), CVE Terms of Use, modified 2026-04-20
- NVD: [CVE-2026-40340](https://nvd.nist.gov/vuln/detail/CVE-2026-40340), Public domain, modified 2026-10-26

---

Page: https://cve.day/CVE-2026-40340 · Whole record: https://cve.day/CVE-2026-40340.json · Rebuilt by cve.day 2026-11-25T22:59:18.982Z
