Summary
A reflected Cross-Site Scripting (XSS) flaw in ChurchCRM's GeoPage.php allows authenticated users to inject arbitrary JavaScript into the browsers of other authenticated users.
Because the payload can trigger automatically via an autofocus mechanism, an attacker who can convince a victim to submit a crafted form may steal session cookies and fully take over victim accounts, including administrator accounts.
Affected context
This vulnerability occurs in the GeoPage functionality of ChurchCRM when user-controlled data is reflected into the HTML response without proper output encoding.
It is relevant in deployments where:
- Users authenticate to ChurchCRM and access GeoPage.php
- Application pages accept parameters that are echoed into the response
- Input validation and output encoding are insufficient for data rendered into HTML or JavaScript contexts
The issue manifests when a crafted request or form submission causes the application to return a page where attacker-supplied content is executed in the victim's browser.
Exploit preconditions
- Attack surface: Web interface, specifically the GeoPage.php endpoint.
- Required access: Attacker must be an authenticated ChurchCRM user.
- Victim profile: Another authenticated user (including administrators) who can be induced to load or submit a crafted request (e.g., via a malicious form or link).
- Trigger point: The vulnerable page reflects attacker-controlled input into the HTML response, where browser autofocus behavior causes the injected script to execute automatically.
- Why exploitation is possible: The application renders untrusted input directly into the page without context-appropriate HTML/JavaScript escaping, enabling arbitrary script execution in the victim's session.
Why this happens
The root cause is improper neutralization of user input before it is included in the HTML output, aligning with CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting).
GeoPage.php accepts parameters from authenticated users and reflects them back into the response without robust output encoding (e.g., HTML entity encoding, attribute encoding, or JavaScript string encoding, depending on context).
Because this reflection occurs inside a browser-interpreted context and is coupled with autofocus-based auto-triggering, an attacker's injected JavaScript runs with the victim's session privileges.
Conceptually, this reflects the classic XSS pattern: trusting data from a request and embedding it into a dynamic page without ensuring it is treated purely as data rather than executable code.
Potential impact
- Theft of session cookies for authenticated ChurchCRM users.
- Full account takeover of victim users, including administrator accounts.
- Unauthorized changes to church membership data, donations, or configuration settings.
- Execution of arbitrary actions on behalf of the victim (e.g., modifying records, exporting sensitive information).
- Installation of persistent browser-based backdoors or keyloggers via injected scripts.
- Lateral movement by abusing compromised admin accounts to change security settings or user roles.
General mitigation guidance
Effective mitigation focuses on robust output encoding and clear separation of data from code in all dynamic pages:
- Apply context-appropriate escaping whenever inserting user-controlled data into HTML, attribute, URL, CSS, or JavaScript contexts (e.g., HTML entity encoding for HTML body, attribute encoding for attributes, JS string encoding inside scripts).
- Centralize output encoding through templating helpers or view-layer functions so that no raw user input is written directly to the response.
- Avoid constructing HTML or JavaScript via string concatenation; use safe templating engines and data-binding frameworks that encode by default.
- Enforce a strict input handling policy where parameters passed to views are normalized and validated according to expected formats.
- Reduce privilege exposure by ensuring that sensitive actions and pages are protected with strong authorization checks, limiting the blast radius of any XSS.
- Consider a defense-in-depth Content Security Policy (CSP) that disallows inline scripts and restricts script sources to trusted origins, reducing the effectiveness of script injection.
How teams detect issues like this
Detection usually combines automated analysis with focused code review:
- Use static analysis rules to flag direct use of unencoded request parameters or variables in HTML templates, especially in echo/print statements or string concatenations in PHP.
- During code review, scan for patterns where:
- Input from GET/POST/REQUEST arrays is passed directly into views.
- Variables are inserted in attributes like
value=,on*=handlers, or script blocks without encoding. - Dynamic HTML/JavaScript is assembled with concatenated strings rather than templating helpers.
- Integrate automated security testing (DAST) that probes parameters for reflected content and checks whether probes appear unencoded in responses.
- Establish CI policies requiring security-focused review for changes to view templates and controller code that handles user input.
- Periodically run specialized XSS scanners against authenticated parts of the application, including pages like GeoPage.php.

