REFERENCE GUIDE

PATH, environment, and helper-program trust

Programs sometimes launch helpers by an unqualified name or consult environment variables for configuration and library loading.

Also known as: PATH hijacking · LD_PRELOAD

path-and-environmentlinux

Mechanism

Programs sometimes launch helpers by an unqualified name or consult environment variables for configuration and library loading. The trust boundary arises when a privileged or trusted process resolves those values using attacker-controlled state. Resolution behavior differs between shells, exec variants, dynamic loaders, and applications.

Practical method

Identify the exact helper-launch API and inherited environment. Inspect PATH ordering, working directory, and writable search locations. In a local fixture, substitute an inert helper that logs its invocation and arguments. Analyze dynamic-loader variables separately from ordinary application settings.

printf "%s\n" "$PATH"
command -v helper
# Absolute helper paths reduce search ambiguity.

Interpreting evidence

Confirm that the target resolves the substituted helper, not merely that your interactive shell does. Capture the target process environment and privilege state at execution.

Pitfalls and limits

Privileged loader modes ignore several environment variables. A shell caches command locations. Absolute paths can still point into writable directories or invoke scripts with unsafe interpreter resolution.

Sources & further reading

  1. exec family ↗linux-man
  2. Dynamic loader environment ↗linux-man

Content license: CC-BY-4.0. Source-derived sections retain their cited licenses and redistribution notices. How this reference is compiled →