timwhitez starred DarkWidow
2023-7-28 11:45:7 Author: github.com(查看原文) 阅读量:30 收藏

This is a Dropper/PostExploitation Tool (or can be used in both situations) targeting Windows.

Capabilities:

  1. Indirect Dynamic Syscall
  2. SSN + Syscall address sorting via Modified TartarusGate approach
  3. Remote Process Injection via APC Early Bird
  4. Spawns a sacrificial Process as the target process
  5. ACG(Arbitrary Code Guard)/BlockDll mitigation policy on spawned process
  6. PPID spoofing (MITRE ATT&CK TTP: T1134.004)
  7. Api resolving from TIB (Directly via offset (from TIB) -> TEB -> PEB -> resolve Nt Api)
  8. Cursed Nt API hashing

Bonus: If blessed with Admin privilege =>

  1. Disables Event Log via killing EventLog Service Threads (MITRE ATT&CK TTP: T1562.002)

Disadv: If threads are resumed, all events that occurred during the suspension of Event Logger, get logged Again!

So, thought of killing them instead!

"It's more Invasive than suspension, but the decision is always up to the operator. Besides, killing threads get logged on the kernel level" - @SEKTOR7net

While Killing only those threads in the indirect syscall implant, was facing an error. I was unable to get the "eventlog" SubProcessTag Value. So thought of killing all threads, i.e. killing the whole process (responsible svchost.exe). Yeah creating an IOC!.

= EDR/Ring-3/UserLand hook Bypass Probably! -> Don't have EDR to check it though ;(

Compile:

Directly via VS compiler:

image

  1. Also via compile.bat (prefer option 1.)

Usage:

PS C:> .\x64\Release\indirect.exe
[!] Wrong!
[->] Syntax: .\x64\Release\indirect.exe <PPID to spoof>

In Action:

DarkWidow.mp4

Further Improvements:

  1. PPID spoofing (Emotet method)
  2. Much Stealthier Use Case of EventLog Disabling!

Portions of the Code and links those helped:

  1. TIB:

  2. GS and FS register:

  3. PEB LDR structure:

  4. TIB -> TEB -> PEB -> Resolve Nt API and API hashing

  5. ACG(Arbitrary Code Guard)/BlockDll mitigation policy:

  6. PPID Spoofing Detection:

    • PPID Spoofing Detect by @spotheplanet
    • If got time, I will be adding a detection Portion to this portion! -> [Remaining..............................................!]
  7. Moneta Detection and PESieve Detection:\

    • Moneta:
      alt text

    • PESieve:
      alt text

  8. Capa Scan:
    alt text

  9. How Thread Stack Looks of the Implant Process:

Implant Process Legit Cmd process
alt text alt text

It follows that by executing the return instruction in the memory of the ntdll.dll in the indirect syscall POC, the return address can be successfully spoofed, the ntdll.dll can be placed at the top of the call stack and the EDR will interpret a higher legitimacy. - @VirtualAllocEx from DirectSyscall Vs Indirect Syscall
Also thanks to, @peterwintrsmith!

  1. EventLogger Config, I used: image alt text

  2. Setting SeDebugPrivilege:
    From Here: alt text To Here: alt text

  3. Killing Event Log Threads:

Major Thanks for helping me out (Directly/indirectly (pun NOT intended :))):

  1. @SEKTOR7net
  2. @peterwintrsmith
  3. @Jean_Maes_1994
  4. @D1rkMtr
  5. @spotheplanet
  6. @0xBoku
  7. @winterknife
  8. @monnappa22
  9. @xpn
  10. @hlldz

I hope I didn't miss someone!

This project is a part of my journey to learn about EDR World! => Learning-EDR-and-EDR_Evasion


文章来源: https://github.com/reveng007/DarkWidow
如有侵权请联系:admin#unsafe.sh