# GHSA-73PW-G56W-95H8: Eclipse Ditto policy enforcers ignore revokes in multi-permission and partial permission checks

- Database: GitHub
- Severity: CVSS 2.3 (Low)
- Published: 2026-11-19
- Modified: 2026-11-19

## Tracked as

- [CVE-2026-129702](https://cve.now/CVE-2026-129702.md): Eclipse Ditto authorization bypass in policy enforcers

## Description

### Summary

Eclipse Ditto's policy enforcers do not let a revoke win over a grant in two kinds of permission checks. As a result,
they report permissions as granted although the policy revokes them:

1. **Checks of several permissions at once** (default, throughput-optimized "trie-based" enforcer): a more specific
   grant of one permission hides a revoke of another permission. This is reachable through the
   [`checkPermissions` API](https://eclipse.dev/ditto/basic-auth-checkpermissions.html), which can answer `true` for
   e.g. `["READ", "WRITE"]` although `WRITE` is revoked.
2. **Partial permission checks** ("is the permission granted on the resource or on any of its sub-resources?"), used
   to authorize retrieving Things and Policies and to determine the subjects which receive events: a grant on a
   sub-resource is counted although the same permission is revoked on that very sub-resource
   - by **another subject of the same authorization context** (both enforcers), or
   - for the **same subject** (memory-optimized "tree-based" enforcer).

Both issues require a policy which grants and revokes the same permission for the subject(s) of a request, and most of
them an authorization context with **several subjects** (e.g. a user subject and a group/role subject extracted from
the same JWT, or a connection with several authorization subjects).

The content of retrieved Things and Policies is not affected: it is filtered field by field, which evaluates grants and
revokes correctly. What is affected is the authorization decision itself, so a requester can learn about the
**existence** of a Thing or Policy and receive **metadata** (e.g.
an empty `{}` with status `200` instead of `404`, or events with an empty payload) where the policy grants no readable
content at all. An application that relies on the `checkPermissions` result for its own authorization decision can be
misled into allowing an action the policy denies.

Severity: **Low**.

### Details

#### 1. Multi-permission checks (trie-based enforcer)

[`GrantRevokeIndex#hasPermissions`](https://github.com/eclipse-ditto/ditto/blob/3.9.8/policies/model/src/main/java/org/eclipse/ditto/policies/model/enforcers/trie/GrantRevokeIndex.java#L106-L111)
compares the highest grant weight across **all** requested permissions with the highest revoke weight across **all**
requested permissions
([`PermissionSubjectsMap#getMaxNonemptyWeightForAllPermissions`](https://github.com/eclipse-ditto/ditto/blob/3.9.8/policies/model/src/main/java/org/eclipse/ditto/policies/model/enforcers/trie/PermissionSubjectsMap.java#L113-L132),
[`#getMaxWeightForAllPermissions`](https://github.com/eclipse-ditto/ditto/blob/3.9.8/policies/model/src/main/java/org/eclipse/ditto/policies/model/enforcers/trie/PermissionSubjectsMap.java#L89-L101))
instead of comparing grant and revoke of each permission on its own, as its Javadoc and the tree-based enforcer
([`CheckPermissionsVisitor`](https://github.com/eclipse-ditto/ditto/blob/3.9.8/policies/model/src/main/java/org/eclipse/ditto/policies/model/enforcers/tree/CheckPermissionsVisitor.java#L106-L127))
do. The defect shows when the grant and the revoke of a permission belong to different subjects of the same
authorization context. The only Ditto API passing several permissions is `checkPermissions`
([`PolicyCheckPermissionsStrategy`](https://github.com/eclipse-ditto/ditto/blob/3.9.8/policies/service/src/main/java/org/eclipse/ditto/policies/service/persistence/actors/strategies/commands/PolicyCheckPermissionsStrategy.java#L91-L102)),
available since 3.7.0. It always uses the caller's own authorization context.

Relatedly,
[`PermissionSubjectsMap#getSubjectIntersect`](https://github.com/eclipse-ditto/ditto/blob/3.9.8/policies/model/src/main/java/org/eclipse/ditto/policies/model/enforcers/trie/PermissionSubjectsMap.java#L159-L168)
ignores a requested permission which no subject holds at all, so the trie-based `getSubjectsWith*Permission` methods
over-report subjects for several permissions. Ditto itself only calls these with a single permission.

#### 2. Partial permission checks

- **Tree-based enforcer**: when evaluating sub-resources of the checked resource,
  [`CheckPartialPermissionsVisitor`](https://github.com/eclipse-ditto/ditto/blob/3.9.8/policies/model/src/main/java/org/eclipse/ditto/policies/model/enforcers/tree/CheckPartialPermissionsVisitor.java#L47-L61),
  [`CollectPartialGrantedSubjectsVisitor`](https://github.com/eclipse-ditto/ditto/blob/3.9.8/policies/model/src/main/java/org/eclipse/ditto/policies/model/enforcers/tree/CollectPartialGrantedSubjectsVisitor.java#L106-L117)
  and
  [`ClassifySubjectsVisitor`](https://github.com/eclipse-ditto/ditto/blob/3.9.8/policies/model/src/main/java/org/eclipse/ditto/policies/model/enforcers/tree/ClassifySubjectsVisitor.java#L128-L155)
  only collect the grants and ignore all revokes, including a revoke on the same sub-resource.
- **Trie-based enforcer**: the "bottom-up grant trie" used by
  [`TrieBasedPolicyEnforcer#hasPartialPermissions`](https://github.com/eclipse-ditto/ditto/blob/3.9.8/policies/model/src/main/java/org/eclipse/ditto/policies/model/enforcers/trie/TrieBasedPolicyEnforcer.java#L138-L145)
  pushes the grants of each subject up to the super-resources on their own. A revoke of another subject on the same
  sub-resource does not cancel them.

`hasPartialPermissions` decides whether retrieving a Thing
([`ThingCommandEnforcement`](https://github.com/eclipse-ditto/ditto/blob/3.9.8/things/service/src/main/java/org/eclipse/ditto/things/service/enforcement/ThingCommandEnforcement.java#L371-L390))
or a Policy is authorized, and whether the existence of an inaccessible Thing is hidden. The partially granted
subjects determine the receivers of Thing events.

### Proof of concept

Using the `deployment/docker` docker-compose setup, which enables pre-authentication and exposes the gateway directly on
port `8081` (the gateway accepts several comma-separated pre-authenticated subjects, which stands in for e.g. a JWT
yielding several subjects):

1. Create a policy where `nginx:alice` is granted `WRITE` on `thing:/`, `READ` on `thing:/attributes/pub` and `READ`
   on `thing:/features/secret`, while `nginx:group-x` has `WRITE` revoked on `thing:/attributes` and `READ` revoked on
   `thing:/features/secret`, plus a Thing using it:

   ```sh
   curl -u ditto:ditto -X PUT -H 'Content-Type: application/json' \
     http://localhost:8080/api/2/policies/org.example:poc -d '{
       "entries": {
         "admin": {
           "subjects": { "nginx:ditto": { "type": "admin" } },
           "resources": {
             "policy:/": { "grant": ["READ", "WRITE"], "revoke": [] },
             "thing:/": { "grant": ["READ", "WRITE"], "revoke": [] }
           }
         },
         "user": {
           "subjects": { "nginx:alice": { "type": "user" } },
           "resources": {
             "thing:/": { "grant": ["WRITE"], "revoke": [] },
             "thing:/attributes/pub": { "grant": ["READ"], "revoke": [] },
             "thing:/features/secret": { "grant": ["READ"], "revoke": [] }
           }
         },
         "restricted": {
           "subjects": { "nginx:group-x": { "type": "group" } },
           "resources": {
             "thing:/attributes": { "grant": [], "revoke": ["WRITE"] },
             "thing:/features/secret": { "grant": [], "revoke": ["READ"] }
           }
         }
       }
     }'

   curl -u ditto:ditto -X PUT -H 'Content-Type: application/json' \
     http://localhost:8080/api/2/things/org.example:poc \
     -d '{ "policyId": "org.example:poc", "attributes": { "pub": "value" }, "features": { "secret": {} } }'
   ```

2. **Multi-permission check** as the authorization context `{nginx:alice, nginx:group-x}`:

   ```sh
   curl -X POST -H 'Content-Type: application/json' \
     -H 'x-ditto-pre-authenticated: nginx:alice,nginx:group-x' \
     http://localhost:8081/api/2/checkPermissions -d '{
       "readWrite": {
         "resource": "thing:/attributes/pub",
         "entityId": "org.example:poc",
         "hasPermissions": ["READ", "WRITE"]
       },
       "write": {
         "resource": "thing:/attributes/pub",
         "entityId": "org.example:poc",
         "hasPermissions": ["WRITE"]
       }
     }'
   ```

   Vulnerable versions answer `{"readWrite": true, "write": false}`. The correct answer is
   `{"readWrite": false, "write": false}`, because `WRITE` on `thing:/attributes/pub` is revoked.

3. **Partial permission check** as the same authorization context, retrieving the `secret` feature which is the only
   resource below `thing:/features` granted to `nginx:alice`, but revoked for `nginx:group-x`:

   ```sh
   curl -i -H 'x-ditto-pre-authenticated: nginx:alice,nginx:group-x' \
     http://localhost:8081/api/2/things/org.example:poc/features
   ```

   Vulnerable versions answer `200` with an empty JSON object. The correct answer is `404`, as nothing below
   `thing:/features` is readable for this authorization context.

Ditto's own enforcement of modifications stays correct throughout, e.g. writing `thing:/attributes/pub` with this
authorization context is rejected with `403`.

### Impact

Incorrect authorization (CWE-863).

- **Ditto**: requesters whose authorization context contains several subjects, or (with the memory-optimized policy
  evaluator) whose policy grants and revokes a permission on the same resource, can learn about the existence of
  Things and Policies and receive metadata (empty views, events with empty payloads) where the policy grants them no
  readable content. No field values are disclosed and no modification is authorized.
- **Applications using `checkPermissions`** with more than one permission per check entry and acting on the result
  themselves can be told that a subject holds a set of permissions it does not hold.

Not impacted:

- authorization of modifying commands (`WRITE`) and of live messages,
- the content of retrieved Things and Policies (filtered field by field),
- policies which never grant and revoke the same permission for subjects of the same authorization context on the
  same resource.

#### Workarounds

Until a patched version is deployed:

- Avoid policies which grant a permission to one subject and revoke the same permission on the same resource from
  another subject which can be part of the same authorization context, and (with the memory-optimized policy
  evaluator) policies which grant and revoke the same permission on the same resource for one subject.
- Request only **one permission per `checkPermissions` entry** (e.g. split `["READ", "WRITE"]` into two entries and
  combine the results in the application).

### Patches

Fixed in Eclipse Ditto **3.8.15** and **3.9.9**:

- the trie-based enforcer compares grant and revoke weights per permission and only reports subjects holding all
  requested permissions,
- both enforcers let a revoke on a sub-resource cancel the grants of all subjects of the authorization context on that
  sub-resource when checking partial permissions.

A randomized test now verifies both enforcers against a reference evaluation of the policy semantics.

## References

- https://github.com/eclipse-ditto/ditto/security/advisories/GHSA-73pw-g56w-95h8

Page: https://cve.now/GHSA-73PW-G56W-95H8
