Skip to main content

How to fix: Sitemap.xml publicly accessible

sitemap.xml is publicly accessible or referenced in the page. While a sitemap is designed to help search engines index public content, it may inadvertently list admin paths, internal tools, or staging URLs that were not intended for public visibility.

Why it matters

A sitemap intended for search engines may expose admin paths, internal API routes, staging URLs, or paginated content trees. Attackers can use sitemap.xml as a ready-made map of the application's endpoint structure, skipping the need for active crawling or brute-force discovery.

Sitemaps are meant to list pages you want indexed. Problems arise when the sitemap is generated automatically from all routes without filtering, including paths like /admin, /internal, or /_debug that should not be publicly listed.

How to fix it

  1. 1Audit sitemap.xml to confirm it lists only pages intended for public indexing.
  2. 2Exclude admin, internal, debug, and API routes from sitemap generation.
  3. 3Use robots.txt Disallow rules alongside sitemap to signal crawler scope.
  4. 4For Next.js, configure the sitemap generator to exclude protected paths.

Code examples

Next.js (next-sitemap.config.js)

JavaScript
/** @type {import('next-sitemap').IConfig} */
module.exports = {
  siteUrl: process.env.SITE_URL || 'https://example.com',
  generateRobotsTxt: true,
  exclude: [
    '/admin',
    '/admin/*',
    '/api/*',
    '/_debug',
    '/internal/*',
  ],
};

robots.txt (pair with sitemap)

text
User-agent: *
Disallow: /admin/
Disallow: /api/
Disallow: /internal/

Sitemap: https://example.com/sitemap.xml

References

Detected automatically by VulnRadar. The check id is sitemap-public, stable across every scan so you can filter or diff on it.

See every info disclosure check

Questions

How severe is Sitemap.xml publicly accessible?
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 sitemap-public, which stays the same between runs so you can filter, diff, or gate CI on it.

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.

Propose a checkHow a check is built

Scan your own site for sitemap.xml publicly accessible

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

How to fix: Sitemap.xml publicly accessible | VulnRadar