System Hacking Phases and Attack Techniques · Topic 4 of 6

Executing Applications, Hiding Files, Persistence and Clearing Logs

Learn the later system hacking steps: remote execution, rootkits, alternate data streams, steganography, persistence and log clearing, with defenses.

  • 5 min
In a nutshell
  • Rootkits hide malware, and they can run in user mode, kernel mode, boot or firmware.
  • Steganography hides existence of data, while cryptography hides its meaning.
  • ADS is an NTFS feature.

What it is

After gaining and raising access, an attacker runs programs on the system, hides them, makes sure they survive a restart, and then removes the evidence. These are the later steps of system hacking.

For the exam, learn the name and purpose of each technique, how a defender notices it and which control stops it.

Execute applicationsrun tools and malwareHide filesrootkits, streams, stegoEstablish persistencesurvive rebootClear logsremove evidence

How it works

Executing applications

Executing applications means running code on the compromised host, usually from a remote location. The code may be a backdoor, a keylogger, a spyware agent or a remote administration tool.

Attackers prefer methods that look normal.

MethodDescription
Remote execution toolsRemote administration software and utilities such as PsExec and RemoteExec run commands on other systems
Built-in scriptingScripting engines and command shells that are already installed
Scheduled tasks and servicesStart a program at a chosen time
Living off the landAbusing legitimate tools already on the system so that no new file is dropped
Malicious documentsMacros or embedded objects that run on open

Because legitimate tools are used, detection depends on behavior: unusual parent and child processes, remote execution from a user workstation and scripts started from odd locations.

Hiding files

TechniqueDescription
RootkitSoftware that hides its own presence and that of other malware
NTFS alternate data streams (ADS)Data attached to a file as a hidden stream that does not change the visible file size
SteganographyHiding data inside another file such as an image, audio or text
File attributes and namesHidden flag, misleading names or locations

Rootkits are classified by where they run: user mode, kernel mode, library level, bootkit (infects the boot sector), firmware and hypervisor. A kernel rootkit is harder to find because it controls what the operating system reports. Detection uses tools that compare views, scan from outside the running system, or use integrity checks. Tools include GMER and tools that scan from a clean boot medium. The only safe remedy for a serious rootkit is often a rebuild from trusted media.

Alternate data streams are an NTFS feature. A file can have a second stream that does not show in a normal directory listing. Defenders can list streams with a directory option and with Sysinternals streams tool.

Steganography differs from cryptography. Cryptography hides the meaning of a message, while steganography hides its existence. Types include image, audio, video, document and network steganography. Tools include OpenStego, Steghide, QuickStego and SNOW. Steganalysis is the practice of detecting hidden data, for example by comparing file statistics.

Establishing persistence

Persistence makes access survive a reboot or logoff.

LocationWindowsLinux
Startup entriesRegistry Run keys, Startup folderShell profile files, rc scripts
Scheduled executionScheduled taskscron
ServicesNew or modified servicesystemd units
Accounts and keysNew local or domain accountNew user, SSH authorized key
Event-drivenWMI event subscriptionsUdev rules
Library or binary replacementDLL search order hijackingReplaced shared library
WebWeb shellWeb shell

Detection compares the system against a baseline and looks at autorun locations, tasks, services and accounts. Sysinternals Autoruns lists many Windows startup locations.

Clearing logs

Clearing logs aims to remove or alter evidence.

ActionNotes
Clearing Windows event logsSecurity, System and Application logs can be cleared by an administrator
Disabling auditingStops events from being recorded
Deleting history filesLinux shell history and similar records
Modifying log filesRemoving individual lines
Altering timestampsMakes new files look old

Clearing the Windows Security log itself creates an event, with event ID 1102, and clearing the System log creates event ID 104. These events are valuable to defenders. Linux logs are mostly under /var/log, and shell history is stored per user.

Defenses work by moving evidence out of the attacker's reach.

Local logsForward in real timelog server or SIEMProtectwrite once, restricted accessAlertlog cleared, auditing off
  • Send logs to a central, protected server so that local deletion does not erase them.
  • Restrict who can clear logs or change audit policy and alert when it happens.
  • Use file integrity monitoring.
  • Keep enough log capacity and retention for investigations.
  • Use time synchronization so that timeline analysis is reliable.

Countermeasures for the whole group

  • Use application allow lists to control what executes.
  • Monitor processes, command lines and remote execution.
  • Scan for rootkits, hidden streams and unexpected autorun entries.
  • Rebuild from trusted images after a serious compromise.
  • Apply least privilege so attackers cannot write to startup locations.

A worked example

An analyst finds an alert that the Security log was cleared on a server at 03:10. Event ID 1102 shows which account did it. Logs forwarded to the SIEM still hold the previous activity, and they show a scheduled task and a new service created minutes earlier by the same account.

How the exam asks about this

  • "Which technique hides data inside an image file?" -> Steganography.
  • "Which NTFS feature hides data in a second stream of a file?" -> Alternate data streams.
  • "Which event ID shows that the Windows Security log was cleared?" -> 1102.

What to remember for the exam

  • Rootkits hide malware, and they can run in user mode, kernel mode, boot or firmware.
  • Steganography hides existence of data, while cryptography hides its meaning.
  • ADS is an NTFS feature.
  • Persistence uses startup entries, tasks, services, accounts and keys.
  • Central log forwarding defeats local log clearing.
Watch out

Clearing the log is itself logged (event ID 1102 for Security, 104 for System), so a question about detecting log clearing points to those events.

Common mistakes

Believing a hidden file is encrypted. Hiding and encryption are different, and hidden data can be plainly readable once found.

Relying on logs stored only on the same host. An attacker with administrator rights can delete them.

Cleaning a rootkit with antivirus alone. Kernel level rootkits can hide from tools running in the same system.

Check yourself

  • What is the difference between steganography and cryptography?

    Steganography hides that a message exists, while cryptography makes the message unreadable.

  • Which NTFS feature can hide data inside a file?

    Alternate data streams.

  • How do defenders preserve evidence when an attacker clears local logs?

    By forwarding logs in real time to a protected central log server or SIEM.

Topic 4 of 6 in System Hacking Phases and Attack Techniques

Test yourself on System Hacking Phases and Attack Techniques

The full EC-Council 312-50 question bank has 1,000 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by EC-Council. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.