@cclabsnz/sf-audit 1.20.0 → 1.21.1

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.
package/CHANGELOG.md CHANGED
@@ -9,6 +9,33 @@ published note and carries the signed provenance attestation and CycloneDX SBOM
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [v1.21.1](https://github.com/cclabsnz/sf-audit-plugin/releases/tag/v1.21.1) — 2026-10-28
13
+
14
+ ### Fixed
15
+
16
+ - **The CORS allowlist check no longer overstates the risk.** Its findings said a wildcard origin enabled "token theft" and "authenticated cross-origin requests". An allowlist entry supplies no credential: script on an allowed origin can use the org's APIs from a user's browser only with a session ID or OAuth token it already has, except for a Lightning Out app shared with guest users. The findings now say so. Severity is unchanged.
17
+
18
+ ## [v1.21.0](https://github.com/cclabsnz/sf-audit-plugin/releases/tag/v1.21.0) — 2026-10-28
19
+
20
+ Findings and attack chains now name the MITRE ATT&CK techniques an attacker would use, and chain
21
+ steps are listed in the order an attack would run.
22
+
23
+ ### Added
24
+
25
+ - **MITRE ATT&CK techniques on findings.** A finding carries the techniques for the attacker capabilities it grants, never for the check that raised it: as `threats.attack` in JSON, an **ATT&CK** line in Markdown, `attack:<id>` rule tags in SARIF, and a technique label on each attack-chain step in Markdown and HTML (SARIF steps carry `attackTechniques`). Techniques are pinned to Enterprise ATT&CK v20.0, and only techniques whose id, name, tactics and fit are recorded in the verification worksheet are ever shown. Where a capability's usual technique does not fit a finding, the finding names its own or none.
26
+ - **Detection gaps say what goes unseen.** A finding showing that nothing alerts on suspicious logins carries the techniques it leaves unobserved (`threats.detects`, "leaves unobserved" in Markdown), kept apart from the techniques a finding grants.
27
+ - **Chain steps follow the ATT&CK tactic order.** Steps of named and potential chains are listed from the earliest tactic (initial access) to the latest (exfiltration, impact). Ordering moves steps only; the break point, severity and score are unchanged.
28
+
29
+ ### Changed
30
+
31
+ - **Active debug traces no longer count as an exposed secret.** The finding fires on a trace at any log level, and only View All Data users can read debug logs, so it grants no attacker capability. It no longer feeds `cred-theft-pivot`, nor the potential chain from an unauthenticated foothold to credential theft.
32
+ - **Wildcard and broad CORS origins no longer count as an exposed secret.** An allowlist entry exposes no stored credential; abusing one needs a controlled origin and a logged-in victim, and reaches only that user's own access. The findings keep their severity but no longer feed `cred-theft-pivot`, nor the potential chain from an unauthenticated foothold to credential theft.
33
+ - **Org-wide email spoofing no longer grants egress.** An address open to all profiles, or mail without DKIM, is a phishing surface rather than a channel for moving data.
34
+
35
+ ### Fixed
36
+
37
+ - **`cred-theft-pivot` needs an egress path among its steps.** It checked only that some finding granted egress, so exposed secrets plus a finding outside the chain (org-wide email spoofing, a session id in an outbound message) fired a CRITICAL chain with no egress step in it.
38
+
12
39
  ## [v1.20.0](https://github.com/cclabsnz/sf-audit-plugin/releases/tag/v1.20.0) — 2026-10-28
13
40
 
14
41
  Findings now say which threats they enable, and each named attack chain says who would run it and
@@ -9,6 +9,8 @@ export interface AttackChainStep {
9
9
  capabilityInferred?: true;
10
10
  /** The step belongs to the named chain's break point: fixing all such steps stops the chain (RULE-111). */
11
11
  breaksChain?: true;
12
+ /** Verified ATT&CK technique ids for `capability` as this step's finding grants it; absent when inferred (RULE-110, RULE-113). */
13
+ techniques?: string[];
12
14
  title?: string;
13
15
  severity?: RiskLevel;
14
16
  }
@@ -3,6 +3,11 @@ import type { Finding } from '../findings/Finding.js';
3
3
  export interface CapabilityEntry {
4
4
  grants?: Capability[];
5
5
  requires?: Capability[];
6
+ /**
7
+ * ATT&CK techniques for a granted capability where the capability's default
8
+ * (`CAPABILITY_TECHNIQUES`) does not fit this finding. An empty list means no technique fits.
9
+ */
10
+ techniques?: Partial<Record<Capability, string[]>>;
6
11
  }
7
12
  /**
8
13
  * The full attack model lives here: finding id → attacker capabilities it grants.
@@ -12,13 +12,13 @@ export const CAPABILITY_REGISTRY = {
12
12
  'guest-user-write-access': { grants: ['unauth-foothold', 'data-write', 'data-read'] },
13
13
  'guest-user-read-access': { grants: ['unauth-foothold', 'data-read'] },
14
14
  'guest-user-sharing-exposure': { grants: ['unauth-foothold', 'data-read'] },
15
- 'guest-user-baseline': { grants: ['unauth-foothold'] },
15
+ 'guest-user-baseline': { grants: ['unauth-foothold'], techniques: { 'unauth-foothold': [] } },
16
16
  // External / portal sharing
17
17
  'sharing-model-external-write': { grants: ['low-trust-authenticated', 'data-write', 'data-read-bulk'] },
18
18
  'sharing-model-external-read': { grants: ['low-trust-authenticated', 'data-read-bulk'] },
19
19
  // Apex / code execution surfaces
20
20
  'portal-exposed-apex-without-sharing': { grants: ['code-exec', 'data-read', 'data-write'] },
21
- 'soql-injection-risk': { grants: ['code-exec', 'data-read-bulk'] },
21
+ 'soql-injection-risk': { grants: ['code-exec', 'data-read-bulk'], techniques: { 'code-exec': [] } },
22
22
  // Sensitive data presence
23
23
  'field-level-security-high': { grants: ['data-read'] },
24
24
  'field-level-security-medium': { grants: ['data-read'] },
@@ -26,7 +26,8 @@ export const CAPABILITY_REGISTRY = {
26
26
  'hardcoded-credentials-found': { grants: ['credential-theft'] },
27
27
  'custom-labels-credential-value-match': { grants: ['credential-theft'] },
28
28
  'custom-labels-credential-name-match': { grants: ['credential-theft'] },
29
- 'debug-log-active-traces': { grants: ['credential-theft'] },
29
+ // Active debug traces grant nothing: reading debug logs needs View All Data, so a log reader
30
+ // already reads every record, and a trace at any level counts here, even one that logs no values.
30
31
  // Egress
31
32
  'named-credentials-inventory': { grants: ['external-egress'] },
32
33
  'named-credentials-http-endpoint': { grants: ['external-egress'] },
@@ -35,45 +36,46 @@ export const CAPABILITY_REGISTRY = {
35
36
  'users-modify-all-data': { grants: ['data-read-bulk', 'data-write'] },
36
37
  'users-view-all-data': { grants: ['data-read-bulk'] },
37
38
  'users-super-admin-combo': { grants: ['org-takeover'] },
38
- 'users-author-apex': { grants: ['code-exec', 'priv-esc'] },
39
+ 'users-author-apex': { grants: ['code-exec', 'priv-esc'], techniques: { 'priv-esc': ['T1648'] } },
39
40
  // New checks (Tasks 8–10)
40
41
  'guest-executable-apex-unprotected': { grants: ['code-exec', 'data-read-bulk', 'data-write'] },
41
42
  'guest-executable-apex-exposed': { grants: ['code-exec'] },
42
43
  // Sharing still bounds which records a guest reaches; SYSTEM_MODE lifts only CRUD/FLS on them.
43
44
  'guest-executable-apex-system-mode': { grants: ['code-exec', 'data-read'] },
44
- 'cors-wildcard-origin': { grants: ['credential-theft'] },
45
- 'cors-broad-origin': { grants: ['credential-theft'] },
46
- 'escalation-perms-found': { grants: ['priv-esc'] },
45
+ // CORS allowlist entries grant nothing: an entry exposes no stored credential. Abusing one needs
46
+ // control of a matching origin and a logged-in victim visiting it, and yields at most that user's
47
+ // own session-scoped access.
48
+ 'escalation-perms-found': { grants: ['priv-esc'], techniques: { 'priv-esc': ['T1098'] } },
47
49
  // Guest bulk-read surface (UI-API reachable) — the confirmed exfiltration sink
48
50
  'guest-object-exposure-public-owd': { grants: ['unauth-foothold', 'data-read-bulk'] },
49
51
  'guest-object-exposure-guest-owned': { grants: ['unauth-foothold', 'data-read-bulk'] },
50
52
  // Observed guest recon in EventLogFile — an active unauthenticated foothold
51
- 'guest-traffic-anomaly-recon': { grants: ['unauth-foothold'] },
52
- 'guest-traffic-anomaly-anonymizer': { grants: ['unauth-foothold'] },
53
+ 'guest-traffic-anomaly-recon': { grants: ['unauth-foothold'], techniques: { 'unauth-foothold': [] } },
54
+ 'guest-traffic-anomaly-anonymizer': { grants: ['unauth-foothold'], techniques: { 'unauth-foothold': [] } },
53
55
  // Guest API/Bulk access — programmatic unauthenticated bulk read / destruction
54
56
  'guest-api-access-enabled': { grants: ['unauth-foothold', 'data-read-bulk'] },
55
- 'guest-api-hard-delete': { grants: ['unauth-foothold', 'data-write'] },
57
+ 'guest-api-hard-delete': { grants: ['unauth-foothold', 'data-write'], techniques: { 'data-write': ['T1485'] } },
56
58
  // Guest enumeration of other USERS. The staff roster is the targeting asset behind credential
57
59
  // stuffing and phishing at named admins, and both of the first two paths expose every User record
58
60
  // on their own, so both are bulk reads. The object-level Read grant is not: it makes User
59
61
  // queryable but still needs a sharing path before it returns anyone else's record.
60
- 'guest-user-visibility-view-all-users': { grants: ['unauth-foothold', 'data-read-bulk'] },
61
- 'guest-user-visibility-owd': { grants: ['unauth-foothold', 'data-read-bulk'] },
62
- 'guest-user-visibility-object-read': { grants: ['unauth-foothold', 'data-read'] },
62
+ 'guest-user-visibility-view-all-users': { grants: ['unauth-foothold', 'data-read-bulk'], techniques: { 'data-read-bulk': ['T1087.004', 'T1213.004'] } },
63
+ 'guest-user-visibility-owd': { grants: ['unauth-foothold', 'data-read-bulk'], techniques: { 'data-read-bulk': ['T1087.004', 'T1213.004'] } },
64
+ 'guest-user-visibility-object-read': { grants: ['unauth-foothold', 'data-read'], techniques: { 'data-read': ['T1087.004', 'T1213.004'] } },
63
65
  // Classic Visualforce sites — a second unauthenticated foothold surface
64
- 'classic-sites-active': { grants: ['unauth-foothold'] },
66
+ 'classic-sites-active': { grants: ['unauth-foothold'], techniques: { 'unauth-foothold': [] } },
65
67
  // Mass data-export capability — a bulk-read sink for an authenticated actor
66
68
  'data-export-weekly-export': { grants: ['data-read-bulk'] },
67
69
  'data-export-bulk-api-viewall': { grants: ['data-read-bulk', 'data-write'] },
68
70
  // Impersonation / delegated-admin escalation
69
71
  'login-access-policy-delegated-admins': { grants: ['priv-esc'] },
70
- 'login-access-policy-login-as-enabled': { grants: ['priv-esc', 'data-read-bulk'] },
72
+ 'login-access-policy-login-as-enabled': { grants: ['priv-esc', 'data-read-bulk'], techniques: { 'priv-esc': ['T1078.004'] } },
71
73
  // External federation an attacker could ride in on
72
74
  'auth-providers-social': { grants: ['low-trust-authenticated'] },
73
75
  // Toxic permission combinations held by one user. Capabilities follow each combo's own stated
74
76
  // outcome — see COMBOS in SeparationOfDutiesCheck, where the ids are defined.
75
77
  'separation-of-duties-self-escalation': { grants: ['priv-esc', 'org-takeover'] },
76
- 'separation-of-duties-identity-takeover': { grants: ['priv-esc', 'org-takeover'] },
78
+ 'separation-of-duties-identity-takeover': { grants: ['priv-esc', 'org-takeover'], techniques: { 'priv-esc': ['T1556'] } },
77
79
  'separation-of-duties-grant-self-data': { grants: ['priv-esc', 'data-read-bulk'] },
78
80
  'separation-of-duties-code-and-data': { grants: ['code-exec', 'data-read-bulk', 'data-write'] },
79
81
  'separation-of-duties-external-exfil-channel': { grants: ['external-egress', 'data-read-bulk'] },
@@ -85,7 +87,7 @@ export const CAPABILITY_REGISTRY = {
85
87
  // 'portal-exposed-apex-without-sharing'. Screen flows need a user to drive them, so they do not
86
88
  // grant the unattended write that an autolaunched flow does.
87
89
  'flows-autolaunched-without-sharing': { grants: ['code-exec', 'data-read', 'data-write'] },
88
- 'flows-screen-without-sharing': { grants: ['code-exec', 'data-read'] },
90
+ 'flows-screen-without-sharing': { grants: ['code-exec', 'data-read'], techniques: { 'code-exec': [] } },
89
91
  // Sharing rules granting All Internal Users — bulk read for any authenticated employee. Internal
90
92
  // by definition, so this grants no 'low-trust-authenticated' entry point of its own.
91
93
  'public-group-sharing-exposure': { grants: ['data-read-bulk'] },
@@ -96,14 +98,14 @@ export const CAPABILITY_REGISTRY = {
96
98
  // 'guest-user-sharing-exposure' rather than the confirmed bulk-read sinks.
97
99
  'guest-record-access-policy-not-enforced': { grants: ['unauth-foothold', 'data-read'] },
98
100
  // Sensitive data present and readable — what every other capability is ultimately reaching for.
99
- 'encryption-coverage-unencrypted-sensitive': { grants: ['data-read'] },
101
+ 'encryption-coverage-unencrypted-sensitive': { grants: ['data-read'], techniques: { 'data-read': [] } },
100
102
  'sandbox-data-masking-pii-present': { grants: ['data-read'] },
101
103
  // Integration accounts holding permissions they do not use. Author Apex and Customize Application
102
104
  // deploy code that runs in system context, and the user-management permissions let the holder
103
105
  // grant itself the rest — the same reach as 'users-author-apex', on an account with long-lived
104
106
  // credentials and nobody watching. The unused-grant and dormancy findings grant nothing: an
105
107
  // unexercised permission is not a capability an attacker holds today.
106
- 'integration-least-privilege-escalation-permissions': { grants: ['code-exec', 'priv-esc'] },
108
+ 'integration-least-privilege-escalation-permissions': { grants: ['code-exec', 'priv-esc'], techniques: { 'priv-esc': ['T1098'] } },
107
109
  'integration-least-privilege-data-permissions': { grants: ['data-read-bulk'] },
108
110
  // Credentials in custom settings — the third place secrets hide, after hardcoded literals and
109
111
  // custom labels, both of which already grant here. A protected custom setting is readable by any
@@ -121,7 +123,7 @@ export const CAPABILITY_REGISTRY = {
121
123
  // A live session ID posted to an external endpoint. This is a credential leaving the org through
122
124
  // a supported feature rather than a flaw, which is exactly why it is easy to leave in place: the
123
125
  // receiving endpoint can act as the running user until the session expires.
124
- 'outbound-messages-session-id': { grants: ['credential-theft', 'external-egress'] },
126
+ 'outbound-messages-session-id': { grants: ['credential-theft', 'external-egress'], techniques: { 'credential-theft': ['T1528'] } },
125
127
  // Anonymously fetchable files: public Documents and static resources, served from a URL that
126
128
  // never reaches a login, and content distribution links that never expire or ask for a password.
127
129
  //
@@ -143,7 +145,7 @@ export const CAPABILITY_REGISTRY = {
143
145
  // already assumes they have. On its own it is a supported feature and harmless; it earns a
144
146
  // capability because 'sharing-model-external-*' grants reach to whoever holds an account, and
145
147
  // this is the finding that says anyone may hold one.
146
- 'experience-cloud-site-self-registration': { grants: ['low-trust-authenticated'] },
148
+ 'experience-cloud-site-self-registration': { grants: ['low-trust-authenticated'], techniques: { 'low-trust-authenticated': ['T1136.003', 'T1078.004'] } },
147
149
  // The "Full" OAuth scope gives a token the same API reach as the user who authorised it. The
148
150
  // never-expiring refresh token and the stale/unmatched token findings are deliberately absent:
149
151
  // persistence and disuse are evidence about a token, not reach an attacker holds, and they earn
@@ -160,19 +162,17 @@ export const CAPABILITY_REGISTRY = {
160
162
  'genai-prompt-template-grounding-untrusted': { grants: ['data-read'] },
161
163
  'data-cloud-data-space-default-overshared': { grants: ['data-read-bulk'] },
162
164
  'data-cloud-data-share-target-unconstrained': { grants: ['data-read-bulk'] },
163
- 'platform-event-subscriber-escalation': { grants: ['priv-esc', 'data-write'] },
165
+ 'platform-event-subscriber-escalation': { grants: ['priv-esc', 'data-write'], techniques: { 'priv-esc': ['T1546'] } },
164
166
  'flow-http-callout-hardcoded-secret': { grants: ['credential-theft', 'external-egress'] },
165
167
  'flow-http-callout-uncredentialed-endpoint': { grants: ['external-egress'] },
166
- 'oauth-device-flow-enabled': { grants: ['credential-theft'] },
167
- 'oauth-password-flow-enabled': { grants: ['credential-theft'] },
168
- 'delegated-authentication-admin-assigned': { grants: ['org-takeover'] },
169
- 'delegated-authentication-insecure-gateway': { grants: ['org-takeover'] },
168
+ 'oauth-device-flow-enabled': { grants: ['credential-theft'], techniques: { 'credential-theft': ['T1528'] } },
169
+ 'oauth-password-flow-enabled': { grants: ['credential-theft'], techniques: { 'credential-theft': ['T1110.003'] } },
170
+ 'delegated-authentication-admin-assigned': { grants: ['org-takeover'], techniques: { 'org-takeover': ['T1556.007'] } },
171
+ 'delegated-authentication-insecure-gateway': { grants: ['org-takeover'], techniques: { 'org-takeover': ['T1556.007'] } },
170
172
  'delegated-administration-groups-active': { grants: ['priv-esc'] },
171
- 'auth-provider-registration-handler-admin-exec': { grants: ['priv-esc', 'org-takeover'] },
172
- 'auth-provider-registration-handler-unverified-email-linking': { grants: ['priv-esc', 'org-takeover'] },
173
- 'inbound-email-handler-unauthenticated-execution': { grants: ['unauth-foothold', 'code-exec'] },
174
- 'org-wide-email-spoofing-all-profiles': { grants: ['external-egress'] },
175
- 'org-wide-email-spoofing-no-dkim': { grants: ['external-egress'] },
173
+ 'auth-provider-registration-handler-admin-exec': { grants: ['priv-esc', 'org-takeover'], techniques: { 'priv-esc': ['T1546'] } },
174
+ 'auth-provider-registration-handler-unverified-email-linking': { grants: ['priv-esc', 'org-takeover'], techniques: { 'priv-esc': ['T1078.004'] } },
175
+ 'inbound-email-handler-unauthenticated-execution': { grants: ['unauth-foothold', 'code-exec'], techniques: { 'code-exec': [] } },
176
176
  'external-account-hierarchy-super-users': { grants: ['data-read-bulk'] },
177
177
  'external-account-hierarchy-active': { grants: ['data-read-bulk'] },
178
178
  'restriction-rules-inactive': { grants: ['data-read-bulk'] },
@@ -8,6 +8,8 @@ export declare class ChainEngine {
8
8
  /** Record which (source, sink) capability pairs are already explained by a named chain. */
9
9
  private coveredSourceSinkPairs;
10
10
  private runEmergentPass;
11
+ /** A named chain's steps, break point marked, in tactic order; inferred steps keep their precondition group's place. */
12
+ private namedSteps;
11
13
  private label;
12
14
  }
13
15
  //# sourceMappingURL=ChainEngine.d.ts.map
@@ -1,5 +1,6 @@
1
1
  import { SOURCE_CAPS, HIGH_IMPACT_SINKS } from './Capability.js';
2
2
  import { capabilitiesFor } from './CapabilityRegistry.js';
3
+ import { orderStepsByTactic, techniquesForGrant } from '../threats/attack.js';
3
4
  import { NAMED_CHAINS, inGroup } from './namedChains.js';
4
5
  const SEVERITY_ORDER = {
5
6
  CRITICAL: 0, HIGH: 1, MEDIUM: 2, LOW: 3, INFO: 4,
@@ -40,16 +41,22 @@ export class ChainEngine {
40
41
  // named before potential, then by severity
41
42
  return (c.confidence === 'named' ? 0 : 100) + SEVERITY_ORDER[c.severity];
42
43
  }
43
- stepFor(f, grants) {
44
+ stepFor(f, grants, role) {
44
45
  const step = {
45
46
  findingId: f.id,
46
47
  checkId: f.checkId,
47
- capability: grants[0] ?? 'data-read',
48
+ capability: (role && grants.includes(role) ? role : grants[0]) ?? 'data-read',
48
49
  title: f.title,
49
50
  severity: f.riskLevel,
50
51
  };
51
- if (grants.length === 0)
52
+ if (grants.length === 0) {
52
53
  step.capabilityInferred = true;
54
+ }
55
+ else {
56
+ const techniques = techniquesForGrant(f.id, step.capability);
57
+ if (techniques.length)
58
+ step.techniques = techniques;
59
+ }
53
60
  return step;
54
61
  }
55
62
  runNamedPass(present, active, grantsByFinding) {
@@ -66,12 +73,7 @@ export class ChainEngine {
66
73
  narrative: def.narrative,
67
74
  remediation: def.remediation,
68
75
  abuseCase: { actor: def.abuseCase.actor, goal: def.abuseCase.goal, breakPoint: def.abuseCase.breakPointText },
69
- steps: members.map((f) => {
70
- const step = this.stepFor(f, grantsByFinding.get(f) ?? []);
71
- if (inGroup(f, def.abuseCase.preconditions[def.abuseCase.breakPoint]))
72
- step.breaksChain = true;
73
- return step;
74
- }),
76
+ steps: this.namedSteps(def, members, grantsByFinding),
75
77
  });
76
78
  }
77
79
  return out;
@@ -143,12 +145,26 @@ export class ChainEngine {
143
145
  narrative: `The org presents a ${this.label(src)} entry point and findings that grant ` +
144
146
  `${this.label(sink)}. Review whether these can be combined into an exploit path.`,
145
147
  remediation: 'Treat the contributing findings as a single risk: remediating any one of them breaks the path.',
146
- steps: members.map((f) => this.stepFor(f, grantsByFinding.get(f) ?? [])),
148
+ steps: orderStepsByTactic(members.map((f) => this.stepFor(f, grantsByFinding.get(f) ?? []))),
147
149
  });
148
150
  }
149
151
  }
150
152
  return out;
151
153
  }
154
+ /** A named chain's steps, break point marked, in tactic order; inferred steps keep their precondition group's place. */
155
+ namedSteps(def, members, grantsByFinding) {
156
+ const group = new Map();
157
+ const steps = members.map((f) => {
158
+ const g = def.abuseCase.preconditions.findIndex((p) => inGroup(f, p));
159
+ const step = this.stepFor(f, grantsByFinding.get(f) ?? [], def.abuseCase.preconditions[g]?.role);
160
+ if (inGroup(f, def.abuseCase.preconditions[def.abuseCase.breakPoint]))
161
+ step.breaksChain = true;
162
+ if (g >= 0)
163
+ group.set(step, g);
164
+ return step;
165
+ });
166
+ return orderStepsByTactic(steps, (s) => group.get(s));
167
+ }
152
168
  label(c) {
153
169
  return c.replace(/-/g, ' ');
154
170
  }
@@ -9,6 +9,11 @@ export interface FindingGroup {
9
9
  ids?: readonly string[];
10
10
  prefixes?: readonly string[];
11
11
  capabilities?: readonly Capability[];
12
+ /**
13
+ * The capability this group's findings contribute to the chain. A step shows it when its finding
14
+ * grants it; otherwise the step shows the finding's first grant. Matching never reads it.
15
+ */
16
+ role?: Capability;
12
17
  }
13
18
  /**
14
19
  * A named chain as a structured abuse case (RULE-110). `preconditions` are the groups `match()`
@@ -22,6 +27,14 @@ export interface AbuseCaseDef {
22
27
  breakPoint: number;
23
28
  /** What to fix to break the chain, in plain language for every output. */
24
29
  breakPointText: string;
30
+ /**
31
+ * ATT&CK tactics the chain's steps must start at and reach, in tactic order (RULE-117). Absent
32
+ * where the steps that would show them carry no verified technique.
33
+ */
34
+ tactics?: {
35
+ entry?: string;
36
+ goal?: string;
37
+ };
25
38
  }
26
39
  export interface NamedChainDef {
27
40
  id: string;
@@ -84,7 +84,6 @@ export const TAKEOVER_ADMIN_EVIDENCE = [
84
84
  // Exposed secrets: every finding here that grants credential-theft.
85
85
  export const EXPOSED_SECRETS = [
86
86
  'hardcoded-credentials-found', 'custom-labels-credential-value-match', 'custom-labels-credential-name-match',
87
- 'debug-log-active-traces', 'cors-wildcard-origin', 'cors-broad-origin',
88
87
  'flow-http-callout-hardcoded-secret', 'oauth-device-flow-enabled', 'oauth-password-flow-enabled',
89
88
  'custom-settings-credentials',
90
89
  ];
@@ -251,6 +250,7 @@ export const NAMED_CHAINS = [
251
250
  goal: 'read or change business data in bulk without logging in',
252
251
  preconditions: [{ ids: GUEST_EXPOSURE }, { ids: UNAUTH_EXFIL_STEPS }, { ids: UNAUTH_EXFIL_WIDENERS }, { capabilities: ['unauth-foothold'] }, { capabilities: ['code-exec', 'data-read-bulk', 'data-write'] }],
253
252
  breakPoint: 0,
253
+ tactics: { entry: 'initial-access', goal: 'collection' },
254
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
255
  },
256
256
  match(present, active) {
@@ -285,8 +285,9 @@ export const NAMED_CHAINS = [
285
285
  abuseCase: {
286
286
  actor: 'an unauthenticated visitor already probing the site',
287
287
  goal: 'map the guest-readable data and pull it',
288
- preconditions: [{ ids: GUEST_TRAFFIC }, { ids: GUEST_BULK_SURFACE }],
288
+ preconditions: [{ ids: GUEST_TRAFFIC }, { ids: GUEST_BULK_SURFACE, role: 'data-read-bulk' }],
289
289
  breakPoint: 1,
290
+ tactics: { entry: 'discovery', goal: 'collection' },
290
291
  breakPointText: 'Close the guest bulk-read surface: guest object exposure and guest visibility of users.',
291
292
  },
292
293
  match(_present, active) {
@@ -309,6 +310,7 @@ export const NAMED_CHAINS = [
309
310
  goal: 'take full control of the org',
310
311
  preconditions: [{ ids: LOW_TRUST_ENTRY }, { ids: NON_ADMIN_ESCALATION }, { ids: TAKEOVER_ADMIN_EVIDENCE }],
311
312
  breakPoint: 1,
313
+ tactics: { entry: 'initial-access', goal: 'privilege-escalation' },
312
314
  breakPointText: 'Remove every escalation permission held by someone who is not an administrator.',
313
315
  },
314
316
  match(_present, active) {
@@ -325,15 +327,16 @@ export const NAMED_CHAINS = [
325
327
  id: 'cred-theft-pivot',
326
328
  title: 'Credential theft to external pivot',
327
329
  severity: 'CRITICAL',
328
- narrative: 'Exposed secrets (hardcoded credentials, credentials in custom labels, debug logs, or broad CORS) ' +
329
- 'combine with an external egress path (named credential or remote site) to exfiltrate data to attacker infrastructure.',
330
- 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.',
331
333
  abuseCase: {
332
334
  actor: 'anyone who obtains an exposed secret',
333
335
  goal: 'use it to move data to infrastructure they control',
334
336
  preconditions: [{ ids: EXPOSED_SECRETS }, { ids: EGRESS_PATHS }, { capabilities: ['credential-theft'] }, { capabilities: ['external-egress'] }],
335
337
  breakPoint: 0,
336
- breakPointText: 'Rotate and remove every exposed secret: hardcoded credentials, credentials in custom settings or labels, active debug traces, broad CORS origins and enabled device or password OAuth flows.',
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.',
337
340
  },
338
341
  match(present, active) {
339
342
  if (!has(present, 'credential-theft', 'external-egress'))
@@ -343,6 +346,10 @@ export const NAMED_CHAINS = [
343
346
  if (byIds(active, EXPOSED_SECRETS).length === 0)
344
347
  return null;
345
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;
346
353
  return steps.length >= 2 ? steps : null;
347
354
  },
348
355
  },
@@ -355,8 +362,9 @@ export const NAMED_CHAINS = [
355
362
  abuseCase: {
356
363
  actor: 'a user who can reach injectable Apex',
357
364
  goal: 'read large datasets beyond their own access',
358
- preconditions: [{ ids: SOQL_INJECTION }, { ids: SOQL_READ_SINKS }, { capabilities: ['code-exec'] }],
365
+ preconditions: [{ ids: SOQL_INJECTION }, { ids: SOQL_READ_SINKS, role: 'data-read-bulk' }, { capabilities: ['code-exec'] }],
359
366
  breakPoint: 0,
367
+ tactics: { goal: 'collection' },
360
368
  breakPointText: 'Use bind variables in the injectable dynamic SOQL.',
361
369
  },
362
370
  match(present, active) {
@@ -446,6 +454,7 @@ export const NAMED_CHAINS = [
446
454
  goal: 'have the agent query records and send them out',
447
455
  preconditions: [{ prefixes: AGENT_QUERY_REACH }, { ids: AGENT_OUTBOUND, prefixes: STALE_TRUSTED_URL }, { ids: UNTRUSTED_INPUT }],
448
456
  breakPoint: 1,
457
+ tactics: { entry: 'initial-access' },
449
458
  breakPointText: 'Require confirmation on every outbound agent action and remove trusted domains you no longer control.',
450
459
  },
451
460
  match(_present, active) {
@@ -474,6 +483,7 @@ export const NAMED_CHAINS = [
474
483
  goal: 'read real production personal data under weaker controls',
475
484
  preconditions: [{ ids: SANDBOX_PII }, { ids: SANDBOX_WEAK_CONTROLS }],
476
485
  breakPoint: 0,
486
+ tactics: { entry: 'initial-access', goal: 'collection' },
477
487
  breakPointText: 'Mask the production personal data in the sandbox, or refresh it without production data.',
478
488
  },
479
489
  match(_present, active) {
@@ -501,6 +511,7 @@ export const NAMED_CHAINS = [
501
511
  goal: 'export business data in bulk without a record of it',
502
512
  preconditions: [{ ids: INSIDER_BROAD_READ }, { ids: INSIDER_BULK_EGRESS }, { ids: INSIDER_BLIND_SPOT }],
503
513
  breakPoint: 1,
514
+ tactics: { entry: 'collection', goal: 'exfiltration' },
504
515
  breakPointText: 'Restrict Weekly Data Export and bulk API export to a named few, and remove self-provisioned connected-app or API export channels.',
505
516
  },
506
517
  match(_present, active) {
@@ -529,6 +540,7 @@ export const NAMED_CHAINS = [
529
540
  goal: 'act without being detected or reconstructed afterwards',
530
541
  preconditions: [{ ids: DETECTION_BLIND_SPOTS }, { capabilities: EXPLOITABLE_ACCESS }],
531
542
  breakPoint: 0,
543
+ tactics: { entry: 'initial-access' },
532
544
  breakPointText: 'Restore detection: Event Monitoring with adequate retention, threat detection, a Transaction Security policy and SIEM forwarding.',
533
545
  },
534
546
  match(present, active) {
@@ -555,6 +567,7 @@ export const NAMED_CHAINS = [
555
567
  goal: 'take over a privileged account without a second factor',
556
568
  preconditions: [{ ids: MFA_WEAKNESS }, { ids: PRIVILEGED_ACCOUNTS }],
557
569
  breakPoint: 0,
570
+ tactics: { goal: 'privilege-escalation' },
558
571
  breakPointText: 'Enforce MFA for every user and remove trusted-IP ranges that bypass it.',
559
572
  },
560
573
  match(_present, active) {
@@ -596,6 +609,8 @@ export const NAMED_CHAINS = [
596
609
  goal: 'use standing API access that no login control sees',
597
610
  preconditions: [{ ids: OAUTH_STANDING }, { ids: OAUTH_UNCONTAINED }],
598
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.
599
614
  breakPointText: 'Replace Full scope with the scopes each integration uses, and set refresh tokens to expire.',
600
615
  },
601
616
  match(_present, active) {
@@ -634,6 +649,7 @@ export const NAMED_CHAINS = [
634
649
  goal: 'self-register and read more than their own records',
635
650
  preconditions: [{ ids: SELF_REGISTRATION }, { ids: PORTAL_REACH }, { ids: SOCIAL_SIGN_ON }],
636
651
  breakPoint: 0,
652
+ tactics: { entry: 'initial-access', goal: 'collection' },
637
653
  breakPointText: 'Turn off self-registration on the site.',
638
654
  },
639
655
  match(_present, active) {
@@ -671,6 +687,7 @@ export const NAMED_CHAINS = [
671
687
  goal: 'replay the session it receives as the running user',
672
688
  preconditions: [{ ids: SESSION_ID_LEAK }, { ids: SESSION_UNCHECKED }],
673
689
  breakPoint: 0,
690
+ tactics: { entry: 'credential-access' },
674
691
  breakPointText: 'Clear Send Session ID on the outbound message.',
675
692
  },
676
693
  match(_present, active) {
@@ -713,6 +730,7 @@ export const NAMED_CHAINS = [
713
730
  goal: 'collect org files outside every record control',
714
731
  preconditions: [{ ids: ANONYMOUS_FILES }, { ids: FILES_UNACCOUNTED }],
715
732
  breakPoint: 0,
733
+ tactics: { entry: 'collection' },
716
734
  breakPointText: 'Remove anonymous access to files: public documents and static resources, links without expiry or password, and guest file access.',
717
735
  },
718
736
  match(_present, active) {
@@ -782,6 +800,7 @@ export const NAMED_CHAINS = [
782
800
  goal: 'trigger privileged Apex without credentials',
783
801
  preconditions: [{ ids: OPEN_EMAIL_HANDLER }, { ids: EMAIL_FOLLOW_ON }, { capabilities: ['unauth-foothold'] }, { capabilities: ['code-exec'] }],
784
802
  breakPoint: 0,
803
+ tactics: { entry: 'initial-access', goal: 'execution' },
785
804
  breakPointText: 'Restrict the email service to authorised senders and reject mail that fails authentication.',
786
805
  },
787
806
  match(present, active) {
@@ -808,6 +827,7 @@ export const NAMED_CHAINS = [
808
827
  goal: 'publish an event that runs as a privileged user',
809
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'] }],
810
829
  breakPoint: 1,
830
+ tactics: { entry: 'initial-access', goal: 'privilege-escalation' },
811
831
  breakPointText: 'Run event subscribers as a dedicated least-privilege user, not Automated Process or an administrator.',
812
832
  },
813
833
  match(present, active) {
@@ -1,6 +1,6 @@
1
1
  import { buildAuditResult } from '../findings/scoring.js';
2
2
  import { getComplianceTags } from '../compliance/resolve.js';
3
- import { threatsFor } from '../threats/resolve.js';
3
+ import { threatsFor, withAttack } from '../threats/resolve.js';
4
4
  import { ChainEngine } from '../chains/ChainEngine.js';
5
5
  import { applyWaivers } from '../waivers/applyWaivers.js';
6
6
  import { permissionLabelsFor } from '../preflight/permissions.js';
@@ -95,7 +95,7 @@ export class CheckEngine {
95
95
  const result = await check.run(this.ctx);
96
96
  const tags = getComplianceTags(check.id);
97
97
  findings.push(...result.findings.map((f) => ({
98
- ...f, checkId: check.id, complianceTags: tags, threats: threatsFor(check.id, f.threats),
98
+ ...f, checkId: check.id, complianceTags: tags, threats: withAttack(f, threatsFor(check.id, f.threats)),
99
99
  })));
100
100
  if (result.metrics) {
101
101
  metrics = { ...metrics, ...result.metrics };
@@ -4,7 +4,7 @@ export declare class CorsAllowlistCheck implements SecurityCheck {
4
4
  readonly id = "cors-allowlist";
5
5
  readonly name = "CORS Allowlist";
6
6
  readonly category = "External Connectivity";
7
- readonly description = "Detects wildcard or overly broad CORS allowlist origins that let malicious sites make authenticated browser requests";
7
+ readonly description = "Detects wildcard or overly broad CORS allowlist origins, which widen the set of websites whose scripts can use the org's APIs from a user's browser";
8
8
  run(ctx: AuditContext): Promise<CheckResult>;
9
9
  }
10
10
  //# sourceMappingURL=CorsAllowlistCheck.d.ts.map
@@ -2,7 +2,7 @@ export class CorsAllowlistCheck {
2
2
  id = 'cors-allowlist';
3
3
  name = 'CORS Allowlist';
4
4
  category = 'External Connectivity';
5
- description = 'Detects wildcard or overly broad CORS allowlist origins that let malicious sites make authenticated browser requests';
5
+ description = 'Detects wildcard or overly broad CORS allowlist origins, which widen the set of websites whose scripts can use the org\'s APIs from a user\'s browser';
6
6
  async run(ctx) {
7
7
  const findings = [];
8
8
  const setupUrl = `${ctx.orgInfo.instanceUrl}/lightning/setup/CorsWhitelistEntries/home`;
@@ -31,7 +31,7 @@ export class CorsAllowlistCheck {
31
31
  riskLevel: 'LOW',
32
32
  passed: true,
33
33
  title: 'No CORS allowlist entries configured',
34
- detail: 'No cross-origin allowlist entries exist, so browser-based cross-origin token theft via CORS is not a concern.',
34
+ detail: 'No CORS allowlist entries exist, so scripts on other websites cannot use the org\'s REST-family APIs, Apex REST or Lightning Out from a user\'s browser. This setting does not affect server-to-server API access.',
35
35
  remediation: 'If CORS entries are added later, allow only exact, fully-qualified HTTPS origins.',
36
36
  });
37
37
  return { findings };
@@ -48,7 +48,10 @@ export class CorsAllowlistCheck {
48
48
  category: this.category,
49
49
  riskLevel: 'HIGH',
50
50
  title: `${wildcard.length} CORS allowlist entry(ies) use a full wildcard origin`,
51
- detail: 'A wildcard CORS origin lets ANY website make authenticated cross-origin requests to your org from a logged-in user\'s browser and read the responses, enabling session-scoped data and token theft.',
51
+ detail: 'A full wildcard origin lets scripts on any website use the org\'s REST APIs, Apex REST and Lightning Out from a user\'s browser and read the responses. ' +
52
+ 'These calls only work if the page supplies a session ID or OAuth access token; the allowlist entry does not provide one. ' +
53
+ 'The exception is a Lightning Out app shared with guest users, which any website can then run with guest access. ' +
54
+ 'Whatever the page does runs with the permissions of that token or session: it can read and change what that user can, within the token\'s scopes.',
52
55
  remediation: 'Replace wildcard origins with exact, fully-qualified HTTPS origins for each trusted application.',
53
56
  affectedItems: wildcard.map((r) => ({ label: r.UrlPattern, url: setupUrl, note: 'Full wildcard: remove immediately' })),
54
57
  });
@@ -59,7 +62,9 @@ export class CorsAllowlistCheck {
59
62
  category: this.category,
60
63
  riskLevel: 'MEDIUM',
61
64
  title: `${broad.length} CORS allowlist entry(ies) use a broad subdomain wildcard`,
62
- detail: 'Subdomain-wildcard CORS origins trust every current and future subdomain, widening the set of sites that can make authenticated cross-origin requests. A single compromised or attacker-controlled subdomain can steal session-scoped data.',
65
+ detail: 'A subdomain wildcard trusts every current and future subdomain of that domain. If any one of them is taken over or runs injected script, ' +
66
+ 'that script can use any Salesforce token or session available to it in the user\'s browser to read and change what that user can access. ' +
67
+ 'The entry itself exposes no stored credential.',
63
68
  remediation: 'Pin CORS origins to the exact subdomains that need access rather than a wildcard.',
64
69
  affectedItems: broad.map((r) => ({ label: r.UrlPattern, url: setupUrl, note: 'Broad wildcard: narrow to exact origins' })),
65
70
  });
@@ -172,7 +172,7 @@ export const CHECKS = [
172
172
  new CustomLabelsCredentialCheck(), // credentials stored in globally-readable labels
173
173
  new ReportFolderAccessCheck(), // public report folders — mass data exfiltration risk
174
174
  new EscalationPermsCheck(), // priv-esc permission cluster (chain ingredient)
175
- new CorsAllowlistCheck(), // wildcard/broad CORS origins (chain ingredient)
175
+ new CorsAllowlistCheck(), // wildcard/broad CORS origins
176
176
  new EmailSecurityCheck(), // inbound email services + send-as spoofing
177
177
  new OutboundMessagesCheck(), // outbound message session-id leak + cleartext endpoints
178
178
  new PublicContentExposureCheck(), // externally available Documents + public static resources
@@ -62,7 +62,7 @@ export const CHECK_META = {
62
62
  'custom-labels-credential': { effort: 'quick', impact: 'Credentials in custom labels are globally readable by all authenticated users via merge fields.' },
63
63
  'report-folder-access': { effort: 'quick', impact: 'Public report folders let any authenticated user view all reports and the data behind them: mass exfiltration.' },
64
64
  'escalation-perms': { effort: 'moderate', impact: 'Lateral-movement permissions let a compromised account grant itself more access and persist.' },
65
- 'cors-allowlist': { effort: 'quick', impact: 'Wildcard CORS origins let malicious sites make authenticated browser requests against the org.' },
65
+ 'cors-allowlist': { effort: 'quick', impact: 'Wildcard CORS origins let script on any matching website use a Salesforce token or session available to it to call the org\'s APIs from the user\'s browser; the entry itself supplies no credential.' },
66
66
  'guest-executable-apex': { effort: 'project', impact: 'Unauthenticated web users can execute Apex that bypasses sharing: bulk record exfiltration without login.' },
67
67
  'email-security': { effort: 'quick', impact: 'Unauthenticated inbound email services and all-profile send-as addresses let attackers trigger Apex or spoof internal senders.' },
68
68
  'outbound-messages': { effort: 'quick', impact: 'Outbound messages can ship a live session ID to external endpoints over cleartext: a direct session-hijack and exfiltration path.' },
@@ -1,6 +1,7 @@
1
1
  import { esc, firaFontFaceCss, INTERACTIVE_CSP_META } from '@cclabsnz/sf-core';
2
2
  import { renderAttackChainDagSvg } from './AttackChainDagRenderer.js';
3
3
  import { coverageSummary, coverageAdvice } from '../findings/coverage.js';
4
+ import { techniqueLabel } from '../threats/attack.js';
4
5
  import { unknownMetrics } from '../findings/unknownMetrics.js';
5
6
  const RISK_COLORS = {
6
7
  CRITICAL: '#dc2626',
@@ -194,7 +195,8 @@ export class HtmlRenderer {
194
195
  const dagSvg = renderAttackChainDagSvg(c, { theme: 'dark' });
195
196
  const steps = c.steps
196
197
  .map((s) => {
197
- const grants = s.capabilityInferred ? '' : `: grants <code>${esc(s.capability)}</code>`;
198
+ const technique = s.techniques?.length ? ` → ${esc(s.techniques.map(techniqueLabel).join(' · '))}` : '';
199
+ const grants = s.capabilityInferred ? '' : `: grants <code>${esc(s.capability)}</code>${technique}`;
198
200
  const cut = s.breaksChain ? ' <strong>✂ break point</strong>' : '';
199
201
  return `<li><strong>${esc(s.title ?? s.findingId)}</strong> (${esc(s.severity ?? '—')})${grants}${cut}</li>`;
200
202
  })
@@ -1,4 +1,5 @@
1
1
  import { coverageSummary, coverageAdvice } from '../findings/coverage.js';
2
+ import { techniqueLabel } from '../threats/attack.js';
2
3
  import { buildThreatView, threatRowStatusText, PRIVACY_COST_OF_LOGGING } from '../threats/view.js';
3
4
  function escapeMdCell(s) {
4
5
  return s.replace(/\\/g, '\\\\').replace(/\|/g, '\\|').replace(/\n/g, ' ');
@@ -9,6 +10,10 @@ function threatTags(f) {
9
10
  parts.push(`STRIDE ${f.threats.stride.join(' · ')}`);
10
11
  if (f.threats?.linddun?.length)
11
12
  parts.push(`LINDDUN ${f.threats.linddun.join(' · ')}`);
13
+ if (f.threats?.attack?.length)
14
+ parts.push(`ATT&CK ${f.threats.attack.join(' · ')}`);
15
+ if (f.threats?.detects?.length)
16
+ parts.push(`leaves unobserved: ${f.threats.detects.map(techniqueLabel).join(' · ')}`);
12
17
  return parts.join(' | ');
13
18
  }
14
19
  function threatTable(lines, rows) {
@@ -57,7 +62,8 @@ export class MarkdownRenderer {
57
62
  lines.push('**Steps:**');
58
63
  lines.push('');
59
64
  c.steps.forEach((s, i) => {
60
- const grants = s.capabilityInferred ? '' : `: grants \`${s.capability}\``;
65
+ const technique = s.techniques?.length ? ` → ${s.techniques.map(techniqueLabel).join(' · ')}` : '';
66
+ const grants = s.capabilityInferred ? '' : `: grants \`${s.capability}\`${technique}`;
61
67
  const cut = s.breaksChain ? ' ✂ _break point_' : '';
62
68
  lines.push(`${i + 1}. **${s.title ?? s.findingId}** (${s.severity ?? '—'})${grants}${cut}`);
63
69
  });
@@ -225,12 +225,18 @@ export class SarifRenderer {
225
225
  rules.set(ruleId, acc);
226
226
  }
227
227
  acc.worst = acc.worst ? maxRisk(acc.worst, chain.severity) : chain.severity;
228
+ for (const id of chain.steps.flatMap((s) => s.techniques ?? [])) {
229
+ const tag = `attack:${id}`;
230
+ if (!acc.rule.properties.tags.includes(tag))
231
+ acc.rule.properties.tags.push(tag);
232
+ }
228
233
  const stepLocation = (step, idx) => ({
229
234
  message: { text: `Step ${idx + 1}: ${step.title ?? step.findingId} (${step.findingId})` },
230
235
  logicalLocations: logicalLocations([step.findingId]),
231
236
  properties: {
232
237
  ...(step.capabilityInferred ? {} : { capability: step.capability }),
233
238
  ...(step.breaksChain ? { breaksChain: true } : {}),
239
+ ...(step.techniques?.length ? { attackTechniques: step.techniques } : {}),
234
240
  },
235
241
  });
236
242
  return {
@@ -0,0 +1,63 @@
1
+ import type { Capability } from '../chains/Capability.js';
2
+ import type { Finding } from '../findings/Finding.js';
3
+ /** The Enterprise ATT&CK release every technique below was checked against. */
4
+ export declare const ATTACK_RELEASE = "20.0";
5
+ /** The Enterprise matrix's tactic order in the pinned release, earliest stage first (RULE-116). */
6
+ export declare const ATTACK_TACTIC_ORDER: readonly string[];
7
+ export interface AttackTechnique {
8
+ id: string;
9
+ name: string;
10
+ /** Tactic short names as the pinned release spells them. */
11
+ tactics: string[];
12
+ release: string;
13
+ url: string;
14
+ /** Provenance gate: true only once id, name, tactics and fit are recorded in the verification worksheet. */
15
+ verified: boolean;
16
+ }
17
+ export declare const ATTACK_TECHNIQUES: Record<string, AttackTechnique>;
18
+ /**
19
+ * What an attacker does with each capability. A technique sits here only if it fits every finding
20
+ * that grants the capability; a finding it does not fit overrides it in its registry entry
21
+ * (`CapabilityEntry.techniques`).
22
+ */
23
+ export declare const CAPABILITY_TECHNIQUES: Record<Capability, string[]>;
24
+ /**
25
+ * Detection gaps: the technique a finding leaves unobserved (RULE-108). Never a technique the
26
+ * finding grants, and never added to a chain step.
27
+ */
28
+ export declare const DETECTION_GAP_TECHNIQUES: Record<string, string[]>;
29
+ /** RULE-109: on only while every capability has a verified technique. */
30
+ export declare const ATTACK_OUTPUT_ENABLED = true;
31
+ /** Verified techniques for one capability as granted by this finding id. */
32
+ export declare function techniquesForGrant(findingId: string, capability: Capability): string[];
33
+ /** Verified techniques for every capability the finding grants; none for capabilities it only requires. */
34
+ export declare function attackFor(finding: Finding): string[] | undefined;
35
+ /** Verified techniques this detection-gap finding leaves unobserved. */
36
+ export declare function detectsFor(finding: Finding): string[] | undefined;
37
+ /** "T1213.004 Customer Relationship Management Software" — for text outputs. */
38
+ export declare function techniqueLabel(id: string): string;
39
+ /** Capabilities with no verified technique; RULE-109 requires this to be empty while output is on. */
40
+ export declare function capabilitiesWithoutTechnique(): Capability[];
41
+ /** Position of the earliest tactic among these verified techniques; undefined when there are none. */
42
+ export declare function tacticRank(ids: readonly string[] | undefined): number | undefined;
43
+ /**
44
+ * Where a step sits in tactic order: its own techniques, or, when its finding has none, the
45
+ * default technique of the capability it grants. The default orders the step and is never
46
+ * rendered on it. An inferred step has no rank of its own.
47
+ */
48
+ export declare function stepTacticRank(step: {
49
+ capability: Capability;
50
+ capabilityInferred?: true;
51
+ techniques?: string[];
52
+ }): number | undefined;
53
+ /**
54
+ * Steps in ATT&CK tactic order (RULE-116). A step without a rank takes the earliest rank in its
55
+ * precondition group, else the rank of the group before it, else of the step before it; ties keep
56
+ * their order. Sorting changes no step, only where it is listed.
57
+ */
58
+ export declare function orderStepsByTactic<T extends {
59
+ capability: Capability;
60
+ capabilityInferred?: true;
61
+ techniques?: string[];
62
+ }>(steps: readonly T[], groupOf?: (step: T) => number | undefined): T[];
63
+ //# sourceMappingURL=attack.d.ts.map
@@ -0,0 +1,156 @@
1
+ // MITRE ATT&CK techniques. They attach to the attacker capabilities a finding grants, never to a
2
+ // check (RULE-106), and only verified techniques ever render (RULE-107, MN-059).
3
+ import { ALL_CAPABILITIES } from '../chains/Capability.js';
4
+ import { CAPABILITY_REGISTRY, capabilitiesFor } from '../chains/CapabilityRegistry.js';
5
+ /** The Enterprise ATT&CK release every technique below was checked against. */
6
+ export const ATTACK_RELEASE = '20.0';
7
+ /** The Enterprise matrix's tactic order in the pinned release, earliest stage first (RULE-116). */
8
+ export const ATTACK_TACTIC_ORDER = [
9
+ 'reconnaissance', 'resource-development', 'initial-access', 'execution', 'persistence',
10
+ 'privilege-escalation', 'stealth', 'defense-impairment', 'credential-access', 'discovery',
11
+ 'lateral-movement', 'collection', 'command-and-control', 'exfiltration', 'impact',
12
+ ];
13
+ function t(id, name, tactics, verified) {
14
+ return {
15
+ id, name, tactics, release: ATTACK_RELEASE,
16
+ url: `https://attack.mitre.org/techniques/${id.replace('.', '/')}`,
17
+ verified,
18
+ };
19
+ }
20
+ export const ATTACK_TECHNIQUES = {
21
+ 'T1190': t('T1190', 'Exploit Public-Facing Application', ['initial-access'], true),
22
+ 'T1078.004': t('T1078.004', 'Cloud Accounts', ['stealth', 'persistence', 'privilege-escalation', 'initial-access'], true),
23
+ 'T1213.004': t('T1213.004', 'Customer Relationship Management Software', ['collection'], true),
24
+ 'T1565.001': t('T1565.001', 'Stored Data Manipulation', ['impact'], true),
25
+ 'T1059.009': t('T1059.009', 'Cloud API', ['execution'], true),
26
+ 'T1552': t('T1552', 'Unsecured Credentials', ['credential-access'], true),
27
+ 'T1528': t('T1528', 'Steal Application Access Token', ['credential-access'], true),
28
+ 'T1110': t('T1110', 'Brute Force', ['credential-access'], true),
29
+ 'T1110.003': t('T1110.003', 'Password Spraying', ['credential-access'], true),
30
+ 'T1136.003': t('T1136.003', 'Cloud Account', ['persistence'], true),
31
+ 'T1087.004': t('T1087.004', 'Cloud Account', ['discovery'], true),
32
+ 'T1485': t('T1485', 'Data Destruction', ['impact'], true),
33
+ 'T1556': t('T1556', 'Modify Authentication Process', ['defense-impairment', 'persistence', 'credential-access'], true),
34
+ 'T1556.007': t('T1556.007', 'Hybrid Identity', ['defense-impairment', 'persistence', 'credential-access'], true),
35
+ 'T1098.003': t('T1098.003', 'Additional Cloud Roles', ['persistence', 'privilege-escalation'], true),
36
+ 'T1098': t('T1098', 'Account Manipulation', ['persistence', 'privilege-escalation'], true),
37
+ 'T1546': t('T1546', 'Event Triggered Execution', ['privilege-escalation', 'persistence'], true),
38
+ 'T1648': t('T1648', 'Serverless Execution', ['execution'], true),
39
+ 'T1567': t('T1567', 'Exfiltration Over Web Service', ['exfiltration'], true),
40
+ };
41
+ /**
42
+ * What an attacker does with each capability. A technique sits here only if it fits every finding
43
+ * that grants the capability; a finding it does not fit overrides it in its registry entry
44
+ * (`CapabilityEntry.techniques`).
45
+ */
46
+ export const CAPABILITY_TECHNIQUES = {
47
+ 'unauth-foothold': ['T1190'],
48
+ 'low-trust-authenticated': ['T1078.004'],
49
+ 'data-read': ['T1213.004'],
50
+ 'data-read-bulk': ['T1213.004'],
51
+ 'data-write': ['T1565.001'],
52
+ 'code-exec': ['T1059.009'],
53
+ 'credential-theft': ['T1552'],
54
+ 'priv-esc': ['T1098.003'],
55
+ 'org-takeover': ['T1098'],
56
+ 'external-egress': ['T1567'],
57
+ };
58
+ /**
59
+ * Detection gaps: the technique a finding leaves unobserved (RULE-108). Never a technique the
60
+ * finding grants, and never added to a chain step.
61
+ */
62
+ export const DETECTION_GAP_TECHNIQUES = {
63
+ // SBS-MON-003/004: nobody is alerted to suspicious logins or API anomalies, so password guessing
64
+ // and a stolen account in use go unnoticed.
65
+ 'siem-integration-not-detected': ['T1110', 'T1078.004'],
66
+ };
67
+ /** RULE-109: on only while every capability has a verified technique. */
68
+ export const ATTACK_OUTPUT_ENABLED = true;
69
+ function verifiedIds(ids) {
70
+ if (!ATTACK_OUTPUT_ENABLED || !ids)
71
+ return [];
72
+ return ids.filter((id) => ATTACK_TECHNIQUES[id]?.verified);
73
+ }
74
+ /** Verified techniques for one capability as granted by this finding id. */
75
+ export function techniquesForGrant(findingId, capability) {
76
+ const override = CAPABILITY_REGISTRY[findingId]?.techniques?.[capability];
77
+ return verifiedIds(override ?? CAPABILITY_TECHNIQUES[capability]);
78
+ }
79
+ /** Verified techniques for every capability the finding grants; none for capabilities it only requires. */
80
+ export function attackFor(finding) {
81
+ const out = new Set();
82
+ for (const cap of capabilitiesFor(finding).grants) {
83
+ for (const id of techniquesForGrant(finding.id, cap))
84
+ out.add(id);
85
+ }
86
+ return out.size ? [...out] : undefined;
87
+ }
88
+ /** Verified techniques this detection-gap finding leaves unobserved. */
89
+ export function detectsFor(finding) {
90
+ if (finding.passed || finding.inconclusive)
91
+ return undefined;
92
+ const ids = verifiedIds(DETECTION_GAP_TECHNIQUES[finding.id]);
93
+ return ids.length ? ids : undefined;
94
+ }
95
+ /** "T1213.004 Customer Relationship Management Software" — for text outputs. */
96
+ export function techniqueLabel(id) {
97
+ const tech = ATTACK_TECHNIQUES[id];
98
+ return tech ? `${tech.id} ${tech.name}` : id;
99
+ }
100
+ /** Capabilities with no verified technique; RULE-109 requires this to be empty while output is on. */
101
+ export function capabilitiesWithoutTechnique() {
102
+ return ALL_CAPABILITIES.filter((c) => !(CAPABILITY_TECHNIQUES[c] ?? []).some((id) => ATTACK_TECHNIQUES[id]?.verified));
103
+ }
104
+ /** Position of the earliest tactic among these verified techniques; undefined when there are none. */
105
+ export function tacticRank(ids) {
106
+ let best;
107
+ for (const id of verifiedIds(ids)) {
108
+ for (const tactic of ATTACK_TECHNIQUES[id].tactics) {
109
+ const i = ATTACK_TACTIC_ORDER.indexOf(tactic);
110
+ if (i >= 0 && (best === undefined || i < best))
111
+ best = i;
112
+ }
113
+ }
114
+ return best;
115
+ }
116
+ /**
117
+ * Where a step sits in tactic order: its own techniques, or, when its finding has none, the
118
+ * default technique of the capability it grants. The default orders the step and is never
119
+ * rendered on it. An inferred step has no rank of its own.
120
+ */
121
+ export function stepTacticRank(step) {
122
+ if (step.capabilityInferred)
123
+ return undefined;
124
+ return tacticRank(step.techniques) ?? tacticRank(CAPABILITY_TECHNIQUES[step.capability]);
125
+ }
126
+ /**
127
+ * Steps in ATT&CK tactic order (RULE-116). A step without a rank takes the earliest rank in its
128
+ * precondition group, else the rank of the group before it, else of the step before it; ties keep
129
+ * their order. Sorting changes no step, only where it is listed.
130
+ */
131
+ export function orderStepsByTactic(steps, groupOf = () => undefined) {
132
+ const own = steps.map((s) => stepTacticRank(s));
133
+ const groupRank = new Map();
134
+ steps.forEach((s, i) => {
135
+ const g = groupOf(s);
136
+ const r = own[i];
137
+ if (g === undefined || r === undefined)
138
+ return;
139
+ groupRank.set(g, Math.min(groupRank.get(g) ?? r, r));
140
+ });
141
+ const keys = [];
142
+ steps.forEach((s, i) => {
143
+ let key = own[i];
144
+ const g = groupOf(s);
145
+ if (key === undefined && g !== undefined) {
146
+ for (let k = g; k >= 0 && key === undefined; k--)
147
+ key = groupRank.get(k);
148
+ }
149
+ keys.push(key ?? (i > 0 ? keys[i - 1] : -1));
150
+ });
151
+ return steps
152
+ .map((s, i) => ({ s, i, key: keys[i] }))
153
+ .sort((a, b) => a.key - b.key || a.i - b.i)
154
+ .map((x) => x.s);
155
+ }
156
+ //# sourceMappingURL=attack.js.map
@@ -1,8 +1,11 @@
1
1
  import type { FindingThreats } from './types.js';
2
+ import type { Finding } from '../findings/Finding.js';
2
3
  /**
3
4
  * The threat categories for a finding of this check. A category list the check set inline on the
4
5
  * finding replaces the check-level entry for that taxonomy; the other taxonomy still comes from
5
6
  * the maps.
6
7
  */
7
8
  export declare function threatsFor(checkId: string, inline?: FindingThreats): FindingThreats | undefined;
9
+ /** Adds the finding's verified ATT&CK techniques, which follow its granted capabilities, not its check (RULE-106, RULE-108). */
10
+ export declare function withAttack(finding: Finding, threats: FindingThreats | undefined): FindingThreats | undefined;
8
11
  //# sourceMappingURL=resolve.d.ts.map
@@ -1,3 +1,4 @@
1
+ import { attackFor, detectsFor } from './attack.js';
1
2
  import { CHECK_STRIDE_MAP } from './stride.js';
2
3
  import { CHECK_LINDDUN_MAP } from './linddun.js';
3
4
  /**
@@ -15,4 +16,12 @@ export function threatsFor(checkId, inline) {
15
16
  out.linddun = [...linddun];
16
17
  return out.stride || out.linddun ? out : undefined;
17
18
  }
19
+ /** Adds the finding's verified ATT&CK techniques, which follow its granted capabilities, not its check (RULE-106, RULE-108). */
20
+ export function withAttack(finding, threats) {
21
+ const attack = attackFor(finding);
22
+ const detects = detectsFor(finding);
23
+ if (!attack && !detects)
24
+ return threats;
25
+ return { ...threats, ...(attack ? { attack } : {}), ...(detects ? { detects } : {}) };
26
+ }
18
27
  //# sourceMappingURL=resolve.js.map
@@ -8,6 +8,10 @@ export type LinddunCategory = 'L' | 'I' | 'Nr' | 'D' | 'DD' | 'U' | 'Nc';
8
8
  export interface FindingThreats {
9
9
  stride?: StrideCategory[];
10
10
  linddun?: LinddunCategory[];
11
+ /** Verified ATT&CK technique ids for the capabilities the finding grants (RULE-106). */
12
+ attack?: string[];
13
+ /** Verified ATT&CK technique ids a detection gap leaves unobserved (RULE-108). */
14
+ detects?: string[];
11
15
  }
12
16
  export declare const STRIDE_CATEGORIES: readonly StrideCategory[];
13
17
  export declare const LINDDUN_CATEGORIES: readonly LinddunCategory[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cclabsnz/sf-audit",
3
- "version": "1.20.0",
3
+ "version": "1.21.1",
4
4
  "description": "Read-only Salesforce security audit for the sf CLI: 109 checks, attack-chain correlation, A-F risk grading, compliance mapping, free EventLogFile capture, and Guest User Anomaly investigation.",
5
5
  "keywords": [
6
6
  "salesforce",