Summary
Discourse's Patreon webhook integration can treat requests as valid even when the patreon_webhook_secret is left blank, allowing attackers to forge HMAC-MD5 signatures using an empty key.
If an attacker can send requests to the Patreon webhook endpoint while the secret is unset, they can submit arbitrary webhook payloads, resulting in unauthorized creation, modification, or deletion of Patreon pledge data and unintended patron-to-group synchronization.
Affected context
This vulnerability arises in Discourse instances that have the Patreon integration enabled but leave the patreon_webhook_secret configuration empty.
In this state, the application still accepts and verifies incoming Patreon webhooks using an HMAC-MD5 signature computed with an empty key, effectively eliminating the shared secret component of the verification.
Any environment where attackers can reach the Patreon webhook endpoint over the network and the secret is not configured becomes exposed to forged webhook requests.
Exploit preconditions
- Attack surface: The public or network-accessible Patreon webhook endpoint exposed by a Discourse instance.
- Required access: Ability to send HTTP requests to the Discourse Patreon webhook URL (no valid Patreon account or prior authentication to Discourse is required).
- Configuration state: The
patreon_webhook_secretsite setting is left blank or unset while the Patreon integration is active. - Trigger point: The application verifies incoming webhooks by computing an HMAC-MD5 signature with an empty key, which matches the attacker's computed signature over the same request body.
- Why exploitation is possible: With a blank secret, the HMAC check degenerates into a predictable computation using a publicly known key (empty string), allowing an attacker who knows the request body to generate a signature that passes validation and submit arbitrary webhook payloads.
Why this happens
The underlying issue is an improper authorization and configuration-handling pattern in webhook signature verification.
Webhook authentication relies on a shared secret key to compute an HMAC over the request body; this key must be unknown to attackers and non-empty.
In the affected Discourse versions, the Patreon integration does not enforce that patreon_webhook_secret is configured before enabling webhook verification, and proceeds to compute HMAC-MD5 signatures with an empty string as the key.
This effectively removes the secret from the scheme and converts the HMAC into a predictable calculation that anyone can replicate, mapping to CWE-639: Authorization Bypass Through User-Controlled Key in the sense that an authorization decision (accepting webhook content) is based on a weak, user-influenced configuration that fails to constrain who can act as a trusted webhook sender.
Potential impact
- Attackers could create fake Patreon pledge events, making users appear to be patrons when they are not.
- Attackers could modify or revoke pledge data, potentially removing legitimate patrons' access.
- Attackers could trigger unauthorized patron-to-group synchronization, causing users to be added to or removed from privileged Discourse groups.
- Attackers could abuse group assignments to escalate access within the forum (e.g., gaining private category visibility or special posting capabilities).
- Audit trails and business logic tied to Patreon support tiers could become untrustworthy due to tampered webhook data.
General mitigation guidance
Effective mitigation focuses on ensuring webhook authentication is robust and cannot operate in a misconfigured, secret-less state.
Recommended defensive patterns include:
- Enforcing that webhook integrations cannot be enabled unless a strong, non-empty secret is configured.
- Treating the absence of a secret as a hard failure: reject all incoming webhooks until the secret is set.
- Centralizing signature verification logic to ensure consistent use of secrets and algorithms across all webhook handlers.
- Using well-understood, modern HMAC algorithms with adequate key length and ensuring secrets are generated with strong randomness.
- Storing webhook secrets in secure configuration stores or environment variables with strict access controls, rather than relying on defaults.
- Designing configuration UIs and documentation to highlight secrets as mandatory security boundaries, not optional conveniences.
How teams detect issues like this
To detect similar authorization and webhook verification issues, organizations can:
- Review configuration defaults and code paths where secrets or API keys are used; flag any logic that proceeds with an empty or placeholder value.
- Use static analysis or linters to identify cryptographic operations (e.g., HMAC) that accept constant or trivially derived keys.
- Implement configuration validation checks at startup that log warnings or fail fast when security-critical settings like webhook secrets are missing.
- Instrument application logs to record rejected webhook attempts and anomalous acceptance patterns, then monitor for suspicious volumes or unusual payloads.
- Periodically audit webhook handlers during code review, ensuring every handler uses a securely stored secret and enforces strict verification before processing payloads.

