Skip to main content

libgphoto2 CVE-2026-138158

| EUVDEUVD-2026-137555 HIGH
Stack-based Buffer Overflow (CWE-121)
2026-11-28 VulnCheck GHSA-57qr-c6wx-f722
7.0
CVSS 4.0 · Vendor: VulnCheck
View

Attack ChainAIDerived

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

  1. Access
    Attacker supplies malicious USB/sierra device
  2. Delivery
    Victim connects device and lists files
  3. Exploit
    Device returns oversized file-name register packet
  4. Execution
    memcpy overruns 1024-byte stack buffer
  5. Impact
    Deterministic crash or possible code execution

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Stack buffer bounds checking
MITRE ATT&CK

1 technique across 1 tactic: Execution

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

Exploitation Conditions

Exploitation requires the victim to physically connect an attacker-controlled device (a malicious sierra-protocol camera or any USB device impersonating one) AND to invoke a file-listing operation (e.g. gphoto2 -L), which reaches sierra_list_files → sierra_get_string_register with the 1024-byte filename buffer; the device then returns a single oversized packet (SIERRA_PACKET_SIZE allows up to 32768 payload bytes) with no bound check against the destination. Limiting factors: physical attack vector (AV:P) and required user interaction (UI:P) - the attacker cannot reach this remotely in a default setup, and only the sierra camlib code path is affected, not other camera drivers. Important exception stated by the researchers: in deployments that attach the device over USB/IP, the sink becomes network-reachable, raising the realistic vector to network and the ceiling to CVSS 7.5.

Impact

This is a genuine memory-corruption bug but a low-urgency one in practical terms, and the signals are consistent rather than conflicting. The supplied CVSS 4.0 vector (AV:P/AC:L/AT:N/PR:N/UI:P, VC:H/VI:H/VA:H, scored 7.0) hinges on a physical attack vector and required user participation: the attacker IS the device the victim chooses to plug in, and the vulnerable code only runs when the user triggers a file listing on a sierra-protocol camera. There is no KEV listing and no EPSS score in the input, so there is no signal of active or probable widespread exploitation; the vuln.today priority is 'this_week', not act_now/emergency, consistent with a patched, physically-gated flaw. The reporting researchers (Deus Rex at Cyrex, via VulnCheck) demonstrated a deterministic crash 10/10 runs over USB and serial but explicitly did NOT demonstrate code execution, so the VC:H/VI:H and the 'RCE' tag represent the theoretical ceiling of a stack-overflow class, not a proven outcome - availability impact (crash) is confirmed, confidentiality/integrity impact is inferred potential. One real caveat to flag: the researchers note the vector rises to a network-reachable CVSS 7.5 in deployments that attach the device over USB/IP, so environments using USB-over-IP should treat this as remotely reachable rather than purely physical. Net: a real bug worth patching on a normal cycle, not a drop-everything emergency, absent any exploitation evidence.

Exploit ScenarioDerived

An attacker supplies or substitutes a USB device (or malicious sierra-protocol camera) that the victim physically connects to a machine running libgphoto2; when the victim lists files (e.g. via gphoto2 -L), the device answers the file-name register with an oversized packet that overflows a 1024-byte stack buffer. Given UI:P and AV:P, the victim must both attach the device and initiate the listing. The researchers reproduced a deterministic crash this way (no public weaponized exploit code is identified); code execution is the plausible ceiling but was not demonstrated.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.4% exploitation probability (EPSS)

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

Alert me

AnalysisAIv1 – Nov 28, 2026

A stack-based buffer overflow in libgphoto2's sierra camlib (all versions through 2.5.34) lets a malicious camera or USB device impersonating the Sierra protocol overwrite stack memory when the victim lists files, for example with gphoto2 -L. The device answers a file-name register request with an oversized packet of up to 32768 bytes that is copied into a 1024-byte stack buffer in sierra_list_files with no length check against the destination, giving a deterministic crash and a plausible but undemonstrated path to code execution. The attacker must physically connect the device and the user must trigger a file-listing operation (CVSS:4.0/AV:P/AC:L/PR:N/UI:P, 7.0; independent assessment CVSS:3.1/AV:P/AC:L/PR:N/UI:R, High), so the practical urgency is low outside niche USB/IP deployments where the transport becomes network-reachable; the issue is fixed in 2.5.35 and no public exploit code was identified at time of analysis, though the reporting researchers reproduced a deterministic abort from the real gphoto2 -L entry point over both USB and serial transport.

RemediationAI

Upgrade to libgphoto2 2.5.35, which contains the fix; the vendor patch is commit c4cd525d7461c26b89b4705dc74fc4b84d57ff3a (https://github.com/gphoto/libgphoto2/commit/c4cd525d7461c26b89b4705dc74fc4b84d57ff3a), and the advisory is at https://github.com/gphoto/libgphoto2/security/advisories/GHSA-4f44-frcc-8824. The patch adds a b_size capacity argument to sierra_get_string_register() and returns GP_ERROR_CORRUPTED_DATA when a packet's declared length exceeds the space left in the destination, so if you build from source and cannot take 2.5.35 immediately, backport that commit - note this changes the function signature in camlibs/sierra/library.h, so all in-tree sierra callers must be updated together or the build breaks. Because the attack requires attaching a hostile device, the practical interim control is procedural: do not connect untrusted or unfamiliar USB devices and camera-emulating hardware to systems running libgphoto2-based software, and avoid running file listings against such devices; the trade-off is that this blocks legitimate use of unknown peripherals rather than fixing the code. For deployments that expose cameras over USB/IP, where the researchers note the sink becomes network-reachable and the realistic ceiling rises, restrict access to the USB/IP service and its port (TCP 3240 by default) to trusted hosts and disable the service where it is not needed, accepting the loss of remote camera access as the cost. Updating remains the only complete fix, since the library cannot distinguish a malicious register response from a legitimate one.

Affected VersionsENISA

libgphoto2 0 ≤2.5.34

Affected Packages

euvd libgphoto2 no fix

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in euvd

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

Technical ContextAI · show details

libgphoto2 is the userspace library behind gphoto2 and many photo-management applications for talking to digital cameras over USB and serial; each camera family is handled by a camlib, and the sierra camlib implements the Sierra/Kodak-style register protocol. The protocol frames data with a self-declared 16-bit length field read at camlibs/sierra/library.c as packlength = p[2] | (p[3] << 8), and sierra_get_string_register() (library.c:1205-1290) copies that many bytes with memcpy(&b[*b_len], &p[4], packlength) into a caller-supplied buffer that arrives as a bare pointer with no capacity argument. The only length validation in the chain, length > SIERRA_PACKET_SIZE in sierra_read_packet (library.c:638), bounds the 34816-byte local read buffer and not the destination, so a single legal packet can carry 32768 payload bytes; source review shows the loop continues until SIERRA_PACKET_DATA_END, so even a larger destination would not be safe against multiple packets. The affected sink on the listing path is char filename[1024] in sierra_list_files (library.c:118-122), filled at library.c:157-160, and nearby paths use even smaller destinations such as int audio_info[8] (32 bytes) reached via sierra_get_pic_info. This is CWE-121 (stack-based buffer overflow), with the vendor advisory additionally classifying it as CWE-20 and CWE-787: the root cause is an unvalidated, device-declared length used as a copy size, which the upstream fix addresses by threading a b_size capacity argument through every caller and rejecting any packet that exceeds the room remaining. The trigger is entirely device-driven: whatever the hostile peripheral declares in its register response is trusted by the host library.

Know when Libgphoto2 gets its next vulnerability

  • 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 (VulnCheck) PRIMARY 7.0 HIGH
CVSS:4.0/AV:P/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
vuln.today AI 6.6 MEDIUM

Attacker is the connected device so AV:P and PR:N; victim must attach it and list files so UI:R; demonstrated crash gives A:H and the overflow's code-exec ceiling supports C:H/I:H.

3.1 AV:P/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
4.0 AV:P/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N

Primary rating from Vendor (VulnCheck).

CVSS VectorVendor: VulnCheck

Attack Vector
Physical
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
Passive
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
High
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

DescriptionCVE.org

libgphoto2 through 2.5.34 contains a stack buffer overflow in sierra_get_string_register() that lets a malicious sierra-protocol camera or USB device overwrite stack memory. When files are listed, the device can answer the file-name register with an oversized packet, writing up to 32 KB past small stack buffers to cause crashes or possible code execution.

Technical POC Analysis

CWE-121 stack-based buffer overflow in libgphoto2's Sierra camlib.

Full technical POC analysis - root cause, step-by-step exploitation and patch breakdown - is part of the Pro and Business plans.

Executive ViewAI

Why It Matters

CVE-2026-138158 is a high-severity stack buffer overflow in libgphoto2's Sierra camera protocol handling (versions through 2.5.34) that can be triggered by a malicious USB device impersonating a camera when a user lists files. Successful exploitation requires physical device connection and user interaction, yielding a deterministic crash and a plausible but undemonstrated code execution path; the primary organizational risk is concentrated in niche USB/IP or remote-access scenarios where physical USB is network-exposed, potentially leading to local code execution or denial of service on affected systems.

Business Impact: Medium
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.4%
Top 69% exploitable
Prevalence
High
libgphoto2 ships in nearly all Linux desktop distributions and GNOME/KDE stacks
Social Media
1
Sightings
Data Quality
6 sources
Confidence: High

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 HIGH
CISA KEV No
Public POC No
EPSS 0.4%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.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· derived
None
System Exposure· derived
Small
Automatable· derived
No
Human Impact
Medium

Priority Score

35
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +35
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.

A stack-based buffer overflow occurs when a program writes more data to a buffer located on the stack than it was allocated to hold.

Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.

Vendor StatusVendor

Debian

libgphoto2
Release Status Fixed Version Urgency
bookworm vulnerable 2.5.30-1 -
trixie vulnerable 2.5.31-4 -
forky, sid vulnerable 2.5.34-2 -
(unstable) fixed (unfixed) -

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