AppArmor Exec Transitions Decide Which Profile an Executable Actually Enters
An AppArmor profile is not a static label attached to a service forever. When a confined process executes another program, the profile rule can inherit the current confinement, transition to a named profile, or run unconfined. The transition choice is a security decision, and a typo can turn a restrictive service profile into an unconfined child shell.
Know the transition classes
AppArmor policy language uses execution rules that combine permission to execute with a transition mode. The AppArmor documentation describes ix as inheriting the current profile, px as entering a named profile, cx as entering a child profile, and ux as executing unconfined. pux and related fallback forms can behave differently when the target profile is absent.
Treat every executable path in a service profile as a transition review. Record the expected target profile for shells, interpreters, helper binaries, package managers, and user-controlled scripts. If a script is writable by a less trusted account, a px or ix rule may allow that account to influence what code the confined service runs.
ux deserves special attention because it removes confinement for the executed program. It can be useful for carefully bounded administrative workflows, but it should not appear casually in a network-facing service profile.
Audit paths and attachments
Start with the executable paths that appear in x rules. Resolve symlinks and check whether the target can be replaced. Confirm the attachment path of the named profile and whether the executed program is actually covered by that profile on the host.
Profile names can exist while attachments change after a package upgrade. A rule that expects a transition to an application profile may fail or fall back to a less restrictive mode if the profile is missing. Validate the loaded profile set after upgrades and after image changes.
Review writable locations as part of the same task. A confined service that can write a helper binary and transition to a profile with broader file access can become a privilege path. Directory ownership, mount options, and AppArmor file rules must agree.
Test the real execution
Use aa-status or the distribution's supported tooling to confirm which profiles are loaded and in what mode. Review audit logs for denied operations and unexpected transitions. Then exercise the actual command path that the service uses, including interpreters and wrappers.
Do not test only by running the binary as a user from an interactive shell. Service managers, containers, and custom launchers may apply a different attachment or environment. Capture the process label before and after exec, and compare it with the approved transition.
For high-risk helpers, add a denial test. Attempt an operation that the target profile should block. A transition that reports success but lands in the wrong profile is more dangerous than an obvious compatibility failure.
Keep policy and deployment together
Store the profile, its expected attachment, and the tested executable set as one reviewed artifact. Include a change procedure for package upgrades that replace binaries or add new helpers. When a transition fallback is used, document why the fallback cannot drop to unconfined unexpectedly.
AppArmor is most useful when the expected domain is explicit. The review question is not merely whether the service starts. It is which profile the service enters, which profile each child enters, and whether any route through the documented execution path reaches ux.
References
- AppArmor QuickProfileLanguage, AppArmor project documentation. Retrieved 2026-11-18.
- AppArmor policy development guide, AppArmor project documentation. Retrieved 2026-11-18.
Top comments (0)