> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/web-application-and-api-protection-waap-discovery-discovery-discovery-discovery/protection/bot-protection/bot-protection.md). Agents can also search and read this documentation through its [MCP server](https://developer.harness.io/~gitbook/mcp).

# Bot Protection

Overview of bot attack patterns such as credential stuffing, carding, and scraping, and how Harness Advanced API Protection bot protection counters them

Bots have become a significant challenge in the digital landscape, with automated programs often being used to exploit systems and scale abuse. These malicious bots cause harm through activities such as credential stuffing, fake account creation, carding, scraping, scalping, gift card cracking, and automated booking of airline or event seats. Understanding these threats is crucial to building robust defenses.

{% hint style="info" %}
Bot Protection is available for both SaaS and Self-Managed Platform (SMP) deployments.
{% endhint %}

## What you will learn from this topic

By the end of this topic, you will be able to:

* Understand common bot attack patterns and their impact.
* Recognize the need for bot protection.
* Identify how bots affect your systems and accounts.
* Use Bot protection to detect, track, and mitigate bot activity.
* Apply effective instrumentation for accurate detection.

***

## Understand bot protection

Bot Protection helps identify and mitigate automated attacks targeting APIs and web applications. It analyzes API traffic, behavioral patterns, contextual signals, and request-response activity to distinguish legitimate users from malicious bots. Based on configured security policies, Bot Protection automatically applies the appropriate action to protect your applications. The following table discusses the significance of Bot Protection:

| **Why to use?**                                                                                                                                                                                                                      | **When to use it?**                                                                                                                                                                                                               | **How does it help?**                                                                                                                                                                                                                                                                                                   |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Bots increasingly mimic legitimate user behavior, making them difficult to detect using traditional security controls. Automated attacks can result in account compromise, financial fraud, revenue loss, and poor user experiences. | Use Bot Protection when your APIs and applications are exposed to automated threats such as credential stuffing, fake account creation, carding, gift card cracking, scraping, scalping, automated booking, and account takeover. | Harness Advanced API Protection analyzes API requests and responses, behavioral patterns, and contextual signals to identify malicious automation. It evaluates activity against configured security policies and applies mitigation actions such as Block, Allow, Header Injection, Visual CAPTCHA, and Rate Limiting. |

***

## Bot protection capabilities

Bot Protection identifies and mitigates automated attacks targeting APIs and web applications, including credential stuffing, carding, scraping, and scalping. It combines behavioral analysis, anomaly detection, and configurable security policies to detect malicious automation and prevent fraudulent activity.

**Key capabilities:**

* **Bot detection:** Detect automated threats using volumetric analysis, API access anomalies, browser and device anomalies, and mouse replay detection.
* **Custom policies:** Define security rules and actions based on specific attack patterns and application requirements.
* **Workflow builder:** Combine multiple policies into workflows to implement layered detection and mitigation.
* **Mitigation actions:** Apply actions such as Block, Allow, Header Injection, Visual CAPTCHA, and Rate Limiting to manage detected bot activity.

***

## Track account activity and risk

Harness Advanced API Protection helps track account activity across its lifecycle, from account creation to subsequent interactions, to identify fraudulent, malicious, or compromised accounts. By correlating account-level behavior with business-specific risk indicators, you can distinguish legitimate activity from bot-driven behavior and account takeover attempts.

**Key capabilities:**

* **Custom entity attribution:** Define business-specific entities using API schemas to track account-related attributes such as email addresses, order IDs, order amounts, and total money transferred.
* **Exploratory analysis:** Analyze entity-level activity and historical patterns using the data lake to identify suspicious behavior and emerging fraud risks.
* **Workflow builder:** Combine multiple entity-based detection policies into workflows to automate fraud detection and response.

## Quantify business impact

Harness Advanced API Protection helps quantify the business impact of automated attacks and fraudulent activity by tracking business-specific key performance indicators (KPIs). This provides visibility into financial losses, transaction abuse, and operational impact, helping you assess the severity of attacks and prioritize mitigation efforts.

**Key capabilities:**

\- **Business impact configuration:** Define business-specific KPIs through an API-driven schema to measure the impact of security threats. Track indicators such as fraudulent transaction amounts, financial losses, and other business metrics relevant to your applications.

***

## Instrumentation

Harness Advanced API Protection uses **HTTP request and response analysis** to detect and mitigate bot activity. Effective instrumentation ensures visibility into both sides of the transaction, enabling accurate bot detection and real-time mitigation.

### Recommended instrumentation: Edge and inline

Harness Advanced API Protection recommends combining **edge instrumentation** (behind the CDN) with **inline instrumentation** for the following reasons:

* **Real-time mitigation:** Inline deployment enables real-time actions against malicious traffic.
* **Cookie management:** Edge instrumentation enables first-party cookie management for tracking detection lifecycles, maintaining session state, and deriving metrics without requiring additional customer-side instrumentation.

#### Supported CDN and edge integrations

Harness Advanced API Protection supports the following CDN and edge integrations:

* AWS CloudFront via Lambda: Node.js, [Traceable Lambda runtime extension](https://developer.harness.io/web-application-and-api-protection-waap-discovery-discovery-discovery-discovery/data-collection/serverless/traceable-lambda-runtime-extension.md), and Python Lambda.
* [Cloudflare Worker](https://developer.harness.io/web-application-and-api-protection-waap-discovery-discovery-discovery-discovery/data-collection/gateways-load-balancers/cloudflare-workers.md)
* [Akamai EdgeWorkers](https://developer.harness.io/web-application-and-api-protection-waap-discovery-discovery-discovery-discovery/data-collection/serverless/akamai-edgeworker.md)

#### Instrumentation methods

Harness Advanced API Protection supports multiple instrumentation methods to accommodate different deployment architectures and ensure effective bot detection and mitigation.

**CDN-based instrumentation:** Deploy instrumentation behind the CDN using edge workers. Ensure that instrumentation covers all CDNs that handle relevant north-south traffic requiring bot detection and protection.

{% hint style="info" %}
If your CDN does not support response capture, instrument another ingress point to capture both requests and responses. Go to [Data collection](https://developer.harness.io/web-application-and-api-protection-waap-discovery-discovery-discovery-discovery/data-collection/data-collection.md) for alternative ingress points and data collection methods.
{% endhint %}

***

## Response capture

**Response capture** involves observing and collecting the HTTP responses your application sends to clients. This capability is important for bot protection because many detection techniques rely not only on analyzing incoming requests (such as headers, IP addresses, and payloads) but also on evaluating the server’s responses: including response codes, content length, and redirect behavior.

Without response visibility, it becomes difficult to fully correlate request and response behaviors, which may lead to incomplete detection or reduced accuracy in identifying sophisticated bot activity.

Some CDNs, due to architectural or policy limitations, do not support full response capture. In such cases, bot detection systems may have limited visibility, making it harder to distinguish between legitimate and automated traffic.

***

## Ingress instrumentation for response capture

When a CDN is used, it often terminates the client connection and forwards only the request to the origin, with limited or no visibility into the actual HTTP response. However, bot\*\* \*\*detection often relies on analyzing both the request and the corresponding response: such as HTTP status codes, redirect behavior, or content length.

Instrumenting other ingress points, such as API gateways and load balancers, or using eBPF or traffic mirroring helps restore this full visibility. These locations operate closer to the origin, where both incoming requests and outgoing responses are accessible.

For example:

* **Gateways and Load Balancers** (for example, NGINX, Apigee, AWS API Gateway) can observe full transaction flows.
* **eBPF** provides low-level visibility into all network traffic, including responses.
* **Traffic mirroring** captures both request and response data passively for analysis.

{% @harness-feedback/feedback %}
