MCP07
- Location
dist/src/messaging/sender-access.js:118- Finding
Empty Sender Authorization State Fails Open ## Remediation Suggestions 1. Remove both empty-list admission mechanisms. An absent authorization list must not automatically authorize the current sender. 2. Route unidentified senders through the host's pairing workflow, or deny dispatch until an owner is explicitly configured. 3. Require explicit owner binding when importing token-only accounts. Do not infer ownership from the first arriving message. 4. Distinguish an intentionally configured public-access policy from missing, unreadable, or migrated authorization state. 5. Add regression tests for both SDK paths covering empty stores, absent owner IDs, token-only accounts, migration failures, valid owners, and unauthorized senders. 6. Keep command-owner and execution-approval checks independent of message admission.
- Content
View full analysis
Vulnerability Details
File Location:
plugin/dist/src/messaging/sender-access.js:12–18,87–93,118–121
Vulnerability Type: Improper Authorization / Fail-Open Access Control
Risk Level: High, conditional on missing account-owner and pairing stateVulnerable Code
The authorization store falls back to the saved account owner, then to an empty list:
js export function readWeixinAllowFromStore(accountId) { const fromStore = readFrameworkAllowFromList(accountId); if (fromStore.length > 0) return fromStore; const userId = loadWeixinAccount(accountId)?.userId?.trim(); return userId ? [userId] : []; }The legacy authorization path treats that empty list as permission:
js const authorization = await legacy.resolveSenderCommandAuthorizationWithRuntime({ cfg: params.config, rawBody: params.rawBody, isGroup: false, dmPolicy: "pairing", configuredAllowFrom: [], configuredGroupAllowFrom: [], senderId: params.senderId, isSenderAllowed: (id, list) => list.length === 0 || list.includes(id), readAllowFromStore, runtime: params.commands, });The newer ingress path explicitly adds the current sender when the store is empty:
js const result = await resolveIngress({ channelId: CHANNEL_ID, accountId: params.accountId, identity: defineStableChannelIngressIdentity({ key: "weixin-user-id", kind: "stable-id" }), subject: { stableId: params.senderId }, conversation: { kind: "direct", id: params.senderId }, event: { kind: "message", authMode: "inbound", mayPair: true }, policy: { dmPolicy: "pairing", groupPolicy: "allowlist" }, // Legacy command-auth treated an empty pairing store as allowed. Keep that // admission for token-only accounts that have no saved user id. allowFrom: storeAllowFrom.length === 0 ? [params.senderId] : [], readStoreAllowFrom: async () => storeAllowFrom, ...(mayAuthorizeCommand ? { command: { ...[truncated 1944 chars]
