Home/Glossary/Keylogger

Keylogger

Malicious software or hardware that secretly records keystrokes to capture passwords, credit card numbers, and other sensitive information typed by users.

Threat IntelligenceAlso called: "keystroke logger", "keyboard logger", "keylogging malware"

Keyloggers are a category of spyware used by attackers to harvest credentials and sensitive data by recording everything a victim types, often operating invisibly in the background.

Why it matters

  • Primary method for stealing credentials, bypassing encryption and MFA in some cases.
  • Can capture data before encryption is applied (typing into HTTPS forms).
  • Often deployed as part of larger malware campaigns or targeted attacks.
  • Hardware keyloggers can evade all software-based detection.

Key concepts

  • Software keyloggers: Malicious programs running at kernel or user level to intercept keystrokes.
  • Hardware keyloggers: Physical devices installed between keyboard and computer or within keyboards.
  • Form grabbers: Variant that captures form field data before HTTPS encryption.
  • Screen capture: Advanced variants that also record screenshots and mouse clicks.
  • Memory injection: Technique to hide keylogger code within legitimate processes.

Types of keyloggers

  • API-based: Hooks Windows keyboard APIs (SetWindowsHookEx, GetAsyncKeyState).
  • Kernel-level: Operates at driver level for deeper access and harder detection.
  • Form grabbing: Intercepts web form submissions before encryption.
  • Acoustic: Analyzes keyboard sounds to determine keystrokes (research attack).
  • Hardware: USB devices, PS/2 adapters, or embedded in keyboards.

Detection techniques

  • Endpoint detection and response (EDR) monitoring for hooking behavior.
  • Process behavior analysis for unexpected keyboard API access.
  • Physical inspection for hardware devices on workstations.
  • Network traffic analysis for exfiltration patterns.
  • Anti-keylogger software that encrypts keystrokes at the driver level.

Defense strategies

  • Deploy robust endpoint protection with behavioral analysis.
  • Use password managers with auto-fill to avoid typing credentials.
  • Implement hardware security keys for phishing-resistant MFA.
  • Conduct regular security awareness training about keylogger risks.
  • Use virtual keyboards for highly sensitive operations.
  • Physically secure workstations and audit hardware connections.

Common delivery methods

  • Phishing emails with malicious attachments.
  • Drive-by downloads from compromised websites.
  • Bundled with pirated software or fake utilities.
  • USB drop attacks with infected devices.
  • Supply chain compromise of legitimate software.