Skip to content

Commit aed8a71

Browse files
committed
Self delete using Alternate Data Stream
1 parent 015c296 commit aed8a71

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[package]
2+
name = "Alternate_Data_Stream"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]
7+
winapi = {version = "0.3.9", features = ["fileapi","handleapi", "heapapi","minwinbase","winbase","winnt"] }
8+
9+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Self Deletion Using Alternate Data Stream
2+
3+
The code creates an alternate data stream, which isn't visible in typical file listings, and uses this to manipulate the file in a way that allows for self-deletion.
4+
5+
By renaming the file's alternate data stream, it essentially prepares the file for an operation that can be performed on itself without directly needing admin permissions for file deletion.
6+
7+
The actual deletion occurs when the file handle is closed after marking the file for deletion, which is a Windows feature where marking a file for deletion and then closing the last handle to it results in the file being deleted.
8+
9+
## Usage
10+
11+
```
12+
cargo build --release
13+
14+
./target/release/Alternate_Data_Stream.exe
15+
```
16+
17+
## References and Credits
18+
19+
* https://maxkersten.nl/binary-analysis-course/malware-snippets/self-deletion/
20+
* https://github.com/joaoviictorti/RustRedOps/blob/main/Self_Deletion/src/main.rs
21+
22+
By [@5mukx](https://x.com/5mukx)

0 commit comments

Comments
 (0)