First published: Sun Aug 18 2013(Updated: )
by default, ansible try to create a ControlMaster file in a predictible location in /tmp. This is vulnerable to a ssh socket injection attack like this : ~ $ sudo ln -s /tmp/ansible-ssh-elspeth.example.org-22-misc /tmp/ansible-ssh-sisay.example.org-22-misc ~ $ ansible -i 'elspeth.example.org,sisay.example.org' all -m shell -u misc -a hostname elspeth.example.org | success | rc=0 >> elspeth.example.org sisay.example.org | success | rc=0 >> elspeth.example.org I also did a test without using root, that's the same. Based on this attack, someone could divert the ssh connexion to another server, make it connect to a server under the control of attacker, and steal configuration file ( with passwords ), or steal password with a fake sudo ( since ansible can also use sudo ) Please note that you need to : - disable selinux # setenforce 0 - disable latest protection from the kernel # sysctl -w fs.protected_symlinks=0 # sysctl -w fs.protected_hardlinks=0 to make sure this work. I didn't found how/where ssh control the socket file for suitability, maybe it should I am not sure what could be a good fix. I do have a patch that put the socket in $XDG_RUNTIME_DIR but it is a very weak mitigation technique that do not work on older platform such as RHEL 6. Another solution would be to make sure the socket is created in specific temporary directory, but this could make the software much slower. And checking if the socket exist first is prone to race condition. Upstream was not contacted yet, and plan to release 1.3 around 2 weeks. Issue is not public ( but quite easy to spot )
Affected Software | Affected Version | How to fix |
---|---|---|
Ansible |
Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.
REDHAT-BUG-998223 describes a vulnerability in Ansible where it creates a ControlMaster file in a predictable location, allowing for potential SSH socket injection attacks.
The vulnerability could allow an attacker to manipulate SSH connections, leading to unauthorized access or command execution on the affected systems.
To mitigate REDHAT-BUG-998223, it is recommended to restrict access to the /tmp directory and avoid using predictable filenames for ControlMaster files.
While the specific versions of Ansible affected by REDHAT-BUG-998223 are not specified, the vulnerability applies to installations that use the default settings of ControlMaster file creation.
Currently, there are no specific patches mentioned for REDHAT-BUG-998223, but it is advisable to monitor Ansible's official channels for updates and fixes.