This lab explains how misuse of privileged Salesforce platform methods can bypass intended security controls and lead to account compromise, unauthorized actions, or data exposure when invoked without strict authorization and context validation.
Executive Summary
High privilege methods perform sensitive actions such as password operations, user state changes, privileged callouts, or execution in elevated contexts. These methods are not inherently vulnerable, but become exploitable when user-controlled inputs can reach them without robust authorization checks and business validation.
Security review should focus on exploitability: can a low-privilege or untrusted flow trigger a privileged operation outside intended policy?
Salesforce Attack Surface
Password and user lifecycle operations: methods that set, reset, or unlock user access
Administrative state changes: profile, permission, or role-affecting logic paths
Privileged integrations: Named Credential or system-context callouts acting on behalf of users
System-mode execution chains: controller and service methods running without effective user constraints
Generic utility controllers: methods exposing privileged actions through broad endpoints
Business Impact
Unauthorized account control: forced resets, lockout abuse, or session disruption
Explicit authorization gates: verify both role permission and business ownership before privileged actions
Context binding: bind target entity to authorized actor scope, never trust client-supplied target IDs alone
Least privilege execution: isolate privileged code to minimal, audited service layers
Defense in depth: pair method-level checks with CRUD/FLS/sharing validation where applicable
Operational controls: alerting and immutable audit logs for sensitive method invocation
// Safer pattern: enforce privilege and ownership before action
@AuraEnabled
public static void resetUserPassword(Id targetUserId) {
if (!FeatureManagement.checkPermission('Can_Reset_User_Password')) {
throw new SecurityException('Not authorized');
}
// Example business validation: caller can only manage users in allowed scope
User target = [SELECT Id, ManagerId FROM User WHERE Id = :targetUserId LIMIT 1];
if (target.ManagerId != UserInfo.getUserId()) {
throw new SecurityException('Target user out of scope');
}
System.resetPassword(targetUserId, true);
}
Verification Checklist
All high privilege methods are inventoried and linked to authorized use cases
Entry points enforce strict authorization before invoking privileged sinks
Target resources are validated against caller scope and ownership