CVE-2022-48733 (GCVE-0-2022-48733)
Vulnerability from cvelistv5
Published
2024-06-20 11:13
Modified
2026-08-05 08:52
Summary
In the Linux kernel, the following vulnerability has been resolved: btrfs: fix use-after-free after failure to create a snapshot At ioctl.c:create_snapshot(), we allocate a pending snapshot structure and then attach it to the transaction's list of pending snapshots. After that we call btrfs_commit_transaction(), and if that returns an error we jump to 'fail' label, where we kfree() the pending snapshot structure. This can result in a later use-after-free of the pending snapshot: 1) We allocated the pending snapshot and added it to the transaction's list of pending snapshots; 2) We call btrfs_commit_transaction(), and it fails either at the first call to btrfs_run_delayed_refs() or btrfs_start_dirty_block_groups(). In both cases, we don't abort the transaction and we release our transaction handle. We jump to the 'fail' label and free the pending snapshot structure. We return with the pending snapshot still in the transaction's list; 3) Another task commits the transaction. This time there's no error at all, and then during the transaction commit it accesses a pointer to the pending snapshot structure that the snapshot creation task has already freed, resulting in a user-after-free. This issue could actually be detected by smatch, which produced the following warning: fs/btrfs/ioctl.c:843 create_snapshot() warn: '&pending_snapshot->list' not removed from list So fix this by not having the snapshot creation ioctl directly add the pending snapshot to the transaction's list. Instead add the pending snapshot to the transaction handle, and then at btrfs_commit_transaction() we add the snapshot to the list only when we can guarantee that any error returned after that point will result in a transaction abort, in which case the ioctl code can safely free the pending snapshot and no one can access it anymore.
Impacted products
Vendor Product Version
Linux Linux Version: c37b2b6269ee4637fb7cdb5da0d1e47215d57ce2
Version: c37b2b6269ee4637fb7cdb5da0d1e47215d57ce2
Version: c37b2b6269ee4637fb7cdb5da0d1e47215d57ce2
Version: c37b2b6269ee4637fb7cdb5da0d1e47215d57ce2
Create a notification for this product.
Show details on NVD website


{
  "containers": {
    "adp": [
      {
        "providerMetadata": {
          "dateUpdated": "2025-11-03T21:46:47.137Z",
          "orgId": "af854a3a-2127-422b-91ae-364da2661108",
          "shortName": "CVE"
        },
        "references": [
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/a7b717fa15165d3d9245614680bebc48a52ac05d"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/9372fa1d73da5f1673921e365d0cd2c27ec7adc2"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/28b21c558a3753171097193b6f6602a94169093a"
          },
          {
            "url": "https://lists.debian.org/debian-lts-announce/2024/10/msg00003.html"
          }
        ],
        "title": "CVE Program Container"
      },
      {
        "metrics": [
          {
            "other": {
              "content": {
                "id": "CVE-2022-48733",
                "options": [
                  {
                    "Exploitation": "none"
                  },
                  {
                    "Automatable": "no"
                  },
                  {
                    "Technical Impact": "partial"
                  }
                ],
                "role": "CISA Coordinator",
                "timestamp": "2024-09-10T17:10:54.149503Z",
                "version": "2.0.3"
              },
              "type": "ssvc"
            }
          }
        ],
        "providerMetadata": {
          "dateUpdated": "2024-09-11T17:34:48.869Z",
          "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
          "shortName": "CISA-ADP"
        },
        "title": "CISA ADP Vulnrichment"
      }
    ],
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "fs/btrfs/ioctl.c",
            "fs/btrfs/transaction.c",
            "fs/btrfs/transaction.h"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "7e4c72dbaf62f8978af8321a24dbd35566d3a78a",
              "status": "affected",
              "version": "c37b2b6269ee4637fb7cdb5da0d1e47215d57ce2",
              "versionType": "git"
            },
            {
              "lessThan": "a7b717fa15165d3d9245614680bebc48a52ac05d",
              "status": "affected",
              "version": "c37b2b6269ee4637fb7cdb5da0d1e47215d57ce2",
              "versionType": "git"
            },
            {
              "lessThan": "9372fa1d73da5f1673921e365d0cd2c27ec7adc2",
              "status": "affected",
              "version": "c37b2b6269ee4637fb7cdb5da0d1e47215d57ce2",
              "versionType": "git"
            },
            {
              "lessThan": "28b21c558a3753171097193b6f6602a94169093a",
              "status": "affected",
              "version": "c37b2b6269ee4637fb7cdb5da0d1e47215d57ce2",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "fs/btrfs/ioctl.c",
            "fs/btrfs/transaction.c",
            "fs/btrfs/transaction.h"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "3.7"
            },
            {
              "lessThan": "3.7",
              "status": "unaffected",
              "version": "0",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.10.*",
              "status": "unaffected",
              "version": "5.10.226",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.15.*",
              "status": "unaffected",
              "version": "5.15.22",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.16.*",
              "status": "unaffected",
              "version": "5.16.8",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "5.17",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "cpeApplicability": [
        {
          "nodes": [
            {
              "cpeMatch": [
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.10.226",
                  "versionStartIncluding": "3.7",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.15.22",
                  "versionStartIncluding": "3.7",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.16.8",
                  "versionStartIncluding": "3.7",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.17",
                  "versionStartIncluding": "3.7",
                  "vulnerable": true
                }
              ],
              "negate": false,
              "operator": "OR"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: fix use-after-free after failure to create a snapshot\n\nAt ioctl.c:create_snapshot(), we allocate a pending snapshot structure and\nthen attach it to the transaction\u0027s list of pending snapshots. After that\nwe call btrfs_commit_transaction(), and if that returns an error we jump\nto \u0027fail\u0027 label, where we kfree() the pending snapshot structure. This can\nresult in a later use-after-free of the pending snapshot:\n\n1) We allocated the pending snapshot and added it to the transaction\u0027s\n   list of pending snapshots;\n\n2) We call btrfs_commit_transaction(), and it fails either at the first\n   call to btrfs_run_delayed_refs() or btrfs_start_dirty_block_groups().\n   In both cases, we don\u0027t abort the transaction and we release our\n   transaction handle. We jump to the \u0027fail\u0027 label and free the pending\n   snapshot structure. We return with the pending snapshot still in the\n   transaction\u0027s list;\n\n3) Another task commits the transaction. This time there\u0027s no error at\n   all, and then during the transaction commit it accesses a pointer\n   to the pending snapshot structure that the snapshot creation task\n   has already freed, resulting in a user-after-free.\n\nThis issue could actually be detected by smatch, which produced the\nfollowing warning:\n\n  fs/btrfs/ioctl.c:843 create_snapshot() warn: \u0027\u0026pending_snapshot-\u003elist\u0027 not removed from list\n\nSo fix this by not having the snapshot creation ioctl directly add the\npending snapshot to the transaction\u0027s list. Instead add the pending\nsnapshot to the transaction handle, and then at btrfs_commit_transaction()\nwe add the snapshot to the list only when we can guarantee that any error\nreturned after that point will result in a transaction abort, in which\ncase the ioctl code can safely free the pending snapshot and no one can\naccess it anymore."
        }
      ],
      "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"
          },
          "scenarios": [
            {
              "lang": "en",
              "value": "AV:L - The bug is reached only via local BTRFS_IOC_SNAP_CREATE/SNAP_CREATE_V2 ioctls on a mounted btrfs filesystem; it is not reachable from network packet or remote filesystem protocol paths.\nAC:L - An unprivileged attacker who can create snapshots can drive the failing commit path and separately force another transaction commit, and between the free and reuse can spray the heap; the UAF does not depend on a race the attacker cannot influence.\nPR:L - Snapshot creation needs only directory write/exec permission and ownership of the source subvolume (inode_owner_or_capable), not real root or init-namespace CAP_SYS_ADMIN.\nUI:N - The attacker triggers the vulnerable ioctl themselves; no separate victim action is required.\nS:U - Impact is standard in-kernel memory corruption and privilege escalation within the host kernel\u0027s security authority, not a VM/IOMMU/sandbox boundary crossing.\nC:H - Use-after-free of btrfs_pending_snapshot leaves attacker-controllable freed memory that create_pending_snapshot later dereferences (dentry/dir/root/path/root_item), enabling arbitrary kernel read primitives.\nI:H - The same UAF of a pointer-rich structure during snapshot commit enables heap spraying and arbitrary write/control-flow hijacking.\nA:H - Dereferencing the freed pending snapshot during a later transaction commit can oops/panic the kernel even without a full exploit."
            }
          ]
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2026-08-05T08:52:01.350Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/7e4c72dbaf62f8978af8321a24dbd35566d3a78a"
        },
        {
          "url": "https://git.kernel.org/stable/c/a7b717fa15165d3d9245614680bebc48a52ac05d"
        },
        {
          "url": "https://git.kernel.org/stable/c/9372fa1d73da5f1673921e365d0cd2c27ec7adc2"
        },
        {
          "url": "https://git.kernel.org/stable/c/28b21c558a3753171097193b6f6602a94169093a"
        }
      ],
      "title": "btrfs: fix use-after-free after failure to create a snapshot",
      "x_generator": {
        "engine": "bippy-1.2.0"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2022-48733",
    "datePublished": "2024-06-20T11:13:20.737Z",
    "dateReserved": "2024-06-20T11:09:39.053Z",
    "dateUpdated": "2026-08-05T08:52:01.350Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2",
  "vulnerability-lookup:meta": {
    "vulnrichment": {
      "containers": "{\"adp\": [{\"title\": \"CVE Program Container\", \"references\": [{\"url\": \"https://git.kernel.org/stable/c/a7b717fa15165d3d9245614680bebc48a52ac05d\", \"tags\": [\"x_transferred\"]}, {\"url\": \"https://git.kernel.org/stable/c/9372fa1d73da5f1673921e365d0cd2c27ec7adc2\", \"tags\": [\"x_transferred\"]}, {\"url\": \"https://git.kernel.org/stable/c/28b21c558a3753171097193b6f6602a94169093a\", \"tags\": [\"x_transferred\"]}, {\"url\": \"https://lists.debian.org/debian-lts-announce/2024/10/msg00003.html\"}], \"providerMetadata\": {\"orgId\": \"af854a3a-2127-422b-91ae-364da2661108\", \"shortName\": \"CVE\", \"dateUpdated\": \"2025-11-03T21:46:47.137Z\"}}, {\"title\": \"CISA ADP Vulnrichment\", \"metrics\": [{\"other\": {\"type\": \"ssvc\", \"content\": {\"id\": \"CVE-2022-48733\", \"role\": \"CISA Coordinator\", \"options\": [{\"Exploitation\": \"none\"}, {\"Automatable\": \"no\"}, {\"Technical Impact\": \"partial\"}], \"version\": \"2.0.3\", \"timestamp\": \"2024-09-10T17:10:54.149503Z\"}}}], \"providerMetadata\": {\"orgId\": \"134c704f-9b21-4f2e-91b3-4a467353bcc0\", \"shortName\": \"CISA-ADP\", \"dateUpdated\": \"2024-09-11T12:42:26.077Z\"}}], \"cna\": {\"title\": \"btrfs: fix use-after-free after failure to create a snapshot\", \"metrics\": [{\"cvssV3_1\": {\"version\": \"3.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\"}, \"scenarios\": [{\"lang\": \"en\", \"value\": \"AV:L - The bug is reached only via local BTRFS_IOC_SNAP_CREATE/SNAP_CREATE_V2 ioctls on a mounted btrfs filesystem; it is not reachable from network packet or remote filesystem protocol paths.\\nAC:L - An unprivileged attacker who can create snapshots can drive the failing commit path and separately force another transaction commit, and between the free and reuse can spray the heap; the UAF does not depend on a race the attacker cannot influence.\\nPR:L - Snapshot creation needs only directory write/exec permission and ownership of the source subvolume (inode_owner_or_capable), not real root or init-namespace CAP_SYS_ADMIN.\\nUI:N - The attacker triggers the vulnerable ioctl themselves; no separate victim action is required.\\nS:U - Impact is standard in-kernel memory corruption and privilege escalation within the host kernel\u0027s security authority, not a VM/IOMMU/sandbox boundary crossing.\\nC:H - Use-after-free of btrfs_pending_snapshot leaves attacker-controllable freed memory that create_pending_snapshot later dereferences (dentry/dir/root/path/root_item), enabling arbitrary kernel read primitives.\\nI:H - The same UAF of a pointer-rich structure during snapshot commit enables heap spraying and arbitrary write/control-flow hijacking.\\nA:H - Dereferencing the freed pending snapshot during a later transaction commit can oops/panic the kernel even without a full exploit.\"}]}], \"affected\": [{\"repo\": \"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git\", \"vendor\": \"Linux\", \"product\": \"Linux\", \"versions\": [{\"status\": \"affected\", \"version\": \"c37b2b6269ee4637fb7cdb5da0d1e47215d57ce2\", \"lessThan\": \"7e4c72dbaf62f8978af8321a24dbd35566d3a78a\", \"versionType\": \"git\"}, {\"status\": \"affected\", \"version\": \"c37b2b6269ee4637fb7cdb5da0d1e47215d57ce2\", \"lessThan\": \"a7b717fa15165d3d9245614680bebc48a52ac05d\", \"versionType\": \"git\"}, {\"status\": \"affected\", \"version\": \"c37b2b6269ee4637fb7cdb5da0d1e47215d57ce2\", \"lessThan\": \"9372fa1d73da5f1673921e365d0cd2c27ec7adc2\", \"versionType\": \"git\"}, {\"status\": \"affected\", \"version\": \"c37b2b6269ee4637fb7cdb5da0d1e47215d57ce2\", \"lessThan\": \"28b21c558a3753171097193b6f6602a94169093a\", \"versionType\": \"git\"}], \"programFiles\": [\"fs/btrfs/ioctl.c\", \"fs/btrfs/transaction.c\", \"fs/btrfs/transaction.h\"], \"defaultStatus\": \"unaffected\"}, {\"repo\": \"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git\", \"vendor\": \"Linux\", \"product\": \"Linux\", \"versions\": [{\"status\": \"affected\", \"version\": \"3.7\"}, {\"status\": \"unaffected\", \"version\": \"0\", \"lessThan\": \"3.7\", \"versionType\": \"semver\"}, {\"status\": \"unaffected\", \"version\": \"5.10.226\", \"versionType\": \"semver\", \"lessThanOrEqual\": \"5.10.*\"}, {\"status\": \"unaffected\", \"version\": \"5.15.22\", \"versionType\": \"semver\", \"lessThanOrEqual\": \"5.15.*\"}, {\"status\": \"unaffected\", \"version\": \"5.16.8\", \"versionType\": \"semver\", \"lessThanOrEqual\": \"5.16.*\"}, {\"status\": \"unaffected\", \"version\": \"5.17\", \"versionType\": \"original_commit_for_fix\", \"lessThanOrEqual\": \"*\"}], \"programFiles\": [\"fs/btrfs/ioctl.c\", \"fs/btrfs/transaction.c\", \"fs/btrfs/transaction.h\"], \"defaultStatus\": \"affected\"}], \"references\": [{\"url\": \"https://git.kernel.org/stable/c/7e4c72dbaf62f8978af8321a24dbd35566d3a78a\"}, {\"url\": \"https://git.kernel.org/stable/c/a7b717fa15165d3d9245614680bebc48a52ac05d\"}, {\"url\": \"https://git.kernel.org/stable/c/9372fa1d73da5f1673921e365d0cd2c27ec7adc2\"}, {\"url\": \"https://git.kernel.org/stable/c/28b21c558a3753171097193b6f6602a94169093a\"}], \"x_generator\": {\"engine\": \"bippy-1.2.0\"}, \"descriptions\": [{\"lang\": \"en\", \"value\": \"In the Linux kernel, the following vulnerability has been resolved:\\n\\nbtrfs: fix use-after-free after failure to create a snapshot\\n\\nAt ioctl.c:create_snapshot(), we allocate a pending snapshot structure and\\nthen attach it to the transaction\u0027s list of pending snapshots. After that\\nwe call btrfs_commit_transaction(), and if that returns an error we jump\\nto \u0027fail\u0027 label, where we kfree() the pending snapshot structure. This can\\nresult in a later use-after-free of the pending snapshot:\\n\\n1) We allocated the pending snapshot and added it to the transaction\u0027s\\n   list of pending snapshots;\\n\\n2) We call btrfs_commit_transaction(), and it fails either at the first\\n   call to btrfs_run_delayed_refs() or btrfs_start_dirty_block_groups().\\n   In both cases, we don\u0027t abort the transaction and we release our\\n   transaction handle. We jump to the \u0027fail\u0027 label and free the pending\\n   snapshot structure. We return with the pending snapshot still in the\\n   transaction\u0027s list;\\n\\n3) Another task commits the transaction. This time there\u0027s no error at\\n   all, and then during the transaction commit it accesses a pointer\\n   to the pending snapshot structure that the snapshot creation task\\n   has already freed, resulting in a user-after-free.\\n\\nThis issue could actually be detected by smatch, which produced the\\nfollowing warning:\\n\\n  fs/btrfs/ioctl.c:843 create_snapshot() warn: \u0027\u0026pending_snapshot-\u003elist\u0027 not removed from list\\n\\nSo fix this by not having the snapshot creation ioctl directly add the\\npending snapshot to the transaction\u0027s list. Instead add the pending\\nsnapshot to the transaction handle, and then at btrfs_commit_transaction()\\nwe add the snapshot to the list only when we can guarantee that any error\\nreturned after that point will result in a transaction abort, in which\\ncase the ioctl code can safely free the pending snapshot and no one can\\naccess it anymore.\"}], \"cpeApplicability\": [{\"nodes\": [{\"negate\": false, \"cpeMatch\": [{\"criteria\": \"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\", \"vulnerable\": true, \"versionEndExcluding\": \"5.10.226\", \"versionStartIncluding\": \"3.7\"}, {\"criteria\": \"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\", \"vulnerable\": true, \"versionEndExcluding\": \"5.15.22\", \"versionStartIncluding\": \"3.7\"}, {\"criteria\": \"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\", \"vulnerable\": true, \"versionEndExcluding\": \"5.16.8\", \"versionStartIncluding\": \"3.7\"}, {\"criteria\": \"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\", \"vulnerable\": true, \"versionEndExcluding\": \"5.17\", \"versionStartIncluding\": \"3.7\"}], \"operator\": \"OR\"}]}], \"providerMetadata\": {\"orgId\": \"416baaa9-dc9f-4396-8d5f-8c081fb06d67\", \"shortName\": \"Linux\", \"dateUpdated\": \"2026-08-05T08:52:01.350Z\"}}}",
      "cveMetadata": "{\"cveId\": \"CVE-2022-48733\", \"state\": \"PUBLISHED\", \"dateUpdated\": \"2026-08-05T08:52:01.350Z\", \"dateReserved\": \"2024-06-20T11:09:39.053Z\", \"assignerOrgId\": \"416baaa9-dc9f-4396-8d5f-8c081fb06d67\", \"datePublished\": \"2024-06-20T11:13:20.737Z\", \"assignerShortName\": \"Linux\"}",
      "dataType": "CVE_RECORD",
      "dataVersion": "5.2"
    }
  }
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.


Loading…

Loading…