Inventory hoarding: bots that hold stock in carts

Intermediate3 min readUpdated

GET /learn/scalping/inventory-hoarding-bots/ Accept text/html text/markdown

Short answer

Inventory hoarding is when bots add limited stock to carts or hold seats, rooms or slots without paying, so real buyers see it as sold out. OWASP calls it Denial of Inventory. Operators use it to release stock to their own accounts later, sell held items or damage a sale. Defences are short hold times, a cap on holds per identity and bot detection on add-to-cart.

OWASP lists inventory hoarding as OAT-021 Denial of Inventory and defines it as: "Deplete goods or services stock without completing the purchase or committing to the transaction." The entry reaches well beyond shopping carts. It names reservations for hotel rooms, restaurant tables, holidays and flight seats, and things that are not goods at all, such as availability slots and queue positions. It sits next to scalping in the OWASP automated threats list.

Why do bots hoard inventory?

  • To keep stock out of reach until the operator's own accounts are ready to buy it.
  • To sell the hold. In ticketing, a held seat can be released at an agreed moment so a waiting buyer can grab it, which moves the seat without the platform's transfer feature. How ticket bots work covers the rest of that operation.
  • To make a product look scarce and push resale prices up.
  • To damage a competitor's or a seller's launch.

Appointment systems suffer the same pattern with slots instead of stock, covered in appointment and booking bots.

What does inventory hoarding look like in your data?

  • A high add-to-cart or hold rate with low conversion, on one product or event.
  • Holds that expire unpaid, followed at once by a new hold on the same item from a linked session.
  • Many active holds per account, device or IP range.
  • "Sold out" shown on the site while paid orders are well below the stock count.
  • Hold requests with no product page view in the same session.

This PostgreSQL query (illustrative schema) finds devices that hold the same item again within 30 seconds of their previous hold expiring:

sql
SELECT h1.item_id, h1.device_id, count(*) AS re_holds
FROM holds h1
JOIN holds h2
  ON h2.item_id = h1.item_id
 AND h2.device_id = h1.device_id
 AND h2.created_at BETWEEN h1.expires_at AND h1.expires_at + interval '30 seconds'
WHERE h1.status = 'expired'
GROUP BY h1.item_id, h1.device_id
HAVING count(*) >= 3
ORDER BY re_holds DESC;

Three re-holds is a starting threshold. Run the same query on account ID and card fingerprint, since operators rotate devices.

Shorten and cap holds

  • Reserve later. For limited releases, take stock out of the available count at the start of checkout or at payment, not at add-to-cart.
  • Keep holds short, and do not extend them without a payment step.
  • Allow one active hold per item per identity, and cap total holds at the purchase limit. Count across linked accounts, devices and cards.
  • Add a cooldown. After a hold expires unpaid, the same identity cannot hold that item again for a few minutes.
  • For seats, limit the number of seats in one hold to the ticket limit for the event.

A hold with an automatic expiry can be as simple as one Redis key per item. NX makes the hold succeed only if nobody holds the item, and EX 600 expires it after 600 seconds:

bash
redis-cli SET hold:event42:seat:A12 "acct:8841" NX EX 600

The server should also keep a count of active holds per identity and refuse a new hold once that count reaches the limit.

Put bot detection on add-to-cart and hold endpoints

Hoarding runs through the add-to-cart or hold API, often without any product page view. Score those requests for automation and challenge or reject the low scores, the same way you protect checkout. The OWASP API Security Top 10 lists this kind of flow under API6:2023, unrestricted access to sensitive business flows. How to protect APIs from bots covers the API side.

Rate limits help as a floor. Limit holds per session and per account, as well as per IP address, because hoarders spread holds over proxies. Rate limiting for bots explains what limits miss. The checkout steps that follow a hold are covered in how to stop bots from buying your products.

Tools that help

StopBots is published by Kairal, which is one of the tools listed. The list is not a ranking.

  • Kairal runs bot detection with protection set per endpoint, so add-to-cart and hold calls get their own rules, and links the sessions, devices and IP addresses behind repeated holds.
  • Cloudflare rate limiting rules cap requests to hold endpoints by IP address or other request characteristics, and fit sites already on Cloudflare.
  • AWS WAF Bot Control adds managed bot rules for sites served through CloudFront or other AWS front ends.
  • Akamai Bot Manager scores bot traffic at Akamai's edge, which suits large ticketing and retail sites already on Akamai.

Common questions

What is denial of inventory?

It is OWASP's name for automated threat OAT-021. Other names listed in the entry include inventory hoarding, inventory exhaustion, stock exhaustion, hold-all attack and seat spinning.

How long should a cart hold stock?

Long enough for a real buyer to pay, and no longer. Measure how long your real buyers take from the start of checkout to payment on a normal day, and set the hold for a limited release a little above that.

How is seat spinning different from scalping?

Scalping ends in a purchase that the operator resells. Seat spinning may never end in a purchase: the seats are held to block other buyers or released at a chosen moment, so the damage shows up as unsold stock and lost sales.