Summary
Krayin CRM through version 2.2.3 contains an insecure direct object reference issue across multiple controllers handling leads, people, organizations, quotes, and activities.
Authenticated users can directly access and manipulate records they do not own, allowing them to edit, update, delete, or reassign ownership of other users' CRM data when record-level authorization checks are missing.
Affected context
This vulnerability appears in Krayin CRM deployments where application logic relies on route parameters or IDs to identify CRM records (leads, people, organizations, quotes, activities) without consistently enforcing record-level ownership checks.
It typically manifests where authenticated users can reference arbitrary IDs in edit, update, or delete actions and the backend only verifies authentication, not whether the record belongs to the current user or their tenant.
Exploit preconditions
- Attack surface: Web application endpoints in LeadController, PersonController, OrganizationController, QuoteController, and ActivityController.
- Required access: Valid authenticated user account within the CRM.
- Trigger point: Supplying another user's record ID to edit, update, or destroy endpoints.
- Why exploitation is possible: Controller methods authorize based on authentication and basic permissions but lack robust ownership or access control checks at the record level, allowing arbitrary IDs to be acted upon.
Why this happens
The underlying issue is a missing or incomplete authorization layer at the object level, mapped to CWE-639: Authorization Bypass Through User-Controlled Key.
Controller actions trust user-supplied identifiers (e.g., record IDs in URL or form data) without revalidating that the current user is permitted to operate on that specific record.
This pattern occurs when access control is enforced only at a broad role or module level (e.g., "can manage leads") rather than enforcing fine-grained checks that bind each record to an owner or tenant and verify that relationship before performing updates or deletions.
Potential impact
- Authenticated users could edit CRM records owned by other users.
- Attackers may delete or soft-delete business-critical leads, organizations, quotes, and activities.
- Ownership of records could be reassigned, disrupting sales pipelines and accountability.
- Confidential customer or deal information might be exposed or altered.
- Data integrity issues could undermine reporting, forecasting, and audit trails.
General mitigation guidance
Effective mitigation focuses on enforcing consistent, centralized object-level authorization.
Common defensive patterns include:
- Implementing a reusable authorization layer that verifies ownership or tenant membership for each record before edit, update, or delete operations.
- Scoping all record queries by the current user or tenant context so that only permitted records can be retrieved or modified.
- Using access control policies (e.g., ACLs or policy classes) that encode which users or roles can access particular records based on ownership, teams, or assignments.
- Avoiding reliance on client-supplied identifiers alone; always bind operations to server-side lookups filtered by the current principal.
- Logging and monitoring sensitive record changes to support audit and anomaly detection.
How teams detect issues like this
Detection typically involves both code-level and runtime approaches:
- Static analysis / code review: Look for controller methods that accept record IDs from requests and call update or delete operations without verifying ownership or access policies.
- Access control review: Map out which controllers and routes expose record-level operations and verify that each path enforces consistent authorization checks.
- Security testing: Perform authenticated tests by attempting to access or modify records belonging to other users through ID tampering, including API endpoints.
- Policy enforcement: Use internal security guidelines or automated linters to flag direct use of user-controlled IDs without accompanying access checks or scoped queries.

