[flex-objects] shortcode bypasses Flex directory ACL entirely, exposing any registered collection to anyone with page-edit access
Description
The [flex-objects] shortcode, and its [flex] alias, resolves a Flex collection by name and renders it without performing any authorization check. Any user who can edit page content can therefore place [flex-objects collection=<type> /] in a page and publish the contents of any Flex directory registered on the site, bypassing the authorize: ACL that the Admin panel enforces for the same data.
Affected versions
Grav Flex Objects plugin (getgrav/grav-plugin-flex-objects) >= 1.4.0, <= 1.4.7.
The shortcode was introduced in 1.4.0 and the missing check has been present in every 1.4.x release since. The 1.3.x line does not contain the shortcode and is not affected.
Details
FlexObjectsShortcode::renderCollection() takes the collection name directly from a shortcode attribute and passes it to Flex::getCollection():
$flex = $this->grav['flex'] ?? null;
$collection = $flex ? $flex->getCollection($type) : null;No user, session, or permission context is involved. There is no allowlist of renderable types, no plugin setting gating the shortcode, and no consultation of the target directory's authorize configuration. Flex::getCollection() is an internal data-access API and behaves correctly within its documented scope; the missing authorization layer is in the shortcode that calls it.
This matters more than a general "a publisher can write content" issue, because Grav 2.0 deliberately removed this capability from content authors. The Twig sandbox is allowlist-based and denies grav.get('flex') to editor-authored content, and this shortcode exists specifically as the sanctioned, narrow replacement for that blocked capability. Shortcodes are expanded independently of Twig processing, so the shortcode bypasses the sandbox it was introduced to be the safe alternative to.
Impact
A user whose only privilege is page-content editing can publish, on a page readable by anonymous visitors, the contents of a Flex directory they are not authorized to view.
The original report noted that Grav 2.0 can store user accounts as a Flex directory and that this might extend to exposing the site's user list, while explicitly declining to claim it as verified. We have since confirmed it. The Flex Objects plugin ships a user-accounts blueprint and the frontend templates that render it, and registers those template paths on the frontend, so on a site configured the common way the shortcode renders the full account roster: usernames, full names, email addresses, and the permission map identifying which accounts hold administrative access.
The templates shipped with the plugin do not print password hashes. A site that has written its own flex/user-accounts/object/* template dumping the object would additionally expose the stored hash, because the secret-stripping in UserObject applies to serialization rather than to property access.
Patches
Fixed in Flex Objects 1.4.8. The shortcode now checks authorization before rendering anything, and a Flex directory must opt in before it can be rendered publicly. A collection that has not opted in renders nothing for viewers who are not authorized to list it.
Operators upgrading from an affected version should review any existing use of the [flex-objects] or [flex] shortcode on public pages, since a collection that previously rendered without a check will now need the opt-in.
Workarounds
Until you can upgrade, restrict page-editing permissions to trusted accounts, or disable the Shortcode Core plugin, which [flex-objects] requires in order to be expanded at all.
Credits
Reported by @alham-rizvi.