• Stars
    star
    532
  • Rank 83,377 (Top 2 %)
  • Language
    C
  • License
    MIT License
  • Created over 1 year ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Indirect Dynamic Syscall, SSN + Syscall address sorting via Modified TartarusGate approach + Remote Process Injection via APC Early Bird + Spawns a sacrificial Process as target process + (ACG+BlockDll) mitigation policy on spawned process + PPID spoofing + Api resolving from TIB + API hashing

DarkWidow

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 (MITRE ATT&CK TTP: T1055.004)
  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) (MITRE ATT&CK TTP: T1106)
  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!

Compile:

Directly via VS compiler:

image

image

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

Usage:

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

In Action:

DarkWidow.mp4

Sofos XDR Bypass:

alt text


Further Improvements:

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

  1. TIB:

  2. GS and FS register:

  3. PEB LDR structure:

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

def create_hash(input_string):
    # Initialize the hash value to zero
    hash_value = 0

    # Iterate through each character in the input string
    for char in input_string:
        # Add the ASCII value of the character to the hash_value
        hash_value += ord(char)

    return hash_value

if __name__ == "__main__":
    input_string = input("Enter the string to hash: ")
    hashed_value = create_hash(input_string)
    print("Hash:", hashed_value)
  1. ACG(Arbitrary Code Guard)/BlockDll mitigation policy:

  2. PPID Spoofing Detection:

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

    • Moneta:
      alt text

    • PESieve:
      alt text

  4. Capa Scan:
    alt text

  5. 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. @Sh0ckFR
  8. @winterknife
  9. @monnappa22
  10. @xpn
  11. @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

More Repositories

1

SharpGmailC2

Our Friendly Gmail will act as Server and implant will exfiltrate data via smtp and will read commands from C2 (Gmail) via imap protocol
C#
256
star
2

Learning-EDR-and-EDR_Evasion

I will be uploading all the codes which I created with the help either opensource projects or blogs. This is a step by step EDR learning path for me.
C++
254
star
3

reveng_rtkit

Linux Loadable Kernel Module (LKM) based rootkit (ring-0), capable of hiding itself, processes/implants, rmmod proof, has ability to bypass infamous rkhunter antirootkit.
C
231
star
4

ReflectiveNtdll

A Dropper POC with a focus on aiding in EDR evasion, NTDLL Unhooking followed by loading ntdll in-memory, which is present as shellcode (using pe2shc by @hasherezade). Payload encryption via SystemFucntion033 NtApi and No new thread via Fiber
C
163
star
5

CheckHooks-n-load

A Windows stager-cum-PELoader focusing Dynamic EDR Evasion, as well as FUD till now (24/02/23), when Operator wants to Know the the Underlying functions Hooks and then craft Implant based on the previous condition.
C++
97
star
6

AMSI-patches-learned-till-now

I have documented all of the AMSI patches that I learned till now
C++
66
star
7

C2_Server

C2 server to connect to a victim machine via reverse shell
Python
49
star
8

DareDevil

Stealthy Loader-cum-dropper/stage-1/stager targeting Windows10
C#
37
star
9

reveng_loader

C# loader capable of running stage-1 from remote url, file path as well as file share
C#
14
star
10

ETW_patches_from_userMode_learned_till_now

ETW patches from userMode learned till now
C++
9
star
11

Executable_Files

Database for custom made as well as publicly available stage-2 or beacons or stageless payloads, used by loaders/stage-1/stagers, or for further usage of C2 as well
PowerShell
9
star
12

GDB-Cheat-Sheet

8
star
13

VulnCon-WorkShop-Slides

VulnCon WorkShop - Maldev Workshop : Offensive TradeCraft - Syscalls to Stack Spoofing
5
star
14

RemoveFalsePositives

Just a small python script which spits out unsigned char representation for Hooked Underlying Ntapis (Which are False Positives) , for c/cpp Usage
Python
2
star
15

TryHackMe

THM Walkthroughs
PowerShell
2
star
16

HTB

Shell
1
star
17

SSH_Bruter

Bruteforces ssh creds.
Python
1
star
18

Simple_Port_Scanner

Scans Single port as well as Multiple Ports
Python
1
star
19

C-for-Everyone-Programming-Fundamentals

All the topics and concepts of C programming that I have learned so far. The things covered in this repo are all beginner-friendly.
C
1
star
20

reveng007

1
star
21

reveng007.github.io

1
star