What does Google say about SEO? /
Quick SEO Quiz

Test your SEO knowledge in 5 questions

Less than a minute. Find out how much you really know about Google search.

🕒 ~1 min 🎯 5 questions

Official statement

Injection of malicious code can include iFrames leading to attack sites, JavaScript scripts executed from attack sites, or redirects to attack sites. Look for complex constructions like 'iFrame', 'eval', and 'unescape' to identify this type of malware.
1:04
🎥 Source video

Extracted from a Google Search Central video

⏱ 1:35 💬 EN 📅 12/03/2013 ✂ 3 statements
Watch on YouTube (1:04) →
Other statements from this video 2
  1. Comment détecter une injection de code et limiter les dégâts sur votre site infecté ?
  2. 1:35 Pourquoi nettoyer un site hacké ne suffit-il jamais à le sécuriser durablement ?
📅
Official statement from (13 years ago)
TL;DR

Google identifies three main types of malicious injections: hidden iFrames, external JavaScript scripts, and forced redirects. These attacks undermine your SEO by diverting your visitors or blacklisting you in Search Console. Detection involves looking for complex JavaScript constructions like 'eval', 'unescape', and 'iFrame' in your source code.

What you need to understand

Why do these injections often go unnoticed?

The injected malicious code usually hides in under-checked areas of the site: outdated templates, unmaintained WordPress plugins, minified JavaScript files. Hackers use obfuscation techniques to make the code unreadable at first glance.

Invisible iFrames are particularly dangerous because they load external content without your knowledge. They can point to phishing sites, link farms, or pages stuffed with malware. Google detects them via its Safe Browsing and can blacklist your domain within hours.

What makes 'eval', 'unescape', and 'iFrame' so suspicious?

These three JavaScript constructions are legitimate in certain contexts, but they become indicators when they appear together or in obfuscated forms. 'eval()' executes code on-the-fly, allowing anything to be injected without leaving an obvious trace in the source file.

'unescape()' decodes encoded strings, often used to mask URLs or malicious scripts. When you see 'eval(unescape(...))' in your code, it's an immediate red flag. Hackers stack these functions to complicate detection by automated scanners.

What are the direct SEO consequences of these injections?

Google detects these intrusions via its Safe Browsing system and displays a red warning in search results. Your traffic can drop by 95% within 24 hours. Search Console sends you a notification, but sometimes too late: the damage is done.

Malicious redirects are particularly insidious: they redirect only certain visitors (geolocation, mobile user-agent) to evade detection. You test your site from your office, everything seems normal, but your mobile users end up on pharmaceutical spam sites.

  • Loss of user trust: Your visitors see security warnings before accessing your site.
  • Drastic drop in organic traffic: Google de-indexes or penalizes infected pages.
  • Entire domain blacklisting: In severe cases, Google marks the entire domain as dangerous.
  • Impact on crawl budget: Google bots avoid flagged sites, reducing crawl frequency.
  • Long recovery time: Even after cleaning, a manual review request is needed, which can take several weeks.

SEO Expert opinion

Does this statement cover all forms of modern injection?

Let's be honest: Google focuses on classic attack vectors (iFrames, eval, unescape) but overlooks more recent techniques. Injections via WebAssembly, hijacked Service Workers, or attacks via JavaScript prototype pollution are not mentioned. [To be verified] if Google effectively detects these emerging threats.

In the field, an increasing number of injections never touch HTML or frontend JavaScript: they directly alter cached server responses (Varnish, Cloudflare) or inject content via manipulated HTTP headers. These attacks completely evade basic source code searches.

Are the recommended detection tools really reliable?

Manually searching for 'eval', 'unescape', and 'iFrame' in your code is a good start, but it's far from sufficient. Hackers use base64 encodings, invisible Unicode characters, and self-modifying code that never contains these strings in clear text.

WordPress security plugins (Wordfence, Sucuri) detect about 70% of common infections, but miss custom backdoors. A true audit requires comparing your current code with a known clean version (Git diff), monitoring unexpected file changes, and tracking suspicious outbound HTTP requests.

Warning: Some injections reactivate automatically after cleaning if the initial entry point (vulnerable plugin, weak password) is not patched. Cleaning without securing your site is like emptying a bathtub with a running faucet.

When are these constructions legitimate?

Not all sites use 'eval' or 'iFrame' maliciously. Page builders (Elementor, Divi) sometimes generate iFrames for YouTube embeds or Google Maps. Some third-party analytics scripts use 'eval' to load code dynamically.

The problem is that Google does not make the distinction in its documentation. Therefore, you should document your legitimate iFrames: list them, ensure they point to trusted domains, and audit them regularly. A legitimate 'eval' in your theme should never contain obscure encoded strings or point to unknown external domains.

Practical impact and recommendations

How can you effectively scan your site to detect these injections?

Start with a recursive grep search through all your PHP, JS, and HTML files. Look for 'eval(', 'unescape(', 'iframe', 'base64_decode', 'gzinflate', and 'str_rot13'. If you find occurrences in files you have never edited, that's suspicious.

Then, use Google's tools: Search Console displays security alerts under the Security Issues tab. Set up Google Safe Browsing Status to regularly check your domain. Complement with third-party scanners like Sucuri SiteCheck or VirusTotal for cross-referencing detections.

What preventive measures should you implement immediately?

Secure your entry points: change all admin passwords (FTP, cPanel, WordPress, database) to random strings of 20+ characters. Enable two-factor authentication wherever possible. Disable file editing from the WordPress back office (define('DISALLOW_FILE_EDIT', true) in wp-config.php).

Implement a restrictive Content Security Policy (CSP) that blocks unauthorized iFrames and inline scripts. Set up file change monitoring (AIDE, Tripwire, or WordPress plugins like WP File Monitor) to receive an alert as soon as a file is modified. Injections often occur at night: active monitoring detects them in real-time.

What should you do if your site is already infected?

Immediately switch to maintenance mode to limit visitor exposure. Identify all recently modified files (use the 'find' command under Linux with a date filter). Compare with a known clean backup or a fresh installation of the CMS. Never delete files before identifying the entry point; otherwise, the infection will return.

Once cleaned, request a manual review in Search Console under Security Issues. Google can take 72 hours to several weeks to remove the warning. Meanwhile, your traffic remains impacted. Some advanced security optimizations (strict CSP, forensic log analysis, server hardening) are technical and time-consuming. Hiring a specialized SEO agency for web security can expedite the process and ensure no backdoor remains.

  • Scan all files with grep for 'eval', 'unescape', 'iframe', 'base64_decode'
  • Check Search Console alerts under Security Issues every week
  • Change all server and CMS access passwords (20+ random characters)
  • Activate real-time file change monitoring
  • Set up a Content Security Policy (CSP) blocking unauthorized iFrames and external scripts
  • Regularly compare the current code with a clean version via Git diff or backups
Malicious code injections are not inevitable if you implement proactive monitoring and solid entry barriers. Early detection makes all the difference between a minor incident and a complete domain blacklisting. Google provides the markers (eval, unescape, iFrame): it's up to you to track them before they sabotage your SEO.

❓ Frequently Asked Questions

Est-ce que tous les iFrames sont considérés comme malveillants par Google ?
Non, les iFrames légitimes (YouTube, Google Maps, widgets sociaux) sont tolérées. Google détecte principalement les iFrames cachées (CSS display:none) pointant vers des domaines suspects ou inconnus. Documente tes iFrames autorisées et vérifie régulièrement leur destination.
Comment différencier un 'eval' légitime d'une injection malveillante ?
Un 'eval' légitime est visible en clair, documenté dans le code source officiel de ton thème ou plugin, et n'exécute jamais de chaînes encodées en base64 ou provenant de sources externes. Si tu trouves 'eval(unescape(...))' ou 'eval(atob(...))' avec des chaînes longues et incompréhensibles, c'est presque toujours malveillant.
Combien de temps faut-il pour que Google retire un avertissement de sécurité après nettoyage ?
Après avoir soumis une demande de révision dans Search Console, Google prend généralement entre 72 heures et 2 semaines. Pendant ce délai, l'avertissement rouge reste affiché dans les résultats de recherche et ton trafic reste impacté. Un nettoyage incomplet peut entraîner un nouveau signalement.
Les CDN et systèmes de cache peuvent-ils propager du code malveillant injecté ?
Oui, si l'injection se produit avant la mise en cache. Le code infecté est alors servi à tous les visiteurs via le CDN jusqu'à purge manuelle du cache. Certaines attaques ciblent spécifiquement les headers HTTP pour injecter du contenu dans Varnish ou Cloudflare sans toucher aux fichiers source.
Faut-il systématiquement supprimer tout code JavaScript obfusqué trouvé sur son site ?
Pas nécessairement. Certains scripts légitimes (analytics, anti-adblock, protections anti-scraping) utilisent l'obfuscation. Vérifie d'abord l'origine : si c'est un fichier de ton thème ou d'un plugin reconnu, compare-le avec la version officielle. Si c'est un fichier orphelin sans origine claire, supprime-le après sauvegarde.
🏷 Related Topics
JavaScript & Technical SEO Redirects

🎥 From the same video 2

Other SEO insights extracted from this same Google Search Central video · duration 1 min · published on 12/03/2013

🎥 Watch the full video on YouTube →

Related statements

💬 Comments (0)

Be the first to comment.

2000 characters remaining
🔔

Get real-time analysis of the latest Google SEO declarations

Be the first to know every time a new official Google statement drops — with full expert analysis.

No spam. Unsubscribe in one click.