GHSA-cxgv-hp74-jj7r: Pip/ansible-jailexec vulnerability
Through version 1.3.0, the jailexec connection plugin's putfile resolved a transfer's destination to a path on the jail host (<jail filesystem root> + <destination>) and ran mkdir -p and mv there as root on the host. Those commands follow symbolic links, and the path was operated on outside the jail, so a symlink existing inside the jail was followed by the host-side, root-privileged mv.
A party controlling content inside a managed jail (the jail's root, or any process able to create a symlink in a directory an Ansible task later writes to) can therefore cause an arbitrary root-owned write on the host, outside the jail — a full jail escape. Arbitrary root-owned host writes are readily escalated to host compromise (e.g. cron, rc.d, authorizedkeys).
Preconditions: the operator runs a copy/template/fetch-style task (anything using putfile) against the jail, and the attacker can place a symlink inside the jail at or above the task's destination before the transfer runs.
Patches: Fixed in 2.0.0. File transfers now run inside the jail via jexec (mkdir -p <dir> && cat > <dest> for putfile; cat < <src> for fetchfile), so every path resolves within the jail's chroot. An in-jail symlink can at most redirect within the same jail and can no longer reach the host.
Workarounds: None in affected versions; upgrade to 2.0.0.
Resources: - https://github.com/chofstede/ansiblejailexec/blob/main/docs/security/advisory-2.0.0-jail-escape.md - https://github.com/chofstede/ansiblejailexec/pull/6
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/ansible-jailexecto a version that resolves this vulnerability.Fixed in 2.0.0 - Upgrade
Upgrade
ansible_jailexec (jail escape via put_file/fetch_file symlink handling)to a version that resolves this vulnerability.Fixed in 2.0.0
Event History
Frequently Asked Questions
What is the severity of GHSA-cxgv-hp74-jj7r?
The severity of GHSA-cxgv-hp74-jj7r is rated at 77.
How do I fix GHSA-cxgv-hp74-jj7r?
To fix GHSA-cxgv-hp74-jj7r, upgrade the ansible-jailexec package to version 1.3.1 or later.
What vulnerabilities are associated with GHSA-cxgv-hp74-jj7r?
GHSA-cxgv-hp74-jj7r is associated with vulnerabilities that allow unauthorized file transfers and command execution on the host.
Which versions of ansible-jailexec are affected by GHSA-cxgv-hp74-jj7r?
Versions of ansible-jailexec up to and including 1.3.0 are affected by GHSA-cxgv-hp74-jj7r.
What users are at risk from GHSA-cxgv-hp74-jj7r?
Users of the ansible-jailexec connection plugin, particularly those running vulnerable versions, are at risk from GHSA-cxgv-hp74-jj7r.