Skip to main content

CVE-2026-40339

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. Access
    Connect malicious Sony camera
  2. Delivery
    libgphoto2 processes PTP device properties
  3. Exploit
    ptp_unpack_Sony_DPD() reads without bounds check
  4. Execution
    Out-of-bounds memory read occurs
  5. Impact
    Sensitive data leaked or crash triggered

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

Physical connection of a Sony camera device to a system running libgphoto2 versions 0 through 2.5.33 is required. The vulnerability is triggered only when libgphoto2 processes PTP packets from Sony cameras specifically - the vulnerable code path is unique to the Sony variant function and does not affect standard PTP device processing. The attacker must control or manipulate the Sony camera's firmware or responses to craft a malicious device property descriptor with insufficient data length that violates the expected buffer bounds. The application using libgphoto2 must actively initiate communication with the camera (e.g., via gphoto2 command-line tool, image management software, or custom application) that calls the vulnerable ptp_unpack_Sony_DPD() function. The vulnerability does NOT require remote access, authentication, or user interaction beyond the initial camera connection - once connected, merely querying the device properties can trigger the flaw.

Impact

CVSS 5.2 indicates moderate risk with physical attack vector (AV:P), low complexity (AC:L), no privilege requirement (PR:N), and user interaction not required (UI:N). The physical attack vector constraint significantly limits real-world exploitability compared to network-based vulnerabilities - the attacker must physically connect a malicious Sony camera or manipulate an existing camera's firmware. The confidentiality impact is high (C:H) but integrity is none (I:N), making this primarily an information disclosure issue. The availability impact is low (A:L), suggesting minor DoS potential through crash conditions rather than system compromise. No EPSS score or KEV status provided; however, the physical access requirement and targeted nature (Sony cameras only) suggest this is not a widespread exploitation priority compared to network-accessible vectors. The vulnerability is real but constrained to threat models involving physical device compromise, making it relevant primarily for environments handling untrusted camera hardware (security researchers, forensics labs, restricted-access facilities). The presence of a confirmed upstream fix via commit 09f8a940b1e418b5693f5c11e3016a1ad2cea62d indicates vendor acknowledgment and resolution path.

Exploit ScenarioDerived

An attacker with physical access to a system running libgphoto2 connects a specially crafted Sony camera (via USB or similar PTP interface) with malicious firmware or packet data. When libgphoto2 attempts to read the device property descriptor from the camera, the Sony-specific unpacking function reads beyond the allocated buffer bounds, leaking sensitive memory contents such as credentials, keys, or adjacent process memory. The out-of-bounds read could also crash the application if the memory access triggers a segmentation fault, denying service to legitimate camera access.

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 allows local attackers with physical access to a connected camera to read sensitive memory and potentially cause denial of service via a specially crafted Sony camera device. The vulnerability exists in the Sony-specific PTP packet unpacking function which omits bounds validation present in the standard variant, enabling attackers with direct camera access to trigger information disclosure and minor availability impact.

RemediationAI

Upgrade libgphoto2 to a version incorporating commit 09f8a940b1e418b5693f5c11e3016a1ad2cea62d or later. The upstream fix adds bounds validation to ptp_unpack_Sony_DPD() matching the protective checks already present in ptp_unpack_DPD(), eliminating the out-of-bounds read condition. Check the GitHub repository (https://github.com/gphoto/libgphoto2) and GHSA-42cm-m9hc-r7q8 advisory for patched release versions. If immediate patching is not feasible, restrict physical access to camera devices and disable Sony PTP camera support at the application or system level if not required for normal operations. Validate camera firmware from trusted sources before connecting to systems running libgphoto2, as malicious camera firmware could trigger this vulnerability. Test patched versions thoroughly in your environment before production deployment, as the bounds-checking fix may affect performance characteristics of large PTP packet processing.

Affected ProductsAI

libgphoto2 versions 0 through 2.5.33 are affected, with the vulnerability specifically triggered when processing Sony camera devices communicating via PTP. The issue is present in the Sony-variant packet unpacking code path (ptp_unpack_Sony_DPD function) in camlibs/ptp2/ptp-pack.c. The fix is available in the upstream repository via commit 09f8a940b1e418b5693f5c11e3016a1ad2cea62d (https://github.com/gphoto/libgphoto2/commit/09f8a940b1e418b5693f5c11e3016a1ad2cea62d) and addressed in GitHub Security Advisory GHSA-42cm-m9hc-r7q8 (https://github.com/gphoto/libgphoto2/security/advisories/GHSA-42cm-m9hc-r7q8). Users of libgphoto2 installations that interact with Sony camera hardware are at risk.

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 implements the Picture Transfer Protocol (PTP) for camera communication via the ptp-pack.c module. The vulnerability resides in ptp_unpack_Sony_DPD() at line 842, which unpacks device property descriptors from Sony cameras. The function reads a FormFlag byte without validating that the read offset plus sizeof(uint8_t) remains within the data buffer bounds (dpdlen). The standard ptp_unpack_DPD() function correctly performs this bounds check at lines 686-687 using *offset + sizeof(uint8_t) > dpdlen before the identical read operation. This is a classic out-of-bounds read (CWE-125) where the Sony variant's code path bypasses the protective validation logic present in the non-Sony code path, creating an information disclosure window. CPE: cpe:2.3:a:gphoto:libgphoto2:*:*:*:*:*:*:*:* (versions 0 through 2.5.33).

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.0 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_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.

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