Squarespace is a hosted website builder. Squarespace runs and patches the platform, so you have no server files or plugins to clean. Code that does not belong on your site usually arrives through something you control: a contributor account, a pasted snippet, an embed, or a connected service. That makes the search smaller than it is on a self-managed CMS, but you need to know exactly where to look.
Why hosting changes the cleanup
On a self-hosted CMS you scan the file system and compare files against a clean copy. A standard Squarespace site has no file system that you can reach, so there is nothing to scan that way. Cleanup means reviewing every place where your account lets you add custom code or content.
One exception is a site that uses Squarespace’s developer tooling, often called Developer Mode. Those sites keep template files in a Git repository, so you can compare files and review history like any other codebase. If your site works this way, use that history as your source of truth. Availability depends on your plan and setup, so check the Squarespace help center to see what applies to you.
For every other site, the places that can hold injected code are limited and all live in the site’s settings and editor.
Where injected code can hide
Work through these locations in order. Each one can run JavaScript or add hidden links on every page or on a single page.
- Code Injection (site-wide). Under Settings, in the Developer Tools area, the Header and Footer fields run on every page. Squarespace also offers fields for the order confirmation and lock page, so check all of them.
- Page-level code injection. Individual pages have their own advanced settings with a header code field. A single odd page can redirect visitors while the rest of the site looks normal.
- Code blocks and Embed blocks. These can hold scripts, iframes or hidden links inside a page body. Check blog posts, footers and rarely visited pages, as well as the pages in your main navigation.
- Custom CSS. CSS cannot run scripts, but it can hide content from you, position links off-screen, or restyle elements so a fake form looks real.
- Connected accounts and extensions. Third-party tools you have linked can add tracking or scripts to your pages. Check what is connected and whether you still use it.
- Header and footer content. Text links in the footer or site-wide content areas sometimes carry spam links that blend into the design.
How to inspect your pages
Start with the code you can see in the settings, then confirm what visitors actually receive.
- Open each Code Injection field and read it line by line. Note every script tag, every external domain, and any long strings of unreadable characters.
- Compare what you find with your own records. If you cannot say who added a snippet and why, treat it as suspect.
- Open your live site in a private browser window and view the page source. Search for the word script, for iframe, and for domains you do not recognise.
- Use your browser’s developer tools and open the Network tab. Reload the page and look at which outside domains are contacted. A request to an unfamiliar domain tells you something is loading that you may not have added.
- Test redirects on a phone as well as a desktop, and arrive from a search result rather than by typing the address. Some injected redirects only trigger for certain visitors.
For a reference on how browsers treat scripts and what a content security policy does, the MDN guide to Content Security Policy is a useful read. Note that on a hosted builder you may not be able to set your own response headers.
Removing what you find
Work in a deliberate order so the problem does not come back while you clean.
- Secure access first. If an attacker still has a login, they can re-add the code as fast as you remove it. Change your password and review contributors before editing anything else.
- Save a copy. Copy any suspicious snippet into a text file before deleting it. You may need it to work out how it got there. Do not paste it back into any live page.
- Delete the unexplained code. Remove the snippet from the field, block or page. If a legitimate tool needs part of a field, such as an analytics tag, put back only that vendor’s official snippet, copied from the vendor’s own site.
- Remove hidden links and embeds. Delete the offending Code or Embed block rather than editing around it.
- Disconnect what you do not use. Remove any extension or connected service you cannot account for.
- Re-test. Reload the page source and the Network tab, and try the redirect test again on a phone.
If a page is still behaving strangely after this, contact Squarespace support through the Squarespace help center. Support can look at account-level issues you cannot see from the editor.
Credential rotation and access review
Injected code on a hosted builder almost always means someone had access. Treat the account as exposed until you have checked it.
- Change your Squarespace password to a long, unique one that you do not use anywhere else.
- Turn on two-factor authentication for your own login and ask every contributor to do the same.
- Review the list of contributors under the site’s permissions. Remove anyone who has left, and downgrade anyone who does not need full access.
- Change the passwords on the email account tied to your Squarespace login and on your domain registrar. An attacker who controls your email can reset everything else.
- Revoke access for connected services you no longer use and re-authorise the ones you keep.
- Check your domain’s DNS records for entries you did not create.
Preventing it from happening again
Most prevention is about reducing the number of places code can enter and noticing changes early.
- Limit who can add code. Give contributors the lowest permission level that lets them do their work.
- Keep a code register. Write down each snippet in Code Injection, who added it, what it does, and where it came from. A short document is enough, and it turns an unexplained script into something you can spot instantly.
- Use official snippets only. Copy tracking and widget code from the vendor’s own documentation, never from a forum post or a message sent to you.
- Prefer built-in features. If Squarespace has a native option for what you want, use it instead of pasting custom code.
- Review on a schedule. Open every Code Injection field and skim your Code and Embed blocks regularly, and always after a contributor changes.
- Be wary of phishing. Messages claiming your account is suspended and asking you to log in through a link are a common way credentials get stolen. Go to the site directly instead.
The OWASP site has general guidance on web application security if you want to understand how injected scripts work in more depth.
Frequently asked questions
Can I scan a Squarespace site for malware the way I would a WordPress site?
Not at the file level, because you do not have server or plugin access. You can review every area where custom code is allowed and inspect the page source and network requests of the live site. Developer Mode sites can also compare template files in Git.
Does injected code mean Squarespace itself was breached?
Not necessarily. In most cases the code arrived through a compromised login, a contributor account, a pasted snippet or a connected service. Check those first, and contact Squarespace support if you cannot find the source.
How do I know the cleanup worked?
Reload the live page source and look for the script or link you removed. Check the Network tab for unfamiliar domains and repeat the redirect test on a phone. Then watch the site for a few days, since an attacker with a lingering login may re-add code.