commit 36ab6cfec8fd42d8804d32b047e26ef2fadda63c
Author: finwo <finwo@pm.me>
Date: Fri, 1 May 2026 23:34:16 +0200
Project init
Diffstat:
7 files changed, 130 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -0,0 +1 @@
+*.o
diff --git a/Makefile b/Makefile
@@ -0,0 +1,19 @@
+BIN?=cve-toolkit
+
+SRC:=
+SRC+=$(wildcard src/*.c)
+SRC+=$(wildcard src/**/*.c)
+
+OBJ:=$(SRC:.c=.o)
+
+default: $(BIN)
+
+.c.o:
+ $(CC) $< $(CFLAGS) -c -o $@
+
+$(BIN): $(OBJ)
+ $(CPP) $(OBJ) $(CPPFLAGS) $(LDFLAGS) -s -o $@
+
+.PHONY: clean
+clean:
+ rm -f $(OBJ)
diff --git a/README.md b/README.md
diff --git a/src/detector/cve-2026-31431.c b/src/detector/cve-2026-31431.c
@@ -0,0 +1,37 @@
+#include <stdio.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <unistd.h>
+#include <linux/if_alg.h>
+
+#include "setup.h"
+
+void detector_cve_2026_31431(int num) {
+ detector_total++;
+
+ int fd = socket(AF_ALG, SOCK_SEQPACKET, 0);
+ if (fd < 0) {
+ perror("socket");
+ return;
+ }
+
+ struct sockaddr_alg sa;
+ memset(&sa, 0, sizeof(sa));
+ sa.salg_family = AF_ALG;
+
+ strcpy((char*)sa.salg_type,"aead");
+ strcpy((char*)sa.salg_name,"authencesn(hmac(sha256),cbc(aes))");
+
+ if (bind(fd,(struct sockaddr*)&sa, sizeof(sa)) < 0) {
+ detector_pass++;
+ return;
+ }
+
+ detector_fail++;
+ return;
+}
+
+__attribute__((constructor))
+void detector_cve_2026_31431_setup() {
+ detector_queue_append("CVE-2026-31431", detector_cve_2026_31431);
+}
diff --git a/src/detector/setup.c b/src/detector/setup.c
@@ -0,0 +1,29 @@
+#include "setup.h"
+
+#include <stdlib.h>
+
+extern struct detector_queue_entry **detector_queue;
+int detector_queue_cap = 0;
+int detector_queue_length = 0;
+
+int detector_total = 0;
+int detector_pass = 0;
+int detector_fail = 0;
+
+void detector_queue_append(const char *name, void (*fn)(int)) {
+
+ // Initial queue initialize
+ if (!detector_queue_cap) {
+ detector_queue = malloc(sizeof(void*));
+ detector_queue_cap = 1;
+ }
+
+ // Grow queue if needed
+ if ((detector_queue_length+1) > detector_queue_cap) {
+ detector_queue_cap *= 2;
+ detector_queue = realloc(detector_queue, detector_queue_cap * sizeof(void*));
+ }
+
+ // Append fn to queue
+ detector_queue[detector_queue_length++] = fn;
+}
diff --git a/src/detector/setup.h b/src/detector/setup.h
@@ -0,0 +1,27 @@
+#ifndef __CVETK_DETECTOR_SETUP_H__
+#define __CVETK_DETECTOR_SETUP_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stddef.h>
+
+struct detector_queue_entry {
+ void (*handler)(int);
+};
+
+extern struct detector_queue_entry **detector_queue;
+extern int detector_queue_cap;
+extern int detector_queue_length;
+extern int detector_total;
+extern int detector_pass;
+extern int detector_fail;
+
+void detector_queue_append(const char *name, void (*fn)(int));
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // __CVETK_DETECTOR_SETUP_H__
diff --git a/src/main.c b/src/main.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+
+#include "detector/setup.h"
+
+int main() {
+ int i = 0;
+
+ for (int i = 0 ; i < detector_queue_length ; i++) {
+ struct detector_queue_entry *entry = detector_queue[i];
+ entry->handler(i);
+ }
+
+ printf("====[ REPORT ]====\n");
+
+ printf("pass: %d\n", detector_pass);
+ printf("fail: %d\n", detector_fail);
+}