title: Bypass XMLHttpRequest overriding
body: <p>I want to make hcaptcha solver Chrome extension. I am successfully using some api to solve captchas, find <code>data-sitekey</code> and another params.</p>
  <p>But exactly on <a href="https://dashboard.hcaptcha.com/signup" rel="nofollow noreferrer">Hcaptcha's site</a> there is a block that I currently can't bypass.</p>
  <p>It overrides (with obfuscation) <code>XMLHttpRequest</code> and, in particular, <code>send</code> method allowing requests only to some domains, and I, obviously need to send request to custom domain, so when I try to do that, it throws an exception.</p>
  <p><strong>My try</strong></p>
  <p>In extension I have two files - <code>content.js</code> and <code>inject.js</code>.</p>
  <p><code>content.js</code> just injecting <code>inject.js</code> <em>before</em> page loads:</p>
  <pre><code>function injectScript() {
  var s = document.createElement('script');
  s.setAttribute(&quot;charset&quot;, &quot;UTF-8&quot;);
  s.src = chrome.runtime.getURL('inject.js');
  s.onload = function() {
      //this.remove();
  };
  (document.head || document.documentElement).prepend(s);
  }
  injectScript();
  </code></pre>
  <p>In <code>inject.js</code> there is an <code>interval</code> that tries to find and parse captcha's data need to solve it, and after parse send to solver server via Ajax request.</p>
  <p>I tried different methods, adding at the beginning of <code>inject.js</code>:</p>
  <ol>
  <li>Variable that contains yet indeed original <code>XMLHttpRequest</code> - <code>var dihdkn278dm = XMLHttpRequest</code> and then creating not <code>XMLHttpRequest</code> but <code>dihdkn278dm</code> object;</li>
  <li>Variable that contains yet indeed original <code>XMLHttpRequest</code> object - <code>var dihdkn278dm = new XMLHttpRequest()</code> and then instead of creating request object use it;</li>
  <li>Variable that contains <code>XMLHttpRequest</code> <code>send</code> function (yes just <code>native code</code>).</li>
  </ol>
  <p>However, when it comes to call <code>send</code> in the code, it is already overwritten.</p>
  <p>Ideas how to bypass it? Only inspect obfuscated code?</p>
  <p>*<code>fetch</code> also overridden</p>