On this page
What this issue is
Cross-site scripting (XSS) means a page treats text as code. In the stored kind, an attacker types something like <script> or <img src=x onerror=...> into a public form field. Your site saves it. Later an employee opens the entries list, the lead in the CRM, or a notification email viewer, and the saved text is rendered as HTML instead of plain text. The script then runs with that employee's permissions.
- Attacker submits formMessage field contains script code
- Site saves entryStored in the database as submitted
- Admin opens entryValue printed as raw HTML
- Script runsActs as the logged-in user
- Account or data takenSession, leads or settings exposed
The break happens when the admin screen prints the saved value without escaping it.
Why it costs you leads or sales
The script runs as your staff member. It can read what they can read, change what they can change, or create a new admin user. That puts your lead database, customer details, form settings and integrations at risk.
The business cost is indirect but large. An attacker can redirect form notifications, insert malicious code on your public pages, or export contacts. Leads can be lost or leaked, ad accounts can be flagged if your pages start serving malware, and you may have to notify customers under data protection rules.
Day 1
A bot submits your contact form with a script in the message field.
Day 1
The entry looks like ordinary spam in the list.
Day 2
A team member opens it while logged in; the script runs silently.
Day 2
A hidden admin user is created or a session token is sent out.
Day 3
You escape output, update the plugin and rotate passwords.
How to check if your site has it
Only test sites you own or have written permission to test. Do it on a staging copy if you can, because a working payload will run in your own browser when you open the entry.
Use a harmless marker payload
Submit a test entry with
<b>xsstest</b>in each text field. Open the entry in the admin. If the text appears in bold instead of showing the tags, output is not escaped.Try an image payload
Submit
<img src=x onerror=alert(document.domain)>. If a popup appears when you open the entry, the flaw is confirmed.Check every place the data shows
Look at the entries list, the single entry view, exports, dashboard widgets, email previews and any CRM or helpdesk that receives the lead.
Run an automated scan
Use a web application security scanner against staging. It will try many payloads and form fields that you would not think to test by hand.
Delete your test entries
Remove the test submissions from the database and from any connected tool afterwards.
How to fix it
The core rule: escape on output. Treat every submitted value as plain text when you display it, whatever was checked when it was saved. Validating input is a useful second layer, but output escaping is what stops the script running.
Update everything
Update WordPress core, your form plugin and any entries or CRM add-ons. Stored XSS in form plugins is often fixed in a patch release. Check the plugin's changelog.
Replace abandoned plugins
If the form plugin no longer gets updates, move to a maintained one.
Escape output in custom code
In your own templates or admin screens, wrap values with
esc_html(),esc_attr()orwp_kses_post()when printing. Sanitise input withsanitize_text_field()orsanitize_textarea_field().Limit who sees entries
Give entry access only to roles that need it under Users and your form plugin's permissions settings.
Use auto-escaping templates
Use a template engine that escapes by default (for example Twig, Blade or Jinja) and avoid raw output options.
Escape for the right context
HTML body, attribute, JavaScript and URL contexts need different encoding. Use your framework's helper, not hand-written replacements.
Never use innerHTML for user data
In admin front-end code, set
textContentinstead ofinnerHTMLwhen showing submitted values.Sanitise rich text with a library
If you must allow HTML, use a maintained sanitiser with an allow-list of tags, such as DOMPurify in the browser or HTML Purifier in PHP.
Check custom code you added
Review any custom HTML, custom values or scripts you placed in workflows, emails or dashboards that print contact fields. Avoid rendering form answers as raw HTML.
Report platform flaws
If a payload runs inside the standard contact view, stop testing and report it to GoHighLevel support, since you cannot patch their code.
Review Velo code
If you use Velo, check pages that read form data and write it to the page. Use text elements'
.textproperty rather than HTML elements or.htmlfor submitted values.Report platform flaws
If the standard form inbox runs a payload, report it to Wix support.
Escape in Liquid
In theme code that prints form or customer input, use the
escapefilter, for example{{ form.body | escape }}.Audit apps
Remove form or review apps you no longer use and keep the rest updated. Report problems in an app to its developer.
<?php
// On save
$message = sanitize_textarea_field( wp_unslash( $_POST['message'] ?? '' ) );
// On output (admin screen or template)
echo '<p>' . esc_html( $message ) . '</p>';const cell = document.querySelector('#entry-message');
// Unsafe: cell.innerHTML = entry.message;
cell.textContent = entry.message; // safe: shown as plain textAdd a Content-Security-Policy to the admin area
A policy that blocks inline scripts and unknown script sources stops many payloads even if one escape is missed. Test in report-only mode first.
Set cookies as HttpOnly
HttpOnly session cookies cannot be read by scripts, which limits what an injected script can steal.
Clean existing entries
Search the entries table for
<script,onerror=andjavascript:. Delete suspicious entries and check for admin users or settings you do not recognise.Rotate credentials if you opened a payload
If a staff member opened a working payload while logged in, reset their password, end all sessions and review recent changes.
add_header Content-Security-Policy-Report-Only "default-src 'self'; script-src 'self'; object-src 'none'; base-uri 'self'" always;Before
- Entry text printed as raw HTML
- A payload runs when staff open the entry
- No policy limiting scripts in the admin
After
- Entry text escaped and shown as plain text
- Payload appears as harmless visible characters
- CSP blocks inline scripts as a backup
How to confirm it's fixed
- Submit
<b>xsstest</b>again and see the literal tags in every place the entry appears - The image payload no longer shows a popup in the list, detail view, export and CRM
- Browser console shows no CSP violations from normal admin use
- No unknown admin users, API keys or form notification addresses exist
- A repeat automated scan reports no XSS findings
How to prevent it happening again
- Turn on automatic updates for form plugins and CMS core where you can
- Remove plugins and apps you do not use
- Escape on output in all custom code and review it in code reviews
- Give staff the lowest role they need, and use 2FA on admin accounts
- Open suspicious entries in a plain-text view or export, not the live admin
- Run a security scan after each major change to forms or the admin
- Add a Content-Security-Policy and keep it in your release checklist
How FunnelGuard handles this
This issue is outside what FunnelGuard checks. FunnelGuard runs your customer journeys with a robot visitor and checks that forms submit, tracking fires and test leads arrive. It does not test whether submitted text is escaped in your admin, and it does not hunt for injection flaws.
The kind of tool that fits is a web application security scanner (dynamic application security testing) run against a staging copy, or a penetration test by a qualified tester. For WordPress, a vulnerability scanner that tracks known plugin flaws also helps. FunnelGuard can still help you confirm that your form keeps working after you change it, since it submits a marked test lead and checks it reaches the inbox and CRM.
Questions people ask
What is stored XSS in a contact form?
Stored XSS is when a form saves script code that an attacker typed in, and your site later shows it as live HTML. The script runs in the browser of whoever opens it, often a logged-in admin. The attacker never needs an account.
Why does a script in my form entry run when I open it in the admin?
The admin screen is printing the saved value as raw HTML instead of plain text. The browser cannot tell your content from the attacker's code. Escaping the value on output, for example with esc_html() in WordPress, fixes it.
How do I test my form for stored XSS safely?
On a site you own, preferably staging, submit <b>xsstest</b> and open the entry. If it shows in bold instead of as visible tags, output is not escaped. Then try an image onerror payload to confirm, and delete your test entries afterwards.
Is sanitising input enough to stop stored XSS?
No. Sanitising on input helps, but the reliable defence is escaping on output for the right context (HTML, attribute, JavaScript or URL). Data can reach the page from imports, APIs and old records that skipped input checks.
Can a CAPTCHA or spam filter prevent stored XSS?
Not reliably. They reduce bot volume, but a human or a bypassing tool can still submit a payload. The fix has to be in how your admin or CRM displays the data.
What should I do if a staff member opened a malicious form entry?
Delete the entry, reset that person's password, end all active sessions and check for new admin users, changed notification emails and unknown plugins or API keys. Then fix the output escaping and update the form tool.
Does a Content-Security-Policy stop stored XSS?
A strict policy that blocks inline scripts can stop many payloads from running, so it is a strong backup. It does not replace escaping output. Use both.
Does FunnelGuard detect XSS in form submissions?
No. FunnelGuard checks that your journeys, tracking and lead delivery work. For XSS, use a web application security scanner or a penetration test.