Summary
node-opcua may fail to enforce restrictive namespace-level role permissions for nodes that do not have explicit per-node permissions. An anonymous network client could consequently write variables or call bound methods when the server relies on those namespace defaults for access control.
Affected context
The issue concerns node-opcua servers that configure restrictive namespace defaults through setDefaultRolePermissions and rely on those defaults for nodes without explicit per-node RolePermissions. In the affected enforcement path, the configured namespace value may not be read as the applicable default, and a missing or null permission result is handled permissively. Servers with no declared restrictive policy, nodes with explicit per-node permissions, and correctly bound programmatic namespace metadata are outside this authorization-bypass case.
Exploit preconditions
- Attack surface: Network-accessible OPC UA server operations for writing variables or calling bound methods
- Required access: An anonymous client may be sufficient; the client must be able to reach the relevant server endpoint
- Trigger point: A write or method-call authorization check for a node without explicit per-node role permissions
- Why exploitation is possible: The runtime enforcement path does not apply the configured namespace default and treats the resulting null permission value permissively
Why this happens
The authorization check retrieves a missing or null DefaultRolePermissions metadata value instead of the namespace-level default configured through setDefaultRolePermissions. Because the null result is handled permissively, the runtime can allow an operation that the configured policy was intended to restrict. This is an incorrect authorization decision (CWE-863), also related to improper access control (CWE-285) and fail-open behavior (CWE-636).
Potential impact
- An unauthenticated or otherwise insufficiently authorized client may write variables configured with
CurrentWriteaccess. - A client may invoke bound methods that namespace defaults were intended to restrict.
- Unauthorized writes could alter operational data or influence downstream systems.
- Method calls could trigger actions exposed by the server.
General mitigation guidance
Defensive approaches focus on ensuring that authorization checks use the effective policy intended for each node and fail closed when permission metadata is absent.
- Keep namespace policy configuration and runtime enforcement metadata consistently bound.
- Apply explicit per-node permissions where inheritance cannot be reliably verified.
- Treat missing or invalid permission metadata as a denial rather than an implicit grant.
- Limit anonymous access and run server processes with only the privileges they require.
- Validate authorization behavior for inherited permissions across reads, writes, and method calls.
How teams detect issues like this
- Review authorization code for mismatches between namespace policy setters and the metadata fields read by enforcement checks.
- Use static analysis and code review to flag permission checks that allow operations when policy metadata is null or missing.
- Test anonymous and low-privilege sessions against nodes that inherit restrictive namespace defaults, covering writes and method calls.
- Enforce policies requiring explicit handling of missing authorization metadata and tests for inherited access-control rules.
- Automated code review tools may help identify fail-open checks and inconsistent policy data flow.

