Developers Build 5KB Pure-JavaScript Headless Browser to Bypass DuckDuckGo AI Chat Anti-Bot System

A detailed technical analysis reveals how a minimal 5,408-byte obfuscated JavaScript payload delivered via the x-vqd-hash-1 HTTP header can be executed inside a fully synthetic browser environment written in pure JavaScript. The implementation replicates enough of the Chrome DOM, HTML5 parser, V8 engine fingerprints, and iframe behavior to solve DuckDuckGo’s rotating anti-bot challenges without using any real browser engine. The resulting Telegram bot, called headless-duckapi, streams responses from multiple free models including GPT-6-luna, Claude-haiku-4-5, and Mistral-small-2603 while also supporting image generation and vision tasks. Four distinct challenge variants were deobfuscated, exposing checks that range from native-code string detection and subclassed Array behavior to precise HTML5 parsing of malformed markup. The entire solution runs in serverless isolates with no external dependencies, maintaining a solved challenge token across restarts via SQLite.

HabrTranslated from Russian

Read at source

A team of developers has constructed a fully functional headless browser using only 5,408 bytes of obfuscated JavaScript to defeat DuckDuckGo’s anti-bot protection on its free AI chat service duck.ai.

The project began after repeated 500 errors containing the message “no x-vqd-hash-1 token” appeared while building a Telegram proxy bot. The researchers reverse-engineered four rotating challenge variants delivered inside the x-vqd-hash-1 response header, each containing heavily obfuscated JavaScript that must be executed to produce a valid proof-of-browser token.

Challenge Mechanics

Upon receiving the challenge, the synthetic browser performs environment checks that include:

  • Verification that native functions contain the string “[native code]”
  • Subclassing behavior of Array objects under V8
  • Correct normalization of malformed HTML5 markup such as “<p><div></p><p></div”
  • iframe contentWindow properties and prototype chain integrity for HTMLDivElement, HTMLElement, and Element

Results are combined with a fabricated stack trace and execution duration metadata, then hashed with a pure-JavaScript SHA-256 implementation before being returned in the same header.

Telegram Bot Capabilities

The resulting serverless Telegram bot supports ten live models, progressive message editing for streaming responses, automatic image generation via the GenerateImage tool, and JPEG-to-PNG conversion for vision requests—all without any external libraries. A dedicated SQLite table persists solved challenge tokens across function invocations.

The authors note that the entire client, including a custom HTML5 parser and DOM mannequin, fits comfortably inside a single 950-line JavaScript file that runs identically in Node.js and lightweight serverless isolates.

Meridian digestThe week's most consequential security stories, distilled into one briefing.See the digest

More in AI Security

Logical Argument Claims Full Alignment of Superintelligent AGI Is Fundamentally Impossible
Claude Account Bans Linked to IP Reputation, Device Environment and Payment Channels, But No Confirmed Formula
Local LLMs in AppSec: What Open Tools and Models Can Handle in Application Security