Unauthenticated disclosure of commenter email addresses and server file paths in the Comments plugin admin handler
Description
The Comments plugin registers an admin handler that returns comment data as JSON to any visitor, with no authentication check. On a site using the classic Admin plugin, an anonymous request to /admin/comments/page:<n> returns every comment from the last 7 days — including each commenter's email address and the absolute filesystem path of the data file on the server — data that is never exposed on the public frontend.
CWE-306 (Missing Authentication for Critical Function) and CWE-200 (Exposure of Sensitive Information). An unauthenticated visitor escapes the anonymous trust scope and reads admin-only data.
Affected versions
All released versions of grav-plugin-comments up to and including 1.2.10, when the classic Admin plugin is installed and Comments is enabled (the default).
Sites running the Grav 2.0 Admin Next stack (admin2 + api) instead of the classic Admin plugin are not affected via this path, because the admin service is not registered at the point the handler runs.
Fixed in 1.2.11.
Details
The plugin's onPluginsInitialized handler branches on isAdmin(), which in Grav resolves to isset($grav['admin']) — it only tells the plugin that the admin service is present on the current route, not that the visitor is authenticated. When the classic Admin plugin is installed it registers that service early in onPluginsInitialized, before the plugin's own handler runs.
The Comments admin handler then reads the requested page and, when a page parameter is present, echoes the JSON and calls exit():
$page = $this->grav['uri']->param('page'); $comments = $this->getLastComments($page); if ($page > 0) { echo json_encode($comments); exit(); }
This runs during the plugins stage of the request, before the Admin plugin reaches the pages stage where it would render its login screen for an unauthenticated visitor. The exit() pre-empts that enforcement entirely, so no login, session, cookie, or CSRF token is required.
getLastComments() returns each stored comment with its email field intact and injects the absolute server path of each data file as filePath.
Proof of concept
curl 'target/
A fractional page value satisfies the page > 0 check while the slice offset floors to zero, returning the freshest comments. A single comment in the last 7 days is enough. The response is a JSON array of comment objects, each carrying email and an absolute filePath.
Impact
Any anonymous visitor can retrieve the email addresses of everyone who has commented in the last 7 days, along with absolute server filesystem paths that aid further attacks. No account of any kind is needed.
Patches
Upgrade to grav-plugin-comments 1.2.11. The admin handler now requires an authenticated user holding admin.comments or admin.super before returning any data, and the absolute filePath has been removed from the response entirely.
Operators who cannot upgrade immediately should disable the Comments plugin.
Credits
Reported by @AlpetGexha. Thank you for the clear write-up and reproduction.