CVE catalog

CVE-2026-40339

libgphoto2 is a camera access and control library…

[CVE catalog]

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 5.2CVSS:3.1/AV:P/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:L
Published
Source
[NVD] · [CVE record]
EPSS
0.20% · Oct 27, 2026

Projects and upstream resources

Reported versions and fixes

Each observation applies to its named package, distribution, and release. Distribution backports can fix a vulnerability while retaining an older upstream version number.

Version impact has not been established. The original provider fields are retained below.

Provider details and historical evidence
Original provider fields
{
  "package_releases": [
    {
      "name": "libgphoto2",
      "status": "fixed",
      "release": "sid",
      "version": "2.5.34-2"
    },
    {
      "name": "libgphoto2",
      "status": "fixed",
      "release": "forky",
      "version": "2.5.34-2"
    },
    {
      "name": "libgphoto2",
      "status": "vulnerable",
      "release": "trixie",
      "version": "2.5.31-4"
    },
    {
      "name": "libgphoto2",
      "status": "vulnerable",
      "release": "bookworm",
      "version": "2.5.30-1"
    }
  ],
  "fixed_versions": [
    {
      "bug": 1134329,
      "name": "libgphoto2",
      "type": "source",
      "origin": null,
      "release": "sid",
      "urgency": "not yet assigned",
      "fixed_version": "2.5.34-1"
    },
    {
      "bug": 1134329,
      "name": "libgphoto2",
      "type": "source",
      "origin": null,
      "release": "forky",
      "urgency": "not yet assigned",
      "fixed_version": "2.5.34-1"
    },
    {
      "bug": 1134329,
      "name": "libgphoto2",
      "type": "source",
      "origin": null,
      "release": "trixie",
      "urgency": "not yet assigned",
      "fixed_version": ""
    },
    {
      "bug": 1134329,
      "name": "libgphoto2",
      "type": "source",
      "origin": null,
      "release": "bookworm",
      "urgency": "not yet assigned",
      "fixed_version": ""
    }
  ],
  "distribution_packages": [
    {
      "name": "libgphoto2",
      "ecosystem": "cpe",
      "fixed_version": "not yet fixed"
    },
    {
      "name": "libgphoto2",
      "distro": "ubuntu",
      "ranges": [
        {
          "fixed": "2.5.31-2.1ubuntu1.1",
          "introduced": "0"
        }
      ],
      "release": "noble",
      "ecosystem": "deb",
      "fixed_version": "2.5.31-2.1ubuntu1.1"
    },
    {
      "name": "libgphoto2-6t64",
      "distro": "ubuntu",
      "ranges": [
        {
          "fixed": "2.5.31-2.1ubuntu1.1",
          "introduced": "0"
        }
      ],
      "release": "noble",
      "ecosystem": "deb",
      "fixed_version": "2.5.31-2.1ubuntu1.1"
    },
    {
      "name": "libgphoto2-dev",
      "distro": "ubuntu",
      "ranges": [
        {
          "fixed": "2.5.31-2.1ubuntu1.1",
          "introduced": "0"
        }
      ],
      "release": "noble",
      "ecosystem": "deb",
      "fixed_version": "2.5.31-2.1ubuntu1.1"
    },
    {
      "name": "libgphoto2-dev-doc",
      "distro": "ubuntu",
      "ranges": [
        {
          "fixed": "2.5.31-2.1ubuntu1.1",
          "introduced": "0"
        }
      ],
      "release": "noble",
      "ecosystem": "deb",
      "fixed_version": "2.5.31-2.1ubuntu1.1"
    },
    {
      "name": "libgphoto2-l10n",
      "distro": "ubuntu",
      "ranges": [
        {
          "fixed": "2.5.31-2.1ubuntu1.1",
          "introduced": "0"
        }
      ],
      "release": "noble",
      "ecosystem": "deb",
      "fixed_version": "2.5.31-2.1ubuntu1.1"
    },
    {
      "name": "libgphoto2-port12t64",
      "distro": "ubuntu",
      "ranges": [
        {
          "fixed": "2.5.31-2.1ubuntu1.1",
          "introduced": "0"
        }
      ],
      "release": "noble",
      "ecosystem": "deb",
      "fixed_version": "2.5.31-2.1ubuntu1.1"
    },
    {
      "name": "libgphoto2",
      "distro": "ubuntu",
      "ranges": [
        {
          "type": "ECOSYSTEM",
          "events": [
            {
              "introduced": "0"
            }
          ]
        }
      ],
      "release": "14.04",
      "versions": [
        "2.5.2-0ubuntu5",
        "2.5.2-0ubuntu6",
        "2.5.3.1-0ubuntu1",
        "2.5.3.1-1ubuntu2",
        "2.5.3.1-1ubuntu2.2"
      ],
      "ecosystem": "deb",
      "fixed_version": "",
      "provider_record_id": "UBUNTU-CVE-2026-40339"
    },
    {
      "name": "libgphoto2",
      "distro": "ubuntu",
      "ranges": [
        {
          "type": "ECOSYSTEM",
          "events": [
            {
              "introduced": "0"
            }
          ]
        }
      ],
      "release": "16.04",
      "versions": [
        "2.5.8-1",
        "2.5.8-2",
        "2.5.8-3",
        "2.5.9-2",
        "2.5.9-3"
      ],
      "ecosystem": "deb",
      "fixed_version": "",
      "provider_record_id": "UBUNTU-CVE-2026-40339"
    },
    {
      "name": "libgphoto2",
      "distro": "ubuntu",
      "ranges": [
        {
          "type": "ECOSYSTEM",
          "events": [
            {
              "introduced": "0"
            }
          ]
        }
      ],
      "release": "18.04",
      "versions": [
        "2.5.14-1",
        "2.5.16-2"
      ],
      "ecosystem": "deb",
      "fixed_version": "",
      "provider_record_id": "UBUNTU-CVE-2026-40339"
    },
    {
      "name": "libgphoto2",
      "distro": "ubuntu",
      "ranges": [
        {
          "type": "ECOSYSTEM",
          "events": [
            {
              "introduced": "0"
            }
          ]
        }
      ],
      "release": "20.04",
      "versions": [
        "2.5.23-2",
        "2.5.24-1",
        "2.5.25-0ubuntu0.1"
      ],
      "ecosystem": "deb",
      "fixed_version": "",
      "provider_record_id": "UBUNTU-CVE-2026-40339"
    },
    {
      "name": "libgphoto2",
      "distro": "ubuntu",
      "ranges": [
        {
          "type": "ECOSYSTEM",
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "2.5.27-1ubuntu0.1"
            }
          ]
        }
      ],
      "release": "22.04",
      "versions": [
        "2.5.27-1",
        "2.5.27-1build1",
        "2.5.27-1build2"
      ],
      "ecosystem": "deb",
      "fixed_version": "2.5.27-1ubuntu0.1",
      "provider_record_id": "UBUNTU-CVE-2026-40339"
    },
    {
      "name": "libgphoto2",
      "distro": "ubuntu",
      "ranges": [
        {
          "type": "ECOSYSTEM",
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "2.5.31-2.1ubuntu1.1"
            }
          ]
        }
      ],
      "release": "24.04",
      "versions": [
        "2.5.30-1",
        "2.5.31-1",
        "2.5.31-2",
        "2.5.31-2.1build1",
        "2.5.31-2.1build2",
        "2.5.31-2.1ubuntu1"
      ],
      "ecosystem": "deb",
      "fixed_version": "2.5.31-2.1ubuntu1.1",
      "provider_record_id": "UBUNTU-CVE-2026-40339"
    },
    {
      "name": "libgphoto2",
      "distro": "ubuntu",
      "ranges": [
        {
          "type": "ECOSYSTEM",
          "events": [
            {
              "introduced": "0"
            }
          ]
        }
      ],
      "release": "25.10",
      "versions": [
        "2.5.31-4",
        "2.5.31-4build1",
        "2.5.31-4ubuntu1"
      ],
      "ecosystem": "deb",
      "fixed_version": "",
      "provider_record_id": "UBUNTU-CVE-2026-40339"
    },
    {
      "name": "libgphoto2",
      "distro": "ubuntu",
      "ranges": [
        {
          "type": "ECOSYSTEM",
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "2.5.33-1ubuntu1.1"
            }
          ]
        }
      ],
      "release": "26.04",
      "versions": [
        "2.5.31-4build1",
        "2.5.32-1",
        "2.5.33-1",
        "2.5.33-1ubuntu1"
      ],
      "ecosystem": "deb",
      "fixed_version": "2.5.33-1ubuntu1.1",
      "provider_record_id": "UBUNTU-CVE-2026-40339"
    }
  ]
}

[Debian bug #1134329]

Publisher notes

[trixie] libgphoto2: Minor issue [bookworm] libgphoto2: Minor issue

OpenFactory catalog packages

Matching against OpenFactory catalog package versions is in progress.

[Debian 12 (Bookworm)]

  • [libgphoto2-6]Unknown

    Source package: [libgphoto2]

    Details (2)
    • 2.5.30-1 · amd64 · bookworm

      Affected

      nvd · libgphoto2 · debian · bookworm; nvd · libgphoto2 · debian · 12

    • 2.5.30-1 · arm64 · bookworm

      Affected

      nvd · libgphoto2 · debian · bookworm; nvd · libgphoto2 · debian · 12

  • Source package: [libgphoto2]

    Details (2)
    • 2.5.30-1 · amd64 · bookworm

      Affected

      nvd · libgphoto2 · debian · bookworm; nvd · libgphoto2 · debian · 12

    • 2.5.30-1 · arm64 · bookworm

      Affected

      nvd · libgphoto2 · debian · bookworm; nvd · libgphoto2 · debian · 12

  • Source package: [libgphoto2]

    Details (2)
    • 2.5.30-1 · all · bookworm

      Affected

      nvd · libgphoto2 · debian · bookworm; nvd · libgphoto2 · debian · 12

    • 2.5.30-1 · all · bookworm

      Affected

      nvd · libgphoto2 · debian · bookworm; nvd · libgphoto2 · debian · 12

  • Source package: [libgphoto2]

    Details (2)
    • 2.5.30-1 · all · bookworm

      Affected

      nvd · libgphoto2 · debian · bookworm; nvd · libgphoto2 · debian · 12

    • 2.5.30-1 · all · bookworm

      Affected

      nvd · libgphoto2 · debian · bookworm; nvd · libgphoto2 · debian · 12

  • Source package: [libgphoto2]

    Details (2)
    • 2.5.30-1 · amd64 · bookworm

      Affected

      nvd · libgphoto2 · debian · bookworm; nvd · libgphoto2 · debian · 12

    • 2.5.30-1 · arm64 · bookworm

      Affected

      nvd · libgphoto2 · debian · bookworm; nvd · libgphoto2 · debian · 12

[Debian 13 (Trixie)]

  • Source package: [libgphoto2]

    Details (2)
    • 2.5.31-4 · amd64 · trixie

      Affected

      nvd · libgphoto2 · debian · 13

    • 2.5.31-4 · arm64 · trixie

      Affected

      nvd · libgphoto2 · debian · 13

  • Source package: [libgphoto2]

    Details (2)
    • 2.5.31-4 · amd64 · trixie

      Affected

      nvd · libgphoto2 · debian · 13

    • 2.5.31-4 · arm64 · trixie

      Affected

      nvd · libgphoto2 · debian · 13

  • Source package: [libgphoto2]

    Details (2)
    • 2.5.31-4 · all · trixie

      Affected

      nvd · libgphoto2 · debian · 13

    • 2.5.31-4 · all · trixie

      Affected

      nvd · libgphoto2 · debian · 13

  • Source package: [libgphoto2]

    Details (2)
    • 2.5.31-4 · all · trixie

      Affected

      nvd · libgphoto2 · debian · 13

    • 2.5.31-4 · all · trixie

      Affected

      nvd · libgphoto2 · debian · 13

  • Source package: [libgphoto2]

    Details (2)
    • 2.5.31-4 · amd64 · trixie

      Affected

      nvd · libgphoto2 · debian · 13

    • 2.5.31-4 · arm64 · trixie

      Affected

      nvd · libgphoto2 · debian · 13

Observed:

References