Summary
A privilege escalation issue in the AGL app-framework-binder (afb-daemon) supervision "Do" command clears request credentials before dispatching an attacker-controlled API call.
When APIs depend on a non-NULL credential context for authorization, they may treat the missing credentials as implicitly trusted or skip checks, allowing attackers to invoke privileged operations via crafted JSON input.
Affected context
This vulnerability occurs within AGL afb-daemon deployments that expose the supervision "Do" command and register APIs whose authorization decisions rely on context->credentials.
The issue manifests when:
- The
on_supervision_callhandler is reachable by an attacker-controlled client, - The handler clears the credential context before dispatching,
- Downstream APIs assume that
context->credentialsis valid and non-NULL when making authorization checks.
In such setups, APIs may execute privileged operations even for untrusted callers if they are invoked through the supervision mechanism.
Exploit preconditions
- Attack surface: The afb-daemon supervision "Do" command endpoint, typically exposed over the daemon's configured IPC or remote interface.
- Required access: Ability to send crafted JSON payloads that control the
apiandverbparameters to the supervision call. - Trigger point: Invocation of
on_supervision_callinafb-supervision.c, which: - Calls
afb_context_change_cred(&xreq->context, NULL)to clear credentials. - Dispatches the request via
xapi->itf->call(xapi->closure, xreq)to any registered target API/verb. - Why exploitation is possible: The credential context is explicitly set to NULL and propagated through
afb-context.candafb-cred.c, resulting in a zeroed credential pointer. APIs that interpret NULL as "no restriction" or that fail to handle the NULL case correctly can perform sensitive actions without verifying the caller's actual privileges.
Why this happens
The root cause is improper privilege management and incorrect handling of credential context in the supervision path.
Specifically, on_supervision_call intentionally replaces the request's credential context with NULL (afb_context_change_cred(&xreq->context, NULL)) before forwarding the request to an arbitrary API and verb chosen by the attacker-controlled JSON input.
This design assumes that downstream APIs will robustly handle the absence of credentials, but many authorization checks are implemented under the assumption that context->credentials is present and valid.
As a result, authorization logic can fail open when credentials are NULL, mapping directly to CWE-269: Improper Privilege Management, where privilege checks are bypassed due to mismanaged or missing security attributes.
Potential impact
- Execution of privileged API endpoints without proper authentication or authorization.
- Escalation from a low-privilege client to roles or capabilities reserved for trusted components.
- Modification of protected configuration or system state via internal management APIs.
- Access to sensitive data or operations that were intended to be restricted to authenticated users.
- Indirect compromise of other parts of the AGL system that rely on afb-daemon enforcement.
General mitigation guidance
Effective mitigation focuses on ensuring that authorization decisions never silently accept missing credentials and that supervision paths cannot strip or weaken identity information:
- Treat a NULL or empty credential context as an explicit failure condition in all APIs, returning an authorization error instead of proceeding.
- Centralize authorization logic so that privilege checks occur before dispatching to target APIs, not within each API in an ad hoc fashion.
- Avoid clearing or downgrading credential contexts when forwarding requests; instead, preserve the caller's identity or explicitly substitute a well-defined, least-privileged service identity.
- Introduce strict role/permission mapping for supervision features so they can only invoke a constrained, well-audited subset of APIs.
- Design APIs defensively with fail-closed behavior: if credentials or roles cannot be resolved, deny access rather than assuming a default.
How teams detect issues like this
Organizations can identify and monitor this class of issue through:
- Static analysis and code scanning:
- Flagging calls that nullify or overwrite credential or security-context structures before request dispatch.
- Detecting authorization checks that do not handle a NULL or "anonymous" credential path and may default to allow.
- Focused code review:
- Reviewing supervision or administrative pathways that can call arbitrary APIs or verbs, ensuring they enforce explicit policy constraints.
- Ensuring all APIs that use
context->credentialscheck for presence, validity, and required privileges, and fail closed when ambiguous. - Runtime and logging strategies:
- Logging all supervision invocations with their target API/verb and effective credential context to detect anomalous usage patterns.
- Enforcing security policies that alert on privileged operations executed with a NULL or anonymous credential context.
- Automated policy enforcement:
- Using CI/CD hooks or security linters to prevent changes that introduce credential-clearing behavior before authorization boundaries.

