How to fix: reCAPTCHA site key exposure
A Google reCAPTCHA site key was found in the page source. reCAPTCHA site keys are intentionally public (they must be embedded in the browser to work), but their exposure is worth noting for rotation policy awareness.
Why it matters
reCAPTCHA site keys are not secret by design and do not grant API access. However, a disclosed site key can be used by third parties to load reCAPTCHA widgets on their own pages under your property, potentially consuming your quota or generating noise in your reCAPTCHA dashboard. Secret keys (used server-side for token verification) are the sensitive component and must never appear in client-side code.
Google reCAPTCHA uses a two-key system: the site key (public, embedded in HTML) and the secret key (server-side, used to verify tokens). Only the site key is expected to appear in browser-visible source. This finding is informational unless the secret key is also exposed.
How to fix it
- 1Confirm only the site key (6L...) is embedded in client-side code, never the secret key.
- 2Rotate site keys if you suspect abuse (e.g., spam or unusual reCAPTCHA token requests).
- 3Store secret keys in environment variables on the server side only.
- 4Monitor reCAPTCHA analytics for unusual traffic patterns that might indicate key abuse.
Code examples
Safe usage (site key in frontend, secret key server-side only)
// Frontend (public: site key is intentionally visible)
grecaptcha.ready(() => {
grecaptcha.execute(process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY, { action: 'submit' })
.then(token => { /* send token to server */ });
});
// Server-side (secret key must NEVER reach the browser)
const response = await fetch('https://www.google.com/recaptcha/api/siteverify', {
method: 'POST',
body: new URLSearchParams({
secret: process.env.RECAPTCHA_SECRET_KEY, // env var, not NEXT_PUBLIC_
response: tokenFromClient,
}),
});References
Detected automatically by VulnRadar. The check id is recaptcha-key-leaked, stable across every scan so you can filter or diff on it.
More info disclosure checks
- MediumRails Session Cookie Missing HttpOnly Flag
- InfoServer header truncated
- InfoPHP session cookie naming exposes runtime
- Infoconfig.js / settings.js referenced (verify contents)
- Infoenv.js / environment.js referenced (verify contents)
- InfoSitemap.xml publicly accessible
- InfoOpenAPI schema version exposed in URL
- LowCORS exposes internal CDN hostname
Questions
- How severe is reCAPTCHA site key exposure?
- VulnRadar rates this info severity in the info disclosure category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id recaptcha-key-leaked, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does reCAPTCHA site key exposure map to?
- It maps to CWE-200. In the OWASP Top 10 it falls under A05:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.