mirror of
https://github.com/HackTricks-wiki/hacktricks.git
synced 2025-10-10 18:36:50 +00:00
Translated ['src/generic-methodologies-and-resources/basic-forensic-meth
This commit is contained in:
parent
012d09513c
commit
84c1d3e5ab
@ -37,6 +37,7 @@
|
||||
- [Mobile Phishing Malicious Apps](generic-methodologies-and-resources/phishing-methodology/mobile-phishing-malicious-apps.md)
|
||||
- [Phishing Files & Documents](generic-methodologies-and-resources/phishing-methodology/phishing-documents.md)
|
||||
- [Basic Forensic Methodology](generic-methodologies-and-resources/basic-forensic-methodology/README.md)
|
||||
- [Adaptixc2 Config Extraction And Ttps](generic-methodologies-and-resources/basic-forensic-methodology/adaptixc2-config-extraction-and-ttps.md)
|
||||
- [Baseline Monitoring](generic-methodologies-and-resources/basic-forensic-methodology/file-integrity-monitoring.md)
|
||||
- [Anti-Forensic Techniques](generic-methodologies-and-resources/basic-forensic-methodology/anti-forensic-techniques.md)
|
||||
- [Docker Forensics](generic-methodologies-and-resources/basic-forensic-methodology/docker-forensics.md)
|
||||
@ -130,6 +131,7 @@
|
||||
- [Seccomp](linux-hardening/privilege-escalation/docker-security/seccomp.md)
|
||||
- [Weaponizing Distroless](linux-hardening/privilege-escalation/docker-security/weaponizing-distroless.md)
|
||||
- [Escaping from Jails](linux-hardening/privilege-escalation/escaping-from-limited-bash.md)
|
||||
- [Posix Cpu Timers Toctou Cve 2025 38352](linux-hardening/privilege-escalation/linux-kernel-exploitation/posix-cpu-timers-toctou-cve-2025-38352.md)
|
||||
- [euid, ruid, suid](linux-hardening/privilege-escalation/euid-ruid-suid.md)
|
||||
- [Interesting Groups - Linux Privesc](linux-hardening/privilege-escalation/interesting-groups-linux-pe/README.md)
|
||||
- [lxd/lxc Group - Privilege escalation](linux-hardening/privilege-escalation/interesting-groups-linux-pe/lxd-privilege-escalation.md)
|
||||
@ -771,7 +773,7 @@
|
||||
- [Stack Shellcode - arm64](binary-exploitation/stack-overflow/stack-shellcode/stack-shellcode-arm64.md)
|
||||
- [Stack Pivoting - EBP2Ret - EBP chaining](binary-exploitation/stack-overflow/stack-pivoting-ebp2ret-ebp-chaining.md)
|
||||
- [Uninitialized Variables](binary-exploitation/stack-overflow/uninitialized-variables.md)
|
||||
- [ROP and JOP](binary-exploitation/rop-return-oriented-programing/README.md)
|
||||
- [ROP & JOP](binary-exploitation/rop-return-oriented-programing/README.md)
|
||||
- [BROP - Blind Return Oriented Programming](binary-exploitation/rop-return-oriented-programing/brop-blind-return-oriented-programming.md)
|
||||
- [Ret2csu](binary-exploitation/rop-return-oriented-programing/ret2csu.md)
|
||||
- [Ret2dlresolve](binary-exploitation/rop-return-oriented-programing/ret2dlresolve.md)
|
||||
@ -840,6 +842,7 @@
|
||||
- [WWW2Exec - GOT/PLT](binary-exploitation/arbitrary-write-2-exec/aw2exec-got-plt.md)
|
||||
- [WWW2Exec - \_\_malloc_hook & \_\_free_hook](binary-exploitation/arbitrary-write-2-exec/aw2exec-__malloc_hook.md)
|
||||
- [Common Exploiting Problems](binary-exploitation/common-exploiting-problems.md)
|
||||
- [Linux kernel exploitation - toctou](binary-exploitation/linux-kernel-exploitation/posix-cpu-timers-toctou-cve-2025-38352.md)
|
||||
- [Windows Exploiting (Basic Guide - OSCP lvl)](binary-exploitation/windows-exploiting-basic-guide-oscp-lvl.md)
|
||||
- [iOS Exploiting](binary-exploitation/ios-exploiting/README.md)
|
||||
- [ios CVE-2020-27950-mach_msg_trailer_t](binary-exploitation/ios-exploiting/CVE-2020-27950-mach_msg_trailer_t.md)
|
||||
@ -937,6 +940,4 @@
|
||||
- [Stealing Sensitive Information Disclosure from a Web](todo/stealing-sensitive-information-disclosure-from-a-web.md)
|
||||
- [Post Exploitation](todo/post-exploitation.md)
|
||||
- [Investment Terms](todo/investment-terms.md)
|
||||
- [Cookies Policy](todo/cookies-policy.md)
|
||||
|
||||
- [Posix Cpu Timers Toctou Cve 2025 38352](linux-hardening/privilege-escalation/linux-kernel-exploitation/posix-cpu-timers-toctou-cve-2025-38352.md)
|
||||
- [Cookies Policy](todo/cookies-policy.md)
|
@ -0,0 +1,243 @@
|
||||
# AdaptixC2 Configuration Extraction और TTPs
|
||||
|
||||
{{#include ../../banners/hacktricks-training.md}}
|
||||
|
||||
AdaptixC2 एक modular, open‑source post‑exploitation/C2 framework है जिसमें Windows x86/x64 beacons (EXE/DLL/service EXE/raw shellcode) और BOF support शामिल हैं। यह पृष्ठ दस्तावेज़ करता है:
|
||||
- यह बताना कि इसकी RC4‑packed configuration कैसे embedded है और beacons से इसे कैसे extract किया जाए
|
||||
- HTTP/SMB/TCP listeners के लिए Network/profile indicators
|
||||
- वास्तविक दुनिया में देखे गए सामान्य loader और persistence TTPs, साथ ही relevant Windows technique pages के लिंक
|
||||
|
||||
## Beacon profiles and fields
|
||||
|
||||
AdaptixC2 तीन मुख्य beacon प्रकारों का समर्थन करता है:
|
||||
- BEACON_HTTP: web C2 जिसमें configurable servers/ports/SSL, method, URI, headers, user‑agent, और एक custom parameter name शामिल हैं
|
||||
- BEACON_SMB: named‑pipe peer‑to‑peer C2 (intranet)
|
||||
- BEACON_TCP: direct sockets, वैकल्पिक रूप से protocol start को obfuscate करने के लिए prepended marker के साथ
|
||||
|
||||
HTTP beacon configs में सामान्यतः देखे जाने वाले profile fields (decryption के बाद):
|
||||
- agent_type (u32)
|
||||
- use_ssl (bool)
|
||||
- servers_count (u32), servers (array of strings), ports (array of u32)
|
||||
- http_method, uri, parameter, user_agent, http_headers (length‑prefixed strings)
|
||||
- ans_pre_size (u32), ans_size (u32) – used to parse response sizes
|
||||
- kill_date (u32), working_time (u32)
|
||||
- sleep_delay (u32), jitter_delay (u32)
|
||||
- listener_type (u32)
|
||||
- download_chunk_size (u32)
|
||||
|
||||
Example default HTTP profile (from a beacon build):
|
||||
```json
|
||||
{
|
||||
"agent_type": 3192652105,
|
||||
"use_ssl": true,
|
||||
"servers_count": 1,
|
||||
"servers": ["172.16.196.1"],
|
||||
"ports": [4443],
|
||||
"http_method": "POST",
|
||||
"uri": "/uri.php",
|
||||
"parameter": "X-Beacon-Id",
|
||||
"user_agent": "Mozilla/5.0 (Windows NT 6.2; rv:20.0) Gecko/20121202 Firefox/20.0",
|
||||
"http_headers": "\r\n",
|
||||
"ans_pre_size": 26,
|
||||
"ans_size": 47,
|
||||
"kill_date": 0,
|
||||
"working_time": 0,
|
||||
"sleep_delay": 2,
|
||||
"jitter_delay": 0,
|
||||
"listener_type": 0,
|
||||
"download_chunk_size": 102400
|
||||
}
|
||||
```
|
||||
देखी गई दुर्भावनापूर्ण HTTP प्रोफ़ाइल (वास्तविक हमला):
|
||||
```json
|
||||
{
|
||||
"agent_type": 3192652105,
|
||||
"use_ssl": true,
|
||||
"servers_count": 1,
|
||||
"servers": ["tech-system[.]online"],
|
||||
"ports": [443],
|
||||
"http_method": "POST",
|
||||
"uri": "/endpoint/api",
|
||||
"parameter": "X-App-Id",
|
||||
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.6167.160 Safari/537.36",
|
||||
"http_headers": "\r\n",
|
||||
"ans_pre_size": 26,
|
||||
"ans_size": 47,
|
||||
"kill_date": 0,
|
||||
"working_time": 0,
|
||||
"sleep_delay": 4,
|
||||
"jitter_delay": 0,
|
||||
"listener_type": 0,
|
||||
"download_chunk_size": 102400
|
||||
}
|
||||
```
|
||||
## एन्क्रिप्टेड कॉन्फ़िगरेशन पैकिंग और लोड पाथ
|
||||
|
||||
जब ऑपरेटर बिल्डर में Create पर क्लिक करता है, AdaptixC2 एन्क्रिप्टेड प्रोफ़ाइल को beacon में एक tail blob के रूप में एम्बेड कर देता है। फॉर्मेट है:
|
||||
- 4 bytes: कॉन्फ़िगरेशन का आकार (uint32, little‑endian)
|
||||
- N bytes: RC4‑एन्क्रिप्टेड कॉन्फ़िगरेशन डेटा
|
||||
- 16 bytes: RC4 कुंजी
|
||||
|
||||
beacon loader अंत से 16‑byte कुंजी को कॉपी करता है और N‑byte ब्लॉक को उसी स्थान पर RC4‑decrypt करता है:
|
||||
```c
|
||||
ULONG profileSize = packer->Unpack32();
|
||||
this->encrypt_key = (PBYTE) MemAllocLocal(16);
|
||||
memcpy(this->encrypt_key, packer->data() + 4 + profileSize, 16);
|
||||
DecryptRC4(packer->data()+4, profileSize, this->encrypt_key, 16);
|
||||
```
|
||||
व्यावहारिक निहितार्थ:
|
||||
- पूरी संरचना अक्सर PE .rdata सेक्शन के अंदर रहती है।
|
||||
- निकासी निश्चित है: size पढ़ें, उस size के ciphertext को पढ़ें, तुरंत बाद रखी गई 16‑byte key पढ़ें, फिर RC4‑decrypt करें।
|
||||
|
||||
## कॉन्फ़िगरेशन निकासी वर्कफ़्लो (रक्षा करने वाले)
|
||||
|
||||
ऐसा extractor लिखें जो beacon logic की नकल करे:
|
||||
1) PE के अंदर blob को खोजें (आमतौर पर .rdata)। एक व्यावहारिक तरीका यह है कि .rdata को संभावित [size|ciphertext|16‑byte key] लेआउट के लिए स्कैन करें और RC4 आजमाएँ।
|
||||
2) पहले 4 bytes पढ़ें → size (uint32 LE).
|
||||
3) अगले N=size bytes पढ़ें → ciphertext.
|
||||
4) अंतिम 16 bytes पढ़ें → RC4 key.
|
||||
5) ciphertext को RC4‑decrypt करें। फिर plain profile को इस तरह parse करें:
|
||||
- u32/boolean scalars जैसा ऊपर बताया गया
|
||||
- length‑prefixed strings (u32 length के बाद bytes; trailing NUL मौजूद हो सकता है)
|
||||
- arrays: servers_count के बाद उतने [string, u32 port] जोड़े
|
||||
|
||||
Minimal Python proof‑of‑concept (standalone, no external deps) जो pre‑extracted blob के साथ काम करता है:
|
||||
```python
|
||||
import struct
|
||||
from typing import List, Tuple
|
||||
|
||||
def rc4(key: bytes, data: bytes) -> bytes:
|
||||
S = list(range(256))
|
||||
j = 0
|
||||
for i in range(256):
|
||||
j = (j + S[i] + key[i % len(key)]) & 0xFF
|
||||
S[i], S[j] = S[j], S[i]
|
||||
i = j = 0
|
||||
out = bytearray()
|
||||
for b in data:
|
||||
i = (i + 1) & 0xFF
|
||||
j = (j + S[i]) & 0xFF
|
||||
S[i], S[j] = S[j], S[i]
|
||||
K = S[(S[i] + S[j]) & 0xFF]
|
||||
out.append(b ^ K)
|
||||
return bytes(out)
|
||||
|
||||
class P:
|
||||
def __init__(self, buf: bytes):
|
||||
self.b = buf; self.o = 0
|
||||
def u32(self) -> int:
|
||||
v = struct.unpack_from('<I', self.b, self.o)[0]; self.o += 4; return v
|
||||
def u8(self) -> int:
|
||||
v = self.b[self.o]; self.o += 1; return v
|
||||
def s(self) -> str:
|
||||
L = self.u32(); s = self.b[self.o:self.o+L]; self.o += L
|
||||
return s[:-1].decode('utf-8','replace') if L and s[-1] == 0 else s.decode('utf-8','replace')
|
||||
|
||||
def parse_http_cfg(plain: bytes) -> dict:
|
||||
p = P(plain)
|
||||
cfg = {}
|
||||
cfg['agent_type'] = p.u32()
|
||||
cfg['use_ssl'] = bool(p.u8())
|
||||
n = p.u32()
|
||||
cfg['servers'] = []
|
||||
cfg['ports'] = []
|
||||
for _ in range(n):
|
||||
cfg['servers'].append(p.s())
|
||||
cfg['ports'].append(p.u32())
|
||||
cfg['http_method'] = p.s()
|
||||
cfg['uri'] = p.s()
|
||||
cfg['parameter'] = p.s()
|
||||
cfg['user_agent'] = p.s()
|
||||
cfg['http_headers'] = p.s()
|
||||
cfg['ans_pre_size'] = p.u32()
|
||||
cfg['ans_size'] = p.u32() + cfg['ans_pre_size']
|
||||
cfg['kill_date'] = p.u32()
|
||||
cfg['working_time'] = p.u32()
|
||||
cfg['sleep_delay'] = p.u32()
|
||||
cfg['jitter_delay'] = p.u32()
|
||||
cfg['listener_type'] = 0
|
||||
cfg['download_chunk_size'] = 0x19000
|
||||
return cfg
|
||||
|
||||
# Usage (when you have [size|ciphertext|key] bytes):
|
||||
# blob = open('blob.bin','rb').read()
|
||||
# size = struct.unpack_from('<I', blob, 0)[0]
|
||||
# ct = blob[4:4+size]
|
||||
# key = blob[4+size:4+size+16]
|
||||
# pt = rc4(key, ct)
|
||||
# cfg = parse_http_cfg(pt)
|
||||
```
|
||||
Tips:
|
||||
- ऑटोमेशन करते समय, .rdata को पढ़ने के लिए PE parser का उपयोग करें फिर sliding window लागू करें: प्रत्येक offset o के लिए, प्रयास करें size = u32(.rdata[o:o+4]), ct = .rdata[o+4:o+4+size], candidate key = next 16 bytes; RC4‑decrypt करें और जाँचें कि string फ़ील्ड UTF‑8 में decode होते हैं और lengths समझदारी के हैं।
|
||||
- SMB/TCP profiles को भी वही length‑prefixed सम्मतियाँ फ़ॉलो करके पार्स करें।
|
||||
|
||||
## नेटवर्क फ़िंगरप्रिंटिंग और हंटिंग
|
||||
|
||||
HTTP
|
||||
- आम: operator‑selected URIs पर POST (उदा., /uri.php, /endpoint/api)
|
||||
- Beacon ID के लिए custom header parameter का उपयोग (उदा., X‑Beacon‑Id, X‑App‑Id)
|
||||
- User‑agents जो Firefox 20 या समकालीन Chrome builds की नकल करते हैं
|
||||
- Polling cadence जो sleep_delay/jitter_delay के माध्यम से दिखाई देती है
|
||||
|
||||
SMB/TCP
|
||||
- intranet C2 के लिए SMB named‑pipe listeners जहाँ web egress सीमित होता है
|
||||
- TCP beacons ट्रैफ़िक से पहले कुछ bytes prepend कर सकते हैं ताकि protocol start को अस्पष्ट किया जा सके
|
||||
|
||||
## Loader और persistence TTPs जिन्हें incidents में देखा गया
|
||||
|
||||
इन‑मेमोरी PowerShell लोडर्स
|
||||
- Base64/XOR payloads डाउनलोड करते हैं (Invoke‑RestMethod / WebClient)
|
||||
- unmanaged memory allocate करें, shellcode कॉपी करें, फिर VirtualProtect के माध्यम से protection को 0x40 (PAGE_EXECUTE_READWRITE) में बदलें
|
||||
- .NET dynamic invocation के जरिए execute करें: Marshal.GetDelegateForFunctionPointer + delegate.Invoke()
|
||||
|
||||
इन‑मेमोरी execution और AMSI/ETW विचारों के लिए इन पन्नों को देखें:
|
||||
|
||||
{{#ref}}
|
||||
../../windows-hardening/av-bypass.md
|
||||
{{#endref}}
|
||||
|
||||
देखे गए Persistence mechanisms
|
||||
- Startup folder shortcut (.lnk) ताकि logon पर loader को पुनः लॉन्च किया जा सके
|
||||
- Registry Run keys (HKCU/HKLM ...\CurrentVersion\Run), अक्सर "Updater" जैसे benign‑sounding नामों के साथ जो loader.ps1 शुरू करते हैं
|
||||
- DLL search‑order hijack: प्रभावित प्रक्रियाओं के लिए %APPDATA%\Microsoft\Windows\Templates के अंतर्गत msimg32.dll गिराकर
|
||||
|
||||
Technique deep‑dives और चेक्स:
|
||||
|
||||
{{#ref}}
|
||||
../../windows-hardening/windows-local-privilege-escalation/privilege-escalation-with-autorun-binaries.md
|
||||
{{#endref}}
|
||||
|
||||
{{#ref}}
|
||||
../../windows-hardening/windows-local-privilege-escalation/dll-hijacking/README.md
|
||||
{{#endref}}
|
||||
|
||||
Hunting ideas
|
||||
- PowerShell में RW→RX transitions: powershell.exe के अंदर PAGE_EXECUTE_READWRITE के लिए VirtualProtect कॉल्स
|
||||
- Dynamic invocation पैटर्न (GetDelegateForFunctionPointer)
|
||||
- user या common Startup फोल्डर्स के तहत Startup .lnk
|
||||
- Suspicious Run keys (उदा., "Updater"), और update.ps1/loader.ps1 जैसे loader नाम
|
||||
- %APPDATA%\Microsoft\Windows\Templates के अंतर्गत user‑writable DLL paths जिनमें msimg32.dll मौजूद हो
|
||||
|
||||
## OpSec फ़ील्ड्स पर नोट्स
|
||||
|
||||
- KillDate: वह timestamp जिसके बाद एजेंट self‑expire कर देता है
|
||||
- WorkingTime: वे घंटे जब एजेंट को एक्टिव होना चाहिए ताकि यह business activity में घुलमिल जाए
|
||||
|
||||
इन फ़ील्ड्स का उपयोग clustering के लिए और देखी गई शांत अवधि की व्याख्या करने के लिए किया जा सकता है।
|
||||
|
||||
## YARA और static लीड्स
|
||||
|
||||
Unit 42 ने beacons (C/C++ and Go) और loader API‑hashing constants के लिए बेसिक YARA प्रकाशित किए हैं। इसे पूरक नियमों के साथ बढ़ाने पर विचार करें जो PE .rdata के अंत के पास [size|ciphertext|16‑byte‑key] लेआउट और default HTTP profile strings को ढूंढते हों।
|
||||
|
||||
## References
|
||||
|
||||
- [AdaptixC2: A New Open-Source Framework Leveraged in Real-World Attacks (Unit 42)](https://unit42.paloaltonetworks.com/adaptixc2-post-exploitation-framework/)
|
||||
- [AdaptixC2 GitHub](https://github.com/Adaptix-Framework/AdaptixC2)
|
||||
- [Adaptix Framework Docs](https://adaptix-framework.gitbook.io/adaptix-framework)
|
||||
- [Marshal.GetDelegateForFunctionPointer – Microsoft Docs](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.marshal.getdelegateforfunctionpointer)
|
||||
- [VirtualProtect – Microsoft Docs](https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualprotect)
|
||||
- [Memory protection constants – Microsoft Docs](https://learn.microsoft.com/en-us/windows/win32/memory/memory-protection-constants)
|
||||
- [Invoke-RestMethod – PowerShell](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-restmethod)
|
||||
- [MITRE ATT&CK T1547.001 – Registry Run Keys/Startup Folder](https://attack.mitre.org/techniques/T1547/001/)
|
||||
|
||||
{{#include ../../banners/hacktricks-training.md}}
|
@ -1,12 +1,12 @@
|
||||
# Malware Analysis
|
||||
# मैलवेयर विश्लेषण
|
||||
|
||||
{{#include ../../banners/hacktricks-training.md}}
|
||||
|
||||
## Forensics चीटशीट्स
|
||||
## फॉरेंसिक्स चीटशीट
|
||||
|
||||
[https://www.jaiminton.com/cheatsheet/DFIR/#](https://www.jaiminton.com/cheatsheet/DFIR/)
|
||||
|
||||
## ऑनलाइन सेवाएँ
|
||||
## ऑनलाइन सेवाएं
|
||||
|
||||
- [VirusTotal](https://www.virustotal.com/gui/home/upload)
|
||||
- [HybridAnalysis](https://www.hybrid-analysis.com)
|
||||
@ -24,7 +24,7 @@ sudo apt-get install -y yara
|
||||
```
|
||||
#### नियम तैयार करें
|
||||
|
||||
इस स्क्रिप्ट का उपयोग करके github से सभी yara malware rules डाउनलोड और मर्ज करें: [https://gist.github.com/andreafortuna/29c6ea48adf3d45a979a78763cdc7ce9](https://gist.github.com/andreafortuna/29c6ea48adf3d45a979a78763cdc7ce9)\
|
||||
इस script का उपयोग github से सभी yara malware rules download और merge करने के लिए करें: [https://gist.github.com/andreafortuna/29c6ea48adf3d45a979a78763cdc7ce9](https://gist.github.com/andreafortuna/29c6ea48adf3d45a979a78763cdc7ce9)\
|
||||
Create the _**rules**_ directory and execute it. This will create a file called _**malware_rules.yar**_ which contains all the yara rules for malware.
|
||||
```bash
|
||||
wget https://gist.githubusercontent.com/andreafortuna/29c6ea48adf3d45a979a78763cdc7ce9/raw/4ec711d37f1b428b63bed1f786b26a0654aa2f31/malware_yara_rules.py
|
||||
@ -36,9 +36,9 @@ python malware_yara_rules.py
|
||||
yara -w malware_rules.yar image #Scan 1 file
|
||||
yara -w malware_rules.yar folder #Scan the whole folder
|
||||
```
|
||||
#### YaraGen: malware की जाँच और नियम बनाएँ
|
||||
#### YaraGen: malware की जाँच और नियम बनाना
|
||||
|
||||
आप बाइनरी से yara rules जनरेट करने के लिए टूल [**YaraGen**](https://github.com/Neo23x0/yarGen) का उपयोग कर सकते हैं। इन ट्यूटोरियल्स को देखें: [**Part 1**](https://www.nextron-systems.com/2015/02/16/write-simple-sound-yara-rules/), [**Part 2**](https://www.nextron-systems.com/2015/10/17/how-to-write-simple-but-sound-yara-rules-part-2/), [**Part 3**](https://www.nextron-systems.com/2016/04/15/how-to-write-simple-but-sound-yara-rules-part-3/)
|
||||
आप [**YaraGen**](https://github.com/Neo23x0/yarGen) टूल का उपयोग करके किसी binary से yara rules जेनरेट कर सकते हैं। इन ट्यूटोरियल्स को देखें: [**Part 1**](https://www.nextron-systems.com/2015/02/16/write-simple-sound-yara-rules/), [**Part 2**](https://www.nextron-systems.com/2015/10/17/how-to-write-simple-but-sound-yara-rules-part-2/), [**Part 3**](https://www.nextron-systems.com/2016/04/15/how-to-write-simple-but-sound-yara-rules-part-3/)
|
||||
```bash
|
||||
python3 yarGen.py --update
|
||||
python3.exe yarGen.py --excludegood -m ../../mals/
|
||||
@ -57,27 +57,26 @@ clamscan folderpath #Scan the whole folder
|
||||
```
|
||||
### [Capa](https://github.com/mandiant/capa)
|
||||
|
||||
**Capa** संभावित रूप से दुर्भावनापूर्ण **capabilities** को executables: PE, ELF, .NET में पहचानता है। इसलिए यह Att\&ck tactics जैसी चीज़ें या निम्नलिखित संदिग्ध क्षमताओं को ढूँढेगा:
|
||||
**Capa** executables में संभावित रूप से दुर्भावनापूर्ण **capabilities** का पता लगाती है: PE, ELF, .NET. यह Att\&ck tactics जैसी चीज़ें और निम्नलिखित तरह की संदिग्ध क्षमताओं को खोजेगा:
|
||||
|
||||
- OutputDebugString error की जाँच
|
||||
- सेवा के रूप में चलना
|
||||
- process बनाना
|
||||
- OutputDebugString error के लिए जाँच
|
||||
- सर्विस के रूप में चलना
|
||||
- प्रोसेस बनाना
|
||||
|
||||
Get it int he [**Github repo**](https://github.com/mandiant/capa).
|
||||
इसे [**Github repo**](https://github.com/mandiant/capa) में प्राप्त करें।
|
||||
|
||||
### IOCs
|
||||
|
||||
IOC means Indicator Of Compromise. एक IOC उन **conditions that identify** की एक सेट होती है जो कुछ संभावित अनचाहे सॉफ़्टवेयर या पुष्ट **malware** की पहचान करती है। Blue Teams इस प्रकार की परिभाषा का उपयोग अपने **systems** और **networks** में इस प्रकार की दुर्भावनापूर्ण फ़ाइलों की **search for this kind of malicious files** के लिए करते हैं.\
|
||||
IOC का मतलब Indicator Of Compromise है। एक IOC उन **पहचानने वाली शर्तों** का समूह है जो कुछ संभावित रूप से अनचाहे सॉफ़्टवेयर या निश्चित रूप से मौजूद **malware** की पहचान करती हैं। Blue Teams इस तरह की परिभाषा का उपयोग अपने **सिस्टम्स** और **नेटवर्क्स** में इस प्रकार की **दुर्भावनापूर्ण फ़ाइलों की खोज** के लिए करते हैं.\
|
||||
इन परिभाषाओं को साझा करना बहुत उपयोगी है क्योंकि जब किसी कंप्यूटर में malware पहचाना जाता है और उस malware के लिए एक IOC बनाया जाता है, तो अन्य Blue Teams इसका उपयोग करके उस malware की पहचान तेज़ी से कर सकते हैं।
|
||||
|
||||
इन परिभाषाओं को साझा करना बहुत उपयोगी होता है क्योंकि जब किसी कंप्यूटर में malware की पहचान होती है और उस malware के लिए IOC बनाया जाता है, तो अन्य Blue Teams इसका उपयोग करके malware को तेज़ी से पहचान सकती हैं।
|
||||
|
||||
IOC बनाने या संशोधित करने के लिए एक टूल [**IOC Editor**](https://www.fireeye.com/services/freeware/ioc-editor.html)**.**\
|
||||
आप [**Redline**](https://www.fireeye.com/services/freeware/redline.html) जैसे टूल का उपयोग **परिभाषित IOCs को किसी डिवाइस में खोजने के लिए** कर सकते हैं।
|
||||
IOCs बनाने या संशोधित करने के लिए एक टूल है [**IOC Editor**](https://www.fireeye.com/services/freeware/ioc-editor.html)**.**\
|
||||
आप [**Redline**](https://www.fireeye.com/services/freeware/redline.html) जैसे टूल्स का उपयोग **डिवाइस में परिभाषित IOCs खोजने के लिए** कर सकते हैं।
|
||||
|
||||
### Loki
|
||||
|
||||
[**Loki**](https://github.com/Neo23x0/Loki) is a scanner for Simple Indicators of Compromise.\
|
||||
Detection is based on four detection methods:
|
||||
[**Loki**](https://github.com/Neo23x0/Loki) Simple Indicators of Compromise के लिए एक स्कैनर है.\
|
||||
Detection चार पता लगाने के तरीकों पर आधारित है:
|
||||
```
|
||||
1. File Name IOC
|
||||
Regex match on full file path/name
|
||||
@ -93,41 +92,41 @@ Compares process connection endpoints with C2 IOCs (new since version v.10)
|
||||
```
|
||||
### Linux Malware Detect
|
||||
|
||||
[**Linux Malware Detect (LMD)**](https://www.rfxn.com/projects/linux-malware-detect/) एक Linux के लिए malware स्कैनर है जो GNU GPLv2 license के तहत जारी किया गया है, और यह साझा होस्टेड वातावरणों में सामना किए जाने वाले खतरों को ध्यान में रखकर डिज़ाइन किया गया है। यह network edge intrusion detection systems से threat data का उपयोग करके सक्रिय रूप से हमलों में उपयोग हो रहे malware को extract करता है और detection के लिए signatures जनरेट करता है। इसके अतिरिक्त, threat data LMD checkout feature के माध्यम से user submissions और malware community resources से भी प्राप्त किया जाता है।
|
||||
[**Linux Malware Detect (LMD)**](https://www.rfxn.com/projects/linux-malware-detect/) Linux के लिए एक malware scanner है जो GNU GPLv2 license के तहत जारी है, और इसे shared hosted environments में आने वाले threats को ध्यान में रखकर डिज़ाइन किया गया है। यह network edge intrusion detection systems से threat data का उपयोग करके उन malware को निकालता है जो सक्रिय रूप से attacks में उपयोग हो रहे हैं और detection के लिए signatures जनरेट करता है। इसके अलावा, threat data LMD checkout feature और malware community resources में उपयोगकर्ताओं द्वारा की गई submissions से भी प्राप्त होता है।
|
||||
|
||||
### rkhunter
|
||||
|
||||
Tools like [**rkhunter**](http://rkhunter.sourceforge.net) filesystem को संभावित **rootkits** और malware के लिए जांचने में उपयोग किए जा सकते हैं।
|
||||
rkhunter जैसे टूल्स का उपयोग filesystem की जाँच के लिए किया जा सकता है ताकि संभावित **rootkits** और malware का पता लगाया जा सके।
|
||||
```bash
|
||||
sudo ./rkhunter --check -r / -l /tmp/rkhunter.log [--report-warnings-only] [--skip-keypress]
|
||||
```
|
||||
### FLOSS
|
||||
|
||||
[**FLOSS**](https://github.com/mandiant/flare-floss) एक टूल है जो अलग‑अलग तकनीकों का उपयोग करके executables के अंदर obfuscated strings खोजने की कोशिश करेगा।
|
||||
[**FLOSS**](https://github.com/mandiant/flare-floss) एक टूल है जो विभिन्न तकनीकों का उपयोग करके executables के अंदर obfuscated strings खोजने की कोशिश करता है।
|
||||
|
||||
### PEpper
|
||||
|
||||
[PEpper ](https://github.com/Th3Hurrican3/PEpper) executable के अंदर कुछ बुनियादी चीज़ें चेक करता है (binary data, entropy, URLs and IPs, some yara rules)।
|
||||
[PEpper ](https://github.com/Th3Hurrican3/PEpper) executable के अंदर कुछ बेसिक चीज़ें चेक करता है (binary data, entropy, URLs and IPs, कुछ yara rules)।
|
||||
|
||||
### PEstudio
|
||||
|
||||
[PEstudio](https://www.winitor.com/download) एक टूल है जो Windows executables की जानकारी प्राप्त करने की अनुमति देता है जैसे imports, exports, headers, और साथ ही virus total की जाँच करता है और संभावित Att\&ck techniques ढूँढता है।
|
||||
[PEstudio](https://www.winitor.com/download) एक टूल है जो Windows executables की जानकारी प्राप्त करने की अनुमति देता है जैसे imports, exports, headers, और साथ ही यह VirusTotal चेक करेगा और संभावित Att\&ck techniques ढूँढेगा।
|
||||
|
||||
### Detect It Easy(DiE)
|
||||
|
||||
[**DiE**](https://github.com/horsicq/Detect-It-Easy/) एक टूल है जो यह पता लगाने के लिए कि कोई फ़ाइल **encrypted** है या नहीं और साथ ही **packers** भी ढूँढता है।
|
||||
[**DiE**](https://github.com/horsicq/Detect-It-Easy/) एक टूल है जो पता लगाता है कि कोई फ़ाइल **encrypted** है या नहीं और इसके साथ ही **packers** भी खोजता है।
|
||||
|
||||
### NeoPI
|
||||
|
||||
[**NeoPI** ](https://github.com/CiscoCXSecurity/NeoPI) एक Python script है जो text/script files के भीतर **statistical methods** की विविधता का उपयोग करके **obfuscated** और **encrypted** content का पता लगाती है। NeoPI का उद्देश्य **detection of hidden web shell code** में सहायता करना है।
|
||||
[**NeoPI** ](https://github.com/CiscoCXSecurity/NeoPI) एक Python script है जो text/script files के भीतर मौजूद **obfuscated** और **encrypted** content को detect करने के लिए विभिन्न **statistical methods** का उपयोग करती है। NeoPI का उद्देश्य **detection of hidden web shell code** में सहायता करना है।
|
||||
|
||||
### **php-malware-finder**
|
||||
|
||||
[**PHP-malware-finder**](https://github.com/nbs-system/php-malware-finder) अपनी पूरी कोशिश करता है ताकि **obfuscated**/**dodgy code** के साथ-साथ उन फ़ाइलों का भी पता चल सके जो अक्सर **PHP** functions का उपयोग करती हैं जो **malwares**/webshells में दिखाई देते हैं।
|
||||
[**PHP-malware-finder**](https://github.com/nbs-system/php-malware-finder) अपना पूरा प्रयास करता है **obfuscated**/**dodgy code** का पता लगाने के लिए और उन फाइलों को भी ढूँढता है जो अक्सर **PHP** functions का इस्तेमाल करते हैं जो **malwares**/webshells में पाए जाते हैं।
|
||||
|
||||
### Apple Binary Signatures
|
||||
|
||||
जब आप किसी **malware sample** की जाँच कर रहे हों तो हमेशा बाइनरी के **check the signature** को देखें क्योंकि जिसने इसे साइन किया है वह **developer** पहले से ही **related** with **malware** हो सकता है।
|
||||
जब आप किसी **malware sample** की जाँच कर रहे हों तो आपको हमेशा binary के **signature** की जाँच करनी चाहिए क्योंकि जिसने इसे sign किया है वह पहले से **malware** से **संबंधित** हो सकता है।
|
||||
```bash
|
||||
#Get signer
|
||||
codesign -vv -d /bin/ls 2>&1 | grep -E "Authority|TeamIdentifier"
|
||||
@ -142,21 +141,21 @@ spctl --assess --verbose /Applications/Safari.app
|
||||
|
||||
### File Stacking
|
||||
|
||||
यदि आप जानते हैं कि किसी फ़ोल्डर में web server के **files** थे जिन्हें **last updated on some date** किया गया था। **Check** करें कि web server के सभी **files** किस **date** पर created और modified हुए थे, और अगर कोई date **suspicious** लगे, तो उस file की जाँच करें।
|
||||
यदि आपको पता है कि किसी फ़ोल्डर में वेब सर्वर के **files** थे जिन्हें **किसी तिथि को अंतिम बार अपडेट किया गया था**। उस फ़ोल्डर में मौजूद सभी **files** के बनाए जाने और संशोधित होने की **date** जाँचें, और अगर कोई **date** संदिग्ध हो तो उस file की जाँच करें।
|
||||
|
||||
### Baselines
|
||||
|
||||
यदि किसी फ़ोल्डर के **files** को **shouldn't have been modified** होना चाहिए था, तो आप फ़ोल्डर के **original files** का **hash** निकालकर उन्हें **current** वाले से **compare** कर सकते हैं। जो कुछ भी modified होगा वह **suspicious** माना जाएगा।
|
||||
यदि किसी फ़ोल्डर के files **shouldn't have been modified** होने चाहिए थे, तो आप उस फ़ोल्डर के मूल **files** का **hash** निकालकर उन्हें वर्तमान files से **compare** कर सकते हैं। जो भी चीज़ें बदली हुई हों वे **suspicious** होंगी।
|
||||
|
||||
### Statistical Analysis
|
||||
|
||||
जब जानकारी logs में सेव होती है तो आप **check statistics like how many times each file of a web server was accessed as a web shell might be one of the most** कर सकते हैं — यानी यह देख सकते हैं कि web server के किस **file** तक कितनी बार access हुआ, क्योंकि एक web shell संभवतः सबसे ज़्यादा access किए जाने वाले में से एक हो सकता है।
|
||||
जब जानकारी logs में सेव होती है, आप ऐसे आँकड़े देख सकते हैं — जैसे कि प्रत्येक web server के file तक कितनी बार पहुँच हुई; क्योंकि एक web shell अक्सर सबसे ज्यादा access किया गया file हो सकता है।
|
||||
|
||||
---
|
||||
|
||||
### Android in-app native telemetry (no root)
|
||||
|
||||
Android पर आप target app process के अंदर native code को instrument कर सकते हैं एक छोटा logger library पहले preload करके, इससे पहले कि अन्य JNI libs initialize हों। इससे system-wide hooks या root के बिना native व्यवहार की early visibility मिलती है। एक लोकप्रिय तरीका SoTap है: सही ABI के लिए libsotap.so को APK में drop करें और early में System.loadLibrary("sotap") call inject करें (उदा., static initializer या Application.onCreate), फिर internal/external paths से logs collect करें या Logcat fallback का उपयोग करें।
|
||||
Android पर, आप target app process के अंदर native code में instrumentation कर सकते हैं, छोटे से logger library को अन्य JNI libs initialize होने से पहले preload करके। इससे system-wide hooks या root के बिना ही native व्यवहार की शुरुआती visibility मिलती है। एक लोकप्रिय तरीका SoTap है: सही ABI के लिए libsotap.so को APK में डालें और early में एक System.loadLibrary("sotap") कॉल inject करें (उदा. static initializer या Application.onCreate), फिर internal/external paths या Logcat fallback से logs इकट्ठा करें।
|
||||
|
||||
See the Android native reversing page for setup details and log paths:
|
||||
|
||||
@ -168,11 +167,11 @@ See the Android native reversing page for setup details and log paths:
|
||||
|
||||
## Deobfuscating Dynamic Control-Flow (JMP/CALL RAX Dispatchers)
|
||||
|
||||
आधुनिक malware परिवार Control-Flow Graph (CFG) obfuscation का भारी उपयोग करते हैं: सीधे jump/call के बजाय वे destination को run-time पर compute करते हैं और `jmp rax` या `call rax` execute करते हैं। एक छोटा *dispatcher* (आम तौर पर नौ instructions) CPU के `ZF`/`CF` flags पर निर्भर करके final target सेट करता है, जिससे static CFG recovery पूरी तरह टूट जाती है।
|
||||
आधुनिक malware families Control-Flow Graph (CFG) obfuscation का भारी दुरुपयोग करते हैं: सीधे jump/call के बजाय वे destination को run-time पर गणना करते हैं और `jmp rax` या `call rax` execute करते हैं। एक छोटा *dispatcher* (आमतौर पर नौ instructions) CPU के `ZF`/`CF` flags पर निर्भर करके final target सेट करता है, जिससे static CFG recovery पूरी तरह टूटी जाती है।
|
||||
|
||||
यह technique — SLOW#TEMPEST loader द्वारा प्रदर्शित — IDAPython और Unicorn CPU emulator पर ही निर्भर तीन-स्टेप workflow से bypass की जा सकती है।
|
||||
यह technique — जिसे SLOW#TEMPEST loader ने प्रदर्शित किया — केवल IDAPython और Unicorn CPU emulator पर निर्भर रहने वाले तीन-चरण के workflow से हराया जा सकता है।
|
||||
|
||||
### 1. Locate every indirect jump / call
|
||||
### 1. हर indirect jump / call का पता लगाएँ
|
||||
```python
|
||||
import idautils, idc
|
||||
|
||||
@ -181,7 +180,7 @@ mnem = idc.print_insn_mnem(ea)
|
||||
if mnem in ("jmp", "call") and idc.print_operand(ea, 0) == "rax":
|
||||
print(f"[+] Dispatcher found @ {ea:X}")
|
||||
```
|
||||
### 2. डिस्पैचर का बाइट-कोड निकालें
|
||||
### 2. dispatcher byte-code निकालें
|
||||
```python
|
||||
import idc
|
||||
|
||||
@ -196,7 +195,7 @@ size = jmp_ea + idc.get_item_size(jmp_ea) - start
|
||||
code = idc.get_bytes(start, size)
|
||||
open(f"{start:X}.bin", "wb").write(code)
|
||||
```
|
||||
### 3. इसे Unicorn के साथ दो बार अनुकरण करें
|
||||
### 3. Unicorn के साथ इसे दो बार Emulate करें
|
||||
```python
|
||||
from unicorn import *
|
||||
from unicorn.x86_const import *
|
||||
@ -212,9 +211,9 @@ mu.reg_write(UC_X86_REG_RAX, 0)
|
||||
mu.emu_start(BASE, BASE+len(code))
|
||||
return mu.reg_read(UC_X86_REG_RAX)
|
||||
```
|
||||
`run(code,0,0)` और `run(code,1,1)` चलाएँ ताकि आप *false* और *true* ब्रांच टार्गेट प्राप्त कर सकें।
|
||||
*false* और *true* branch targets प्राप्त करने के लिए `run(code,0,0)` और `run(code,1,1)` चलाएँ।
|
||||
|
||||
### 4. एक direct jump / call को वापस पैच करें
|
||||
### 4. Patch back a direct jump / call
|
||||
```python
|
||||
import struct, ida_bytes
|
||||
|
||||
@ -223,28 +222,37 @@ op = 0xE8 if is_call else 0xE9 # CALL rel32 or JMP rel32
|
||||
disp = target - (ea + 5) & 0xFFFFFFFF
|
||||
ida_bytes.patch_bytes(ea, bytes([op]) + struct.pack('<I', disp))
|
||||
```
|
||||
पैच करने के बाद, IDA को फ़ंक्शन का पुनः विश्लेषण करने के लिए मजबूर करें ताकि पूरा CFG और Hex-Rays आउटपुट बहाल हो:
|
||||
पैच करने के बाद, फ़ंक्शन को पुनः विश्लेषित करने के लिए IDA को मजबूर करें ताकि पूरा CFG और Hex-Rays आउटपुट फिर से बहाल हो:
|
||||
```python
|
||||
import ida_auto, idaapi
|
||||
idaapi.reanalyze_function(idc.get_func_attr(ea, idc.FUNCATTR_START))
|
||||
```
|
||||
### 5. अप्रत्यक्ष API कॉल्स को लेबल करें
|
||||
|
||||
एक बार जब हर `call rax` का वास्तविक गंतव्य ज्ञात हो जाता है, तो आप IDA को बता सकते हैं कि वह क्या है ताकि पैरामीटर प्रकार और वेरिएबल नाम स्वचालित रूप से पुनर्प्राप्त हो जाएँ:
|
||||
एक बार जब हर `call rax` का वास्तविक गंतव्य ज्ञात हो जाता है, तो आप IDA को बता सकते हैं कि वह क्या है ताकि पैरामीटर प्रकार और वेरिएबल नाम स्वतः पुनर्प्राप्त हो जाएँ:
|
||||
```python
|
||||
idc.set_callee_name(call_ea, resolved_addr, 0) # IDA 8.3+
|
||||
```
|
||||
### व्यावहारिक लाभ
|
||||
|
||||
* वास्तविक CFG को बहाल करता है → decompilation *10* लाइनों से हजारों तक पहुँच जाता है।
|
||||
* string-cross-reference & xrefs सक्षम होते हैं, जिससे behaviour reconstruction सरल हो जाता है।
|
||||
* Scripts पुनः उपयोग योग्य हैं: इन्हें उसी trick द्वारा सुरक्षित किसी भी loader में डालें।
|
||||
* वास्तविक CFG को बहाल करता है → decompilation *10* लाइनों से हजारों तक पहुँच जाता है.
|
||||
* string-cross-reference & xrefs सक्षम करता है, जिससे behaviour reconstruction बेहद सरल हो जाता है.
|
||||
* Scripts पुन: उपयोग योग्य हैं: इन्हें उसी ट्रिक से सुरक्षित किसी भी loader में डाल दें.
|
||||
|
||||
---
|
||||
|
||||
## AdaptixC2: Configuration Extraction and TTPs
|
||||
|
||||
समर्पित पेज देखें:
|
||||
|
||||
{{#ref}}
|
||||
adaptixc2-config-extraction-and-ttps.md
|
||||
{{#endref}}
|
||||
|
||||
## संदर्भ
|
||||
|
||||
- [Unit42 – Evolving Tactics of SLOW#TEMPEST: A Deep Dive Into Advanced Malware Techniques](https://unit42.paloaltonetworks.com/slow-tempest-malware-obfuscation/)
|
||||
- SoTap: Lightweight in-app JNI (.so) behavior logger – [github.com/RezaArbabBot/SoTap](https://github.com/RezaArbabBot/SoTap)
|
||||
- [Unit42 – AdaptixC2: A New Open-Source Framework Leveraged in Real-World Attacks](https://unit42.paloaltonetworks.com/adaptixc2-post-exploitation-framework/)
|
||||
|
||||
{{#include ../../banners/hacktricks-training.md}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user