Skip to content

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: operator for the application (viewer can 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 7
yaml
# applications[].policy.api.ownership
ownership:
  enabled: true
  learn_from: both
  public_namespaces: [product, post]
  foreign: log

Describe 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 -yes

A 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 (vehicleId gives vehicle), 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 ​

RuleWhen
bola.foreign_objectThe object was handed to (or first used by) other clients, fewer than Shared after have used it, and its namespace is not public.
bola.enumerationThe client used Distinct IDs per window different objects of one namespace that are not its own within the Enumeration window.
bola.sequentialThe client asked for Sequential run consecutive integer IDs in a row, none its own.
bola.no_identityRequests 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 ​

SettingWhat it doesDefaultAllowed valuesApplies in
Object ownership checks (ownership.enabled)Turns the feature on.falsetrue, falseall
Object ownership mode (ownership.mode)Whether refuse actions apply.empty (same as API protection)detect, block, emptydetect wins over the application's block
Learn owners from (ownership.learn_from)Where owners are learned.bothresponses, requests, bothall
ID names (ownership.id_names)Query and JSON names that carry IDs.id, *_id, *Id, uuid, *_uuidup to 32 names with at most one *; case-sensitiveall
ID shapes (ownership.id_shapes)What an ID value must look like.integer, uuid, hex, alphanumericthose and base64, decimal, textall
Public namespaces (ownership.public_namespaces)Kinds of objects never stored or flagged.noneup to 64 namesall
Shared after (ownership.shared_after)Clients after which an object counts as shared.52 to 1000all
Identity kinds never flagged (ownership.ignore_kinds)Identity kinds that teach owners but are never flagged.ip, ip_ja4the identity kindsall
Foreign object access (ownership.foreign)Action for a foreign object.loglog, refuserefuse in block mode
Distinct IDs per window (ownership.enumeration.distinct)Different foreign objects that make enumeration.505 to 100000all
Enumeration window (ownership.enumeration.window)How far back distinct IDs are counted.10m1m to 24hall
Sequential run (ownership.enumeration.sequential)Consecutive integer IDs that make a walk.103 to 10000all
Enumeration (ownership.enumeration.action)Action for enumeration and walks.loglog, refuserefuse in block mode
Forget objects after (ownership.ttl)An unused object is forgotten after this.168h1h to 2160hall
Objects kept (ownership.max_objects)Objects remembered per application and node.2000001000 to 5000000all
Largest answer learned (ownership.max_response)Longer answers are not read for IDs.256KiB1 up to the response body limitall
Learning period (ownership.learning)Learn only, flag nothing, after switching on or a reset.24h1m to 720hall

Manual endpoint ​

SettingWhat it doesDefaultAllowed valuesApplies in
endpointThe endpoint.none (required)METHOD /path/{var}all
idsWhere the IDs are.nonepath:NAME, query:NAME, json:/pointer, header:NAME; up to 8all
namespaceThe namespace of the IDs.derivedlowercase letters, digits, underscores, up to 64all
hands_outWhere its answers hand out IDs.nonesame forms; * is any element or memberall

Limits ​

LimitValue
Manual endpoints500
Locations per endpoint8
Objects per node, all applications2,000,000
Memory per objectabout 130 bytes, and 8 more per further client (200,000 objects use about 26 MiB)
Counts kept90 days
Stateper 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.