Skip to content

Linux payload implementing HV exploits to run a custom bootloader

C

clean up

Andy Nguyen6f182dc44dfc
diff --git a/Makefile b/Makefile
index 39d8c83..710943d 100644
--- a/Makefile
+++ b/Makefile
@@ -10,31 +10,23 @@ BIN := bin/ps5-linux-loader.elf
SRC := $(wildcard source/*.c)
OBJS := $(SRC:.c=.o)
-# Agregamos los headers de los shellcodes a los CFLAGS para que los encuentre en source/main.c
CFLAGS := -std=c23 -Wall -Iinclude -Ishellcode_hypervisor -Ishellcode_kernel
LDFLAGS :=
-# Rutas de los headers generados
SC_HV_H := shellcode_hypervisor/shellcode_hypervisor.h
SC_K_H := shellcode_kernel/shellcode_kernel.h
-# 1. Regla principal: Construir los shellcodes antes que los objetos del main
all: $(SC_HV_H) $(SC_K_H) $(BIN)
-# 2. Reglas para disparar el Make en las subcarpetas
-# Usamos .PHONY de forma indirecta o forzamos la entrada a la carpeta
$(SC_HV_H):
$(MAKE) -C shellcode_hypervisor
$(SC_K_H):
$(MAKE) -C shellcode_kernel
-# 3. Los objetos dependen de que los headers de los shellcodes existan
-# Si main.c hace #include "shellcode_hypervisor.h", necesita estos targets
$(OBJS): %.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
-# 4. Link final
$(BIN): $(OBJS)
@mkdir -p $(dir $@)
$(CC) $(OBJS) $(LDFLAGS) -o $@
diff --git a/shellcode_hypervisor/boot_linux.c b/shellcode_hypervisor/boot_linux.c
index 6e45dcf..8a2f811 100644
--- a/shellcode_hypervisor/boot_linux.c
+++ b/shellcode_hypervisor/boot_linux.c
@@ -131,7 +131,6 @@ void boot_linux(void) {
}
void entry(void) {
-
disable_intr();
// Set global interrupt flag.
@@ -145,9 +144,7 @@ void entry(void) {
// Clean up mtrr.
wrmsr(MSR_MTRR4kBase + 0, 0);
-
wrmsr(MSR_MTRR4kBase + 1, 0);
-
wrmsr(MSR_MTRRVarBase + 7 * 2 + 1, 0);
atomic_add_32(&exited_cpus, 1);
diff --git a/shellcode_hypervisor/boot_linux.h b/shellcode_hypervisor/boot_linux.h
index 8e4548f..fbe3510 100644
--- a/shellcode_hypervisor/boot_linux.h
+++ b/shellcode_hypervisor/boot_linux.h
@@ -7,8 +7,8 @@
#define VM_CR_R_INIT (1ULL << 1) // Bit 1: Intercept INIT
// // MTRRs (Memory Type Range Registers)
-#define MSR_MTRR4kBase 0x00000268 // MSR_MTRRfix4K_C0000 (primer registro 4k)
-#define MSR_MTRRVarBase 0x00000200 // MTRR variable base (MSR_MTRRphysBase0)
+#define MSR_MTRR4kBase 0x00000268
+#define MSR_MTRRVarBase 0x00000200
#define VRAM_BASE (0x470000000 - info.vram_size)
diff --git a/shellcode_hypervisor/linux.h b/shellcode_hypervisor/linux.h
index 5d8d3c1..d985f3c 100644
--- a/shellcode_hypervisor/linux.h
+++ b/shellcode_hypervisor/linux.h
@@ -1,10 +1,3 @@
-/*
- * Copyright (C) 2026 Andy Nguyen
- *
- * This software may be modified and distributed under the terms
- * of the MIT license. See the LICENSE file for details.
- */
-
#ifndef __LINUX_H__
#define __LINUX_H__