API security

API replay protection and idempotency keys

Transaction integrity: signature, clock, database arranged to illustrate api replay protection and idempotency keys.

Idempotency controls should distinguish a legitimate retry from a new business action. Understanding API replay protection and idempotency keys helps establish which security property the feature needs and where that property is actually enforced.

What does this involve?

Business logic security checks whether the application preserves the intended rules across a complete sequence of actions. State transitions, ownership, approval and retry handling can matter more than the validity of any individual input.

This section considers key requirements to ensure that the application enforces business logic processes in the correct way and is not vulnerable to attacks that exploit the logic and flow of the application.

Why it matters

Consider a realistic failure: a retried payment request creates a second charge.

Legitimate features can cause harm when used out of sequence, repeatedly or under an identity that should not control the current state. Financial loss, inventory disruption and unauthorised changes depend on the particular workflow.

An API review follows the server-side behaviour behind the interface. Direct requests, alternate methods and background operations can reveal boundaries that the normal frontend journey does not exercise.

How penetration testers check for it

Review key scope, request binding, storage lifetime and conflicting concurrent requests.

  • Confirm that the application will only process business logic flows for the same user in the expected sequential step order and without skipping steps.
  • Confirm that business logic limits are implemented per the application's documentation to avoid business logic flaws being exploited.
  • Confirm that transactions are being used at the business logic level such that either a business logic operation succeeds in its entirety or it is rolled back to the previous correct state.
  • Confirm that business logic level locking mechanisms are used to ensure that limited quantity resources cannot be double-booked by manipulating the application's logic.
  • Confirm that high-value business logic flows require multi-user approval to prevent unauthorised or accidental actions. This could include but is not limited to large monetary transfers, contract approvals, access to classified information, or safety overrides in manufacturing.
  • Compare ownership and approval across related operations.
  • Inspect committed outcomes and background side effects.

How to fix it

Bind idempotency records to the caller and operation and enforce atomic processing.

  • Represent important rules explicitly on the server.
  • Bind approvals and state changes to trusted values.
  • Use atomic operations where competing requests affect the same decision.
  • Retain regression cases for invalid transitions and retries.

A behaviour is not automatically a vulnerability because it is unusual. The finding needs a clear violated business rule and a meaningful unauthorised consequence.

Recheck the changed behaviour against the original failure conditions and the legitimate user journey. Keep enough evidence to show which release and configuration were verified, and include related entry points that depend on the same security decision.

Read about our methodology or contact pentested.com to discuss your APIs and integrations.

See your first test report this week.

Book a 30 minute demo. We will verify one of your targets with you and run a test against it, so you can judge the results on your own systems.

Book a demo