HackCert
Intermediate 10 min read May 25, 2026

Syscalls Execution: সিকিউরিটি সফটওয়্যার বাইপাস করতে ওএসের কার্নেলের সাথে সরাসরি যোগাযোগের হ্যাকিং পদ্ধতি!

Direct syscalls execution-এর technique, EDR bypass, Hell's Gate, Heaven's Gate, indirect syscalls এবং offensive security implementation গাইড।

Rokibul Islam
Red Team Operator
share
Syscalls Execution: সিকিউরিটি সফটওয়্যার বাইপাস করতে ওএসের কার্নেলের সাথে সরাসরি যোগাযোগের হ্যাকিং পদ্ধতি!
Overview

আধুনিক Endpoint Detection and Response (EDR) প্রযুক্তি যত শক্তিশালী হয়েছে, ততই red team এবং malware author-রা তা bypass করার নতুন কৌশল আবিষ্কার করেছেন। EDR-এর মূল detection mechanism হলো user-mode API hooking — যেখানে NTDLL এবং Kernel32-এর critical function-এ inline hook বসিয়ে suspicious activity intercept করা হয়। কিন্তু যদি malware এই hooked function-গুলো সম্পূর্ণ avoid করে directly Windows kernel-এর সাথে যোগাযোগ করতে পারে, তবে EDR-এর visibility মুহূর্তেই উবে যায়। এই কৌশলকে বলা হয় Direct Syscalls Execution, যা গত কয়েক বছরে offensive security community-তে standard technique হয়ে উঠেছে। Hell's Gate, Halo's Gate, Heaven's Gate, Tartarus' Gate, এবং SysWhispers-এর মতো technique এই domain-কে rapidly evolve করছে।

Syscall-এর Architectural ভিত্তি

প্রতিটি modern OS-এর architecture-এ user space এবং kernel space-এর মধ্যে একটি কঠোর boundary রয়েছে। User space-এর application কখনোই directly hardware access করতে পারে না — সব file I/O, network communication, process creation, memory allocation kernel-এর মাধ্যমে route হয়। এই transition-এর জন্য system call (syscall) instruction ব্যবহার করা হয়। x64 Windows-এ এটি syscall instruction, x86 Windows-এ sysenter বা int 2e

Windows-এ প্রতিটি syscall-এর একটি unique number থাকে — System Service Number (SSN)। উদাহরণস্বরূপ, NtAllocateVirtualMemory এর SSN Windows 11 24H2-এ 0x18, NtWriteVirtualMemory-এর 0x3A। SSN Windows version, build এবং কখনো কখনো patch level-এ পরিবর্তিত হয়। এই syscall number-গুলো NTDLL.dll-এর exported function-এর body-তে hardcoded থাকে — সাধারণত প্রথম ১০-১২ byte-এ syscall stub থাকে।

Application যখন CreateFile call করে, এটি actually Kernel32.dll-এ পৌঁছায়, সেখান থেকে NTDLL-এর NtCreateFile-এ যায়, যা শেষে syscall instruction execute করে kernel-এ transition করে। EDR এই chain-এর user-mode portion-এ hook বসায় — সাধারণত NTDLL-এর function prologue-এ jmp instruction inject করে নিজস্ব analysis routine-এ redirect করে।

EDR Hooking এবং Detection

Major EDR vendor (CrowdStrike, SentinelOne, Microsoft Defender for Endpoint, Carbon Black, Trend Micro) NTDLL-এ ১০০-৩০০টি function hook করে। প্রতিটি hook function-এ flow modify করে EDR engine-এর analysis routine call করে, যা parameter inspection, behavior analysis এবং policy enforcement চালায়। কোনো suspicious operation detected হলে block, log বা alert generate হয়।

User-mode hooking তিনটি প্রধান technique-এ implement হয়। Inline hooking-এ function-এর প্রথম কয়েক byte-কে jmp instruction দিয়ে replace করা হয়। IAT (Import Address Table) hooking-এ application-এর import table modify করে function pointer redirect করা হয়। Detour patching-এ trampolined hook ব্যবহার করা হয়। সবচেয়ে common হলো inline hooking, কারণ এটি universal এবং reliable।

Kernel-level hooking (যেমন SSDT hook, kernel callback registration) Windows Patch Guard-এর কারণে restricted। তবে modern EDR কর্নেল-level visibility পেতে ETW (Event Tracing for Windows), kernel callback এবং minifilter driver ব্যবহার করে। শুধু user-mode hook bypass করলেই সব EDR escape হবে — এই assumption ভুল; comprehensive evasion-এ multiple layer-এ কাজ করতে হয়।

Hell's Gate Technique

am0nsec এবং RtlMateusz-এর publish করা Hell's Gate technique direct syscall execution-এর foundational approach। মূল idea হলো — NTDLL-এর function-এ যাওয়ার পরিবর্তে, malware নিজেই NTDLL parse করে প্রতিটি Nt function-এর syscall number dynamically extract করে।

Hell's Gate-এর implementation step হলো — PEB (Process Environment Block) থেকে NTDLL-এর base address retrieve করা, Export Address Table parse করে target function-এর address খোঁজা, function-এর প্রথম byte সংগ্রহ করা এবং hardcoded pattern (mov r10, rcx; mov eax, SSN; syscall; ret) থেকে SSN extract করা। SSN পাওয়ার পর malware নিজস্ব syscall stub set up করে এবং সরাসরি syscall execute করে — NTDLL-এর hooked path সম্পূর্ণ bypass করে।

কিন্তু Hell's Gate-এর একটি limitation আছে — যদি EDR ইতিমধ্যে NTDLL function-এ hook বসিয়ে দেয়, তবে স্বাভাবিক syscall stub pattern overwritten থাকে এবং SSN extraction fail করে। Halo's Gate এই সমস্যা সমাধান করে — হুকড function-এর neighboring (adjacent) function পরীক্ষা করে, যেগুলো সাধারণত sequential SSN ধারণ করে। যদি NtCreateFile-এর SSN 0x55 হয়, তবে NtCreateNamedPipeFile-এর SSN সম্ভবত 0x56 — এই pattern থেকে extrapolate করা যায়।

SysWhispers এবং Modern Variation

@Jackson_T এবং @modexpblog-এর SysWhispers project syscall-based evasion-কে production-ready stage-এ নিয়ে এসেছে। SysWhispers একটি Python tool যা specific Windows version-এর জন্য pre-computed SSN লুকআপ table generate করে এবং compiled binary-তে direct syscall stub embed করে। SysWhispers2 এবং SysWhispers3 প্রতিটি refinement-এ আরও sophisticated হয়ে উঠেছে।

Tartarus' Gate, FreshyCalls, Hell's Hall, Hellsgate-x64 — এসব derivative work প্রতিটি নিজস্ব innovation নিয়ে এসেছে। Indirect syscall variant-এ syscall instruction malware-এর নিজস্ব code-এ execute না করে, বরং ntdll.dll-এর legitimate syscall instruction (যা already memory-তে আছে)-এ execute করে। এটি call stack manipulation এবং detection further বাধা দেয়।

modern variant-এ EDR-এর কিছু advanced detection mechanism — যেমন stack walking-এ legitimate ntdll address require করা — bypass করতে indirect syscall ব্যবহার হয়। যখন EDR call stack inspect করে এবং দেখে syscall ntdll memory-তে origin করেছে, তখন legitimate বলে ধরে নেয়।

Linux Ecosystem-এ Syscall Manipulation

Linux-এ syscall mechanism কিছুটা ভিন্ন। x86-64 Linux-এ syscall instruction এবং rax register-এ syscall number store করা হয়। Linux malware traditionally directly syscall করতে পারে কারণ এতে libc-equivalent কোনো mandatory layer নেই — যদিও বেশিরভাগ application glibc ব্যবহার করে।

Linux EDR (Falco, Tracee, Sysdig) eBPF-এর মাধ্যমে syscall-level visibility পায়। eBPF program kernel-এ attach হয়ে individual syscall trace করতে পারে। এই মেকানিজম bypass করা একটি ভিন্ন challenge — কারণ kernel-level instrumentation user-space hook-এর চেয়ে অনেক বেশি comprehensive। তবে কিছু technique যেমন io_uring-based execution বা novel syscall variant temporarily detection coverage এড়াতে পারে।

Linux LD_PRELOAD-based hooking-কে static linking দিয়ে এড়ানো যায়। SECCOMP filter জ্ঞাত malicious syscall block করতে পারে কিন্তু novel attack vector-এ কার্যকর নয়। Container escape এবং privilege escalation-এ syscall manipulation এখনও common technique।

Detection এবং Defense Strategy

Direct syscall detection EDR vendor-দের জন্য একটি ongoing challenge। কিছু কার্যকর approach:

Kernel-level callback এবং ETW: Windows-এ ETW Threat Intelligence (ETW-Ti) provider syscall-related event emit করে। যদি EDR এই event subscribe করে, তবে direct syscall-ও detected হতে পারে — কারণ event kernel-level-এ generate হয়, user-mode bypass possible নয়। তবে malware ETW-Ti disable করার চেষ্টা করতে পারে — patching EtwEventWrite বা thread environment block manipulation।

Call stack analysis: legitimate process-এ syscall instruction always ntdll.dll-এর executable region থেকে আসা উচিত। যদি syscall non-ntdll memory location থেকে আসে, এটি suspicious। Modern EDR এই check implement করে। Indirect syscall এই বাধা bypass করে।

Hardware-level mitigation: Intel CET (Control-flow Enforcement Technology) এবং Indirect Branch Tracking process-এর control flow integrity enforce করে। Hypervisor-based protection (VBS, HVCI) — যেখানে security-sensitive operation virtualized environment-এ verified হয় — additional defense provide করে।

Behavioral analytics এবং ML-based detection: process behavior baseline-এর সাথে compare করা, anomalous syscall sequence detect করা এবং anti-analysis technique signature খোঁজা — এসব approach malware variant detect করে যদিও specific technique bypass করেছে।

Offensive Practice এবং Tooling

Red team এবং penetration test engagement-এ direct syscall ব্যবহার বহু legitimate use case-এ আসে। Cobalt Strike-এর সাম্প্রতিক version-এ Beacon-এ syscall option built-in। Sliver C2 framework-এও similar support। Custom shellcode loader-এ direct syscall integrate করতে SysWhispers, GetSyscallStub-এর মতো tool ব্যবহার করা যায়।

Implementation language-এর choice গুরুত্বপূর্ণ। Pure C/C++ inline assembly সবচেয়ে control দেয়। Rust language নতুন popular হচ্ছে কারণ এর memory safety এবং performance। Nim, Go-ও alternative হিসেবে use হয়। Managed language যেমন C# .NET runtime hooking-এর কারণে direct syscall এ challenging কিন্তু সম্ভব (DInvoke library এই কাজে সাহায্য করে)।

Ethical consideration অপরিহার্য — এই knowledge legitimate authorized testing-এর জন্য। Unauthorized use criminal liability ডেকে আনে। Responsible disclosure এবং defensive collaboration security community-র progressive evolution-এ critical।

প্রতিরোধ ও সর্বোত্তম অনুশীলন

Defender-দের জন্য direct syscall threat মোকাবিলায় multi-layered strategy অপরিহার্য:

Microsoft Defender for Endpoint, CrowdStrike Falcon, SentinelOne — সব major EDR এখন ETW-Ti integration এবং syscall provenance check implement করেছে। Latest version এবং proper policy configuration ছাড়া এই protection ineffective। Application Control (WDAC, AppLocker) policy unauthorized binary execute করা prevent করে — যা novel malware-এর initial foothold বাধা দেয়।

VBS (Virtualization-Based Security) এবং HVCI (Hypervisor-protected Code Integrity) enable করা production environment-এ critical। Latest Windows version (Windows 11 22H2+)-এ এসব default থাকে কিন্তু Windows Server এ explicit configuration প্রয়োজন। Memory protection feature যেমন CFG (Control Flow Guard), ASLR randomization বাড়ানো এবং DEP enforcement attacker-এর exploitation difficulty বাড়ায়।

Threat hunting program-এ syscall anomaly detection scenario অন্তর্ভুক্ত করতে হবে। Sysmon configuration (SwiftOnSecurity, Olaf Hartong-এর community config) syscall-related event capture করতে fine-tuned করতে হবে। Regular red team exercise — যেখানে evader থাকে এবং defender response measure হয় — capability mature করতে সাহায্য করে।

Key Takeaways

Direct syscall execution আধুনিক offensive security-র সবচেয়ে impactful technique-গুলোর একটি, যা EDR এবং malware author-দের মধ্যে চলমান arms race-কে একটি নতুন phase-এ নিয়ে এসেছে। Defender-দের জন্য এই technique-এর গভীর বোঝাপড়া অপরিহার্য, কারণ যে threat তারা দেখতে পান না, তা তারা থামাতেও পারেন না। Attack-এর evolution বুঝে defense strategy update করা, modern OS protection feature embrace করা এবং threat hunting capability strengthen করা — এই triad-ই সফল defensive posture-এর foundation। ভবিষ্যতে hardware-based security feature, AI-driven anomaly detection এবং kernel-level visibility আরও refined হবে, কিন্তু creative attacker-রা ও তেমনি innovative technique আবিষ্কার করতেই থাকবেন। এই domain-এ continuous learning ছাড়া কোনো বিকল্প নেই।

আপনার জ্ঞান যাচাই করতে প্রস্তুত? আজই HackCert-এ Syscalls Execution MCQ Quiz-টি দিন!

Related articles

back to all articles