Skip to content

Mass Assignment / IDOR Vulnerability in Task and Routine Updates #1651

Description

@Abhishek2005-ard

Description

A critical Mass Assignment vulnerability exists within the application's update endpoints for both Tasks (updateTask in taskController.js) and Routines (updateRoutine in routineController.js).

When updating a task or a routine, the backend directly takes the entire req.body object and passes it to Mongoose's $set operator. Because there is no input sanitization or whitelisting of modifiable fields, an attacker can arbitrarily inject and update sensitive database fields. Most critically, an attacker can overwrite the userId field, effectively transferring ownership of a task or routine to another user account (Insecure Direct Object Reference).

Steps to Reproduce

  1. Authenticate as User A and create a new task. Note the _id of this task.
  2. Authenticate as User B and obtain User B's internal userId from the database or API responses.
  3. As User A, send a PUT or PATCH request to the update task endpoint (/api/tasks/:id) with the following payload:
    {
      "title": "Updated Title",
      "userId": "<User_B_ID>"
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendIssues related to server-side, database logic or APIsfrontendIssues related to UI/UX

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions