pseuxide / kur Goto Github PK
View Code? Open in Web Editor NEW:pager: a tiny little code offers kernel-mode read / write using vulnerable signed kernel driver.
License: MIT License
:pager: a tiny little code offers kernel-mode read / write using vulnerable signed kernel driver.
License: MIT License
whatever in cleanup() should happen in destructor of kur_t or vul_driver class.
the lifetime of both class is very similar, so it's matter of the relevance.
~kur_t()
{
// Cleanup code here
}
or
~vul_driver()
{
// Cleanup code here
}
fix memory leak in vul_driver::ioctl_initialize_driver method.
stop allocating malloc and use struct.
driver stop -> unload is required before removing registry key and disked driver.
it doesn't have intuitive interface.
in init function,
// L"\\Device\\echo", GENERIC_READ | GENERIC_WRITE
auto retrieve_device_handle(std::wstring device_name, ACCESS_MASK access_mask) -> PHANDLE
{
NTSTATUS status;
HANDLE device_handle;
OBJECT_ATTRIBUTES obj_attr;
UNICODE_STRING uni_device_name;
IO_STATUS_BLOCK io_status_block;
RtlInitUnicodeString(&uni_device_name, device_name);
InitializeObjectAttributes(&obj_attr, &uni_device_name,
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, NULL, NULL);
ACCESS_MASK access_mask = ;
ULONG share_access = 0;
ULONG open_options = 0;
status = NtOpenFile(&device_handle,
access_mask,
&obj_attr,
&io_status_block,
share_access,
open_options);
if (!NT_SUCCESS(status)) {
std::cerr << "Failed to open handle. Status code: " << std::hex << status << std::endl;
return nullptr;
}
// This handle has to be closed with CloseHandle(device_handle);
return device_handle;
}
by inheriting std::runtime_error
, you can use message when you throw one.
Additionally you also gain polymorphic advantage which you can pass your custom error class to the function which takes param as std::runtime_error
or std::exception
.
Moreover, it has what
function at the first state and it's guaranteed to not throw additional error from it.
class kur_error : public std::runtime_error {
public:
kur_error(const std::string& message)
: std::runtime_error(message) {
}
};
kur_t constructor may should disable these Reg entry.
delete driver name and device name from params of kur_t class.
cuz users of the library don't have to know about the driver.
Currently the compile time is pretty slow, it can be heavily improved by precompiled header i recon.
make pch.h and pch.cpp
set pch.cpp as Create in precompiled header property
set entire project as Use and specify pch.h as precompiled header.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.