Summary
OpenEMR's ACL module contained an authorization flaw where the AclMain::zhAclCheck() function evaluated only "allow" rules and ignored explicit "deny" entries.
In deployments prior to 8.0.0.2, a user who belonged to any group with an "allow" entry would gain access even if an administrator explicitly set that user or group to "deny," undermining access revocation and fine-grained permission control.
Affected context
This vulnerability affects OpenEMR installations using the built-in ACL system to manage user and group permissions.
It appears where administrators rely on explicit "deny" rules to revoke or restrict access to specific modules or actions, especially in environments with overlapping user and group assignments.
The issue is most relevant in multi-role clinical environments where staff accounts belong to multiple groups (e.g., providers, billing, administrative) and where granular access control is required to protect sensitive health records.
Exploit preconditions
- Attack surface: Application-level authorization for OpenEMR modules and features.
- Required access: A valid user account that is a member of at least one group with "allow" ACL entries for a resource.
- Trigger point: An access check executed via
AclMain::zhAclCheck()where the user or one of their groups has an explicit "deny" entry but another group has an "allow" entry. - Why exploitation is possible: The ACL check function only evaluates the existence of any "allow" rule and does not honor explicit "deny" rules (
allowed=0), so deny entries never override allows.
Why this happens
The core issue is an incorrect authorization design (CWE-863) in the ACL evaluation logic.
Rather than applying a clear precedence rule where explicit denies supersede allows, the AclMain::zhAclCheck() implementation effectively treats access as granted if any associated user or group has an "allow" entry, ignoring deny entries altogether.
This flawed logic breaks the principle of least privilege and makes it impossible to reliably revoke access in scenarios with overlapping user and group permissions.
Conceptually, the bug is an access-control policy evaluation error: the policy engine does not correctly interpret and enforce deny rules within the ACL model.
Potential impact
- Users may retain access to modules or data that administrators intended to revoke.
- Staff with multiple group memberships could access sensitive health records or administrative functions beyond their intended role.
- Separation-of-duties policies can be bypassed, leading to conflicts of interest or policy violations.
- Regulatory exposure due to unauthorized access to protected health information (PHI).
- Increased risk of data misuse or accidental disclosure by users with excessive privileges.
General mitigation guidance
Effective mitigation focuses on correcting authorization logic and tightening access-control policy modeling rather than relying on specific version updates.
Recommended patterns include:
- Designing ACL evaluation so that explicit deny rules are processed first and override any allow entries.
- Implementing a clear precedence model (e.g., "deny > allow," or explicit user rules > group rules) and documenting it for administrators.
- Centralizing authorization checks through a single, well-tested function rather than scattered ad hoc checks.
- Applying the principle of least privilege when defining default roles and groups, so excess access is minimized even if misconfigurations occur.
- Regularly reviewing ACL configurations and testing critical permission paths to confirm that revocations are effective.
How teams detect issues like this
Detection typically involves a mix of code-level and configuration-level review:
- Static analysis and code review:
- Look for authorization functions that only check for "allow" conditions without evaluating explicit "deny" states.
- Identify ACL logic that short-circuits on the first "allow" match rather than evaluating the full rule set.
- Verify that authorization decisions consider user-, group-, and context-specific rules in a predictable precedence order.
- Policy and runtime validation:
- Create test accounts with overlapping group memberships and verify that deny rules actually block access.
- Use audit logs to spot users performing actions that should be disallowed according to current ACL settings.
- Incorporate automated permission tests into CI/CD to validate that critical access paths obey deny rules after code changes.
- Automated security review tools can assist by flagging access-control checks that do not reference deny conditions or that bypass central authorization APIs.

