Skip to content

Cross-page form resolution runs a restricted page's form actions for anonymous visitors

Moderate
rhukster published GHSA-33m4-m988-5fvh Aug 21, 2026

Package

getgrav/grav-plugin-form

Affected versions

<= 9.1.21

Patched versions

9.1.22

Description

Summary

When a form POST cannot be resolved to a form on the page being posted to, FormPlugin::getForm() falls back to findFormByName(), which searches every page on the site for a form matching the posted __form-name__ and builds the form from whichever page owns it. That fallback never checks whether the owning page is published or restricted by an access: rule. An anonymous visitor can therefore execute the process actions (save, upload, email, call) of a form defined on a login-restricted or unpublished page, simply by POSTing to any public page with __form-name__ set to the restricted form's name.

The form-nonce CSRF layer itself works correctly — a bad nonce is rejected and nothing is saved. The missing check is page authorization.

Threat model / trust boundary: an unauthenticated visitor reaches a privileged sink — functionality the site owner deliberately placed behind a login wall.

Affected versions

The vulnerable code lives in the Form plugin (getgrav/grav-plugin-form), not in Grav core.

Reported against form plugin 9.1.21 on Grav 2.0.19. The same by-name resolution is present in every 6.x, 7.x, 8.x and 9.x release, and functionally equivalent code exists back through the 5.x line. Because the form plugin declares compatibility: grav: ['1.7', '2.0'], both Grav lines are affected and both are covered by a single plugin release.

Details

In user/plugins/form/form.php:

  • POST entry. form() reads __form-name__ from the request and passes it to getForm() as a bare string, so no route is supplied and the cross-page fallback is eligible.
  • The fallback. getForm() — when the current page has no form by that name, findFormByName($name) scans the site-wide form registry, and the owning page is loaded with $pages->find($route). No published() check, no access: evaluation, no user check. The only filter applied inside findFormByName() is _page_routable, which excludes modular pages and nothing else.
  • The registry includes protected pages. Form definitions are collected in onPageProcessed, which core fires for every page during the page-tree walk, before any publish or access filtering.
  • Processing runs as the restricted page. The resulting Form binds $this->page to the owning page's route, so self@ in a destination resolves to that page's directory.
  • No authorization at submit time. Form::post() verifies the form-nonce and nothing else.
  • The nonce is not a barrier. GET ?task=get-nonce&action=form issues a session-bound form nonce to anyone, anonymously, by design.

Page access rules are enforced by the Login plugin's authorizePage(), which evaluates only $grav['page'] — the page actually requested. A POST to a public route passes that check, and the restricted page is never authorized at all.

PoC

Lab setup: a page /members restricted to logged-in users, defining a form memform whose save action writes to user/data/memform/. Anonymous GET /members returns the login wall, confirming the ACL is enforced at render.

# control A — bad nonce is rejected (CSRF layer intact):
POST /  __form-name__=memform&form-nonce=000...0&data[note]=x   -> nothing saved

# control B — nonexistent form name:
POST /  __form-name__=nosuchform&form-nonce=<valid>&data[note]=x  -> nothing saved

# attack — obtain an anonymous form nonce, then invoke the restricted form:
GET  /?task=get-nonce&action=form      -> {"nonce":"<session-bound nonce>"}
POST /  __form-name__=memform&form-nonce=<nonce>&data[note]=pwned
# -> data file lands in user/data/memform/ although the attacker cannot view /members

Impact

Anonymous execution of the process actions defined on a restricted or unpublished page's form:

  • save — write attacker-controlled data into user/data/, as demonstrated.
  • email — send mail as the site.
  • upload — if the restricted form defines a file field, drop files into the restricted page's own directory, since self@ resolves there. Extension allowlists still apply, and page-content extensions (.md, .yaml, .yml, .json, .twig, .ini) are hard-blocked independently of the form's accept policy, so this cannot become page-content takeover. With avoid_overwriting: false (the default) an existing same-named media file can still be replaced.
  • call — invoke a site-defined callable.

Two adjacent sinks are not reachable this way and do not contribute to severity: the Login plugin's update_user handler refuses a session whose user does not exist, and register_user requires site-wide registration to be enabled, which already implies a public registration path. There is therefore no account takeover and no account creation available through this issue.

Patches

Fixed in getgrav/grav-plugin-form: the cross-page fallback now verifies that the owning page is published and that the current user is authorized for it, delegating the access-rule evaluation to the Login plugin so that parent-inherited rules, incomplete 2FA sessions, and third-party vetoes are all honoured. Forms submitted back to their own page and forms fetched with an explicit route are unaffected.

Credits

Reported by @1K0CT.

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v4 base metrics

Exploitability Metrics
Attack Vector Network
Attack Complexity Low
Attack Requirements None
Privileges Required None
User interaction None
Vulnerable System Impact Metrics
Confidentiality Low
Integrity Low
Availability None
Subsequent System Impact Metrics
Confidentiality None
Integrity None
Availability None

CVSS v4 base metrics

Exploitability Metrics
Attack Vector: This metric reflects the context by which vulnerability exploitation is possible. This metric value (and consequently the resulting severity) will be larger the more remote (logically, and physically) an attacker can be in order to exploit the vulnerable system. The assumption is that the number of potential attackers for a vulnerability that could be exploited from across a network is larger than the number of potential attackers that could exploit a vulnerability requiring physical access to a device, and therefore warrants a greater severity.
Attack Complexity: This metric captures measurable actions that must be taken by the attacker to actively evade or circumvent existing built-in security-enhancing conditions in order to obtain a working exploit. These are conditions whose primary purpose is to increase security and/or increase exploit engineering complexity. A vulnerability exploitable without a target-specific variable has a lower complexity than a vulnerability that would require non-trivial customization. This metric is meant to capture security mechanisms utilized by the vulnerable system.
Attack Requirements: This metric captures the prerequisite deployment and execution conditions or variables of the vulnerable system that enable the attack. These differ from security-enhancing techniques/technologies (ref Attack Complexity) as the primary purpose of these conditions is not to explicitly mitigate attacks, but rather, emerge naturally as a consequence of the deployment and execution of the vulnerable system.
Privileges Required: This metric describes the level of privileges an attacker must possess prior to successfully exploiting the vulnerability. The method by which the attacker obtains privileged credentials prior to the attack (e.g., free trial accounts), is outside the scope of this metric. Generally, self-service provisioned accounts do not constitute a privilege requirement if the attacker can grant themselves privileges as part of the attack.
User interaction: This metric captures the requirement for a human user, other than the attacker, to participate in the successful compromise of the vulnerable system. This metric determines whether the vulnerability can be exploited solely at the will of the attacker, or whether a separate user (or user-initiated process) must participate in some manner.
Vulnerable System Impact Metrics
Confidentiality: This metric measures the impact to the confidentiality of the information managed by the VULNERABLE SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones.
Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the VULNERABLE SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging).
Availability: This metric measures the impact to the availability of the VULNERABLE SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system.
Subsequent System Impact Metrics
Confidentiality: This metric measures the impact to the confidentiality of the information managed by the SUBSEQUENT SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones.
Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the SUBSEQUENT SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging).
Availability: This metric measures the impact to the availability of the SUBSEQUENT SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system.
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N

CVE ID

No known CVE

Weaknesses

Missing Authorization

The product does not perform an authorization check when an actor attempts to access a resource or perform an action. Learn more on MITRE.

Incorrect Authorization

The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. Learn more on MITRE.

Credits