CyberAct
Publications/#Trojans
Tag

Trojans: mechanisms, detection & defense

Understanding Trojans

Definition

Trojans are a category of malware that disguise themselves as legitimate software to trick users into executing malicious code. Unlike viruses or worms, Trojans do not self-replicate. They rely entirely on social engineering or supply chain compromise to achieve initial execution. The term covers a wide spectrum: RATs (Remote Access Trojans) grant full interactive control to an attacker, banking Trojans intercept financial credentials, dropper Trojans silently install secondary payloads, and loader Trojans establish persistence before fetching additional modules. The core mechanisms involve masking a malicious executable inside a trusted-looking file — a PDF, an installer, a signed binary. Once executed, the Trojan typically achieves persistence via registry run keys, scheduled tasks, or DLL hijacking. It then establishes a C2 channel, often over HTTPS or DNS, to receive commands. Modern Trojans implement anti-analysis techniques such as sandbox evasion, process hollowing, and encrypted payload staging. Understanding the full execution chain — from initial lure to C2 beacon — is essential for both defenders and offensive security practitioners working in adversary emulation exercises.

Detection (Blue Team / SOC)

Detecting Trojans from a SOC or Blue Team perspective requires correlating multiple data sources simultaneously. On Windows endpoints, key Event IDs include 4688 (process creation with command-line logging enabled), 7045 (new service installation), and 4698 (scheduled task creation). Sysmon enriches telemetry significantly: Event ID 1 captures process creation with hashes, Event ID 3 logs network connections per process, and Event ID 11 records file creation events. Analysts should alert on processes spawning from unusual parents — for example, Word.exe spawning cmd.exe or PowerShell. Outbound connections from non-browser processes to rare external IPs, especially over port 443 or 53, are strong indicators of C2 beaconing. EDR platforms such as CrowdStrike Falcon or Microsoft Defender for Endpoint correlate these signals automatically. DNS query logs help identify domain generation algorithm (DGA) patterns or long-TTL lookups to recently registered domains. Memory forensics using Volatility can reveal injected shellcode or hollow processes. Network traffic analysis with tools like Zeek or Suricata can flag encrypted C2 sessions by examining JA3 TLS fingerprints. A behavioral baseline per user and host dramatically reduces false positive rates during triage.

Exploitation & countermeasures (Red Team)

Red Teams and pentesters deploy Trojans to simulate realistic threat actor behavior during adversary emulation engagements. Common frameworks include Cobalt Strike, Metasploit, Havoc, and Sliver, all capable of generating stageless or staged payloads disguised as legitimate executables. Delivery vectors replicate real-world initial access: spear-phishing with weaponized Office documents leveraging template injection, ISO/LNK bundles bypassing Mark-of-the-Web controls, or trojanized software installers distributed via typosquatting. Once execution is achieved, operators focus on defense evasion: process injection into trusted processes like svchost.exe, AMSI bypasses, and ETW patching to blind endpoint telemetry. For persistence, common techniques include COM object hijacking, scheduled tasks with randomized names, and registry-based autoruns. From a hardening perspective, defenders should enforce application whitelisting via AppLocker or WDAC, restrict macro execution in Office applications through Group Policy, and deploy attack surface reduction (ASR) rules in Microsoft Defender. Network segmentation limits lateral movement post-compromise. User training targeting social engineering vectors reduces the success rate of initial delivery. Canary tokens planted inside sensitive directories provide early detection when a Trojan begins enumerating file shares.

Articles about Trojans

MenacesBanking Trojans: Lifecycle and Evolution Toward MaaS

From Zeus to Qakbot, banking trojans evolved into criminal platforms. A breakdown of their lifecycle and the MaaS model.

Jun 21, 20266 min read