MITRE ATT&CKsub-technique

T1574.006 Dynamic Linker Hijacking

Published 2020-03-13 Modified 2026-05-12 Official page ↗
Domain
enterprise
Tactics
Stealth, Execution
Platforms
Linux, macOS
Version
3.0
Created
2020-03-13

Description

Adversaries may execute their own malicious payloads by hijacking environment variables the dynamic linker uses to load shared libraries. During the execution preparation phase of a program, the dynamic linker loads specified absolute paths of shared libraries from various environment variables and files, such as LD_PRELOAD on Linux or DYLD_INSERT_LIBRARIES on macOS. Libraries specified in environment variables are loaded first, taking precedence over system libraries with the same function name. Each platform's linker uses an extensive list of environment variables at different points in execution. These variables are often used by developers to debug binaries without needing to recompile, deconflict mapped symbols, and implement custom functions in the original library. Hijacking dynamic linker variables may grant access to the victim process's memory, system/network resources, and possibly elevated privileges. On Linux, adversaries may set LD_PRELOAD to point to malicious libraries that match the name of legitimate libraries which are requested by a victim program, causing the operating system to load the adversary's malicious code upon execution of the victim program. For example, adversaries have used `LD_PRELOAD` to inject a malicious library into every descendant process of the `sshd` daemon, resulting in execution under a legitimate process. When the executing sub-process calls the `execve` function, for example, the malicious library’s `execve` function is executed rather than the system function `execve` contained in the system library on disk. This allows adversaries to Hide Artifacts from detection, as hooking system functions such as `execve` and `readdir` enables malware to scrub its own artifacts from the results of commands such as `ls`, `ldd`, `iptables`, and `dmesg`. Hijacking dynamic linker variables may grant access to the victim process's memory, system/network resources, and possibly elevated privileges.

Related

Subtechnique of · MITRE ATT&CK (1)

  • T1574 Hijack Execution Flow technique

Tactic · MITRE ATT&CK (2)

Referenced by MITRE ATT&CK · mitigates (2)

  • M1038 Execution Prevention mitigation
  • M1028 Operating System Configuration mitigation

Referenced by MITRE ATT&CK · uses (10)

  • S9024 SPAWNCHIMERA software (malware)
  • S1220 MEDUSA software (malware)
  • S1105 COATHANGER software (malware)
  • G0143 Aquatic Panda group
  • S0658 XCSSET software (malware)
  • S0601 Hildegard software (malware)
  • G0106 Rocke group
  • G0096 APT41 group
  • S0394 HiddenWasp software (malware)
  • S0377 Ebury software (malware)

Referenced by CAPEC · att&ck technique (2)

  • CAPEC-13 Subverting Environment Variable Values attack pattern
  • CAPEC-640 Inclusion of Code in Existing Process attack pattern

Referenced by Compliance · mitigates (5)

  • CIS-2.6 Allowlist Authorized Libraries CIS Safeguard v8.1
  • NIST-CM-6 Configuration Settings NIST 800-53 control
  • NIST-CM-7 Least Functionality NIST 800-53 control
  • NIST-SI-10 Information Input Validation NIST 800-53 control
  • NIST-SI-7 Software, Firmware, and Information Integrity NIST 800-53 control

References