CVE-2026-40334
LOWAttack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessConnect malicious camera via USB
-
Deliverylibgphoto2 reads PTP packet
-
Exploitstrncpy copies 13 unterminated bytes
-
ExecutionString operation reads past buffer
-
PersistOut-of-bounds read occurs
-
ImpactMemory disclosure or crash
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Null terminator handling
|
| Exploitation Conditions | Physical access to a Canon camera connected to the target system running libgphoto2 is mandatory. The camera must return a malformed or malicious PTP packet containing a filename field that is exactly 13 bytes with no null terminator - this data must originate from the camera itself (via PTP protocol) to reach the vulnerable code path. The vulnerability does NOT exist in remote PTP connections over network; only direct USB camera connections are affected. Default libgphoto2 configurations with standard Canon cameras will not trigger this; the camera firmware or packets must be non-standard or deliberately crafted. |
| Impact | The CVSS score of 3.5 reflects low impact despite the vulnerability class. Attack Vector is Physical (AV:P), meaning the attacker must have direct access to a camera connected to the system - a significant barrier eliminating remote exploitation. Attack Complexity is Low (AC:L) and no authentication is required (PR:N), but these factors are muted by the physical access requirement. Confidentiality impact is Low (C:L) - out-of-bounds reads can leak small amounts of adjacent memory - and Availability impact is Low (A:L) via crash/denial of service. The CVSS vector explicitly eliminates remote exploitation scenarios. No EPSS score, KEV listing, or public POC has been provided; this appears to be a researcher-reported vulnerability addressed through GitHub security advisory rather than active in-the-wild exploitation. The real-world risk is low because it requires a specialized setup: a system running libgphoto2 connected to a Canon camera, with malformed firmware or crafted PTP packets from the camera itself. Most deployments use libgphoto2 on desktop Linux for casual photo import, not in contexts where camera firmware can be controlled by attackers. Patch availability (commit 259fc7d) is confirmed, reducing urgency. |
| Exploit ScenarioDerived | An attacker with physical access to a Linux system connected to a Canon camera modifies or supplies a malicious camera with crafted PTP firmware containing a 13-byte filename field without null termination. When libgphoto2 attempts to unpack the camera data, it copies the unterminated filename into the 13-byte buffer. A subsequent string operation (such as filename printing or logging) reads past the buffer boundary, leaking heap memory or crashing the application. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Apr 18, 2026
Missing null terminator in libgphoto2's ptp_unpack_Canon_FE() function allows out-of-bounds memory reads when processing Canon camera filenames. Versions up to 2.5.33 are vulnerable when a 13-byte filename without null termination is supplied, causing subsequent string operations to read beyond buffer boundaries. The vulnerability requires physical camera access and results in information disclosure or denial of service, not remote code execution.
RemediationAI
Apply the upstream fix by upgrading libgphoto2 to version 2.5.34 or later, which includes commit 259fc7d3bfe534ce4b114c464f55b448670ab873. The patch adds explicit null termination to the buffer after strncpy(). For systems unable to update immediately, reduce exposure by disconnecting untrusted or unfamiliar camera devices and avoiding use of libgphoto2 with cameras of unknown firmware origin. Because the vulnerability requires a malformed or compromised camera to trigger, the practical mitigation is patch deployment on systems that actively use libgphoto2; systems that have libgphoto2 installed but never connect cameras have negligible risk. See GitHub security advisory GHSA-ph87-cc3j-c6hm for vendor patch details and commit reference.
Affected ProductsAI
libgphoto2 versions up to and including 2.5.33 (CPE: cpe:2.3:a:gphoto:libgphoto2:*:*:*:*:*:*:*:*) are vulnerable. The vulnerability is specific to Canon PTP packet handling and only triggers when a 13-byte filename without null termination is present in camera data. Affected systems are those using libgphoto2 to interface with Canon digital cameras.
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 control library used by Linux and Unix systems to interface with digital cameras via the Picture Transfer Protocol (PTP). The vulnerability exists in the Canon-specific PTP packet unpacking routine (ptp_unpack_Canon_FE) in camlibs/ptp2/ptp-pack.c at line 1377. The function uses strncpy() to copy a filename into a fixed 13-byte buffer without explicitly null-terminating the copied string. CWE-170 (Improper Null Termination) describes the root cause: when strncpy() copies exactly N bytes into an N-byte buffer, it does not append a null terminator, leaving the buffer unterminated. Any subsequent string function (strlen, strcpy, printf) will read past the buffer boundary seeking a null terminator, violating memory safety. CPE affected: cpe:2.3:a:gphoto:libgphoto2:*:*:*:*:*:*:*:* with versions up to and including 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
AV:P/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:L
Primary rating from Vendor (github) · only source for this CVE.
CVSS VectorVendor: github
DescriptionCVE.org
libgphoto2 is a camera access and control library. In versions up to and including 2.5.33, a missing null terminator exists in ptp_unpack_Canon_FE() in camlibs/ptp2/ptp-pack.c (line 1377). The function copies a filename into a 13-byte buffer using strncpy without explicitly null-terminating the result. If the source data is exactly 13 bytes with no null terminator, the buffer is left unterminated, leading to out-of-bounds reads in any subsequent string operation. Commit 259fc7d3bfe534ce4b114c464f55b448670ab873 patches the issue.
Threat Intelligence Overview
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.
What every action level means
SSVC AssessmentENISA
Priority Score
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.
NVD
CVE.org
EPSS
Vulnrichment
GitHub
VulDB
Exploit-DB