CVE-2013-4259: Race Condition

Published Aug 18, 2013
·
Updated

runner/connectionplugins/ssh.py in Ansible before 1.2.3, when using ControlPersist, allows local users to redirect a ssh session via a symlink attack on a socket file with a predictable name in /tmp/.

Other sources

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.protectedsymlinks=0 sysctl -w fs.protectedhardlinks=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 $XDGRUNTIMEDIR 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 )

Red Hat

runner/connectionplugins/ssh.py in Ansible before 1.2.3, when using ControlPersist, allows local users to redirect a ssh session via a symlink attack on a socket file with a predictable name in /tmp/.

MITRE

Affected Software

2 affected componentsFixes available
pip/Ansible<1.2.3
1.2.3
redhat Ansible<=1.2.2

Event History

Aug 18, 2013
Data Sourced
via Red Hat·11:40 AM
DescriptionSeverityAffected Software
Sep 16, 2013
CVE Published
via MITRE·07:00 PM
Data Sourced
via MITRE·07:00 PM
Description
Data Sourced
via NVD·07:14 PM
RemedyDescriptionSeverityWeaknessAffected Software
May 14, 2022
Advisory Published
02:03 AM

Frequently Asked Questions

1

What is the severity of CVE-2013-4259?

CVE-2013-4259 has a moderate severity due to the potential for local users to conduct symlink attacks.

2

How do I fix CVE-2013-4259?

To fix CVE-2013-4259, upgrade to Ansible version 1.2.3 or later.

3

What versions of Ansible are affected by CVE-2013-4259?

CVE-2013-4259 affects Ansible versions prior to 1.2.3.

4

What is the impact of CVE-2013-4259?

The impact of CVE-2013-4259 allows local users to redirect SSH sessions, compromising session integrity.

5

Is there a workaround for CVE-2013-4259?

A potential workaround for CVE-2013-4259 is to configure a different socket file location than the predictable '/tmp/'.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203