{
  "id": "CVE-2025-38346",
  "url": "https://poc.griffinguard.io/cve/CVE-2025-38346",
  "published_at": "2025-07-10T08:15:14.29Z",
  "title": "ftrace: Fix UAF when lookup kallsym after ftrace disabled",
  "vendor": "Linux",
  "product": "Linux",
  "cvss": {
    "score": 7.8,
    "source": "cna",
    "vector": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
  },
  "kev": {
    "in_kev": false,
    "added_at": null,
    "days_after_publication": null
  },
  "first_poc": null,
  "poc_repo_count": 0,
  "exploit_count": 0,
  "suspicious_repo_count": 0,
  "edge_device": null,
  "description": "In the Linux kernel, the following vulnerability has been resolved:\n\nftrace: Fix UAF when lookup kallsym after ftrace disabled\n\nThe following issue happens with a buggy module:\n\nBUG: unable to handle page fault for address: ffffffffc05d0218\nPGD 1bd66f067 P4D 1bd66f067 PUD 1bd671067 PMD 101808067 PTE 0\nOops: Oops: 0000 [#1] SMP KASAN PTI\nTainted: [O]=OOT_MODULE, [E]=UNSIGNED_MODULE\nHardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS\nRIP: 0010:sized_strscpy+0x81/0x2f0\nRSP: 0018:ffff88812d76fa08 EFLAGS: 00010246\nRAX: 0000000000000000 RBX: ffffffffc0601010 RCX: dffffc0000000000\nRDX: 0000000000000038 RSI: dffffc0000000000 RDI: ffff88812608da2d\nRBP: 8080808080808080 R08: ffff88812608da2d R09: ffff88812608da68\nR10: ffff88812608d82d R11: ffff88812608d810 R12: 0000000000000038\nR13: ffff88812608da2d R14: ffffffffc05d0218 R15: fefefefefefefeff\nFS:  00007fef552de740(0000) GS:ffff8884251c7000(0000) knlGS:0000000000000000\nCS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033\nCR2: ffffffffc05d0218 CR3: 00000001146f0000 CR4: 00000000000006f0\nDR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000\nDR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400\nCall Trace:\n \u003cTASK\u003e\n ftrace_mod_get_kallsym+0x1ac/0x590\n update_iter_mod+0x239/0x5b0\n s_next+0x5b/0xa0\n seq_read_iter+0x8c9/0x1070\n seq_read+0x249/0x3b0\n proc_reg_read+0x1b0/0x280\n vfs_read+0x17f/0x920\n ksys_read+0xf3/0x1c0\n do_syscall_64+0x5f/0x2e0\n entry_SYSCALL_64_after_hwframe+0x76/0x7e\n\nThe above issue may happen as follows:\n(1) Add kprobe tracepoint;\n(2) insmod test.ko;\n(3)  Module triggers ftrace disabled;\n(4) rmmod test.ko;\n(5) cat /proc/kallsyms; --\u003e Will trigger UAF as test.ko already removed;\nftrace_mod_get_kallsym()\n...\nstrscpy(module_name, mod_map-\u003emod-\u003ename, MODULE_NAME_LEN);\n...\n\nThe problem is when a module triggers an issue with ftrace and\nsets ftrace_disable. The ftrace_disable is set when an anomaly is\ndiscovered and to prevent any more damage, ftrace stops all text\nmodification. The issue that happened was that the ftrace_disable stops\nmore than just the text modification.\n\nWhen a module is loaded, its init functions can also be traced. Because\nkallsyms deletes the init functions after a module has loaded, ftrace\nsaves them when the module is loaded and function tracing is enabled. This\nallows the output of the function trace to show the init function names\ninstead of just their raw memory addresses.\n\nWhen a module is removed, ftrace_release_mod() is called, and if\nftrace_disable is set, it just returns without doing anything more. The\nproblem here is that it leaves the mod_list still around and if kallsyms\nis called, it will call into this code and access the module memory that\nhas already been freed as it will return:\n\n  strscpy(module_name, mod_map-\u003emod-\u003ename, MODULE_NAME_LEN);\n\nWhere the \"mod\" no longer exists and triggers a UAF bug.",
  "cwe": "CWE-416",
  "cpes": [
    "cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*",
    "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*"
  ],
  "cvss_by_source": {
    "cna": 7.8,
    "nvd": 7.8
  },
  "repos": [],
  "remediation": {
    "affected": [
      {
        "vendor": "Linux",
        "product": "Linux",
        "ranges": [
          "\u003e= aba4b5c22cbac296f4081a0476d0c55828f135b4, \u003c d064c68781c19f378af1ae741d9132d35d24b2bb",
          "\u003e= aba4b5c22cbac296f4081a0476d0c55828f135b4, \u003c 8690cd3258455bbae64f809e1d3ee0f043661c71",
          "\u003e= aba4b5c22cbac296f4081a0476d0c55828f135b4, \u003c 6805582abb720681dd1c87ff677f155dcf4e86c9",
          "\u003e= aba4b5c22cbac296f4081a0476d0c55828f135b4, \u003c 03a162933c4a03b9f1a84f7d8482903c7e1e11bb",
          "\u003e= aba4b5c22cbac296f4081a0476d0c55828f135b4, \u003c 83a692a9792aa86249d68a8ac0b9d55ecdd255fa",
          "\u003e= aba4b5c22cbac296f4081a0476d0c55828f135b4, \u003c 8e89c17dc8970c5f71a3a991f5724d4c8de42d8c",
          "\u003e= aba4b5c22cbac296f4081a0476d0c55828f135b4, \u003c f78a786ad9a5443a29eef4dae60cde85b7375129",
          "\u003e= aba4b5c22cbac296f4081a0476d0c55828f135b4, \u003c f914b52c379c12288b7623bb814d0508dbe7481d"
        ],
        "fixed_in": [
          "d064c68781c19f378af1ae741d9132d35d24b2bb",
          "8690cd3258455bbae64f809e1d3ee0f043661c71",
          "6805582abb720681dd1c87ff677f155dcf4e86c9",
          "03a162933c4a03b9f1a84f7d8482903c7e1e11bb",
          "83a692a9792aa86249d68a8ac0b9d55ecdd255fa",
          "8e89c17dc8970c5f71a3a991f5724d4c8de42d8c",
          "f78a786ad9a5443a29eef4dae60cde85b7375129",
          "f914b52c379c12288b7623bb814d0508dbe7481d"
        ]
      },
      {
        "vendor": "Linux",
        "product": "Linux",
        "ranges": [
          "4.15"
        ],
        "fixed_in": [
          "0",
          "5.4.295",
          "5.10.239",
          "5.15.186",
          "6.1.142",
          "6.6.95",
          "6.12.35",
          "6.15.4",
          "6.16"
        ]
      }
    ],
    "upgrade": [
      "Upgrade Linux to d064c68781c19f378af1ae741d9132d35d24b2bb or 8690cd3258455bbae64f809e1d3ee0f043661c71 or 6805582abb720681dd1c87ff677f155dcf4e86c9 or 03a162933c4a03b9f1a84f7d8482903c7e1e11bb or 83a692a9792aa86249d68a8ac0b9d55ecdd255fa or 8e89c17dc8970c5f71a3a991f5724d4c8de42d8c or f78a786ad9a5443a29eef4dae60cde85b7375129 or f914b52c379c12288b7623bb814d0508dbe7481d or later.",
      "Upgrade Linux to 0 or 5.4.295 or 5.10.239 or 5.15.186 or 6.1.142 or 6.6.95 or 6.12.35 or 6.15.4 or 6.16 or later."
    ]
  },
  "exploit_refs": [],
  "hunt_profile": [],
  "rules": []
}
