Skip to main content

CVE-2026-40335

MEDIUM
Out-of-bounds Read (CWE-125)
2026-04-18 security-advisories@github.com
5.2
CVSS 3.1 · Vendor: github
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Connect malicious USB device
  2. Delivery
    System detects PTP camera
  3. Exploit
    libgphoto2 initializes connection
  4. Install
    Send crafted PTP response
  5. C2
    Parse UINT128/INT128 field
  6. Execute
    Read 16 bytes past buffer
  7. Impact
    Leak heap memory or crash process

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Bounds checking, read limits
MITRE ATT&CK

1 technique across 1 tactic: Collection

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires a malicious or compromised USB device that implements the PTP protocol stack and can be connected to the target system. The vulnerable code path is only reached when libgphoto2 processes camera responses containing UINT128 or INT128 data types in the ptp_unpack_DPV() function-this occurs during normal camera enumeration and property querying, not during file transfer or user-triggered operations, meaning connection alone may trigger exploitation. No special configuration of libgphoto2 is required; default builds with PTP support are vulnerable. The target system must have the camera device detected and libgphoto2 initialized (automatic on most Linux desktops with camera auto-mount, or via explicit invocation in scripts and applications). A malicious device can be crafted using open-source PTP firmware (e.g., modified libptp2 or camera emulator code) and programmed onto a Raspberry Pi Zero, Arduino with USB host shield, or commercial camera hardware. Non-vulnerable systems include those with libgphoto2 entirely absent, those running patched versions 2.5.34+, or those with USB device auto-detection disabled via udev rules or kernel parameters.

Impact

CVSS 5.2 with physical attack vector (AV:P) significantly constrains real-world risk despite the information disclosure and availability impacts (C:H/I:N/A:L). The physical access requirement is a hard limiting factor-an attacker must be present with the target system and capable of connecting a malicious USB camera device, which is considerably more restrictive than network or local exploitation. However, for professional photographers, studios, shared lab environments, or educational settings where untrusted cameras may be plugged into shared systems, this risk becomes material. The low attack complexity (AC:L) and lack of user interaction (UI:N) after physical connection mean exploitation is straightforward once the precondition is met. EPSS score not provided in input, preventing comparative exploitation probability assessment. KEV status not confirmed, suggesting no evidence of active exploitation in the wild at time of analysis. The out-of-bounds read permits information disclosure of heap memory adjacent to camera data structures, potentially leaking sensitive information depending on application context, though libgphoto2's typical use (transferring photos) minimizes exposure of cryptographic or authentication material. Denial of service via out-of-bounds read is achievable but requires the malicious device to remain connected during exploitation. Real-world priority depends on deployment context: high in environments with untrusted device access, low for isolated workstations.

Exploit ScenarioDerived

A photographer or security researcher attaches a malicious USB device programmed to masquerade as a PTP-compatible camera to a workstation running vulnerable libgphoto2. When the system auto-detects the device or the user manually initiates a connection (via file manager, gPhoto GUI, or digiKam), libgphoto2 begins parsing PTP protocol responses from the malicious device. The device crafts a specially formed response where the offset into a data structure is positioned such that a UINT128 or INT128 unpack operation reads 16 bytes beyond the allocated buffer boundary, leaking adjacent heap memory to the application or causing a process crash.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Apr 18, 2026

Out-of-bounds read in libgphoto2 versions up to 2.5.33 in the PTP protocol parser allows information disclosure and potential denial of service when processing specially crafted camera responses. The vulnerability exists in ptp_unpack_DPV() where UINT128 and INT128 cases advance the buffer offset by 16 bytes without verifying sufficient buffer remains available, potentially exposing adjacent memory. Exploitation requires physical access to connect a malicious camera device (AV:P), but no special authentication or user interaction is needed once connected. No public exploit code identified at time of analysis.

RemediationAI

Upgrade libgphoto2 to a version incorporating commit 433bde9888d70aa726e32744cd751d7dbe94379a or later. Most distributions will release patched packages (2.5.34 or newer); check your OS vendor's security advisories for exact patched version numbers. Debian, Ubuntu, Fedora, and other maintainers should provide updated packages through standard package management (apt, dnf, pacman, etc.). For applications bundling libgphoto2, contact the application vendor for a patched release. No effective workarounds exist short of preventing camera device connections; if patching is delayed, restrict USB device access via physical controls (disable USB ports, remove USB connectors) or mandatory access controls (disable udev rules that auto-mount camera devices, disable gphoto2 services). Note that disabling camera support removes legitimate photography workflow functionality, so this mitigation is suitable only for high-security or air-gapped environments where camera use is not required.

Affected ProductsAI

libgphoto2 versions 2.5.33 and earlier are affected. This includes Debian, Ubuntu, Fedora, and other Linux distribution packages of libgphoto2, as well as macOS and Windows versions shipped with photography and imaging applications. No explicit version range lower bound is documented; analysis of GitHub history and releases suggests the vulnerability may exist in much earlier versions, but the GHSA advisory references only versions up to 2.5.33. Applications using libgphoto2 as a dependency (such as digiKam, Shotwell, gPhoto command-line tools, and embedded camera management systems) inherit this risk when running on vulnerable library versions.

Affects your stack

Find out whether the stacks and servers you run are on an affected version.

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

libgphoto2 is a library for accessing digital cameras via USB and other protocols, with support for the Picture Transfer Protocol (PTP) used by most consumer and professional cameras. The vulnerability resides in ptp-pack.c, specifically the ptp_unpack_DPV() function which deserializes binary data from camera responses into application structures. The function implements a bounded buffer read operation but has insufficient validation in the UINT128 and INT128 parsing branches. While the entry check at line 609 validates that at least one byte remains (offset < total), the subsequent 16-byte advancement for UINT128/INT128 types does not verify this condition, allowing reads up to 15 bytes past the actual data boundary. This is a classic out-of-bounds read (CWE-125) where the offset calculation assumes available space without bounds checking. The affected CPE scope is libgphoto2 through version 2.5.33, typically deployed on Linux systems, embedded devices, and photography/imaging applications using the library for camera communication.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (github) PRIMARY 5.2 MEDIUM
AV:P/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:L
SUSE MEDIUM
Red Hat 5.2 MEDIUM

Primary rating from Vendor (github).

CVSS VectorVendor: github

Attack Vector
Physical
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
Low

Lifecycle Timeline

2
Patch released
Apr 28, 2026 - 20:30 nvd
Patch available
CVE Published
Apr 18, 2026 - 00:16 nvd
MEDIUM 5.2

DescriptionCVE.org

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_DPV() in camlibs/ptp2/ptp-pack.c (lines 622-629). The UINT128 and INT128 cases advance *offset += 16 without verifying that 16 bytes remain in the buffer. The entry check at line 609 only guarantees *offset < total (at least 1 byte available), leaving up to 15 bytes unvalidated. Commit 433bde9888d70aa726e32744cd751d7dbe94379a patches the issue.

Threat Intelligence Overview

EPSS Score
0.0%
Top 100% exploitable
Social Media
1
Sightings
Data Quality
7 sources
Confidence: High
NVD CVE.org EPSS Vulnrichment Vendor CIRCL GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Defer
Exploitation
None
System Exposure· derived
Small
Automatable
No
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

26
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +26
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

A buffer overflow occurs when a program writes more data to a memory buffer than it was allocated to hold, causing the excess data to spill into adjacent memory regions.

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

Vendor StatusVendor

SUSE

Severity: Medium
Product Status
SUSE Linux Enterprise Desktop 15 SP7 Fixed
SUSE Linux Enterprise High Performance Computing 15 SP7 Fixed
SUSE Linux Enterprise Module for Desktop Applications 15 SP7 Fixed
SUSE Linux Enterprise Module for Package Hub 15 SP7 Fixed
SUSE Linux Enterprise Server 15 SP7 Fixed

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy