Back to Blog
Tutorials

Imperva Incapsula: Reese84 Token Generation and Bot Protection Analysis

Complete technical guide to Imperva Incapsula's bot protection, reese84 token generation, utmvc cookie mechanism, Advanced Bot Protection flow, and JavaScript challenge analysis.

Astify Team·2025-01-23·16 min read
#incapsula#imperva#reese84#bot-protection

Imperva Incapsula Overview

Imperva, formerly known as Incapsula, is one of the longest-standing bot protection providers in the industry. Their Advanced Bot Protection (ABP) product protects thousands of websites across retail, financial services, travel, and media sectors. The reese84 token is the centerpiece of their modern client-side verification system, replacing older challenge mechanisms with a more sophisticated fingerprinting and behavioral analysis approach.

For security researchers and analysts, understanding Imperva's protection is essential because of its widespread deployment and the distinctive technical approach it takes to bot detection.

Imperva Protection Architecture

Imperva's bot protection operates as a reverse proxy. All traffic to the protected site passes through Imperva's network, where it is analyzed before being forwarded to the origin server.

Protection Layers

  • Layer 1 - IP Reputation: Known bad IPs, data center ranges, and Tor exit nodes are immediately flagged
  • Layer 2 - HTTP Fingerprint: Request header analysis, TLS fingerprint, protocol behavior
  • Layer 3 - JavaScript Challenge: Client-side script execution and fingerprint collection
  • Layer 4 - Advanced Bot Protection: Behavioral analysis and reese84 token validation
  • Layer 5 - CAPTCHA Challenge: Interactive verification for suspicious clients

Challenge Script Delivery

1// Imperva challenge scripts are typically served from:
2// /_Incapsula_Resource?SWJIYLWA=...
3// /_Incapsula_Resource?SWHANEDL=...
4
5// The reese84 challenge endpoint:
6// /XX-XXXXXXXXXXXX-XXXXXXXXXXXXX/_challenge
7
8// Modern deployments may also use:
9// /reese84_challenge_page
10// /reese84/

The Reese84 Token System

The reese84 token is Imperva's modern client-side verification mechanism. Named after an internal project identifier, it has become the standard token format for Imperva's Advanced Bot Protection.

Token Generation Flow

1// Deobfuscated reese84 token generation flow:
2
3// 1. Challenge script loads and initializes
4var collector = initializeCollector();
5
6// 2. Browser fingerprint collected
7var fingerprint = collector.getFingerprint();
8
9// 3. Behavioral signals gathered
10var behavior = collector.getBehaviorSignals();
11
12// 4. Environment validation
13var envCheck = collector.validateEnvironment();
14
15// 5. Payload assembly and encoding
16var payload = {
17  fingerprint: fingerprint,
18  behavior: behavior,
19  environment: envCheck,
20  timestamp: Date.now(),
21  scriptVersion: SCRIPT_VERSION
22};
23
24// 6. POST to challenge endpoint
25fetch('/_challenge', {
26  method: 'POST',
27  headers: {
28    'Content-Type': 'application/json'
29  },
30  body: JSON.stringify({
31    solution: encodePayload(payload)
32  })
33}).then(function(response) {
34  // 7. Server validates and returns token
35  // Token is set as reese84 cookie
36});

Token Structure

The reese84 token is a long encoded string containing:

  • Session identifier: Links the token to a server-side session record
  • Fingerprint digest: A hash of the collected browser fingerprint
  • Validation timestamp: When the token was issued (for expiry checking)
  • Risk score: The server's assessment of the client's legitimacy
  • Integrity signature: Cryptographic signature preventing token modification

The utmvc cookie is Imperva's session tracking mechanism that works alongside the reese84 token.

1// The utmvc cookie is set during the challenge flow:
2// Set-Cookie: ___utmvc=ENCODED_VALUE; path=/;
3//   Max-Age=900; secure; HttpOnly
4
5// Cookie value contains:
6// - Encoded session fingerprint
7// - Challenge completion state
8// - Visit counter
9// - Timestamp information
10
11// The triple underscore prefix (___) is characteristic
12// of Imperva cookies

Other Imperva Cookies

  • visid_incap_XXXXXX: Visitor identification cookie with site-specific suffix
  • incap_ses_XXX_XXXXXX: Session cookie with encoded session data
  • nlbi_XXXXXX: Load balancing cookie for Imperva's infrastructure
  • reese84: The modern challenge token cookie

JavaScript Challenge Mechanism

Stage 1: Initial Script Injection

1// When a new visitor arrives, Imperva injects
2// a challenge script containing:
3
4// 1. String array with encoded values
5var _0x5abc = ['charAt', 'length', 'join',
6  'fromCharCode', 'createElement'];
7
8// 2. Browser capability detection
9function detectCapabilities() {
10  return {
11    cookiesEnabled: navigator.cookieEnabled,
12    platform: navigator.platform,
13    plugins: getPluginList(),
14    mimeTypes: getMimeTypes(),
15    doNotTrack: navigator.doNotTrack,
16    timezone: Intl.DateTimeFormat()
17      .resolvedOptions().timeZone
18  };
19}
20
21// 3. Math-based challenge computation
22function computeChallenge(seed) {
23  var result = seed;
24  for (var i = 0; i < 100; i++) {
25    result = (result * 1103515245 + 12345)
26      & 0x7FFFFFFF;
27  }
28  return result;
29}

Stage 2: Fingerprint Collection

1// Deobfuscated Imperva fingerprint collection
2function collectFingerprint() {
3  var fp = {};
4
5  // Screen and display
6  fp.sr = screen.width + 'x' + screen.height;
7  fp.avr = screen.availWidth + 'x'
8    + screen.availHeight;
9  fp.cd = screen.colorDepth;
10  fp.dpr = window.devicePixelRatio;
11
12  // Browser window
13  fp.iw = window.innerWidth;
14  fp.ih = window.innerHeight;
15  fp.ow = window.outerWidth;
16  fp.oh = window.outerHeight;
17
18  // Navigator
19  fp.ua = navigator.userAgent;
20  fp.lang = navigator.language;
21  fp.langs = navigator.languages
22    ? navigator.languages.join(',')
23    : '';
24  fp.plat = navigator.platform;
25  fp.hc = navigator.hardwareConcurrency;
26  fp.dm = navigator.deviceMemory;
27  fp.mtp = navigator.maxTouchPoints;
28
29  // Canvas fingerprint
30  fp.cvs = computeCanvasFingerprint();
31
32  // WebGL
33  fp.wgl = computeWebGLFingerprint();
34
35  // Audio
36  fp.aud = computeAudioFingerprint();
37
38  // Fonts
39  fp.fonts = detectInstalledFonts();
40
41  // Storage
42  fp.ss = !!window.sessionStorage;
43  fp.ls = !!window.localStorage;
44  fp.idb = !!window.indexedDB;
45
46  // Timezone
47  fp.tz = new Date().getTimezoneOffset();
48  fp.tzName = Intl.DateTimeFormat()
49    .resolvedOptions().timeZone;
50
51  return fp;
52}

Stage 3: Behavioral Signal Collection

1// Imperva behavioral tracking
2var behaviorSignals = {
3  mouseEvents: [],
4  keyEvents: [],
5  scrollPositions: [],
6
7  startTracking: function() {
8    var self = this;
9
10    document.addEventListener('mousemove', function(e) {
11      if (self.mouseEvents.length < 100) {
12        self.mouseEvents.push({
13          x: e.clientX,
14          y: e.clientY,
15          t: Date.now()
16        });
17      }
18    });
19
20    document.addEventListener('keydown', function(e) {
21      self.keyEvents.push({
22        k: e.keyCode,
23        t: Date.now(),
24        d: 1
25      });
26    });
27
28    document.addEventListener('keyup', function(e) {
29      self.keyEvents.push({
30        k: e.keyCode,
31        t: Date.now(),
32        d: 0
33      });
34    });
35
36    window.addEventListener('scroll', function() {
37      self.scrollPositions.push({
38        x: window.scrollX,
39        y: window.scrollY,
40        t: Date.now()
41      });
42    });
43  }
44};

Obfuscation Techniques

Character Code Construction

1// Imperva heavily uses String.fromCharCode
2// to construct strings dynamically:
3
4var _0x1 = String.fromCharCode(
5  99, 97, 110, 118, 97, 115
6);
7// Resolves to: 'canvas'
8
9var _0x2 = String.fromCharCode(
10  103, 101, 116, 67, 111, 110,
11  116, 101, 120, 116
12);
13// Resolves to: 'getContext'
14
15// Used in context:
16var c = document.createElement(_0x1);
17var ctx = c[_0x2]('2d');

Array-Based String Lookup

1// Similar to obfuscator.io pattern:
2var strings = [
3  'createElement', 'getContext', 'toDataURL',
4  'fillText', 'fillStyle', 'font', 'fillRect'
5];
6
7function getStr(index) {
8  return strings[index];
9}
10
11// Usage:
12document[getStr(0)]('canvas');
13ctx[getStr(3)]('test', 10, 20);

Anti-Analysis Techniques

1// Imperva's anti-analysis measures:
2
3// 1. Console method overwriting
4window.console = {
5  log: function() {},
6  warn: function() {},
7  error: function() {},
8  debug: function() {}
9};
10
11// 2. Debugger timing detection
12var timingCheck = setInterval(function() {
13  var start = performance.now();
14  for (var i = 0; i < 100; i++) {
15    Math.random();
16  }
17  var elapsed = performance.now() - start;
18  if (elapsed > 50) {
19    signals.debuggerSuspected = true;
20  }
21}, 1000);
22
23// 3. Stack trace validation
24function validateCallStack() {
25  try {
26    undefined.property;
27  } catch (e) {
28    var stack = e.stack || '';
29    if (stack.indexOf('Proxy') !== -1 ||
30        stack.indexOf('intercept') !== -1) {
31      return false;
32    }
33    return true;
34  }
35}

Advanced Bot Protection Flow

Imperva's Advanced Bot Protection (ABP) complete flow:

  1. First request: Imperva's reverse proxy intercepts and responds with the challenge page
  2. Challenge execution: The browser executes the challenge JavaScript, collecting fingerprint and behavioral data
  3. Token request: Collected data is POSTed to the challenge endpoint
  4. Server evaluation: Imperva's servers analyze the data using ML models
  5. Token issuance: A reese84 token is returned and set as a cookie
  6. Protected requests: Subsequent requests include the reese84 cookie
  7. Continuous validation: The token is re-evaluated on each request, and periodic re-challenges may occur

Real Sites Using Imperva

Retail

  • Major retail chains: E-commerce sites protecting checkout flows and inventory data
  • Luxury brands: Product launch protection and price scraping prevention

Financial Services

  • Banking institutions: Login protection, transaction security, and account management
  • Investment platforms: API abuse prevention and data scraping protection

Travel

  • Airlines: Fare search protection and booking flow security
  • Hotel chains: Rate scraping prevention and reservation protection

Media and Entertainment

  • Streaming services: Account creation and credential stuffing prevention
  • Gaming platforms: Bot prevention for in-game economies

Analysis with Astify

Step 1: Identify Imperva Protection

Look for the characteristic markers: ___utmvc cookies, visid_incap_ cookies, incap_ses_ cookies, or requests to /_Incapsula_Resource endpoints. The reese84 endpoint typically contains a long alphanumeric path segment.

Step 2: Capture Challenge Scripts

The main challenge script is embedded in the response when Imperva serves its challenge page. Use the browser's DevTools to capture the full page response, then extract the inline JavaScript.

Step 3: Deobfuscate with Astify

Upload the extracted challenge script to Astify. The AI engine handles the String.fromCharCode resolution, array-based string lookups, and control flow restoration. The multi-round processing is particularly effective for Imperva's layered obfuscation.

Step 4: Map the Token Generation

Trace the deobfuscated code to understand how fingerprint data is collected, encoded, and submitted to generate the reese84 token. Document the challenge endpoint URL pattern and the expected request/response format.

Step 5: Identify Detection Signals

Catalog all detection signals in the deobfuscated code: fingerprinting methods, automation checks, behavioral analysis hooks, and integrity validation routines.

Imperva's cookie validation system is more complex than a simple token check. The server correlates multiple cookie values to build a session profile:

The visid_incap cookie provides visitor identification, the incap_ses cookie tracks the current session, and the reese84 token provides the challenge validation state. All three must be consistent for a request to be classified as legitimate. If any cookie is missing, stale, or inconsistent with the others, the server may trigger a re-challenge.

Token Refresh Mechanism

1// The reese84 token has a limited lifetime
2// The client-side script handles automatic refresh:
3
4var tokenRefreshInterval = setInterval(function() {
5  var tokenAge = Date.now() - tokenIssuedAt;
6  if (tokenAge > TOKEN_MAX_AGE * 0.8) {
7    // Refresh before expiry
8    refreshToken();
9  }
10}, CHECK_INTERVAL);
11
12function refreshToken() {
13  // Re-collect fingerprint and behavioral data
14  var freshData = collector.getCurrentState();
15  // Submit to challenge endpoint
16  submitChallenge(freshData).then(function(newToken) {
17    // Update cookie with new token
18    document.cookie = 'reese84=' + newToken
19      + '; path=/; secure; SameSite=None';
20    tokenIssuedAt = Date.now();
21  });
22}

Evolution of Imperva's Protection

Imperva's bot protection has evolved significantly over the years. Understanding this evolution helps analysts recognize which generation of protection they are analyzing:

Generation 1: Basic JavaScript Challenges

Early Incapsula protection used simple JavaScript computation challenges -- mathematical operations that required JavaScript execution capability. These were easy to solve programmatically.

The second generation introduced the utmvc cookie system with browser fingerprinting. The fingerprint was relatively simple, covering basic navigator and screen properties.

Generation 3: Reese84 Token System

The current generation uses the reese84 token with comprehensive fingerprinting, behavioral signals, and machine learning evaluation. This generation is significantly more difficult to analyze and represents state-of-the-art protection.

Detecting Imperva in the Wild

Security researchers can quickly identify Imperva-protected sites through several indicators:

  • Response headers: X-CDN: Imperva, or X-Iinfo headers containing Imperva-specific values
  • Cookie names: The visid_incap_, incap_ses_, ___utmvc, and reese84 cookie names are unique to Imperva
  • Challenge page: The challenge page typically contains references to /_Incapsula_Resource with specific query parameters
  • Error page styling: Imperva's block pages have a distinctive look with a reference number format
  • DNS records: Protected sites often have their DNS pointing to Imperva's IP ranges

Comparison with Other Solutions

  • vs. Cloudflare: Imperva operates as a reverse proxy like Cloudflare, but Imperva's reese84 system collects more detailed behavioral data. Cloudflare's challenge is typically faster to complete.
  • vs. PerimeterX: PerimeterX focuses exclusively on bot detection, while Imperva offers it as part of a broader WAF and DDoS protection suite. PerimeterX's behavioral biometrics are generally more sophisticated.

Conclusion

Imperva Incapsula's reese84-based bot protection represents a mature and widely-deployed defense system. Its evolution from simple JavaScript challenges to the current ML-powered token system demonstrates the ongoing arms race between bot protection and bot development. The combination of server-side traffic analysis, client-side fingerprinting, behavioral signals, and the reese84 token mechanism creates a comprehensive protection layer. For security researchers, analyzing Imperva's scripts through deobfuscation with Astify provides insights into established bot detection practices, their evolution over time, and the current state of enterprise-grade web security.

Try Astify Today

Experience AI-powered JavaScript deobfuscation in seconds

Start Deobfuscating