{"api_version":"1","generated_at":"2026-08-01T21:37:51+00:00","cve":"CVE-2025-40205","urls":{"html":"https://cve.report/CVE-2025-40205","api":"https://cve.report/api/cve/CVE-2025-40205.json","docs":"https://cve.report/api","cve_org":"https://www.cve.org/CVERecord?id=CVE-2025-40205","nvd":"https://nvd.nist.gov/vuln/detail/CVE-2025-40205"},"summary":{"title":"btrfs: avoid potential out-of-bounds in btrfs_encode_fh()","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: avoid potential out-of-bounds in btrfs_encode_fh()\n\nThe function btrfs_encode_fh() does not properly account for the three\ncases it handles.\n\nBefore writing to the file handle (fh), the function only returns to the\nuser BTRFS_FID_SIZE_NON_CONNECTABLE (5 dwords, 20 bytes) or\nBTRFS_FID_SIZE_CONNECTABLE (8 dwords, 32 bytes).\n\nHowever, when a parent exists and the root ID of the parent and the\ninode are different, the function writes BTRFS_FID_SIZE_CONNECTABLE_ROOT\n(10 dwords, 40 bytes).\n\nIf *max_len is not large enough, this write goes out of bounds because\nBTRFS_FID_SIZE_CONNECTABLE_ROOT is greater than\nBTRFS_FID_SIZE_CONNECTABLE originally returned.\n\nThis results in an 8-byte out-of-bounds write at\nfid->parent_root_objectid = parent_root_id.\n\nA previous attempt to fix this issue was made but was lost.\n\nhttps://lore.kernel.org/all/4CADAEEC020000780001B32C@vpn.id2.novell.com/\n\nAlthough this issue does not seem to be easily triggerable, it is a\npotential memory corruption bug that should be fixed. This patch\nresolves the issue by ensuring the function returns the appropriate size\nfor all three cases and validates that *max_len is large enough before\nwriting any data.","state":"PUBLISHED","assigner":"Linux","published_at":"2025-11-12 22:15:47","updated_at":"2026-07-30 06:24:17"},"problem_types":[],"metrics":[{"version":"3.1","source":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","type":"Secondary","score":"7.8","severity":"HIGH","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","data":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH","attackVector":"LOCAL","attackComplexity":"LOW","privilegesRequired":"LOW","userInteraction":"NONE","scope":"UNCHANGED","confidentialityImpact":"HIGH","integrityImpact":"HIGH","availabilityImpact":"HIGH"}},{"version":"3.1","source":"CNA","type":"DECLARED","score":"7.8","severity":"HIGH","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","data":{"baseScore":7.8,"baseSeverity":"HIGH","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","version":"3.1"}}],"references":[{"url":"https://git.kernel.org/stable/c/742b44342204e5dfe3926433823623c1a0c581df","name":"https://git.kernel.org/stable/c/742b44342204e5dfe3926433823623c1a0c581df","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/0276c8582488022f057b4cec21975a5edf079f47","name":"https://git.kernel.org/stable/c/0276c8582488022f057b4cec21975a5edf079f47","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/60de2f55d2aca53e81b4ef2a67d7cc9e1eb677db","name":"https://git.kernel.org/stable/c/60de2f55d2aca53e81b4ef2a67d7cc9e1eb677db","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/dff4f9ff5d7f289e4545cc936362e01ed3252742","name":"https://git.kernel.org/stable/c/dff4f9ff5d7f289e4545cc936362e01ed3252742","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/361d67276eb8ec6be8f27f4ad6c6090459438fee","name":"https://git.kernel.org/stable/c/361d67276eb8ec6be8f27f4ad6c6090459438fee","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/d91f6626133698362bba08fbc04bd72c466806d3","name":"https://git.kernel.org/stable/c/d91f6626133698362bba08fbc04bd72c466806d3","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/43143776b0a7604d873d1a6f3e552a00aa930224","name":"https://git.kernel.org/stable/c/43143776b0a7604d873d1a6f3e552a00aa930224","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/d3a9a8e1275eb9b87f006b5562a287aea3f6885f","name":"https://git.kernel.org/stable/c/d3a9a8e1275eb9b87f006b5562a287aea3f6885f","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://www.cve.org/CVERecord?id=CVE-2025-40205","name":"CVE Program record","refsource":"CVE.ORG","tags":["canonical"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-40205","name":"NVD vulnerability detail","refsource":"NVD","tags":["canonical","analysis"]}],"affected":[{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected be6e8dc0ba84029997075a1ec77b4ddb863cbe15 60de2f55d2aca53e81b4ef2a67d7cc9e1eb677db git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected be6e8dc0ba84029997075a1ec77b4ddb863cbe15 742b44342204e5dfe3926433823623c1a0c581df git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected be6e8dc0ba84029997075a1ec77b4ddb863cbe15 d3a9a8e1275eb9b87f006b5562a287aea3f6885f git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected be6e8dc0ba84029997075a1ec77b4ddb863cbe15 d91f6626133698362bba08fbc04bd72c466806d3 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected be6e8dc0ba84029997075a1ec77b4ddb863cbe15 0276c8582488022f057b4cec21975a5edf079f47 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected be6e8dc0ba84029997075a1ec77b4ddb863cbe15 361d67276eb8ec6be8f27f4ad6c6090459438fee git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected be6e8dc0ba84029997075a1ec77b4ddb863cbe15 43143776b0a7604d873d1a6f3e552a00aa930224 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected be6e8dc0ba84029997075a1ec77b4ddb863cbe15 dff4f9ff5d7f289e4545cc936362e01ed3252742 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 2.6.29","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 2.6.29 semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 5.4.301 5.4.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 5.10.246 5.10.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 5.15.195 5.15.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.1.157 6.1.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.6.113 6.6.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.12.54 6.12.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.17.4 6.17.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.18 * original_commit_for_fix","platforms":[]}],"timeline":[],"solutions":[],"workarounds":[],"exploits":[],"credits":[],"nvd_cpes":[],"vendor_comments":[],"enrichments":{"kev":null,"epss":{"cve_year":"2025","cve_id":"40205","cve":"CVE-2025-40205","epss":"0.001410000","percentile":"0.039050000","score_date":"2026-07-31","updated_at":"2026-08-01 00:10:35"},"legacy_qids":[]},"source_records":{"cve_program":{"containers":{"cna":{"affected":[{"defaultStatus":"unaffected","product":"Linux","programFiles":["fs/btrfs/export.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","vendor":"Linux","versions":[{"lessThan":"60de2f55d2aca53e81b4ef2a67d7cc9e1eb677db","status":"affected","version":"be6e8dc0ba84029997075a1ec77b4ddb863cbe15","versionType":"git"},{"lessThan":"742b44342204e5dfe3926433823623c1a0c581df","status":"affected","version":"be6e8dc0ba84029997075a1ec77b4ddb863cbe15","versionType":"git"},{"lessThan":"d3a9a8e1275eb9b87f006b5562a287aea3f6885f","status":"affected","version":"be6e8dc0ba84029997075a1ec77b4ddb863cbe15","versionType":"git"},{"lessThan":"d91f6626133698362bba08fbc04bd72c466806d3","status":"affected","version":"be6e8dc0ba84029997075a1ec77b4ddb863cbe15","versionType":"git"},{"lessThan":"0276c8582488022f057b4cec21975a5edf079f47","status":"affected","version":"be6e8dc0ba84029997075a1ec77b4ddb863cbe15","versionType":"git"},{"lessThan":"361d67276eb8ec6be8f27f4ad6c6090459438fee","status":"affected","version":"be6e8dc0ba84029997075a1ec77b4ddb863cbe15","versionType":"git"},{"lessThan":"43143776b0a7604d873d1a6f3e552a00aa930224","status":"affected","version":"be6e8dc0ba84029997075a1ec77b4ddb863cbe15","versionType":"git"},{"lessThan":"dff4f9ff5d7f289e4545cc936362e01ed3252742","status":"affected","version":"be6e8dc0ba84029997075a1ec77b4ddb863cbe15","versionType":"git"}]},{"defaultStatus":"affected","product":"Linux","programFiles":["fs/btrfs/export.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","vendor":"Linux","versions":[{"status":"affected","version":"2.6.29"},{"lessThan":"2.6.29","status":"unaffected","version":"0","versionType":"semver"},{"lessThanOrEqual":"5.4.*","status":"unaffected","version":"5.4.301","versionType":"semver"},{"lessThanOrEqual":"5.10.*","status":"unaffected","version":"5.10.246","versionType":"semver"},{"lessThanOrEqual":"5.15.*","status":"unaffected","version":"5.15.195","versionType":"semver"},{"lessThanOrEqual":"6.1.*","status":"unaffected","version":"6.1.157","versionType":"semver"},{"lessThanOrEqual":"6.6.*","status":"unaffected","version":"6.6.113","versionType":"semver"},{"lessThanOrEqual":"6.12.*","status":"unaffected","version":"6.12.54","versionType":"semver"},{"lessThanOrEqual":"6.17.*","status":"unaffected","version":"6.17.4","versionType":"semver"},{"lessThanOrEqual":"*","status":"unaffected","version":"6.18","versionType":"original_commit_for_fix"}]}],"cpeApplicability":[{"nodes":[{"cpeMatch":[{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"5.4.301","versionStartIncluding":"2.6.29","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"5.10.246","versionStartIncluding":"2.6.29","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"5.15.195","versionStartIncluding":"2.6.29","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.1.157","versionStartIncluding":"2.6.29","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.6.113","versionStartIncluding":"2.6.29","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.12.54","versionStartIncluding":"2.6.29","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.17.4","versionStartIncluding":"2.6.29","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.18","versionStartIncluding":"2.6.29","vulnerable":true}],"negate":false,"operator":"OR"}]}],"descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: avoid potential out-of-bounds in btrfs_encode_fh()\n\nThe function btrfs_encode_fh() does not properly account for the three\ncases it handles.\n\nBefore writing to the file handle (fh), the function only returns to the\nuser BTRFS_FID_SIZE_NON_CONNECTABLE (5 dwords, 20 bytes) or\nBTRFS_FID_SIZE_CONNECTABLE (8 dwords, 32 bytes).\n\nHowever, when a parent exists and the root ID of the parent and the\ninode are different, the function writes BTRFS_FID_SIZE_CONNECTABLE_ROOT\n(10 dwords, 40 bytes).\n\nIf *max_len is not large enough, this write goes out of bounds because\nBTRFS_FID_SIZE_CONNECTABLE_ROOT is greater than\nBTRFS_FID_SIZE_CONNECTABLE originally returned.\n\nThis results in an 8-byte out-of-bounds write at\nfid->parent_root_objectid = parent_root_id.\n\nA previous attempt to fix this issue was made but was lost.\n\nhttps://lore.kernel.org/all/4CADAEEC020000780001B32C@vpn.id2.novell.com/\n\nAlthough this issue does not seem to be easily triggerable, it is a\npotential memory corruption bug that should be fixed. This patch\nresolves the issue by ensuring the function returns the appropriate size\nfor all three cases and validates that *max_len is large enough before\nwriting any data."}],"metrics":[{"cvssV3_1":{"baseScore":7.8,"baseSeverity":"HIGH","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","version":"3.1"}}],"providerMetadata":{"dateUpdated":"2026-07-30T06:01:25.849Z","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux"},"references":[{"url":"https://git.kernel.org/stable/c/60de2f55d2aca53e81b4ef2a67d7cc9e1eb677db"},{"url":"https://git.kernel.org/stable/c/742b44342204e5dfe3926433823623c1a0c581df"},{"url":"https://git.kernel.org/stable/c/d3a9a8e1275eb9b87f006b5562a287aea3f6885f"},{"url":"https://git.kernel.org/stable/c/d91f6626133698362bba08fbc04bd72c466806d3"},{"url":"https://git.kernel.org/stable/c/0276c8582488022f057b4cec21975a5edf079f47"},{"url":"https://git.kernel.org/stable/c/361d67276eb8ec6be8f27f4ad6c6090459438fee"},{"url":"https://git.kernel.org/stable/c/43143776b0a7604d873d1a6f3e552a00aa930224"},{"url":"https://git.kernel.org/stable/c/dff4f9ff5d7f289e4545cc936362e01ed3252742"}],"title":"btrfs: avoid potential out-of-bounds in btrfs_encode_fh()","x_generator":{"engine":"bippy-1.2.0"}}},"cveMetadata":{"assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","assignerShortName":"Linux","cveId":"CVE-2025-40205","datePublished":"2025-11-12T21:56:35.403Z","dateReserved":"2025-04-16T07:20:57.179Z","dateUpdated":"2026-07-30T06:01:25.849Z","state":"PUBLISHED"},"dataType":"CVE_RECORD","dataVersion":"5.2"},"nvd":{"publishedDate":"2025-11-12 22:15:47","lastModifiedDate":"2026-07-30 06:24:17","problem_types":[],"metrics":{"cvssMetricV31":[{"source":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","type":"Secondary","cvssData":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH","attackVector":"LOCAL","attackComplexity":"LOW","privilegesRequired":"LOW","userInteraction":"NONE","scope":"UNCHANGED","confidentialityImpact":"HIGH","integrityImpact":"HIGH","availabilityImpact":"HIGH"},"exploitabilityScore":1.8,"impactScore":5.9}]},"configurations":[]},"legacy_mitre":{"record":{"CveYear":"2025","CveId":"40205","Ordinal":"1","Title":"btrfs: avoid potential out-of-bounds in btrfs_encode_fh()","CVE":"CVE-2025-40205","Year":"2025"},"notes":[{"CveYear":"2025","CveId":"40205","Ordinal":"1","NoteData":"In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: avoid potential out-of-bounds in btrfs_encode_fh()\n\nThe function btrfs_encode_fh() does not properly account for the three\ncases it handles.\n\nBefore writing to the file handle (fh), the function only returns to the\nuser BTRFS_FID_SIZE_NON_CONNECTABLE (5 dwords, 20 bytes) or\nBTRFS_FID_SIZE_CONNECTABLE (8 dwords, 32 bytes).\n\nHowever, when a parent exists and the root ID of the parent and the\ninode are different, the function writes BTRFS_FID_SIZE_CONNECTABLE_ROOT\n(10 dwords, 40 bytes).\n\nIf *max_len is not large enough, this write goes out of bounds because\nBTRFS_FID_SIZE_CONNECTABLE_ROOT is greater than\nBTRFS_FID_SIZE_CONNECTABLE originally returned.\n\nThis results in an 8-byte out-of-bounds write at\nfid->parent_root_objectid = parent_root_id.\n\nA previous attempt to fix this issue was made but was lost.\n\nhttps://lore.kernel.org/all/4CADAEEC020000780001B32C@vpn.id2.novell.com/\n\nAlthough this issue does not seem to be easily triggerable, it is a\npotential memory corruption bug that should be fixed. This patch\nresolves the issue by ensuring the function returns the appropriate size\nfor all three cases and validates that *max_len is large enough before\nwriting any data.","Type":"Description","Title":"btrfs: avoid potential out-of-bounds in btrfs_encode_fh()"}]}}}