robots.txt is a publicly accessible text file at the root of your domain that tells search engine crawlers which pages not to index. It is not an access control mechanism. Any person, automated tool, or attacker can read your robots.txt without authentication — and security scanners actively fetch it as one of the first steps in reconnaissance. Every Disallow entry you write is a public announcement to anyone who reads the file, including people who should not have that information.
What robots.txt Actually Does
The Robots Exclusion Protocol is a convention, not a technical enforcement. Compliant crawlers — Googlebot, Bingbot, and other major search engine bots — respect Disallow directives. Attackers, vulnerability scanners, and non-compliant bots ignore them entirely. The file contains no authentication, no encryption, and no enforcement capability. It is plain text, served over HTTP to any client that requests it.
robots.txt is also persistent and discoverable. The Internet Archive's Wayback Machine archives robots.txt files over time, preserving historical versions. Your past robots.txt entries — including paths that existed in previous versions of your application — may be visible in archived snapshots even after you remove them from the current file.
The Fundamental Misconception
A significant number of developers add sensitive paths to robots.txt with the intent of keeping them out of search engines and therefore less visible. The reasoning — "if I Disallow /admin/, Googlebot won't crawl it and users won't find it in search results" — is partially correct about the crawling behavior, but it completely misses the security implication: the Disallow entry itself reveals that the path exists.
A Disallow: /admin/ entry tells an attacker: there is an admin panel at /admin/. A Disallow: /api/internal/ entry says: there is an internal API here. A Disallow: /backups/ entry announces: backup files may be stored in this directory. These entries are reconnaissance gifts to anyone who reads the file before probing your site.
What Attackers Look for in robots.txt
Security researchers and attackers treat robots.txt as a site map of sensitive areas. Every Disallow entry is probed to check whether the path is actually protected by authentication or access control. The entries that receive the most immediate attention:
- Admin panels:
/admin/,/wp-admin/,/backend/,/administrator/,/manage/,/cpanel/,/dashboard/ - Internal API endpoints:
/api/internal/,/api/v1/admin/,/api/debug/,/graphql/internal/ - Backup and data directories:
/backups/,/dumps/,/exports/,/db/,/data/ - Configuration paths:
/config/,/.env,/settings/,/private/ - Development artifacts:
/dev/,/test/,/staging/,/old/,/temp/
Security tools call this "robots.txt reconnaissance" — it is one of the first automated steps in any web application security assessment, because the file reliably maps out the sensitive areas developers did not want public, without requiring any active exploitation.
What You Should Put in robots.txt
The correct use of robots.txt is to manage search engine crawl budget and prevent indexing of duplicate or low-value content — not to implement any security control. Paths that are legitimately appropriate to Disallow:
- Duplicate content generated by URL parameters (search result pages, sort orders, filter combinations that create millions of URL variants with the same content)
- User session or cart pages with no search value:
/cart,/checkout,/thank-you - Crawl traps: infinite calendar pagination, faceted navigation that generates unbounded URL combinations
- User-generated content archives where crawl budget would be better spent elsewhere
Notice what is absent from this list: admin panels, API endpoints, backup directories, and configuration paths. Those should be protected by actual access controls — not mentioned in robots.txt at all.
The Correct Control: Real Access Enforcement
If a path should not be publicly accessible, the correct control is authentication, IP allowlisting, or web server deny rules — not robots.txt. Specific implementations:
- Admin panels: Require authentication on every request. Additionally, restrict admin panel access by IP address at the web server level if your admin team has static IPs. Return HTTP 401 or 403 for unauthenticated requests — never HTTP 200 with a login form that a path-guessing attacker simply navigates to.
- Internal APIs: Require API keys or session tokens. Return 401 for unauthenticated requests.
- Backup files: Store backups outside the document root — in
/var/backups/rather than/var/www/html/backups/. If they must exist in the web root, add a web server deny rule: in Nginx,location ~* \.(sql|bak|tar|gz|zip)$ { deny all; } - Configuration files: Never place
.env,config.php,database.yml, or similar files inside the web root. There is no robots.txt entry that makes an accessible.envfile safe.
The Sitemap Directive
robots.txt supports a Sitemap: directive pointing to your XML sitemap: Sitemap: https://example.com/sitemap.xml. This is legitimate and useful for search engine discovery. The risk: if your sitemap includes URLs to admin sections, internal tools, or private user pages — perhaps because they were accidentally added to the sitemap generator's scope — the sitemap itself becomes an information disclosure vector. Review your sitemap to ensure it contains only URLs you want indexed.
How Shieldome Checks This
Shieldome fetches and analyzes your robots.txt file as part of every scan. When you run a Shieldome scan, it specifically:
- Parses all Disallow entries and classifies them against a list of known sensitive path patterns covering admin panels, internal API routes, backup directories, and configuration paths
- Flags any Disallow entry matching sensitive patterns as an Information Disclosure finding at Medium severity, with the specific path in the finding detail
- Probes the flagged paths directly by sending HTTP requests to check whether they are actually protected by authentication — if a path listed in robots.txt returns an HTTP 200 response without credentials, the finding is escalated to High or Critical severity depending on what the response contains
- Checks whether the Sitemap directive points to an accessible sitemap and, if so, whether the sitemap references sensitive internal paths
The finding output shows exactly which Disallow entries Shieldome flagged, what HTTP status each path returned when probed, and specific remediation steps for each case.
Frequently Asked Questions
Does Google actually respect robots.txt?
Yes — Googlebot and major search engine crawlers follow robots.txt directives and will not crawl Disallowed paths. However, Google may still show a URL in search results without indexing its content if other pages link to it — it simply will not crawl the page. The key distinction is that robots.txt controls crawling behavior, not access. It does not prevent a URL from being visited by anyone other than compliant crawlers.
Can I use robots.txt to block my entire site?
You can use User-agent: * Disallow: / to instruct all compliant crawlers to avoid your entire site. This prevents major search engines from indexing any content and will effectively remove your site from search results over time. It does not prevent human visitors, security scanners, or non-compliant bots from accessing any part of your site — it only applies to crawlers that respect the convention.
What is the Wayback Machine risk for robots.txt?
The Internet Archive's Wayback Machine archives web pages, including robots.txt files, over time. Past versions of your robots.txt file may reveal paths that existed in earlier versions of your site — admin panels from a previous CMS, backup directories from an old deployment process, deprecated API routes — that may still be accessible on your server even if the robots.txt entry was removed. Attackers specifically check historical snapshots for this reason. The fix for previously exposed paths is access control on the paths themselves, not removal from current robots.txt.
What should I use instead of robots.txt to prevent sensitive pages from appearing in search results?
For pages that are publicly accessible but should not appear in search results, use the noindex meta tag in the page's HTML head: <meta name="robots" content="noindex">. This tells compliant crawlers not to index the page without advertising the path in a public robots.txt file. For API responses and non-HTML resources, use the X-Robots-Tag: noindex HTTP response header. Neither approach provides access control — the content remains accessible to anyone who requests it.
Is it safe to list user profile URLs in robots.txt?
User profile URLs are generally appropriate to Disallow if they provide no search value and would waste crawl budget. Unlike admin or configuration paths, user profile paths (e.g., /users/ or /profiles/) do not disclose infrastructure details or sensitive system paths — they reveal a URL pattern for user-generated content, which is typically already inferrable from the site's public structure. The security risk of listing user profile patterns is low compared to listing admin or API paths.
My admin panel requires login. Is it still a risk to list it in robots.txt?
The risk is lower if the admin panel is properly protected by authentication — an attacker probing the path will encounter a login form rather than direct access. However, listing the admin path still provides reconnaissance value: it confirms the admin panel exists at that path, identifies the technology (wp-admin suggests WordPress), and saves the attacker the step of guessing common admin paths. Best practice is to not list it at all, so the path is not confirmed publicly.
A robots.txt file that lists your most sensitive paths is an invitation to reconnaissance. Run a free Shieldome scan to check whether your robots.txt is disclosing paths that should not be advertised publicly.