delete-self-poc
delete-self-poc copied to clipboard
A way to delete a locked file, or current running executable, on disk.
🗑️ delete-self-poc
A way to delete a locked, or current running executable, on disk. This was originally found by Jonas Lykkegaard - I just wrote the POC for it. This can also be used to delete locked files on disk, that the current calling process has permissions to get DELETE access to.
How does this work, though - in this POC?
- Open a
HANDLEto the current running process, withDELETEaccess. Note,DELETEis only needed. - Rename the primary file stream,
:$DATA, usingSetFileInformationByHandleto:wtfbbq. - Close the
HANDLE - Open a
HANDLEto the current process, setDeleteFilefor theFileDispositionInfoclass toTRUE. - Close the
HANDLEto trigger the file disposition - Viola - the file is gone.
Releases
I have included a statically linked release within this repository, if you can't be bothered compiling the original source code.