Appearance
Object ownership (BOLA and IDOR) Since v0.2
Broken object-level authorization is the most common API flaw: a client asks for /api/orders/4711 although order 4711 belongs to someone else, and the application forgets to check. Every such request is well formed, so signatures cannot see it. Object ownership learns which client was handed which object IDs and flags clients that use objects handed to others, or that walk through IDs.
Before you begin
- Role:
operatorfor the application (viewercan read). - The checks must tell clients apart, so set up client identity first: a verified API consumer, a JWT claim, the session user or a session cookie. Clients known only by their address (
ip,ip_ja4) are never flagged, because many people can share an address, but they still teach owners. - The feature is off until Object ownership checks is on. After you turn it on, it only learns for the Learning period (24 hours by default) and flags nothing.
Turn on object ownership
text
1. Open Applications > All applications > the application > Request checks > API protection.
2. Open the Object ownership tab, then Settings.
3. Turn on Object ownership checks. Leave the mode on detect.
4. Select Preview changes, add a comment and select Apply.sh
waap api set -app shop -m "object ownership" ownership.enabled=true
waap api ownership -app shop -days 7yaml
# applications[].policy.api.ownership
ownership:
enabled: true
learn_from: both
public_namespaces: [product, post]
foreign: logDescribe endpoints by hand
Where IDs are not recognisable by name, describe the endpoint. Turn the checks on first: endpoints are stored only while they are on.
text
1. On the Object ownership tab, open Endpoints.
2. Add an endpoint, its ID locations, a namespace, and the locations in its answers that
hand out IDs.
3. Select Preview changes, then Apply.sh
waap api ownership endpoints -app shop -f endpoints.yaml -m "vehicle endpoints"yaml
# endpoints.yaml, or applications[].policy.api.ownership.endpoints
- endpoint: GET /identity/api/v2/vehicle/{vehicleId}/location
ids: [path:vehicleId]
namespace: vehicle
hands_out: [json:/vehicles/*/id]A manual endpoint replaces the automatic search for its requests. Short identifiers that are not numbers (/books/v1/bookTitle77) are only seen through an API description or a manual endpoint.
See what was found and reset
The What was found part shows, per kind of object, the objects watched and the foreign accesses, enumerations and sequential walks of the last 1 to 90 days (every node), the objects this node remembers, and whether the learning period is still running.
text
1. Open the Object ownership tab, What was found.
2. To start over, select Reset learned owners and confirm.sh
waap api ownership -app shop -days 30
waap api ownership reset -app shop -yesA reset affects this node only
Reset learned owners makes this node forget every owner, removes the stored counts and starts the learning period again. Other nodes keep their memory until they restart or are reset. Rotating the application's identity key does the same.
How IDs and owners are found
- In requests: the variables of the path template (from the API description, else from the endpoint inventory), and query, form and JSON body values whose names match ID names.
- In answers (successful JSON only): members whose names match ID names.
- A value counts only when it has one of the ID shapes and is at most 128 bytes.
- Each ID has a namespace so that order 7 and invoice 7 stay apart: from the name (
vehicleIdgivesvehicle), else the member that holds it, else the path segment before it. UUIDs share one namespace. - An answer that hands out one ID makes the requesting client its owner. More than two IDs of one namespace make a listing: the client has seen them but does not own them. A listing seen by two or more clients makes those objects public.
- A request that uses an unknown object in its path, query or a header makes the client its owner once the answer is 2xx. IDs in request bodies are checked but do not claim.
What is flagged
| Rule | When |
|---|---|
bola.foreign_object | The object was handed to (or first used by) other clients, fewer than Shared after have used it, and its namespace is not public. |
bola.enumeration | The client used Distinct IDs per window different objects of one namespace that are not its own within the Enumeration window. |
bola.sequential | The client asked for Sequential run consecutive integer IDs in a row, none its own. |
bola.no_identity | Requests that name objects come from clients without an identity, or with an ignored kind only. Logged once a minute per endpoint. |
refuse actions refuse those requests only when the feature is in block mode. Events carry the client's identity, so an analyst can follow one client across requests. Exceptions accept bola.* rule IDs.
A team project read by several users is reported for its first readers until Shared after distinct clients used it. Mark whole kinds of objects that everyone reads as Public namespaces.
Settings reference
| Setting | What it does | Default | Allowed values | Applies in |
|---|---|---|---|---|
Object ownership checks (ownership.enabled) | Turns the feature on. | false | true, false | all |
Object ownership mode (ownership.mode) | Whether refuse actions apply. | empty (same as API protection) | detect, block, empty | detect wins over the application's block |
Learn owners from (ownership.learn_from) | Where owners are learned. | both | responses, requests, both | all |
ID names (ownership.id_names) | Query and JSON names that carry IDs. | id, *_id, *Id, uuid, *_uuid | up to 32 names with at most one *; case-sensitive | all |
ID shapes (ownership.id_shapes) | What an ID value must look like. | integer, uuid, hex, alphanumeric | those and base64, decimal, text | all |
Public namespaces (ownership.public_namespaces) | Kinds of objects never stored or flagged. | none | up to 64 names | all |
Shared after (ownership.shared_after) | Clients after which an object counts as shared. | 5 | 2 to 1000 | all |
Identity kinds never flagged (ownership.ignore_kinds) | Identity kinds that teach owners but are never flagged. | ip, ip_ja4 | the identity kinds | all |
Foreign object access (ownership.foreign) | Action for a foreign object. | log | log, refuse | refuse in block mode |
Distinct IDs per window (ownership.enumeration.distinct) | Different foreign objects that make enumeration. | 50 | 5 to 100000 | all |
Enumeration window (ownership.enumeration.window) | How far back distinct IDs are counted. | 10m | 1m to 24h | all |
Sequential run (ownership.enumeration.sequential) | Consecutive integer IDs that make a walk. | 10 | 3 to 10000 | all |
Enumeration (ownership.enumeration.action) | Action for enumeration and walks. | log | log, refuse | refuse in block mode |
Forget objects after (ownership.ttl) | An unused object is forgotten after this. | 168h | 1h to 2160h | all |
Objects kept (ownership.max_objects) | Objects remembered per application and node. | 200000 | 1000 to 5000000 | all |
Largest answer learned (ownership.max_response) | Longer answers are not read for IDs. | 256KiB | 1 up to the response body limit | all |
Learning period (ownership.learning) | Learn only, flag nothing, after switching on or a reset. | 24h | 1m to 720h | all |
Manual endpoint
| Setting | What it does | Default | Allowed values | Applies in |
|---|---|---|---|---|
endpoint | The endpoint. | none (required) | METHOD /path/{var} | all |
ids | Where the IDs are. | none | path:NAME, query:NAME, json:/pointer, header:NAME; up to 8 | all |
namespace | The namespace of the IDs. | derived | lowercase letters, digits, underscores, up to 64 | all |
hands_out | Where its answers hand out IDs. | none | same forms; * is any element or member | all |
Limits
| Limit | Value |
|---|---|
| Manual endpoints | 500 |
| Locations per endpoint | 8 |
| Objects per node, all applications | 2,000,000 |
| Memory per object | about 130 bytes, and 8 more per further client (200,000 objects use about 26 MiB) |
| Counts kept | 90 days |
| State | per node; a snapshot is saved every 5 minutes and at stop |
Objects are kept as keyed hashes, never as values. Beyond Objects kept, the least recently used objects are dropped (waap_bola_evicted_total).
Known limits
Detection depends on owners using their objects. An attacker with Shared after accounts can make an object look shared. Each node learns what it sees; nodes do not share what they learned yet.
Troubleshooting
Nothing is flagged
- Cause: the learning period is running, the application is in
detect, or clients have only an address identity. - Check: What was found shows whether the learning period is still running.
- Fix: wait, set up client identity, or switch to
block.
Many bola.no_identity events
- Cause: requests that name objects come from clients without an identity.
- Fix: set up client identity for the application.