documentation_complete: true


title: 'Ensure sudo Ignores Commands In Current Dir - sudo ignore_dot'

description: |-
    The sudo <tt>ignore_dot</tt> tag, when specified, will ignore the current directory
    in the PATH environment variable.
{{%- if 'rhel' in product or 'ol' in families %}}
    On {{{ full_name }}}, <tt>ignore_dot</tt> is enabled by default
{{%- endif %}}
    This should be enabled by making sure that the <tt>ignore_dot</tt> tag exists in
    <tt>/etc/sudoers</tt> configuration file or any sudo configuration snippets
    in <tt>/etc/sudoers.d/</tt>.

rationale: |-
    Ignoring the commands in the user's current directory prevents an attacker from executing commands
    downloaded locally.

severity: medium

identifiers:
    cce@rhel8: CCE-83810-2
    cce@rhel10: CCE-90743-6
    cce@sle12: CCE-91493-7
    cce@sle15: CCE-91185-9


ocil_clause: 'ignore_dot is not enabled in sudo'

ocil: |-
    To determine if <tt>ignore_dot</tt> has been configured for sudo, run the following command:
    <pre>$ sudo grep -ri "^[\s]*Defaults.*\bignore_dot\b.*" /etc/sudoers /etc/sudoers.d/</pre>
    The command should return a matching output.

template:
    name: sudo_defaults_option
    vars:
        option: ignore_dot
        default_is_enabled@rhel8: "true"
