Summary
Ghostwriter fails to verify that a selected report template belongs to the client associated with the report. An attacker who can access the template-swap endpoint may enumerate template identifiers, attach another client's template to their own report, and disclose its contents when generating the report.
Affected context
The issue occurs in Ghostwriter report workflows that allow users to swap templates by referencing template primary keys. It becomes risky when the endpoint relies on the supplied identifier without enforcing ownership or client-scope checks, particularly where identifiers are predictable or sequential.
Exploit preconditions
- Attack surface: The report template swap endpoint
- Required access: Access to create or modify reports and invoke the template-selection workflow
- Trigger point: Supplying a template identifier while attaching a template to a report
- Why exploitation is possible: The endpoint does not sufficiently confirm that the selected template belongs to the requesting user's client or authorized scope, and sequential identifiers may support enumeration
Why this happens
The vulnerability is an object-level authorization failure mapped to CWE-639: Authorization Bypass Through User-Controlled Key. The application accepts a user-controlled template primary key and uses it to retrieve or attach an object without consistently checking ownership, tenant boundaries, or effective authorization for the referenced resource. Predictable identifiers increase discoverability, but the fundamental flaw is the missing server-side authorization decision.
Potential impact
- Unauthorized users may attach templates belonging to other clients
- Confidential letterhead, boilerplate, or methodology text may be disclosed
- Cross-client data separation may be weakened
- Generated reports may contain content outside the user's authorized scope
- Exposed templates could support further social engineering or information gathering
General mitigation guidance
Mitigation generally focuses on enforcing object-level authorization at every template access and attachment operation.
Common defensive patterns include:
- Deriving the permitted client or tenant scope from the authenticated session rather than request parameters
- Checking template ownership and report ownership server-side before retrieval, attachment, and rendering
- Using opaque, non-sequential identifiers as a defense-in-depth measure, without treating them as an authorization control
- Returning consistent responses that do not reveal whether unauthorized template identifiers exist
- Applying least privilege and strict tenant isolation to report-generation services
- Validating authorization again at sensitive downstream operations such as report rendering and export
How teams detect issues like this
Organizations can identify similar issues through:
- Static analysis and code review searches for database lookups driven directly by request-supplied object identifiers
- Review of endpoints that update, attach, export, or render tenant-scoped resources
- Test cases that attempt cross-tenant access using valid identifiers from another scope
- Monitoring for sequential enumeration patterns and repeated authorization failures
- Policy enforcement requiring explicit ownership or scope checks before object retrieval and mutation
- Automated application-security testing that exercises object-level authorization boundaries

