Join the Cyber Forum: Threat Intel on May 12, 2026 to learn how AI is reshaping threat defense.Join the Virtual Cyber Forum: Threat IntelRegister Now
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2026-40341

CVE-2026-40341: libgphoto2 DoS Vulnerability

CVE-2026-40341 is a denial of service flaw in libgphoto2 caused by an out of bound read that crashes the library when processing untrusted USB devices. This article covers technical details, affected versions, and mitigation.

Published: April 23, 2026

CVE-2026-40341 Overview

CVE-2026-40341 is an out-of-bounds read vulnerability affecting libgphoto2, a widely-used camera access and control library. The vulnerability exists in the ptp_unpack_EOS_FocusInfoEx function and can be exploited through malicious USB devices to crash applications using the library. This vulnerability affects versions up to and including 2.5.33.

Critical Impact

An attacker with physical access can connect a malicious USB device to trigger an out-of-bounds read, causing a denial of service condition by crashing libgphoto2.

Affected Products

  • libgphoto2 versions up to and including 2.5.33
  • Applications and systems utilizing libgphoto2 for camera control
  • Linux distributions packaging vulnerable libgphoto2 versions

Discovery Timeline

  • 2026-04-18 - CVE CVE-2026-40341 published to NVD
  • 2026-04-20 - Last updated in NVD database

Technical Details for CVE-2026-40341

Vulnerability Analysis

The vulnerability is classified as CWE-126 (Buffer Over-read) and resides in the ptp_unpack_EOS_FocusInfoEx function within camlibs/ptp2/ptp-pack.c. The function processes focus information data from Canon EOS cameras using the Picture Transfer Protocol (PTP). Prior to the fix, the function would directly read multiple 16-bit and 32-bit values from the input buffer without first verifying that the buffer contained sufficient data.

This out-of-bounds read condition occurs because the function attempted to access data at specific offsets (e.g., (*data) + 4, (*data) + 6, etc.) without validating that datasize was large enough to accommodate these reads. When processing malformed data from an untrusted USB device, this could result in reading beyond the allocated buffer boundaries.

Root Cause

The root cause is insufficient input validation in the ptp_unpack_EOS_FocusInfoEx function. The original implementation immediately began extracting structured data from the input buffer using hardcoded offsets without first checking if the provided datasize parameter indicated a buffer large enough to contain the expected data fields. This lack of bounds checking allows an attacker-controlled USB device to provide a truncated or malformed data payload that triggers reads past the end of the allocated buffer.

Attack Vector

Exploitation requires physical access to the target system to connect a malicious USB device masquerading as a camera. When the system interacts with this device and libgphoto2 processes the crafted PTP data, the out-of-bounds read occurs. While the impact is primarily a denial of service (crash), the vulnerability could potentially leak small amounts of memory information depending on how the read data is subsequently processed or logged.

The following patch was applied to fix the vulnerability:

c
 static inline char*
 ptp_unpack_EOS_FocusInfoEx (PTPParams* params, const unsigned char** data, uint32_t datasize)
 {
-	uint32_t size 			= dtoh32a( *data );
-	uint32_t halfsize		= dtoh16a( (*data) + 4);
-	uint32_t version		= dtoh16a( (*data) + 6);
-	uint32_t focus_points_in_struct	= dtoh16a( (*data) + 8);
-	uint32_t focus_points_in_use	= dtoh16a( (*data) + 10);
-	uint32_t sizeX			= dtoh16a( (*data) + 12);
-	uint32_t sizeY			= dtoh16a( (*data) + 14);
-	uint32_t size2X			= dtoh16a( (*data) + 16);
-	uint32_t size2Y			= dtoh16a( (*data) + 18);
+	uint32_t size;
+	uint32_t halfsize;
+	uint32_t version;
+	uint32_t focus_points_in_struct;
+	uint32_t focus_points_in_use;
+	uint32_t sizeX;
+	uint32_t sizeY;
+	uint32_t size2X;
+	uint32_t size2Y;
 	uint32_t i;
 	uint32_t maxlen;
 	char	*str, *p;

+	if (datasize<4) {
+		ptp_error(params, "FocusInfoEx has invalid size (%d)", datasize);
+		return strdup("bad size 0");
+	}
+

Source: GitHub Commit Details

Detection Methods for CVE-2026-40341

Indicators of Compromise

  • Unexpected application crashes when USB camera devices are connected
  • System log entries indicating segmentation faults or memory access violations in processes using libgphoto2
  • Unusual USB device connection events followed by application terminations

Detection Strategies

  • Monitor system logs for crashes in applications that utilize libgphoto2 functionality
  • Implement USB device monitoring to detect and alert on unrecognized or suspicious camera devices
  • Use memory debugging tools (such as AddressSanitizer) during development to detect out-of-bounds access patterns

Monitoring Recommendations

  • Enable verbose logging for camera-related services to capture potential exploitation attempts
  • Monitor for unexpected process terminations in photo management or camera control applications
  • Implement USB device whitelisting on sensitive systems to prevent unauthorized device connections

How to Mitigate CVE-2026-40341

Immediate Actions Required

  • Update libgphoto2 to a version containing commit c385b34af260595dfbb5f9329526be5158985987 or later
  • Restrict physical access to systems where untrusted USB devices could be connected
  • Consider disabling USB ports on high-security systems where camera functionality is not required

Patch Information

A patch is available in the libgphoto2 repository. The fix adds proper bounds checking to validate that the input buffer contains sufficient data before attempting to read from it. Organizations should update to a patched version of libgphoto2 as soon as possible. For detailed patch information, refer to the GitHub Commit Details and the GitHub Security Advisory.

Workarounds

  • No official workarounds are available for this vulnerability according to the security advisory
  • Implement strict physical access controls to prevent unauthorized USB device connections
  • Use USB port blockers or disable USB ports where camera functionality is not essential
  • Apply the patch as the primary remediation strategy
bash
# Verify libgphoto2 version and check for vulnerable installations
pkg-config --modversion libgphoto2

# If using a package manager, check for available updates
apt list --upgradable 2>/dev/null | grep libgphoto2
dnf check-update libgphoto2

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeDOS

  • Vendor/TechLibgphoto2

  • SeverityLOW

  • CVSS Score3.5

  • EPSS Probability0.01%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:P/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:L
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityLow
  • CWE References
  • CWE-126
  • Technical References
  • GitHub Commit Details

  • GitHub Security Advisory
  • Related CVEs
  • CVE-2026-40338: libgphoto2 Buffer Overflow Vulnerability

  • CVE-2026-40333: libgphoto2 Buffer Overflow Vulnerability

  • CVE-2026-40336: libgphoto2 Information Disclosure Flaw

  • CVE-2026-40334: libgphoto2 Buffer Overflow Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English