From 57d27ce6944d99d77c85e47109202b99db229111 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Notin?= Date: Tue, 28 Aug 2018 15:06:31 +0200 Subject: [PATCH] Do not allow audit mode if running as high integrity (returns almost only false positives) Closes #10 --- SharpUp/Program.cs | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/SharpUp/Program.cs b/SharpUp/Program.cs index 804db63..d70792e 100755 --- a/SharpUp/Program.cs +++ b/SharpUp/Program.cs @@ -1023,32 +1023,30 @@ public static void PrivescChecks(bool auditMode) { bool isHighIntegrity = IsHighIntegrity(); bool isLocalAdmin = IsLocalAdmin(); - bool shouldQuit = false; if (isHighIntegrity) { Console.WriteLine("\r\n[*] Already in high integrity, no need to privesc!"); - shouldQuit = true; + if (auditMode) + { + Console.WriteLine("\r\n[X] Cannot run audit mode within an high integrity process."); + } + Console.WriteLine("\r\n[*] To run all checks anyway (audit mode), re-run as medium integrity, and with the \"audit\" argument."); + return; } else if (!isHighIntegrity && isLocalAdmin) { Console.WriteLine("\r\n[*] In medium integrity but user is a local administrator- UAC can be bypassed."); - shouldQuit = true; - } - - // if already admin we can quit without running all checks - if (shouldQuit) - { - if (!auditMode) + if(!auditMode) { - Console.WriteLine("\r\n[*] Quitting now, re-run with \"audit\" argument to run all checks anyway (audit mode)."); + Console.WriteLine("\r\n[*] To run all checks anyway (audit mode), re-run with the \"audit\" argument."); return; } - else - { - // except if auditMode has explictly been asked - Console.WriteLine("\r\n[*] Audit mode: running all checks anyway."); - } + } + + if (auditMode) + { + Console.WriteLine("\r\n[*] Audit mode: running all checks anyway."); } GetModifiableServices();