REDHAT-BUG-998227: Medium severity Ansible Ansible vulnerability
Since version 1.2 of ansible, failed run ( due to connexion errors, or config error ) are listed into /var/tmp/ansible/$scriptname.yml , with $scriptname being the script name used ( or rather the playbook, in ansible linguo )
There is no verification on the file or directory here, and /var/tmp is world writable.
Worst, due to it using a subdirectory under /var/tmp, some symlink protection may not apply ( not tested ). For example, if i create a directory /var/tmp/ansible with owner misc:users and a symlink to a file of joe, the kernel would permit to follow since the symlink and owner of the directory match. This permit to erase file content among others. I am not sure what kind of specific attack could be made by injecting ip and hostname in a specific file, but I am sure this exist.
Code is on https://github.com/ansible/ansible/blob/devel/lib/ansible/playbook/init.py#L480
Upstream was not notified yet AFAIK.
I do have a patch almost ready that do : - verify the permission/owner of directory - create a unique directory derived from username ( so predictable ) with proper permission if doesn't exist
I just need to review and test.
The current code do cope with lack of permission on the directory so even if someone create a directory in advance, this will be handled "gracefully" ( I think a message would be better )
Affected Software
Event History
Frequently Asked Questions
What is the severity of REDHAT-BUG-998227?
The severity of REDHAT-BUG-998227 is moderate due to potential information leakage.
How do I fix REDHAT-BUG-998227?
To fix REDHAT-BUG-998227, ensure proper permissions and verification checks are implemented for the logs generated in /var/tmp.
What versions of Ansible are affected by REDHAT-BUG-998227?
Ansible versions from 1.2 onwards are affected by REDHAT-BUG-998227.
What kind of issues can REDHAT-BUG-998227 cause?
REDHAT-BUG-998227 can lead to unauthorized access to sensitive log files and potential data exposure.
Is there a workaround for REDHAT-BUG-998227?
A possible workaround for REDHAT-BUG-998227 is to manually monitor and secure the /var/tmp directory.