Skip to main content

CVE-2026-40338

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 USB device
  2. Delivery
    Trigger PTP enumeration request
  3. Exploit
    Craft oversized count value in response
  4. Execution
    Read out-of-bounds buffer
  5. Impact
    Disclose 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 (1) an attacker-controlled or malicious PTP device connected via USB or network; (2) libgphoto2 client initiating communication with the device and requesting Sony Device Property Definition enumeration; (3) the device responds with a crafted PTP packet containing a 2-byte count value positioned such that reading 2 bytes exceeds the buffer boundary. No special configuration of libgphoto2 is required; default behavior triggers the vulnerable code path when any Sony-compatible PTP device requests are issued. Exploitation is constrained by physical or network proximity to the victim system - an attacker cannot remotely trigger this without first compromising a device on the same network or gaining physical USB access.

Impact

CVSS 5.2 with physical attack vector (AV:P) and low complexity (AC:L) indicates this vulnerability requires direct physical access to exploit, significantly limiting real-world attack surface compared to network-accessible services. The confidentiality impact is high (C:H) and availability impact is low (A:L), confirming memory disclosure and potential denial of service. EPSS or KEV status data was not provided, but the physical attack vector constraint and requirement for device-level interaction suggests this is lower priority than network-exploitable flaws. The vulnerability is NOT automatically exploitable remotely; an attacker must control a USB device or network camera and actively communicate with a libgphoto2 client. However, for forensic tools, tethered camera workflows, and embedded systems that accept untrusted camera devices, this is a meaningful information disclosure risk. The root cause (missing bounds check) is elementary, and the fix is confirmed upstream, reducing uncertainty about remediation effectiveness.

Exploit ScenarioDerived

A forensic investigator connects a malicious USB device spoofing a Sony PTP camera to a forensic imaging workstation running libgphoto2. The attacker-controlled device responds to property enumeration requests with a crafted packet containing a 2-byte count value that points beyond the allocated buffer. When libgphoto2 calls ptp_unpack_Sony_DPD(), the function reads memory beyond the intended bounds, disclosing sensitive data from the process heap such as cryptographic keys, file paths, or database contents. Depending on kernel memory layout and memory protection, this could also trigger a 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 allows physical attackers to disclose sensitive memory and cause denial of service via a malicious PTP (Picture Transfer Protocol) device. The vulnerability exists in the Sony-specific DPD unpacking function, which fails to validate buffer boundaries before reading an enumeration count, enabling attackers with direct device access to craft responses that trigger the out-of-bounds read. Patch is available via upstream commit 3b9f9696be76ae51dca983d9dd8ce586a2561845.

RemediationAI

Upgrade libgphoto2 to a version after 2.5.33 that includes commit 3b9f9696be76ae51dca983d9dd8ce586a2561845. The exact patched version number is not specified in available references; verify the fix version with the upstream GitHub repository or vendor release notes. Until patching is possible, restrict physical access to systems running libgphoto2 by disabling USB camera auto-detection via device policy or udev rules, disabling PTP protocol support if not required, and isolating camera connection interfaces to trusted networks only. If libgphoto2 is embedded in forensic tools or tethered photography workflows, implement user warnings when connecting untrusted devices and run libgphoto2 in a sandboxed environment with memory protection enabled. These mitigations trade convenience and feature completeness for reduced attack surface.

Affected ProductsAI

libgphoto2 versions up to and including 2.5.33 are affected. The vulnerability is introduced in the Sony Device Property Definition unpacking code within the PTP2 camera library module. CPE string for libgphoto2 is CPE:2.3:a:gphoto:libgphoto2:*:*:*:*:*:*:*:* with version matching up through 2.5.33. Vendor advisory is available at https://github.com/gphoto/libgphoto2/security/advisories/GHSA-2hwp-w84q-27hf.

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 camera access library that implements PTP (Picture Transfer Protocol) for device communication. The vulnerability resides in ptp_unpack_Sony_DPD() at line 856 of camlibs/ptp2/ptp-pack.c, where the function reads a 2-byte enumeration count using dtoh16o(data, *poffset) without checking that 2 bytes remain in the buffer. CWE-125 is an out-of-bounds read vulnerability where the code reads memory beyond allocated boundaries. The standard PTP unpacking function ptp_unpack_DPD() at line 704 implements the correct boundary check, indicating the Sony variant omitted this validation by oversight. The vulnerability affects the Sony Device Property Definition enumeration case, triggered when libgphoto2 communicates with a malicious or specially crafted PTP device.

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 6.1 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 the PTP_DPFF_Enumeration case of ptp_unpack_Sony_DPD() in camlibs/ptp2/ptp-pack.c (line 856). The function reads a 2-byte enumeration count N via dtoh16o(data, *poffset) without verifying that 2 bytes remain in the buffer. The standard ptp_unpack_DPD() at line 704 has this exact check, confirming the Sony variant omitted it by oversight. Commit 3b9f9696be76ae51dca983d9dd8ce586a2561845 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