mina.ko.git


mina.ko

~ (wip)LKM rootkit for 6.1+ kernels
git clone https://github.com/djnnvx/mina.ko.git
log | files | refs | archive | README | LICENSE

commit 7c9e145ed768d85c73652b7f5cfc9271b7923d11
parent 5882a78d36c16e4ee3fa1a4e1d686d9459bc549d
Author: djnn <[email protected]>
Date: Sat, 7 Dec 2024 17:58:21 +0900

feat(meta): moving to separate directory+simplifying build

Diffstat:
DMakefile | 56--------------------------------------------------------
Arootkit/Makefile | 41+++++++++++++++++++++++++++++++++++++++++
Arootkit/includes/mina.h | 9+++++++++
Arootkit/mina.c | 28++++++++++++++++++++++++++++
Dsrc/mina.c | 20--------------------

5 files changed, 78 insertions(+), 76 deletions(-)

diff --git a/Makefile b/Makefile
@@ -1,56 +0,0 @@
-
-.PHONY: all
-all: compile
-
-.PHONY: help
-help:
-	@echo "\033[34mmina.ko targets:\033[0m"
-	@perl -nle'print $& if m{^[a-zA-Z_-\d]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-22s\033[0m %s\n", $$1, $$2}'
-
-# check if shuf exists
-_FOUND_SHUF = $(shell command -v shuf 2> /dev/null)
-
-# options
-MINA_DEBUG = 1
-ifdef _FOUND_SHUF
-  MINA_MAGIC_R15 = $(shell shuf -i 100-100000 -n1)
-else
-  MINA_MAGIC_R15 = $(shell head -n50 /dev/urandom | wc -c)
-endif
-MINA_CLIENT_ID = DEBUG
-
-# kernel config is shit for out of tree modules
-EXTRA_CFLAGS += -DMINA_DEBUG=$(MINA_DEBUG)             \
-                -DMINA_MAGIC_R15=$(MINA_MAGIC_R15)     \
-                -DMINA_CLIENT_ID=\"$(MINA_CLIENT_ID)\"
-
-# kernel vars cant define with patsubst for some fucking reason
-obj-m := mina_$(MINA_CLIENT_ID).o
-mina_$(MINA_CLIENT_ID)-objs := src/mina.o
-
-compile: ## compiles the rootkit
-	$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
-	rm -f *.order *.symvers *.mod *.mod.c *.o
-
-clean: ## cleans up build artifacts
-	$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
-	find . -type f -name *.o -delete
-
-load: ## loads the rootkit on the system
-	@dmesg -C
-	@insmod *.ko
-	@dmesg
-
-unload: ## unloads the rootkit from the system
-	@dmesg -C
-	@rmmod *.ko
-	@dmesg
-
-deps: ## install build dependencies for debian-based systems
-	@apt-get install -y \
-		gcc make build-essential libncurses-dev exuberant-ctags \
-		build-essential linux-headers-`uname -r`
-
-
-
-.PHONY: clean deps load unload
diff --git a/rootkit/Makefile b/rootkit/Makefile
@@ -0,0 +1,41 @@
+
+.PHONY: all
+all: compile
+
+.PHONY: help
+help:
+	@echo "\033[34mmina.ko targets:\033[0m"
+	@perl -nle'print $& if m{^[a-zA-Z_-\d]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-22s\033[0m %s\n", $$1, $$2}'
+
+MINA_CLIENT_ID = meow
+
+# kernel vars cant define with patsubst for some fucking reason
+obj-m := mina_$(MINA_CLIENT_ID).o
+mina_$(MINA_CLIENT_ID)-objs := mina.o
+
+compile: ## compiles the rootkit
+	$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
+	rm -f *.order *.symvers *.mod *.mod.c *.o .mina* .Module* .module*
+
+clean: ## cleans up build artifacts
+	$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
+	find . -type f -name *.o -delete
+
+load: ## loads the rootkit on the system
+	@dmesg -C
+	@insmod *.ko
+	@dmesg
+
+unload: ## unloads the rootkit from the system
+	@dmesg -C
+	@rmmod *.ko
+	@dmesg
+
+deps: ## install build dependencies for debian-based systems
+	@apt-get install -y \
+		gcc make build-essential libncurses-dev exuberant-ctags \
+		build-essential linux-headers-`uname -r`
+
+
+
+.PHONY: clean deps load unload
diff --git a/rootkit/includes/mina.h b/rootkit/includes/mina.h
@@ -0,0 +1,9 @@
+#ifndef __KERNEL_MINA_H
+#define __KERNEL_MINA_H
+
+#include <net/sock.h>
+
+#include <linux/module.h>
+#include <linux/path.h>
+
+#endif
diff --git a/rootkit/mina.c b/rootkit/mina.c
@@ -0,0 +1,28 @@
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+
+MODULE_LICENSE("MIT");
+MODULE_AUTHOR("djnn <[email protected]>");
+MODULE_DESCRIPTION("mina LKM rootkit^-^");
+MODULE_VERSION("0.0.1");
+
+/*
+
+ * mina.ko/rootkit => tiny LKM rootkit spyware thing based
+ * on ngn (https://ngn.tf)'s shrk: https://github.com/ngn13/shrk
+ * written by djnn (https://djnn.sh)
+
+*/
+
+static int __init module_start(void) {
+    printk(KERN_INFO "Hello, World!\n");
+    return 0;
+}
+
+static void __exit module_end(void) {
+    printk(KERN_INFO "Goodbye, World!\n");
+}
+
+module_init(module_start);
+module_exit(module_end);
diff --git a/src/mina.c b/src/mina.c
@@ -1,20 +0,0 @@
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("djnn <[email protected]>");
-MODULE_DESCRIPTION("mina LKM rootkit^-^");
-MODULE_VERSION("0.0.1");
-
-static int __init module_start(void) {
-    printk(KERN_INFO "Hello, World!\n");
-    return 0;
-}
-
-static void __exit module_end(void) {
-    printk(KERN_INFO "Goodbye, World!\n");
-}
-
-module_init(module_start);
-module_exit(module_end);