A race condition flaw was found in Ansible Engine when running a playbook with an unprivileged become user. When Ansible needs to run a module with become user, the temporary directory is created in /var/tmp. This directory is created with "umask 77 && mkdir -p "; this operation does not fail if the directory already exists and is owned by another user. An attacker could take advantage to gain control of the become user as the target directory can be retrieved by iterating ‘/proc//cmdline’.
This issue can be mitigated by mounting the proc filesystem with hidepid=2 option (<https://www.kernel.org/doc/Documentation/filesystems/proc.txt>). This way only the user used by Ansible will be able to perform the attack as users on the system will be able to access only their processes /proc/$PID/ directories.
Also note that mounting proc filesystem with hidepid=2 might require re-mounting it on unpatched kernels, due to a kernel bug (see <https://unix.stackexchange.com/questions/584054/why-procfs-mount-option-only-working-on-remount>), there will be hidepid=3 in the future (<https://patchwork.kernel.org/patch/11310217/>).