highaccess-controlverified ✓
Ensure root PATH does not contain current directory
root-path-integrity · RHEL ≥ 8 · 1 impl
Description
The root user's PATH environment variable should not contain the current directory (.) or empty path elements (::) which could be exploited to execute malicious programs.
Rationale
Including the current directory in root's PATH could allow an attacker to place a malicious script in a directory and have it executed when root runs a common command name from that directory.
Check → Remediate
Checkcommand
echo "$PATH" | grep -qE '(^:|:$|::|\.:|:\.)' && exit 1 || exit 0
- expected_exit:
- 0
Remediatemanual
- note:
- Review the PATH environment variable in root's shell profile (/root/.bash_profile, /root/.bashrc) and remove any empty elements (::), leading colons (:path), trailing colons (path:), or current directory references (.:, :.).
Framework references
CIS
rhel8 5.4.2.5rhel9 5.4.2.5rhel10 5.4.2.5
NIST 800-53
CM-6
Live verification
rhel10:checkrhel8:checkrhel9:check
#root#path#security