@cclabsnz/sf-audit 1.19.0 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/lib/apps/apiLogSource.js +3 -2
  3. package/lib/chains/AttackChain.d.ts +14 -0
  4. package/lib/chains/CapabilityRegistry.d.ts +5 -0
  5. package/lib/chains/CapabilityRegistry.js +31 -31
  6. package/lib/chains/ChainEngine.d.ts +2 -0
  7. package/lib/chains/ChainEngine.js +31 -6
  8. package/lib/chains/namedChains.d.ts +85 -0
  9. package/lib/chains/namedChains.js +404 -210
  10. package/lib/checks/CheckEngine.js +5 -2
  11. package/lib/checks/impl/AgentActionSurfaceCheck.js +2 -13
  12. package/lib/checks/impl/AgentInventoryCheck.js +2 -15
  13. package/lib/checks/impl/ApexLoggingCheck.js +2 -0
  14. package/lib/checks/impl/GuestApiAccessCheck.js +2 -0
  15. package/lib/checks/impl/GuestUserAccessCheck.js +2 -0
  16. package/lib/checks/impl/UsersAndAdminsCheck.js +5 -5
  17. package/lib/checks/registry.js +1 -1
  18. package/lib/checks/support/missingObject.js +2 -1
  19. package/lib/checks/support/schema.js +1 -1
  20. package/lib/commands/audit/incident/collect.js +2 -1
  21. package/lib/findings/Finding.d.ts +7 -0
  22. package/lib/incident/collect/orgErrors.js +3 -1
  23. package/lib/incident/collect/streamGuestLogs.js +3 -2
  24. package/lib/lib/apiErrorText.d.ts +8 -0
  25. package/lib/lib/apiErrorText.js +15 -0
  26. package/lib/renderers/AttackChainDagRenderer.d.ts +5 -1
  27. package/lib/renderers/AttackChainDagRenderer.js +16 -31
  28. package/lib/renderers/ClientReportRenderer.js +4 -1
  29. package/lib/renderers/HtmlRenderer.js +12 -2
  30. package/lib/renderers/MarkdownRenderer.js +67 -2
  31. package/lib/renderers/SarifRenderer.js +16 -2
  32. package/lib/threats/attack.d.ts +63 -0
  33. package/lib/threats/attack.js +156 -0
  34. package/lib/threats/linddun.d.ts +3 -0
  35. package/lib/threats/linddun.js +40 -0
  36. package/lib/threats/resolve.d.ts +11 -0
  37. package/lib/threats/resolve.js +27 -0
  38. package/lib/threats/stride.d.ts +3 -0
  39. package/lib/threats/stride.js +120 -0
  40. package/lib/threats/types.d.ts +20 -0
  41. package/lib/threats/types.js +22 -0
  42. package/lib/threats/view.d.ts +27 -0
  43. package/lib/threats/view.js +51 -0
  44. package/package.json +3 -3
@@ -1,4 +1,17 @@
1
1
  import { capabilitiesFor } from './CapabilityRegistry.js';
2
+ /** True when the finding belongs to the group (a capability group matches on granted capabilities). */
3
+ export function inGroup(f, g) {
4
+ if (g.ids?.includes(f.id))
5
+ return true;
6
+ if (g.prefixes?.some((p) => f.id === p || f.id.startsWith(p)))
7
+ return true;
8
+ if (g.capabilities) {
9
+ const grants = capabilitiesFor(f).grants;
10
+ if (g.capabilities.some((c) => grants.includes(c)))
11
+ return true;
12
+ }
13
+ return false;
14
+ }
2
15
  const has = (s, ...caps) => caps.every((c) => s.has(c));
3
16
  const hasAny = (s, ...caps) => caps.some((c) => s.has(c));
4
17
  const byIds = (active, ids) => active.filter((f) => ids.includes(f.id));
@@ -8,7 +21,7 @@ const byPrefixes = (active, prefixes) => active.filter((f) => prefixes.some((p)
8
21
  // Findings that show an unauthenticated visitor can actually read, write or run something. A guest
9
22
  // user existing (`guest-user-baseline`) or a site being live (`classic-sites-active`) is a surface,
10
23
  // not an exposure: every org with a site has one. RULE-071.
11
- const GUEST_EXPOSURE = [
24
+ export const GUEST_EXPOSURE = [
12
25
  'guest-user-read-access', 'guest-user-write-access', 'guest-user-sharing-exposure',
13
26
  'guest-executable-apex-unprotected', 'guest-executable-apex-exposed', 'guest-executable-apex-system-mode',
14
27
  'guest-object-exposure-public-owd', 'guest-object-exposure-guest-owned',
@@ -19,19 +32,202 @@ const GUEST_EXPOSURE = [
19
32
  ];
20
33
  // Ways in for a low-trust principal: external users with public sharing, social sign-on,
21
34
  // self-registration, or a confirmed guest exposure. RULE-072.
22
- const LOW_TRUST_ENTRY = [
35
+ export const LOW_TRUST_ENTRY = [
23
36
  'sharing-model-external-read', 'sharing-model-external-write',
24
37
  'auth-providers-social', 'experience-cloud-site-self-registration',
25
38
  ...GUEST_EXPOSURE,
26
39
  ];
27
40
  // Escalations a non-admin can use. Admins holding admin permissions (`users-super-admin-combo`,
28
41
  // `users-author-apex`) are not an escalation: they already have the access. RULE-072.
29
- const NON_ADMIN_ESCALATION = [
42
+ export const NON_ADMIN_ESCALATION = [
30
43
  'escalation-perms-found', 'privileged-access-shadow-admins',
31
44
  'separation-of-duties-self-escalation', 'separation-of-duties-identity-takeover', 'separation-of-duties-grant-self-data',
32
45
  'login-access-policy-delegated-admins',
33
46
  'integration-least-privilege-escalation-permissions',
34
47
  ];
48
+ // Each chain's finding groups, shared by match() and its abuse case so the two cannot drift.
49
+ export const UNAUTH_EXFIL_STEPS = [
50
+ 'guest-user-read-access', 'guest-user-write-access', 'guest-user-sharing-exposure', 'guest-user-baseline',
51
+ 'guest-executable-apex-unprotected', 'guest-executable-apex-exposed', 'guest-executable-apex-system-mode',
52
+ 'guest-object-exposure-public-owd', 'guest-object-exposure-guest-owned',
53
+ 'guest-api-access-enabled', 'guest-api-hard-delete', 'classic-sites-active',
54
+ 'guest-user-visibility-view-all-users', 'guest-user-visibility-owd', 'guest-user-visibility-object-read',
55
+ 'portal-exposed-apex-without-sharing', 'sharing-model-external-read', 'sharing-model-external-write',
56
+ 'field-level-security-high', 'field-level-security-medium',
57
+ // The guardrail whose absence lets guest-owned records defeat a Private OWD, and the Flow
58
+ // analogue of portal-exposed Apex running without sharing.
59
+ 'guest-record-access-policy-not-enforced',
60
+ 'flows-autolaunched-without-sharing', 'flows-screen-without-sharing',
61
+ // An open inbound email handler grants unauth-foothold, so it must appear whenever it
62
+ // is what opened the gate.
63
+ 'inbound-email-handler-unauthenticated-execution',
64
+ ];
65
+ // Internal-only weaknesses that widen what a foothold reaches. They join as evidence but
66
+ // never count toward the floor: without a guest-side step they describe no unauthenticated path.
67
+ export const UNAUTH_EXFIL_WIDENERS = ['data-cloud-data-space-default-overshared', 'restriction-rules-inactive'];
68
+ export const GUEST_TRAFFIC = ['guest-traffic-anomaly-recon', 'guest-traffic-anomaly-anonymizer'];
69
+ // A readable User roster counts as an exposed surface in its own right — recon against an org
70
+ // that leaks its staff list is the same incident. The object-level Read grant is excluded: on
71
+ // its own it is not a confirmed exposure, and this chain asserts one already in progress.
72
+ export const GUEST_BULK_SURFACE = [
73
+ 'guest-object-exposure-public-owd', 'guest-object-exposure-guest-owned',
74
+ 'guest-user-visibility-view-all-users', 'guest-user-visibility-owd',
75
+ ];
76
+ // Admin powers: they widen what a takeover reaches but are not themselves the escalation.
77
+ export const TAKEOVER_ADMIN_EVIDENCE = [
78
+ 'users-super-admin-combo', 'users-author-apex', 'guest-user-baseline', 'login-access-policy-login-as-enabled',
79
+ 'separation-of-duties-code-and-data',
80
+ 'delegated-administration-groups-active',
81
+ 'auth-provider-registration-handler-admin-exec', 'auth-provider-registration-handler-unverified-email-linking',
82
+ 'delegated-authentication-admin-assigned', 'platform-event-subscriber-escalation',
83
+ ];
84
+ // Exposed secrets: every finding here that grants credential-theft.
85
+ export const EXPOSED_SECRETS = [
86
+ 'hardcoded-credentials-found', 'custom-labels-credential-value-match', 'custom-labels-credential-name-match',
87
+ 'flow-http-callout-hardcoded-secret', 'oauth-device-flow-enabled', 'oauth-password-flow-enabled',
88
+ 'custom-settings-credentials',
89
+ ];
90
+ export const EGRESS_PATHS = [
91
+ 'named-credentials-inventory', 'named-credentials-http-endpoint', 'remote-sites-inventory',
92
+ // A user who can stand up connected apps and bypass API access control has provisioned
93
+ // their own egress path.
94
+ 'separation-of-duties-external-exfil-channel',
95
+ ];
96
+ export const SOQL_INJECTION = ['soql-injection-risk'];
97
+ export const SOQL_READ_SINKS = [
98
+ 'sharing-model-external-read', 'sharing-model-external-write',
99
+ 'field-level-security-high', 'field-level-security-medium', 'users-view-all-data',
100
+ 'public-group-sharing-exposure', 'report-folder-access-public',
101
+ 'encryption-coverage-unencrypted-sensitive',
102
+ ];
103
+ export const AGENT_GUEST_CHANNEL = ['agent-channel-exposure-guest-'];
104
+ export const AGENT_PRIVILEGE = ['agent-user-privilege-admin-', 'agent-user-privilege-broad-write-'];
105
+ export const AGENT_WRITE_ACTIONS = ['agent-action-surface-write'];
106
+ export const ACTIVE_AGENTS = ['agent-inventory-summary'];
107
+ export const STALE_TRUSTED_URL = ['trusted-url-hygiene-unresolvable-', 'trusted-url-hygiene-parked-'];
108
+ export const AGENT_NO_CAPTURE = ['agent-monitoring-coverage-none'];
109
+ export const AGENT_QUERY_REACH = ['agent-query-reach-'];
110
+ // Egress: an outbound action that needs no confirmation, or a trusted domain anyone can claim.
111
+ export const AGENT_OUTBOUND = ['agent-outbound-actions-unconfirmed', 'agent-outbound-actions-unverified'];
112
+ // Where outsider text enters, when the org shows it. Evidence only: the chain fires without
113
+ // it, since Web-to-Lead, Web-to-Case and email exist in almost every org.
114
+ export const UNTRUSTED_INPUT = [
115
+ 'inbound-email-handler-unauthenticated-execution',
116
+ 'guest-user-write-access',
117
+ 'guest-object-exposure-guest-owned',
118
+ ];
119
+ export const SANDBOX_PII = ['sandbox-data-masking-pii-present'];
120
+ export const SANDBOX_WEAK_CONTROLS = [
121
+ 'internal-user-mfa-gaps', 'trusted-ip-broad-ranges', 'mfa-portal-users-without-enforcement',
122
+ 'public-group-sharing-exposure', 'report-folder-access-public', 'standard-profiles-in-use',
123
+ 'privileged-access-shadow-admins', 'sharing-model-external-read', 'sharing-model-external-write',
124
+ 'guest-user-read-access', 'guest-user-write-access', 'guest-user-sharing-exposure',
125
+ ];
126
+ export const INSIDER_BROAD_READ = [
127
+ 'public-group-sharing-exposure', 'report-folder-access-public',
128
+ 'users-view-all-data', 'users-modify-all-data',
129
+ // An unused Data Export or View All Users grant on an integration account is the same
130
+ // bulk-read reach as the other members of this set.
131
+ 'integration-least-privilege-data-permissions',
132
+ ];
133
+ export const INSIDER_BULK_EGRESS = [
134
+ 'data-export-weekly-export', 'data-export-bulk-api-viewall',
135
+ 'separation-of-duties-external-exfil-channel',
136
+ ];
137
+ export const INSIDER_BLIND_SPOT = [
138
+ 'event-monitoring-disabled', 'siem-integration-not-detected', 'event-monitoring-retention-short',
139
+ ];
140
+ export const DETECTION_BLIND_SPOTS = [
141
+ 'threat-detection-inactive', 'threat-detection-guest-anomaly-missing',
142
+ 'event-monitoring-disabled', 'event-monitoring-retention-short',
143
+ 'transaction-security-policy-none', 'siem-integration-not-detected', 'siem-retention-gap',
144
+ ];
145
+ export const EXPLOITABLE_ACCESS = ['unauth-foothold', 'priv-esc', 'org-takeover'];
146
+ export const MFA_WEAKNESS = ['trusted-ip-broad-ranges', 'internal-user-mfa-gaps', 'mfa-portal-users-without-enforcement'];
147
+ export const PRIVILEGED_ACCOUNTS = [
148
+ 'users-modify-all-data', 'users-view-all-data', 'users-super-admin-combo',
149
+ 'privileged-access-shadow-admins', 'separation-of-duties-self-escalation',
150
+ ];
151
+ // Standing reach: a token that can act broadly, and keeps being able to.
152
+ export const OAUTH_STANDING = [
153
+ 'connected-app-full-scope-infinite-token',
154
+ 'connected-app-full-scope',
155
+ 'connected-app-infinite-refresh-token',
156
+ ];
157
+ // What removes the containment or the observation. Any one of these turns standing access
158
+ // into access nobody is watching or limiting.
159
+ export const OAUTH_UNCONTAINED = [
160
+ // Nobody is reviewing it: tokens with no matching app, or long unused.
161
+ 'oauth-token-unmatched-app', 'oauth-token-stale', 'oauth-token-no-app-inventory',
162
+ // Nothing is limiting it: the network control that survives authorisation, removed.
163
+ 'connected-apps-bypass-ip', 'connected-apps-relax-ip', 'unrestricted-connected-apps',
164
+ 'connected-apps-long-session-timeout', 'admin-no-ip-restrictions',
165
+ // The authorising identity is worth more than it needs to be, so the token inherits more.
166
+ 'integration-least-privilege-escalation-permissions',
167
+ 'integration-least-privilege-data-permissions',
168
+ 'api-client-permission-assigned',
169
+ ];
170
+ export const SELF_REGISTRATION = ['experience-cloud-site-self-registration'];
171
+ // What an account is worth once obtained. Deliberately excludes report-folder-access-public:
172
+ // it is real for internal users, but a self-registered portal account is a Customer Community
173
+ // licence, which generally has no report access at all, so including it would overstate reach.
174
+ export const PORTAL_REACH = [
175
+ 'sharing-model-external-read', 'sharing-model-external-write',
176
+ 'portal-exposed-apex-without-sharing',
177
+ 'flows-autolaunched-without-sharing', 'flows-screen-without-sharing',
178
+ 'apex-rest-without-sharing',
179
+ 'external-account-hierarchy-super-users', 'external-account-hierarchy-active',
180
+ ];
181
+ // Social sign-on is a second way in rather than a requirement, so it joins as evidence when
182
+ // present but never gates the chain on its own.
183
+ export const SOCIAL_SIGN_ON = ['auth-providers-social'];
184
+ export const SESSION_ID_LEAK = ['outbound-messages-session-id'];
185
+ // Why a replayed session would not be stopped or seen. Any one is enough; the point of the
186
+ // chain is the credential leaving, and these say what happens next.
187
+ export const SESSION_UNCHECKED = [
188
+ // Disclosed in transit, so compromising the endpoint is not even required.
189
+ 'outbound-messages-cleartext',
190
+ // Nothing binds or shortens the session that was handed over.
191
+ 'session-hardening-risks', 'session-security-deviations',
192
+ 'admin-no-ip-restrictions', 'broad-ip-ranges',
193
+ // Nothing would record the replay.
194
+ 'event-monitoring-disabled', 'siem-integration-not-detected', 'threat-detection-inactive',
195
+ ];
196
+ export const ANONYMOUS_FILES = [
197
+ 'public-content-public-documents', 'public-content-public-static-resources',
198
+ 'content-links-no-expiry', 'content-links-no-password', 'content-links-stale',
199
+ 'guest-site-options-file-access',
200
+ ];
201
+ // No way to answer "what was in it" or "who took it". Classification and monitoring only:
202
+ // content-links-stale is a subset of content-links-no-expiry, so counting it on both sides
203
+ // would let one check satisfy the conjunction by itself.
204
+ export const FILES_UNACCOUNTED = [
205
+ 'data-classification-missing', 'data-encryption-not-detected',
206
+ 'event-monitoring-disabled', 'siem-integration-not-detected', 'threat-detection-inactive',
207
+ ];
208
+ export const VF_XSS = ['visualforce-xss-escape-false', 'visualforce-xss-js-merge-field', 'visualforce-xss-attr-merge-field'];
209
+ // The browser-side controls that would otherwise contain an injected script. Excludes
210
+ // 'experience-csp-verify', which asks the operator to confirm a setting rather than reporting
211
+ // a weakness — treating an advisory as a confirmed gap would inflate the chain.
212
+ export const BROWSER_WEAKENED = ['session-hardening-risks', 'csp-trusted-sites-insecure'];
213
+ // Somebody whose session is worth the trouble.
214
+ export const SESSION_TARGETS = [
215
+ 'users-super-admin-combo', 'privileged-access-shadow-admins',
216
+ 'users-modify-all-data', 'users-view-all-data',
217
+ 'separation-of-duties-self-escalation',
218
+ ];
219
+ export const OPEN_EMAIL_HANDLER = ['inbound-email-handler-unauthenticated-execution'];
220
+ export const EMAIL_FOLLOW_ON = [
221
+ 'apex-crud-fls-without-sharing', 'soql-injection-risk', 'portal-exposed-apex-without-sharing',
222
+ 'flows-autolaunched-without-sharing', 'users-modify-all-data', 'users-super-admin-combo',
223
+ 'privileged-access-shadow-admins',
224
+ ];
225
+ export const EVENT_SUBSCRIBER_ESCALATION = ['platform-event-subscriber-escalation'];
226
+ export const EVENT_PUBLISHER_FOOTHOLD = [
227
+ 'guest-user-read-access', 'guest-user-write-access', 'guest-user-sharing-exposure', 'guest-user-baseline',
228
+ 'sharing-model-external-read', 'sharing-model-external-write', 'experience-cloud-site-self-registration',
229
+ ];
230
+ export const EVENT_PRIVILEGED_TARGETS = ['users-super-admin-combo', 'users-modify-all-data', 'privileged-access-shadow-admins'];
35
231
  export const NAMED_CHAINS = [
36
232
  {
37
233
  id: 'unauth-bulk-exfil',
@@ -49,6 +245,14 @@ export const NAMED_CHAINS = [
49
245
  'and set external OWD to Private. Grant portal access only via sharing sets. Because the ' +
50
246
  'requests never reach a login page, tightening authentication does not mitigate this — the ' +
51
247
  'object permissions, sharing model and Apex sharing declarations are the controls that apply.',
248
+ abuseCase: {
249
+ actor: 'an unauthenticated site visitor',
250
+ goal: 'read or change business data in bulk without logging in',
251
+ preconditions: [{ ids: GUEST_EXPOSURE }, { ids: UNAUTH_EXFIL_STEPS }, { ids: UNAUTH_EXFIL_WIDENERS }, { capabilities: ['unauth-foothold'] }, { capabilities: ['code-exec', 'data-read-bulk', 'data-write'] }],
252
+ breakPoint: 0,
253
+ tactics: { entry: 'initial-access', goal: 'collection' },
254
+ breakPointText: 'Close every confirmed guest exposure: guest object and record access, guest-callable Apex, guest API access, guest visibility of users, the guest record-access policy, and unauthenticated email handlers.',
255
+ },
52
256
  match(present, active) {
53
257
  if (!has(present, 'unauth-foothold'))
54
258
  return null;
@@ -58,27 +262,10 @@ export const NAMED_CHAINS = [
58
262
  // to reach something.
59
263
  if (byIds(active, GUEST_EXPOSURE).length === 0)
60
264
  return null;
61
- const steps = byIds(active, [
62
- 'guest-user-read-access', 'guest-user-write-access', 'guest-user-sharing-exposure', 'guest-user-baseline',
63
- 'guest-executable-apex-unprotected', 'guest-executable-apex-exposed', 'guest-executable-apex-system-mode',
64
- 'guest-object-exposure-public-owd', 'guest-object-exposure-guest-owned',
65
- 'guest-api-access-enabled', 'guest-api-hard-delete', 'classic-sites-active',
66
- 'guest-user-visibility-view-all-users', 'guest-user-visibility-owd', 'guest-user-visibility-object-read',
67
- 'portal-exposed-apex-without-sharing', 'sharing-model-external-read', 'sharing-model-external-write',
68
- 'field-level-security-high', 'field-level-security-medium',
69
- // The guardrail whose absence lets guest-owned records defeat a Private OWD, and the Flow
70
- // analogue of portal-exposed Apex running without sharing.
71
- 'guest-record-access-policy-not-enforced',
72
- 'flows-autolaunched-without-sharing', 'flows-screen-without-sharing',
73
- // An open inbound email handler grants unauth-foothold, so it must appear whenever it
74
- // is what opened the gate.
75
- 'inbound-email-handler-unauthenticated-execution',
76
- ]);
265
+ const steps = byIds(active, UNAUTH_EXFIL_STEPS);
77
266
  if (steps.length < 2)
78
267
  return null;
79
- // Internal-only weaknesses that widen what a foothold reaches. They join as evidence but
80
- // never count toward the floor: without a guest-side step they describe no unauthenticated path.
81
- return [...steps, ...byIds(active, ['data-cloud-data-space-default-overshared', 'restriction-rules-inactive'])];
268
+ return [...steps, ...byIds(active, UNAUTH_EXFIL_WIDENERS)];
82
269
  },
83
270
  },
84
271
  {
@@ -95,15 +282,17 @@ export const NAMED_CHAINS = [
95
282
  remediation: 'Treat as an active incident: block the source IPs at the WAF/CDN, close the guest bulk-read surface ' +
96
283
  '(set external OWD to Private, strip guest object read, enforce "Secure guest user record access"), ' +
97
284
  'and preserve/forward the event logs before the short EventLogFile retention window closes.',
285
+ abuseCase: {
286
+ actor: 'an unauthenticated visitor already probing the site',
287
+ goal: 'map the guest-readable data and pull it',
288
+ preconditions: [{ ids: GUEST_TRAFFIC }, { ids: GUEST_BULK_SURFACE, role: 'data-read-bulk' }],
289
+ breakPoint: 1,
290
+ tactics: { entry: 'discovery', goal: 'collection' },
291
+ breakPointText: 'Close the guest bulk-read surface: guest object exposure and guest visibility of users.',
292
+ },
98
293
  match(_present, active) {
99
- const traffic = byIds(active, ['guest-traffic-anomaly-recon', 'guest-traffic-anomaly-anonymizer']);
100
- // A readable User roster counts as an exposed surface in its own right — recon against an org
101
- // that leaks its staff list is the same incident. The object-level Read grant is excluded: on
102
- // its own it is not a confirmed exposure, and this chain asserts one already in progress.
103
- const exposure = byIds(active, [
104
- 'guest-object-exposure-public-owd', 'guest-object-exposure-guest-owned',
105
- 'guest-user-visibility-view-all-users', 'guest-user-visibility-owd',
106
- ]);
294
+ const traffic = byIds(active, GUEST_TRAFFIC);
295
+ const exposure = byIds(active, GUEST_BULK_SURFACE);
107
296
  if (traffic.length === 0 || exposure.length === 0)
108
297
  return null;
109
298
  return [...traffic, ...exposure];
@@ -116,6 +305,14 @@ export const NAMED_CHAINS = [
116
305
  narrative: 'A low-trust authenticated user combines with a privilege-escalation permission ' +
117
306
  '(assign permission sets, manage users, author apex, modify metadata) to reach full org control.',
118
307
  remediation: 'Remove escalation permissions from non-admin profiles/permission sets and review who holds them.',
308
+ abuseCase: {
309
+ actor: 'a low-trust authenticated user (external, social sign-on, self-registered, or a guest with confirmed access)',
310
+ goal: 'take full control of the org',
311
+ preconditions: [{ ids: LOW_TRUST_ENTRY }, { ids: NON_ADMIN_ESCALATION }, { ids: TAKEOVER_ADMIN_EVIDENCE }],
312
+ breakPoint: 1,
313
+ tactics: { entry: 'initial-access', goal: 'privilege-escalation' },
314
+ breakPointText: 'Remove every escalation permission held by someone who is not an administrator.',
315
+ },
119
316
  match(_present, active) {
120
317
  // Both ends must be present: a way in for a low-trust principal, and an escalation that
121
318
  // principal could use. Admin-held power and a guest user merely existing join only as evidence.
@@ -123,39 +320,36 @@ export const NAMED_CHAINS = [
123
320
  const escalation = byIds(active, NON_ADMIN_ESCALATION);
124
321
  if (entry.length === 0 || escalation.length === 0)
125
322
  return null;
126
- return [
127
- ...entry,
128
- ...escalation,
129
- ...byIds(active, [
130
- // Admin powers: they widen what a takeover reaches but are not themselves the escalation.
131
- 'users-super-admin-combo', 'users-author-apex', 'guest-user-baseline', 'login-access-policy-login-as-enabled',
132
- 'separation-of-duties-code-and-data',
133
- 'delegated-administration-groups-active',
134
- 'auth-provider-registration-handler-admin-exec', 'auth-provider-registration-handler-unverified-email-linking',
135
- 'delegated-authentication-admin-assigned', 'platform-event-subscriber-escalation',
136
- ]),
137
- ];
323
+ return [...entry, ...escalation, ...byIds(active, TAKEOVER_ADMIN_EVIDENCE)];
138
324
  },
139
325
  },
140
326
  {
141
327
  id: 'cred-theft-pivot',
142
328
  title: 'Credential theft to external pivot',
143
329
  severity: 'CRITICAL',
144
- narrative: 'Exposed secrets (hardcoded credentials, credentials in custom labels, debug logs, or broad CORS) ' +
145
- 'combine with an external egress path (named credential or remote site) to exfiltrate data to attacker infrastructure.',
146
- remediation: 'Rotate and remove exposed secrets, tighten CORS origins, and review external callout endpoints.',
330
+ narrative: 'Exposed secrets (hardcoded credentials, credentials in custom labels or settings, or enabled device or password OAuth flows) ' +
331
+ 'combine with an external egress path (named credential, remote site or Flow callout) to exfiltrate data to attacker infrastructure.',
332
+ remediation: 'Rotate and remove exposed secrets, and review external callout endpoints.',
333
+ abuseCase: {
334
+ actor: 'anyone who obtains an exposed secret',
335
+ goal: 'use it to move data to infrastructure they control',
336
+ preconditions: [{ ids: EXPOSED_SECRETS }, { ids: EGRESS_PATHS }, { capabilities: ['credential-theft'] }, { capabilities: ['external-egress'] }],
337
+ breakPoint: 0,
338
+ tactics: { entry: 'credential-access', goal: 'exfiltration' },
339
+ breakPointText: 'Rotate and remove every exposed secret: hardcoded credentials, credentials in custom settings or labels, and enabled device or password OAuth flows.',
340
+ },
147
341
  match(present, active) {
148
342
  if (!has(present, 'credential-theft', 'external-egress'))
149
343
  return null;
150
- const steps = byIds(active, [
151
- 'hardcoded-credentials-found', 'custom-labels-credential-value-match', 'custom-labels-credential-name-match',
152
- 'debug-log-active-traces', 'cors-wildcard-origin', 'cors-broad-origin',
153
- 'named-credentials-inventory', 'named-credentials-http-endpoint', 'remote-sites-inventory',
154
- 'flow-http-callout-hardcoded-secret', 'oauth-device-flow-enabled', 'oauth-password-flow-enabled',
155
- // A user who can stand up connected apps and bypass API access control has provisioned
156
- // their own egress path.
157
- 'separation-of-duties-external-exfil-channel',
158
- ]);
344
+ // An exposed secret must be one of the steps: credential-theft granted elsewhere (a session id
345
+ // in an outbound message) is session-id-egress, and egress paths alone are no pivot. INT-012.
346
+ if (byIds(active, EXPOSED_SECRETS).length === 0)
347
+ return null;
348
+ const steps = byIds(active, [...EXPOSED_SECRETS, ...EGRESS_PATHS]);
349
+ // The egress must be one of the steps too: egress granted by a finding outside the chain would
350
+ // fire a pivot with no egress path in it.
351
+ if (!steps.some((s) => capabilitiesFor(s).grants.includes('external-egress')))
352
+ return null;
159
353
  return steps.length >= 2 ? steps : null;
160
354
  },
161
355
  },
@@ -165,18 +359,21 @@ export const NAMED_CHAINS = [
165
359
  severity: 'HIGH',
166
360
  narrative: 'Injectable dynamic SOQL combines with bulk data readability to let an attacker extract large datasets.',
167
361
  remediation: 'Use bind variables in all dynamic SOQL and enforce CRUD/FLS; restrict bulk read access.',
362
+ abuseCase: {
363
+ actor: 'a user who can reach injectable Apex',
364
+ goal: 'read large datasets beyond their own access',
365
+ preconditions: [{ ids: SOQL_INJECTION }, { ids: SOQL_READ_SINKS, role: 'data-read-bulk' }, { capabilities: ['code-exec'] }],
366
+ breakPoint: 0,
367
+ tactics: { goal: 'collection' },
368
+ breakPointText: 'Use bind variables in the injectable dynamic SOQL.',
369
+ },
168
370
  match(present, active) {
169
371
  if (!has(present, 'code-exec'))
170
372
  return null;
171
- const inj = byIds(active, ['soql-injection-risk']);
373
+ const inj = byIds(active, SOQL_INJECTION);
172
374
  if (inj.length === 0)
173
375
  return null;
174
- const sink = byIds(active, [
175
- 'sharing-model-external-read', 'sharing-model-external-write',
176
- 'field-level-security-high', 'field-level-security-medium', 'users-view-all-data',
177
- 'public-group-sharing-exposure', 'report-folder-access-public',
178
- 'encryption-coverage-unencrypted-sensitive',
179
- ]);
376
+ const sink = byIds(active, SOQL_READ_SINKS);
180
377
  return sink.length > 0 ? [...inj, ...sink] : null;
181
378
  },
182
379
  },
@@ -196,12 +393,17 @@ export const NAMED_CHAINS = [
196
393
  'support chat; the risk here is not the channel existing, it is the channel reaching a privileged agent.',
197
394
  remediation: 'Break any one link: remove the guest/public binding, scope the agent run-as user to least privilege, ' +
198
395
  'or remove write-capable actions from the exposed agent (and add confirmation/guardrails where they must stay).',
396
+ abuseCase: {
397
+ actor: 'an unauthenticated chat visitor',
398
+ goal: 'steer a privileged agent into reading, changing or deleting data',
399
+ preconditions: [{ prefixes: AGENT_GUEST_CHANNEL }, { prefixes: AGENT_PRIVILEGE }, { ids: AGENT_WRITE_ACTIONS }],
400
+ breakPoint: 0,
401
+ breakPointText: 'Remove the guest or public channel binding from the privileged agent.',
402
+ },
199
403
  match(_present, active) {
200
- const channel = byPrefixes(active, ['agent-channel-exposure-guest-']);
201
- const privilege = byPrefixes(active, [
202
- 'agent-user-privilege-admin-', 'agent-user-privilege-broad-write-',
203
- ]);
204
- const actions = byIds(active, ['agent-action-surface-write']);
404
+ const channel = byPrefixes(active, AGENT_GUEST_CHANNEL);
405
+ const privilege = byPrefixes(active, AGENT_PRIVILEGE);
406
+ const actions = byIds(active, AGENT_WRITE_ACTIONS);
205
407
  if (channel.length === 0 || privilege.length === 0 || actions.length === 0)
206
408
  return null;
207
409
  return [...channel, ...privilege, ...actions];
@@ -217,12 +419,17 @@ export const NAMED_CHAINS = [
217
419
  'into sending data to it, and nothing records or responds to the exfiltration.',
218
420
  remediation: 'Remove or reclaim the stale trusted domain immediately, then enable Event Monitoring (and pull agent logs ' +
219
421
  'with `sf audit events pull`) plus a Transaction Security policy so agent-driven exfiltration is detected.',
422
+ abuseCase: {
423
+ actor: 'an outsider who registers a lapsed allowlisted domain',
424
+ goal: 'receive data an injected agent sends there, with nothing recorded',
425
+ preconditions: [{ ids: ACTIVE_AGENTS }, { prefixes: STALE_TRUSTED_URL }, { ids: AGENT_NO_CAPTURE }],
426
+ breakPoint: 1,
427
+ breakPointText: 'Remove or reclaim every stale trusted domain.',
428
+ },
220
429
  match(_present, active) {
221
- const agents = byIds(active, ['agent-inventory-summary']);
222
- const staleUrl = byPrefixes(active, [
223
- 'trusted-url-hygiene-unresolvable-', 'trusted-url-hygiene-parked-',
224
- ]);
225
- const noCapture = byIds(active, ['agent-monitoring-coverage-none']);
430
+ const agents = byIds(active, ACTIVE_AGENTS);
431
+ const staleUrl = byPrefixes(active, STALE_TRUSTED_URL);
432
+ const noCapture = byIds(active, AGENT_NO_CAPTURE);
226
433
  if (agents.length === 0 || staleUrl.length === 0 || noCapture.length === 0)
227
434
  return null;
228
435
  return [...agents, ...staleUrl, ...noCapture];
@@ -242,22 +449,20 @@ export const NAMED_CHAINS = [
242
449
  remediation: 'Break any one link: remove open-ended querying from agents that read untrusted records, require user ' +
243
450
  'confirmation on every outbound action, remove CSP Trusted URLs whose domains you no longer control, or ' +
244
451
  'keep the agent that queries separate from the agent that sends.',
452
+ abuseCase: {
453
+ actor: 'an outsider who can put text in a record an agent reads',
454
+ goal: 'have the agent query records and send them out',
455
+ preconditions: [{ prefixes: AGENT_QUERY_REACH }, { ids: AGENT_OUTBOUND, prefixes: STALE_TRUSTED_URL }, { ids: UNTRUSTED_INPUT }],
456
+ breakPoint: 1,
457
+ tactics: { entry: 'initial-access' },
458
+ breakPointText: 'Require confirmation on every outbound agent action and remove trusted domains you no longer control.',
459
+ },
245
460
  match(_present, active) {
246
- const reach = byPrefixes(active, ['agent-query-reach-']);
247
- // Egress: an outbound action that needs no confirmation, or a trusted domain anyone can claim.
248
- const outbound = [
249
- ...byIds(active, ['agent-outbound-actions-unconfirmed', 'agent-outbound-actions-unverified']),
250
- ...byPrefixes(active, ['trusted-url-hygiene-parked-', 'trusted-url-hygiene-unresolvable-']),
251
- ];
461
+ const reach = byPrefixes(active, AGENT_QUERY_REACH);
462
+ const outbound = [...byIds(active, AGENT_OUTBOUND), ...byPrefixes(active, STALE_TRUSTED_URL)];
252
463
  if (reach.length === 0 || outbound.length === 0)
253
464
  return null;
254
- // Where outsider text enters, when the org shows it. Evidence only: the chain fires without
255
- // it, since Web-to-Lead, Web-to-Case and email exist in almost every org.
256
- const untrusted = byIds(active, [
257
- 'inbound-email-handler-unauthenticated-execution',
258
- 'guest-user-write-access',
259
- 'guest-object-exposure-guest-owned',
260
- ]);
465
+ const untrusted = byIds(active, UNTRUSTED_INPUT);
261
466
  return [...untrusted, ...reach, ...outbound];
262
467
  },
263
468
  },
@@ -273,16 +478,19 @@ export const NAMED_CHAINS = [
273
478
  remediation: 'Run Salesforce Data Mask on the sandbox (or refresh without production data), and bring its ' +
274
479
  'authentication and sharing configuration up to production standard for as long as real data ' +
275
480
  'remains in it.',
481
+ abuseCase: {
482
+ actor: 'anyone with access to the sandbox',
483
+ goal: 'read real production personal data under weaker controls',
484
+ preconditions: [{ ids: SANDBOX_PII }, { ids: SANDBOX_WEAK_CONTROLS }],
485
+ breakPoint: 0,
486
+ tactics: { entry: 'initial-access', goal: 'collection' },
487
+ breakPointText: 'Mask the production personal data in the sandbox, or refresh it without production data.',
488
+ },
276
489
  match(_present, active) {
277
- const pii = byIds(active, ['sandbox-data-masking-pii-present']);
490
+ const pii = byIds(active, SANDBOX_PII);
278
491
  if (pii.length === 0)
279
492
  return null;
280
- const weakControls = byIds(active, [
281
- 'internal-user-mfa-gaps', 'trusted-ip-broad-ranges', 'mfa-portal-users-without-enforcement',
282
- 'public-group-sharing-exposure', 'report-folder-access-public', 'standard-profiles-in-use',
283
- 'privileged-access-shadow-admins', 'sharing-model-external-read', 'sharing-model-external-write',
284
- 'guest-user-read-access', 'guest-user-write-access', 'guest-user-sharing-exposure',
285
- ]);
493
+ const weakControls = byIds(active, SANDBOX_WEAK_CONTROLS);
286
494
  return weakControls.length > 0 ? [...pii, ...weakControls] : null;
287
495
  },
288
496
  },
@@ -298,21 +506,18 @@ export const NAMED_CHAINS = [
298
506
  remediation: 'Narrow the broad internal sharing, restrict Weekly Data Export and Bulk API access to a named ' +
299
507
  'few, and enable Event Monitoring (plus forwarding to a SIEM) so bulk reads are recorded and ' +
300
508
  'alertable.',
509
+ abuseCase: {
510
+ actor: 'an internal user or whoever holds their stolen credentials',
511
+ goal: 'export business data in bulk without a record of it',
512
+ preconditions: [{ ids: INSIDER_BROAD_READ }, { ids: INSIDER_BULK_EGRESS }, { ids: INSIDER_BLIND_SPOT }],
513
+ breakPoint: 1,
514
+ tactics: { entry: 'collection', goal: 'exfiltration' },
515
+ breakPointText: 'Restrict Weekly Data Export and bulk API export to a named few, and remove self-provisioned connected-app or API export channels.',
516
+ },
301
517
  match(_present, active) {
302
- const broadRead = byIds(active, [
303
- 'public-group-sharing-exposure', 'report-folder-access-public',
304
- 'users-view-all-data', 'users-modify-all-data',
305
- // An unused Data Export or View All Users grant on an integration account is the same
306
- // bulk-read reach as the other members of this set.
307
- 'integration-least-privilege-data-permissions',
308
- ]);
309
- const bulkEgress = byIds(active, [
310
- 'data-export-weekly-export', 'data-export-bulk-api-viewall',
311
- 'separation-of-duties-external-exfil-channel',
312
- ]);
313
- const blindSpot = byIds(active, [
314
- 'event-monitoring-disabled', 'siem-integration-not-detected', 'event-monitoring-retention-short',
315
- ]);
518
+ const broadRead = byIds(active, INSIDER_BROAD_READ);
519
+ const bulkEgress = byIds(active, INSIDER_BULK_EGRESS);
520
+ const blindSpot = byIds(active, INSIDER_BLIND_SPOT);
316
521
  if (broadRead.length === 0 || bulkEgress.length === 0 || blindSpot.length === 0)
317
522
  return null;
318
523
  return [...broadRead, ...bulkEgress, ...blindSpot];
@@ -330,22 +535,23 @@ export const NAMED_CHAINS = [
330
535
  remediation: 'Close the detection gap first: enable Event Monitoring with adequate retention, turn on threat ' +
331
536
  'detection event storage, add a Transaction Security policy, and forward events to a SIEM. Then ' +
332
537
  'remediate the underlying access findings.',
538
+ abuseCase: {
539
+ actor: 'an attacker using an access path the org already exposes',
540
+ goal: 'act without being detected or reconstructed afterwards',
541
+ preconditions: [{ ids: DETECTION_BLIND_SPOTS }, { capabilities: EXPLOITABLE_ACCESS }],
542
+ breakPoint: 0,
543
+ tactics: { entry: 'initial-access' },
544
+ breakPointText: 'Restore detection: Event Monitoring with adequate retention, threat detection, a Transaction Security policy and SIEM forwarding.',
545
+ },
333
546
  match(present, active) {
334
- if (!hasAny(present, 'unauth-foothold', 'priv-esc', 'org-takeover'))
547
+ if (!hasAny(present, ...EXPLOITABLE_ACCESS))
335
548
  return null;
336
- const blindSpots = byIds(active, [
337
- 'threat-detection-inactive', 'threat-detection-guest-anomaly-missing',
338
- 'event-monitoring-disabled', 'event-monitoring-retention-short',
339
- 'transaction-security-policy-none', 'siem-integration-not-detected', 'siem-retention-gap',
340
- ]);
549
+ const blindSpots = byIds(active, DETECTION_BLIND_SPOTS);
341
550
  // One missing control is a finding on its own; two or more is a systemic blind spot. Requiring
342
551
  // two keeps this from firing on every org that has not bought Shield.
343
552
  if (blindSpots.length < 2)
344
553
  return null;
345
- const exposure = active.filter((f) => {
346
- const g = capabilitiesFor(f).grants;
347
- return g.includes('unauth-foothold') || g.includes('priv-esc') || g.includes('org-takeover');
348
- });
554
+ const exposure = active.filter((f) => inGroup(f, { capabilities: EXPLOITABLE_ACCESS }));
349
555
  return exposure.length > 0 ? [...exposure.slice(0, 3), ...blindSpots] : null;
350
556
  },
351
557
  },
@@ -356,14 +562,17 @@ export const NAMED_CHAINS = [
356
562
  narrative: 'Weak MFA enforcement or trusted-IP MFA bypass combines with the presence of highly-privileged ' +
357
563
  'accounts, so a credential-stuffing or phishing attacker can take over an admin without a second factor.',
358
564
  remediation: 'Enforce MFA for all internal users, remove trusted-IP MFA bypass ranges, and minimise privileged accounts.',
565
+ abuseCase: {
566
+ actor: 'a credential-stuffing or phishing attacker',
567
+ goal: 'take over a privileged account without a second factor',
568
+ preconditions: [{ ids: MFA_WEAKNESS }, { ids: PRIVILEGED_ACCOUNTS }],
569
+ breakPoint: 0,
570
+ tactics: { goal: 'privilege-escalation' },
571
+ breakPointText: 'Enforce MFA for every user and remove trusted-IP ranges that bypass it.',
572
+ },
359
573
  match(_present, active) {
360
- const weakness = byIds(active, [
361
- 'trusted-ip-broad-ranges', 'internal-user-mfa-gaps', 'mfa-portal-users-without-enforcement',
362
- ]);
363
- const targets = byIds(active, [
364
- 'users-modify-all-data', 'users-view-all-data', 'users-super-admin-combo',
365
- 'privileged-access-shadow-admins', 'separation-of-duties-self-escalation',
366
- ]);
574
+ const weakness = byIds(active, MFA_WEAKNESS);
575
+ const targets = byIds(active, PRIVILEGED_ACCOUNTS);
367
576
  return weakness.length > 0 && targets.length > 0 ? [...weakness, ...targets] : null;
368
577
  },
369
578
  },
@@ -395,28 +604,20 @@ export const NAMED_CHAINS = [
395
604
  'control still applying after authorisation. Treat a vendor breach notice as a trigger to ' +
396
605
  'revoke every token for that publisher rather than waiting to confirm your own org was ' +
397
606
  'touched: with no login row to search, absence of evidence is not evidence of absence here.',
607
+ abuseCase: {
608
+ actor: "the holder of a connected app's refresh token",
609
+ goal: 'use standing API access that no login control sees',
610
+ preconditions: [{ ids: OAUTH_STANDING }, { ids: OAUTH_UNCONTAINED }],
611
+ breakPoint: 0,
612
+ // No tactics declared: the token holder's own access carries no catalogued technique (T1550.001
613
+ // is not mapped), so the chain's first technique depends on which optional findings are present.
614
+ breakPointText: 'Replace Full scope with the scopes each integration uses, and set refresh tokens to expire.',
615
+ },
398
616
  match(_present, active) {
399
- // Standing reach: a token that can act broadly, and keeps being able to.
400
- const standing = byIds(active, [
401
- 'connected-app-full-scope-infinite-token',
402
- 'connected-app-full-scope',
403
- 'connected-app-infinite-refresh-token',
404
- ]);
617
+ const standing = byIds(active, OAUTH_STANDING);
405
618
  if (standing.length === 0)
406
619
  return null;
407
- // What removes the containment or the observation. Any one of these turns standing access
408
- // into access nobody is watching or limiting.
409
- const uncontained = byIds(active, [
410
- // Nobody is reviewing it: tokens with no matching app, or long unused.
411
- 'oauth-token-unmatched-app', 'oauth-token-stale', 'oauth-token-no-app-inventory',
412
- // Nothing is limiting it: the network control that survives authorisation, removed.
413
- 'connected-apps-bypass-ip', 'connected-apps-relax-ip', 'unrestricted-connected-apps',
414
- 'connected-apps-long-session-timeout', 'admin-no-ip-restrictions',
415
- // The authorising identity is worth more than it needs to be, so the token inherits more.
416
- 'integration-least-privilege-escalation-permissions',
417
- 'integration-least-privilege-data-permissions',
418
- 'api-client-permission-assigned',
419
- ]);
620
+ const uncontained = byIds(active, OAUTH_UNCONTAINED);
420
621
  if (uncontained.length === 0)
421
622
  return null;
422
623
  return [...standing, ...uncontained];
@@ -443,26 +644,22 @@ export const NAMED_CHAINS = [
443
644
  'and make sure Apex and Flows reachable from the site run with sharing. Check what the ' +
444
645
  'self-registration handler assigns as the default profile and licence — the exposure is ' +
445
646
  'whatever that profile can reach, and it is rarely reviewed after the site goes live.',
647
+ abuseCase: {
648
+ actor: 'anyone with an email address',
649
+ goal: 'self-register and read more than their own records',
650
+ preconditions: [{ ids: SELF_REGISTRATION }, { ids: PORTAL_REACH }, { ids: SOCIAL_SIGN_ON }],
651
+ breakPoint: 0,
652
+ tactics: { entry: 'initial-access', goal: 'collection' },
653
+ breakPointText: 'Turn off self-registration on the site.',
654
+ },
446
655
  match(_present, active) {
447
- const acquisition = byIds(active, ['experience-cloud-site-self-registration']);
656
+ const acquisition = byIds(active, SELF_REGISTRATION);
448
657
  if (acquisition.length === 0)
449
658
  return null;
450
- // What an account is worth once obtained. Deliberately excludes report-folder-access-public:
451
- // it is real for internal users, but a self-registered portal account is a Customer Community
452
- // licence, which generally has no report access at all, so including it would overstate reach.
453
- const reach = byIds(active, [
454
- 'sharing-model-external-read', 'sharing-model-external-write',
455
- 'portal-exposed-apex-without-sharing',
456
- 'flows-autolaunched-without-sharing', 'flows-screen-without-sharing',
457
- 'apex-rest-without-sharing',
458
- 'external-account-hierarchy-super-users', 'external-account-hierarchy-active',
459
- ]);
659
+ const reach = byIds(active, PORTAL_REACH);
460
660
  if (reach.length === 0)
461
661
  return null;
462
- // Social sign-on is a second way in rather than a requirement, so it joins as evidence when
463
- // present but never gates the chain on its own.
464
- const alsoOpen = byIds(active, ['auth-providers-social']);
465
- return [...acquisition, ...reach, ...alsoOpen];
662
+ return [...acquisition, ...reach, ...byIds(active, SOCIAL_SIGN_ON)];
466
663
  },
467
664
  },
468
665
  {
@@ -485,21 +682,19 @@ export const NAMED_CHAINS = [
485
682
  'endpoint is cleartext http://, treat the session as already disclosed and change it first, ' +
486
683
  'since anything on the path has seen it. Confirm the outbound message\'s running user is the ' +
487
684
  'least-privileged account that can do the job, because that is the reach being handed out.',
685
+ abuseCase: {
686
+ actor: 'whoever controls the outbound message endpoint',
687
+ goal: 'replay the session it receives as the running user',
688
+ preconditions: [{ ids: SESSION_ID_LEAK }, { ids: SESSION_UNCHECKED }],
689
+ breakPoint: 0,
690
+ tactics: { entry: 'credential-access' },
691
+ breakPointText: 'Clear Send Session ID on the outbound message.',
692
+ },
488
693
  match(_present, active) {
489
- const leak = byIds(active, ['outbound-messages-session-id']);
694
+ const leak = byIds(active, SESSION_ID_LEAK);
490
695
  if (leak.length === 0)
491
696
  return null;
492
- // Why a replayed session would not be stopped or seen. Any one is enough; the point of the
493
- // chain is the credential leaving, and these say what happens next.
494
- const unchecked = byIds(active, [
495
- // Disclosed in transit, so compromising the endpoint is not even required.
496
- 'outbound-messages-cleartext',
497
- // Nothing binds or shortens the session that was handed over.
498
- 'session-hardening-risks', 'session-security-deviations',
499
- 'admin-no-ip-restrictions', 'broad-ip-ranges',
500
- // Nothing would record the replay.
501
- 'event-monitoring-disabled', 'siem-integration-not-detected', 'threat-detection-inactive',
502
- ]);
697
+ const unchecked = byIds(active, SESSION_UNCHECKED);
503
698
  if (unchecked.length === 0)
504
699
  return null;
505
700
  return [...leak, ...unchecked];
@@ -530,21 +725,19 @@ export const NAMED_CHAINS = [
530
725
  'sites that do not depend on it. Treat any credential found in a static resource as ' +
531
726
  'disclosed and rotate it rather than removing the file, since the file has already been ' +
532
727
  'served and may be cached anywhere.',
728
+ abuseCase: {
729
+ actor: 'an anonymous internet caller',
730
+ goal: 'collect org files outside every record control',
731
+ preconditions: [{ ids: ANONYMOUS_FILES }, { ids: FILES_UNACCOUNTED }],
732
+ breakPoint: 0,
733
+ tactics: { entry: 'collection' },
734
+ breakPointText: 'Remove anonymous access to files: public documents and static resources, links without expiry or password, and guest file access.',
735
+ },
533
736
  match(_present, active) {
534
- const surface = byIds(active, [
535
- 'public-content-public-documents', 'public-content-public-static-resources',
536
- 'content-links-no-expiry', 'content-links-no-password', 'content-links-stale',
537
- 'guest-site-options-file-access',
538
- ]);
737
+ const surface = byIds(active, ANONYMOUS_FILES);
539
738
  if (surface.length === 0)
540
739
  return null;
541
- // No way to answer "what was in it" or "who took it". Classification and monitoring only:
542
- // content-links-stale is a subset of content-links-no-expiry, so counting it on both sides
543
- // would let one check satisfy the conjunction by itself.
544
- const unaccounted = byIds(active, [
545
- 'data-classification-missing', 'data-encryption-not-detected',
546
- 'event-monitoring-disabled', 'siem-integration-not-detected', 'threat-detection-inactive',
547
- ]);
740
+ const unaccounted = byIds(active, FILES_UNACCOUNTED);
548
741
  if (unaccounted.length === 0)
549
742
  return null;
550
743
  return [...surface, ...unaccounted];
@@ -573,26 +766,21 @@ export const NAMED_CHAINS = [
573
766
  'settings that deviate from the Salesforce baseline and replace insecure http:// CSP trusted ' +
574
767
  'sites with https:// equivalents, both of which widen what an injected script can do once it ' +
575
768
  'runs.',
769
+ abuseCase: {
770
+ actor: 'anyone who can influence a value the page renders',
771
+ goal: "run script in a privileged user's session",
772
+ preconditions: [{ ids: VF_XSS }, { ids: BROWSER_WEAKENED }, { ids: SESSION_TARGETS }],
773
+ breakPoint: 0,
774
+ breakPointText: 'Encode every flagged Visualforce output for the context it lands in.',
775
+ },
576
776
  match(_present, active) {
577
- const vector = byIds(active, [
578
- 'visualforce-xss-escape-false',
579
- 'visualforce-xss-js-merge-field',
580
- 'visualforce-xss-attr-merge-field',
581
- ]);
777
+ const vector = byIds(active, VF_XSS);
582
778
  if (vector.length === 0)
583
779
  return null;
584
- // The browser-side controls that would otherwise contain an injected script. Excludes
585
- // 'experience-csp-verify', which asks the operator to confirm a setting rather than reporting
586
- // a weakness — treating an advisory as a confirmed gap would inflate the chain.
587
- const weakened = byIds(active, ['session-hardening-risks', 'csp-trusted-sites-insecure']);
780
+ const weakened = byIds(active, BROWSER_WEAKENED);
588
781
  if (weakened.length === 0)
589
782
  return null;
590
- // Somebody whose session is worth the trouble.
591
- const targets = byIds(active, [
592
- 'users-super-admin-combo', 'privileged-access-shadow-admins',
593
- 'users-modify-all-data', 'users-view-all-data',
594
- 'separation-of-duties-self-escalation',
595
- ]);
783
+ const targets = byIds(active, SESSION_TARGETS);
596
784
  if (targets.length === 0)
597
785
  return null;
598
786
  return [...vector, ...weakened, ...targets];
@@ -607,17 +795,21 @@ export const NAMED_CHAINS = [
607
795
  'that bypasses CRUD/FLS and sharing. Attackers can trigger unattended data manipulation or code execution without credentials.',
608
796
  remediation: 'Populate AuthorizedSenders on each email service address, set AuthenticationFailureAction to reject spoofed email, ' +
609
797
  'and ensure email handler Apex classes enforce sharing, validate input, and execute as a dedicated least-privilege user.',
798
+ abuseCase: {
799
+ actor: 'any internet email sender',
800
+ goal: 'trigger privileged Apex without credentials',
801
+ preconditions: [{ ids: OPEN_EMAIL_HANDLER }, { ids: EMAIL_FOLLOW_ON }, { capabilities: ['unauth-foothold'] }, { capabilities: ['code-exec'] }],
802
+ breakPoint: 0,
803
+ tactics: { entry: 'initial-access', goal: 'execution' },
804
+ breakPointText: 'Restrict the email service to authorised senders and reject mail that fails authentication.',
805
+ },
610
806
  match(present, active) {
611
807
  if (!has(present, 'unauth-foothold', 'code-exec'))
612
808
  return null;
613
- const vector = byIds(active, ['inbound-email-handler-unauthenticated-execution']);
809
+ const vector = byIds(active, OPEN_EMAIL_HANDLER);
614
810
  if (vector.length === 0)
615
811
  return null;
616
- const followOn = byIds(active, [
617
- 'apex-crud-fls-without-sharing', 'soql-injection-risk', 'portal-exposed-apex-without-sharing',
618
- 'flows-autolaunched-without-sharing', 'users-modify-all-data', 'users-super-admin-combo',
619
- 'privileged-access-shadow-admins',
620
- ]);
812
+ const followOn = byIds(active, EMAIL_FOLLOW_ON);
621
813
  return followOn.length > 0 ? [...vector, ...followOn] : null;
622
814
  },
623
815
  },
@@ -630,24 +822,26 @@ export const NAMED_CHAINS = [
630
822
  'providing an unauthenticated or low-trust path to system-context privilege escalation and state tampering.',
631
823
  remediation: 'Revoke Create permissions on Platform Events from guest and Experience Cloud profiles. Configure ' +
632
824
  'PlatformEventSubscriberConfig to run event triggers as a dedicated least-privilege user rather than Automated Process or an admin.',
825
+ abuseCase: {
826
+ actor: 'a guest or portal user',
827
+ goal: 'publish an event that runs as a privileged user',
828
+ preconditions: [{ ids: EVENT_PUBLISHER_FOOTHOLD }, { ids: EVENT_SUBSCRIBER_ESCALATION }, { ids: EVENT_PRIVILEGED_TARGETS }, { capabilities: ['unauth-foothold', 'low-trust-authenticated'] }, { capabilities: ['priv-esc', 'data-write'] }],
829
+ breakPoint: 1,
830
+ tactics: { entry: 'initial-access', goal: 'privilege-escalation' },
831
+ breakPointText: 'Run event subscribers as a dedicated least-privilege user, not Automated Process or an administrator.',
832
+ },
633
833
  match(present, active) {
634
834
  if (!hasAny(present, 'unauth-foothold', 'low-trust-authenticated'))
635
835
  return null;
636
836
  if (!hasAny(present, 'priv-esc', 'data-write'))
637
837
  return null;
638
- const escalation = byIds(active, ['platform-event-subscriber-escalation']);
838
+ const escalation = byIds(active, EVENT_SUBSCRIBER_ESCALATION);
639
839
  if (escalation.length === 0)
640
840
  return null;
641
- const foothold = byIds(active, [
642
- 'guest-user-read-access', 'guest-user-write-access', 'guest-user-sharing-exposure', 'guest-user-baseline',
643
- 'sharing-model-external-read', 'sharing-model-external-write', 'experience-cloud-site-self-registration',
644
- ]);
841
+ const foothold = byIds(active, EVENT_PUBLISHER_FOOTHOLD);
645
842
  if (foothold.length === 0)
646
843
  return null;
647
- const targets = byIds(active, [
648
- 'users-super-admin-combo', 'users-modify-all-data', 'privileged-access-shadow-admins',
649
- ]);
650
- return [...foothold, ...escalation, ...targets];
844
+ return [...foothold, ...escalation, ...byIds(active, EVENT_PRIVILEGED_TARGETS)];
651
845
  },
652
846
  },
653
847
  ];