CVE-2026-40339
Full vulnerability record from the local CVENow database.
Description
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.
Severity
MEDIUM
CVSS score
5.2
(v3.1)
Vulnerability status
Deferred
Source identifier
Published
2026-04-18 00:16:37.947000
Last modified
2026-10-25 23:10:00.167000
View original CVE JSON
{
"id": "CVE-2026-40339",
"sourceIdentifier": "[email protected]",
"published": "2026-04-18T00:16:37.947",
"lastModified": "2026-10-25T23:10:00.167",
"vulnStatus": "Deferred",
"cveTags": [],
"descriptions": [
{
"lang": "en",
"value": "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."
},
{
"lang": "es",
"value": "libgphoto2 es una biblioteca de acceso y control de cámaras. Las versiones hasta la 2.5.33 inclusive tienen una lectura fuera de límites en “ptp_unpack_Sony_DPD()” en “camlibs/ptp2/ptp-pack.c” (línea 842). La función lee el byte FormFlag a través de “dtoh8o(data, poffset)” sin una comprobación de límites previa. La función estándar “ptp_unpack_DPD()” en las líneas 686-687 valida correctamente “offset + sizeof(uint8_t) > dpdlen” antes de esta misma lectura, pero la variante de Sony omite esta comprobación por completo. El commit 09f8a940b1e418b5693f5c11e3016a1ad2cea62d corrige el problema."
}
],
"affected": [
{
"source": "[email protected]",
"affectedData": [
{
"vendor": "gphoto",
"product": "libgphoto2",
"versions": [
{
"version": "<= 2.5.33",
"status": "affected"
}
]
}
]
}
],
"metrics": {
"cvssMetricV31": [
{
"source": "[email protected]",
"type": "Secondary",
"cvssData": {
"version": "3.1",
"vectorString": "CVSS:3.1/AV:P/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:L",
"baseScore": 5.2,
"baseSeverity": "MEDIUM",
"attackVector": "PHYSICAL",
"attackComplexity": "LOW",
"privilegesRequired": "NONE",
"userInteraction": "NONE",
"scope": "UNCHANGED",
"confidentialityImpact": "HIGH",
"integrityImpact": "NONE",
"availabilityImpact": "LOW"
},
"exploitabilityScore": 0.9,
"impactScore": 4.2
}
],
"ssvcV203": [
{
"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
"ssvcData": {
"timestamp": "2026-04-20T14:51:42.764789Z",
"id": "CVE-2026-40339",
"options": [
{
"exploitation": "none"
},
{
"automatable": "no"
},
{
"technicalImpact": "partial"
}
],
"role": "CISA Coordinator",
"version": "2.0.3"
}
}
]
},
"weaknesses": [
{
"source": "[email protected]",
"type": "Secondary",
"description": [
{
"lang": "en",
"value": "CWE-125"
}
]
}
],
"references": [
{
"url": "https://github.com/gphoto/libgphoto2/commit/09f8a940b1e418b5693f5c11e3016a1ad2cea62d",
"source": "[email protected]"
},
{
"url": "https://github.com/gphoto/libgphoto2/security/advisories/GHSA-42cm-m9hc-r7q8",
"source": "[email protected]"
}
]
}