Website

Google Dorks Explained: Check What Your Own Website Exposes

In this guide
  1. What Search Operators Are
  2. How to Check What Your Own Site Exposes
  3. How to Fix Exposed Pages and Files
  4. How to Stop It Happening Again
  5. FAQ

A "Google dork" is a search that uses advanced operators such as site: and filetype: to surface pages that were never meant to be public. Attackers use them to find exposed files on other people's websites. If you run a website, you can use the same operators on your own domain to see what Google has indexed, then remove or hide anything that should not be there. This guide covers that defensive use only. It does not include query lists for finding weaknesses or data on sites you do not own.

What Search Operators Are

Search operators are short commands you add to a normal Google search to narrow the results. Google documents these in its Search Help and Search Central pages:

  • Quotation marks match an exact word or phrase.
  • A minus sign excludes a word from the results.
  • site: limits results to a domain, URL or URL prefix. A search for site:example.com includes subdomains such as www.example.com and recipes.example.com.
  • filetype: limits results to one file type, such as PDF.
  • before: and after: limit results by the date a document was last updated.

Do not put a space after the colon. site:example.com works, but site: example.com does not.

Security testers call this search engine reconnaissance. The OWASP Web Security Testing Guide includes it as an information-gathering test because indexes can hold material the owner never meant to publish: network diagrams and configurations, usernames, passwords and private keys, cloud configuration files, revealing error messages, and development or staging versions of a site.

How to Check What Your Own Site Exposes

Run these searches with your own domain in place of yourdomain.com. Use them only on sites you own or are authorised to test.

SearchWhat to look for
site:yourdomain.comPages you forgot about, old test pages, login or admin pages, and subdomains such as staging or dev copies
site:yourdomain.com filetype:pdfDocuments that should be private, such as internal reports, invoices or contracts. Repeat with other document types your site hosts, such as docx or xlsx
site:yourdomain.com "confidential"Pages or files that carry an internal label
site:yourdomain.com before:2023-01-01Old pages and files that have not been updated for years and may no longer belong online

The site: operator has limits. Google's site: operator documentation says it does not necessarily return every indexed URL, so do not treat an empty result as proof that nothing is exposed.

For a fuller picture, use Google Search Console. The Page indexing report shows which of your URLs are indexed and lets you view an example list of up to 1,000 indexed URLs. Google also says the URL Inspection tool is more reliable than search operators for checking a single URL. OWASP advises checking more than one search engine, because each one indexes different pages.

How to Fix Exposed Pages and Files

  1. Remove or lock the content at the source. Delete files that should not be online, or put them behind a login. Once the URL returns a 404 or 410 status, or requires a password, Google removes it from results once it recrawls the URL.
  2. Use noindex for pages that must stay public. Add <meta name="robots" content="noindex"> to the page's head section, or send an X-Robots-Tag: noindex HTTP header. The header also works for PDFs, images and other non-HTML files. Google's noindex guide warns that the page must not be blocked by robots.txt, otherwise Google never sees the noindex rule and the URL can still appear if other pages link to it.
  3. Use the Removals tool for urgent cases. In Search Console, a removal request hides a URL from Google results for about six months. It does not delete anything, so fix the page itself with step 1 or step 2 before the request expires.
  4. Change any exposed secrets. If a password, API key or private key appeared in a file that Google indexed, assume someone has seen it. Change it immediately, even after the file is gone.

How to Stop It Happening Again

  • Do not use robots.txt to hide private paths. Google says robots.txt is not a mechanism for keeping a page out of Google. The robots.txt standard, RFC 9309, adds that listing paths in the file exposes them publicly and makes them discoverable.
  • Keep backups, database exports and log files outside the public web folder.
  • Put staging and development copies of your site behind a password, and use strong, unique passwords on admin accounts. Our tips on keeping a strong password cover the basics.
  • Repeat the searches above after every redesign, migration or plugin install, and check the Page indexing report in Search Console regularly for URLs you do not recognise.

FAQ

Are Google dorks illegal?

Using search operators is ordinary searching. Using what you find to get into systems or data you are not authorised to access is a different matter and can break computer misuse laws. Run these checks only on sites you own or have written permission to test.

Does robots.txt keep pages out of Google?

No. robots.txt controls crawling, and a blocked URL can still be indexed if other pages link to it. Use noindex or password protection instead.

How long does a Search Console removal last?

About six months. After that the URL can return to results unless you have removed the content, protected it with a password or added noindex.

Why does site: show fewer pages than I expected?

The site: operator does not list every indexed URL. Use the Page indexing report in Search Console for a more complete view.

Written by

TheTechRim Team

Published on TheTechRim in Website.