Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Abandoned script domain re-registered by an attacker: fix

OPS-198High impactCould addBy FunnelGuardPublished Updated
On this page

What this issue is

Your pages load JavaScript from other domains: old analytics, a retired widget, a dropped A/B testing tool, a CDN link from a past redesign. If the owner of that domain stops paying, the domain expires and anyone can buy it. The new owner controls what the old URL returns.

Your page still contains <script src="https://old-tool.example/widget.js">. Browsers run whatever that URL returns, with the same rights as your own code. This is a supply chain attack: the weak link is not your server but a forgotten dependency.

Why it costs you leads or sales

The attacker's code can quietly copy form submissions, swap your phone number or payment link, redirect mobile visitors to scam pages, or show fake pop-ups. You may see conversions fall with no error on your side. Browsers and Google Safe Browsing can also flag your site as unsafe, which scares off visitors and ad platforms.

There are also legal costs. If personal data or card details leak through a script you chose to load, you may have to report a breach and answer to customers.

How a forgotten script becomes an attack
  1. Old script tag staysLeft in the theme or tag manager
  2. Vendor domain expiresNobody notices
  3. Attacker registers itServes malicious JS
  4. Visitor loads your pageScript runs with full access
  5. Lead or payment divertedData copied or redirected

The break happens outside your site, so nothing looks wrong in your own code.

How to check if your site has it

Find script domains that may be abandoned
  1. List every external script domain

    Open your key pages (home, landing pages, checkout, thank-you) in Chrome, open DevTools, go to the Network tab, filter by JS and reload. Note every domain that is not yours. Also check the Sources tab, which groups files by domain.

  2. Search your source code too

    Scripts that only load on some pages or after consent may not show up at first. View the page source, your theme files and the tag manager containers, and search for src= and https://.

  3. Check each domain's status

    Look each domain up with a WHOIS or RDAP lookup tool. Note the registrar, creation date and expiry date. A creation date that is very recent for a tool you have used for years is a red flag.

  4. Test whether the URL still works

    Open the script URL in a browser tab. A 404 or a DNS error means the tool is probably dead. Content you do not recognise, or code that looks scrambled, is a warning sign.

  5. Match each script to a purpose

    Ask who added it and why. If nobody can say, treat it as a candidate for removal.

How to fix it

Decide for each risky domain: remove it, replace it, or self-host a reviewed copy. If you suspect an attacker already controls it, remove it first and investigate afterwards.

Remove the abandoned script
  1. Find where it is added

    Search theme files (header.php, footer.php, functions.php) and plugin settings for the domain. Check Appearance > Theme File Editor and any header/footer injection plugin.

  2. Remove or deactivate

    Delete the tag, or deactivate the plugin that adds it. Clear caching plugins and any CDN cache.

Harden against the next one
  1. Self-host critical scripts

    For libraries you must keep, host a reviewed copy yourself so a domain change cannot alter it.

  2. Add Subresource Integrity where possible

    For fixed, versioned files, add an integrity hash so the browser refuses a changed file. It does not work for scripts that change often.

  3. Set a Content Security Policy

    Allow scripts only from domains you list. Start in report-only mode to see what breaks.

  4. Replace dead vendors

    If the tool is still needed, switch to its current supplier and update the tag.

Subresource Integrity on a fixed, versioned filehtml
<script src="https://cdn.example.com/lib/1.2.3/lib.min.js"
        integrity="sha384-REPLACE_WITH_REAL_HASH"
        crossorigin="anonymous"></script>
Content Security Policy header (start with report-only)text
Content-Security-Policy-Report-Only: script-src 'self' https://www.googletagmanager.com https://www.google-analytics.com; report-uri /csp-report
Script setup before and after

Before

  • Old tags from past tools still in the theme
  • No one knows who owns each domain
  • Any domain can serve code to visitors

After

  • Only needed scripts remain
  • Critical files self-hosted or integrity-pinned
  • CSP limits scripts to a short allowlist

How to confirm it's fixed

Confirmation checklist
  • Reload key pages with DevTools Network open and confirm the old domain no longer appears
  • Search the page source and tag manager for the domain: no results
  • Check the live site in a private window after clearing caches
  • Confirm forms, checkout and tracking still work
  • Review CSP reports for blocked or unexpected domains

How to prevent it happening again

Ongoing habits
  • Keep a script inventory with owner, purpose and domain for each external script
  • Remove the tag the same day you cancel a tool
  • Review the inventory every quarter, including WHOIS expiry dates
  • Limit who can add custom code or edit the tag manager
  • Keep a CSP in place and review its reports
  • Prefer self-hosting or pinned versions for anything on checkout and form pages
Example: how it can unfold
  1. Year 1

    You add a small widget script from a vendor's domain.

  2. Year 3

    The vendor closes and the domain expires. The tag stays on your site.

  3. Year 3, later

    Someone registers the domain and serves new code.

  4. After audit

    You find the dead domain, remove the tag and add a CSP.

How FunnelGuard handles this

FunnelGuard does not check for this yet. Spotting an abandoned script domain that has been re-registered is a possible future check, not a current feature.

What FunnelGuard does today is run your real customer journeys (lead forms, checkouts, booking and chat buttons) on a schedule from the EU or the US. It checks each step, the tracking hits sent to ad and analytics platforms, and whether test leads reach your inbox and CRM. If a hijacked script breaks a form step or stops a tracking hit, that failure can show up as a broken journey, but it is not a check for the script itself.

To watch for this yourself, keep a script inventory, run a quarterly review of external domains with WHOIS or RDAP lookups, use a Content Security Policy in report-only mode to see unexpected sources, and use a free website security scanner or your browser DevTools to list third-party requests.

Questions people ask

What happens if a script domain I use expires?

Anyone can register it and serve their own JavaScript from the old URL. Your pages would then run that code for every visitor that loads the script, with the same access as your own code.

How do I find out which third-party scripts my website loads?

Open your page in Chrome, press F12, go to the Network tab, filter by JS and reload. Note every domain that is not yours. Also search your theme files and tag manager containers for src= and external URLs.

How can I tell if a script domain has been taken over?

Look up the domain with a WHOIS or RDAP tool and check the creation date and registrar. A new registration for a long-standing tool is a warning sign. Also open the script URL and check whether it returns unexpected or scrambled code.

Does Subresource Integrity stop a hijacked script?

Yes, for fixed files. The browser compares the file to the hash you set and refuses to run it if it differs. It does not suit scripts that change often, as the hash would break.

How do I stop old scripts from running on my site?

Remove the script tag from your theme, plugins or tag manager, then clear caches. Add a Content Security Policy that lists only the domains you trust, so forgotten sources are blocked.

Can FunnelGuard detect an abandoned script domain being re-registered?

No, FunnelGuard does not check for this yet. It does run your real journeys and check steps, tracking hits and lead delivery, which can reveal a broken form or tracking, but not the script domain change itself.

Why is my site flagged as unsafe by the browser?

One cause is a third-party script serving malware or redirects. Check the external scripts on the flagged pages, remove any you do not recognise and review the Security issues report in Google Search Console.

Does FunnelGuard catch this?

Could add

Not checked yet: could be added to FunnelGuard.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.