Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-91161 Overview
CVE-2026-91161 is an authorization flaw in OpenWA, a free, open source, self-hosted WhatsApp API gateway. Versions prior to 0.23.5 expose the GET /api/sessions/{sessionId}/groups/{groupId}/invite-code endpoint and the GroupGetInviteCode MCP tool without enforcing the OPERATOR role requirement. A holder of a VIEWER key scoped to a session can retrieve an active group invite code. Because the invite code is a transferable WhatsApp bearer capability, an external WhatsApp account can join a group administered by the session without any OpenWA credential. The intruder retains group membership even after the originating VIEWER key is revoked. The issue is classified under CWE-863: Incorrect Authorization.
Critical Impact
A low-privileged VIEWER API key can obtain a transferable WhatsApp group invite code, letting an outside account gain persistent read and post access to administered groups.
Affected Products
- OpenWA self-hosted WhatsApp API gateway versions prior to 0.23.5
- Deployments exposing the group invite-code REST endpoint
- Deployments exposing the GroupGetInviteCode MCP tool
Discovery Timeline
- 2026-09-24 - CVE-2026-91161 published to NVD
- 2026-09-30 - Last updated in NVD database
Technical Details for CVE-2026-91161
Vulnerability Analysis
The flaw stems from mislabeling the invite-code endpoint as a read-tier operation. OpenWA's authorization layer assigns role requirements per endpoint. The group invite-code route was tagged with the read tier and lacked a @RequireRole(ApiKeyRole.OPERATOR) decorator. The same misclassification existed in the agent-tool definition for GroupGetInviteCode. Any valid VIEWER key with session scope could invoke the route and receive an invite link.
The output is not plain read data. A WhatsApp group invite code is a bearer token that any WhatsApp account can redeem outside OpenWA. Once redeemed, membership persists in the WhatsApp group independent of the OpenWA key lifecycle. Revoking the VIEWER key does not evict the joined account.
Root Cause
The controller method in src/modules/group/group.controller.ts and the agent-tool definition in src/core/agent-tools/tools/group.tools.ts did not require the OPERATOR role. The authorization model treated the invite-code output as read-only data rather than a transferable join capability equivalent to the QR login endpoint.
Attack Vector
An attacker holding a valid VIEWER API key scoped to a target session issues an authenticated GET request to the invite-code endpoint or calls the MCP tool. The response contains the active invite code. The attacker, or any party they share the code with, joins the WhatsApp group using an external WhatsApp account. Access to messages and posting rights persists after revocation of the OpenWA key.
// Patch: src/modules/group/group.controller.ts
// Enforces OPERATOR role on the invite-code endpoint
return { success: true, message: 'Group picture removed' };
}
+ // The invite code is a bearer join capability, not read data: it works outside OpenWA and keeps
+ // working after the key that fetched it is revoked. OPERATOR, like the QR endpoint.
@Get(':groupId/invite-code')
+ @RequireRole(ApiKeyRole.OPERATOR)
@ApiOperation({ summary: 'Get group invite code/link' })
@ApiParam({ name: 'sessionId', description: 'Session ID' })
@ApiParam({ name: 'groupId', description: 'Group ID' })
Source: GitHub Commit a888a01
// Patch: src/core/agent-tools/tools/group.tools.ts
// Adds OPERATOR requirement to the GroupGetInviteCode MCP tool
}),
defineTool({
name: 'GroupGetInviteCode',
- description: 'Get the invite code and link for a group.',
+ description:
+ 'Get the invite code and link for a group. Requires OPERATOR role: the code is a ' +
+ 'transferable join capability, not plain read data.',
tier: 'read',
+ requiredRole: ApiKeyRole.OPERATOR,
sessionScoped: true,
inputSchema: z.object({
sessionId,
Source: GitHub Commit d66439d
Detect Identity Attacks the Moment Authentication Fails
Singularity™ Identity surfaces credential misuse, lateral movement, and privilege escalation in real time, so you can contain the breach before it spreads.
Stop Identity AttacksDetection Methods for CVE-2026-91161
Indicators of Compromise
- HTTP GET requests to /api/sessions/{sessionId}/groups/{groupId}/invite-code originating from VIEWER-tier API keys.
- MCP tool invocations of GroupGetInviteCode by non-OPERATOR principals in audit logs.
- Unexpected WhatsApp group membership changes shortly after invite-code retrieval events.
Detection Strategies
- Correlate OpenWA API access logs with the authenticated key role and flag any invite-code reads by VIEWER keys on versions prior to 0.23.5.
- Alert on retrieval of invite codes followed by group participant join events for accounts not provisioned through OpenWA.
- Review MCP server logs for GroupGetInviteCode calls where the caller lacks OPERATOR role.
Monitoring Recommendations
- Enable verbose access logging on the OpenWA gateway and ship logs to a central platform for retention and query.
- Track group participant lists for administered sessions and alert on unexpected additions.
- Audit the inventory of issued API keys and their role assignments, especially VIEWER keys shared with third parties.
How to Mitigate CVE-2026-91161
Immediate Actions Required
- Upgrade OpenWA to version 0.23.5 or later, which enforces OPERATOR role on the invite-code endpoint and MCP tool.
- Rotate all WhatsApp group invite codes for groups administered by OpenWA sessions using the native WhatsApp reset function.
- Audit WhatsApp group participant lists and remove any accounts that joined through unauthorized invite-code disclosure.
- Review and revoke VIEWER keys issued to parties who should not be able to add accounts to administered groups.
Patch Information
The fix is published in OpenWA Release v0.23.5 and tracked in Pull Request #1572. See GitHub Security Advisory GHSA-45fh-xj7x-vj2x for the full advisory text.
Workarounds
- Restrict issuance of VIEWER keys to trusted principals only until the upgrade to 0.23.5 is applied.
- Place a reverse proxy or API gateway rule in front of OpenWA that blocks requests to /api/sessions/*/groups/*/invite-code unless the authenticated key carries OPERATOR or ADMIN role metadata.
- Disable the GroupGetInviteCode MCP tool exposure if MCP is not required.
# Example nginx rule to block invite-code reads at the edge
# Apply until OpenWA is upgraded to 0.23.5
location ~ ^/api/sessions/[^/]+/groups/[^/]+/invite-code$ {
if ($http_x_api_key_role !~ "^(OPERATOR|ADMIN)$") {
return 403;
}
proxy_pass http://openwa_backend;
}
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

