@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.
- package/CHANGELOG.md +52 -0
- package/lib/apps/apiLogSource.js +3 -2
- package/lib/chains/AttackChain.d.ts +14 -0
- package/lib/chains/CapabilityRegistry.d.ts +5 -0
- package/lib/chains/CapabilityRegistry.js +31 -31
- package/lib/chains/ChainEngine.d.ts +2 -0
- package/lib/chains/ChainEngine.js +31 -6
- package/lib/chains/namedChains.d.ts +85 -0
- package/lib/chains/namedChains.js +404 -210
- package/lib/checks/CheckEngine.js +5 -2
- package/lib/checks/impl/AgentActionSurfaceCheck.js +2 -13
- package/lib/checks/impl/AgentInventoryCheck.js +2 -15
- package/lib/checks/impl/ApexLoggingCheck.js +2 -0
- package/lib/checks/impl/GuestApiAccessCheck.js +2 -0
- package/lib/checks/impl/GuestUserAccessCheck.js +2 -0
- package/lib/checks/impl/UsersAndAdminsCheck.js +5 -5
- package/lib/checks/registry.js +1 -1
- package/lib/checks/support/missingObject.js +2 -1
- package/lib/checks/support/schema.js +1 -1
- package/lib/commands/audit/incident/collect.js +2 -1
- package/lib/findings/Finding.d.ts +7 -0
- package/lib/incident/collect/orgErrors.js +3 -1
- package/lib/incident/collect/streamGuestLogs.js +3 -2
- package/lib/lib/apiErrorText.d.ts +8 -0
- package/lib/lib/apiErrorText.js +15 -0
- package/lib/renderers/AttackChainDagRenderer.d.ts +5 -1
- package/lib/renderers/AttackChainDagRenderer.js +16 -31
- package/lib/renderers/ClientReportRenderer.js +4 -1
- package/lib/renderers/HtmlRenderer.js +12 -2
- package/lib/renderers/MarkdownRenderer.js +67 -2
- package/lib/renderers/SarifRenderer.js +16 -2
- package/lib/threats/attack.d.ts +63 -0
- package/lib/threats/attack.js +156 -0
- package/lib/threats/linddun.d.ts +3 -0
- package/lib/threats/linddun.js +40 -0
- package/lib/threats/resolve.d.ts +11 -0
- package/lib/threats/resolve.js +27 -0
- package/lib/threats/stride.d.ts +3 -0
- package/lib/threats/stride.js +120 -0
- package/lib/threats/types.d.ts +20 -0
- package/lib/threats/types.js +22 -0
- package/lib/threats/view.d.ts +27 -0
- package/lib/threats/view.js +51 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,58 @@ published note and carries the signed provenance attestation and CycloneDX SBOM
|
|
|
9
9
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
|
+
## [v1.21.0](https://github.com/cclabsnz/sf-audit-plugin/releases/tag/v1.21.0) — 2026-10-28
|
|
13
|
+
|
|
14
|
+
Findings and attack chains now name the MITRE ATT&CK techniques an attacker would use, and chain
|
|
15
|
+
steps are listed in the order an attack would run.
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- **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.
|
|
20
|
+
- **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.
|
|
21
|
+
- **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.
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- **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.
|
|
26
|
+
- **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.
|
|
27
|
+
- **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.
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- **`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.
|
|
32
|
+
|
|
33
|
+
## [v1.20.0](https://github.com/cclabsnz/sf-audit-plugin/releases/tag/v1.20.0) — 2026-10-28
|
|
34
|
+
|
|
35
|
+
Findings now say which threats they enable, and each named attack chain says who would run it and
|
|
36
|
+
which single fix stops it.
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
40
|
+
- **STRIDE and LINDDUN on every finding.** Each check is mapped to the STRIDE categories it guards (all 109 checks) and, where personal data is involved, to LINDDUN privacy categories (32 checks). Findings carry them as `threats` in JSON, as a **Threats:** line in Markdown, and as `stride:` / `linddun:` rule tags in SARIF. Tagging never changes severity, score or grade.
|
|
41
|
+
- **Threat view in the Markdown report.** One row per category, reading "N findings (from N checks)", "no findings from N checks", "not assessed in this run" or "not assessed by this tool". An empty category is never shown as assurance, and privacy and security readings of the same finding are kept apart, not netted against each other.
|
|
42
|
+
- **Named attack chains are abuse cases.** Every named chain states its actor, goal and preconditions, and its break point: the fix that stops the chain in every case it fires. Markdown, HTML and the executive report show "Abuse case:" and "Breaks the chain:", with the full remediation below it. SARIF chain results carry `abuseCase`, and break-point steps carry `breaksChain`.
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
|
|
46
|
+
- **The attack-chain diagram marks the proven break point** ("✂ BREAK POINT", on every step of a multi-step break point) instead of guessing one cut-point. Steps whose capability was inferred no longer show a capability label.
|
|
47
|
+
- Potential chains label their fix text "Recommended fixes" in Markdown, HTML and the executive report, since no single break point is proven for them.
|
|
48
|
+
- **`cred-theft-pivot` needs an exposed secret.** The chain now fires only when one of its steps exposes a credential (including credentials stored in custom settings), so orgs without one no longer show it.
|
|
49
|
+
- **Moves to `@cclabsnz/sf-core` 0.12.** `queryAll` now reads every page instead of stopping at the client's row limit, so reads that came back short on large orgs are complete.
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
|
|
53
|
+
- **The executive report's "Breaks the chain" line no longer shows the full remediation list.** It now names the break point; the full list follows as "Full remediation".
|
|
54
|
+
- **An expired session stops `incident collect` again.** sf-core 0.12 reports a failed log download as `INVALID_SESSION_ID` instead of "HTTP 401", so collect recorded every remaining log as failed instead of stopping. Error classifiers now read the error's code and status, not only its message.
|
|
55
|
+
- A Salesforce error that arrives with only a code (`INSUFFICIENT_ACCESS`, or `ERROR_HTTP_403` with no body) is classified as a permission problem in `incident collect` and the API log listing, and `ERROR_HTTP_404` counts as a missing object in the checks that probe for optional features.
|
|
56
|
+
- **A malformed agent query no longer reads as "Agentforce not enabled".** The AI & Agents checks counted `MALFORMED_QUERY` as an absent object, which became reachable with sf-core 0.12; they now share the missing-object test the other checks use, so a broken query is inconclusive.
|
|
57
|
+
- A failed download whose error body is empty now names its code and status (`ERROR_HTTP_403 HTTP 403`) in `incident collect` and the API log listing, instead of an empty reason.
|
|
58
|
+
- `users-and-admins` no longer advises raising `org-max-query-limit`, which no longer limits the read. When the assignment count differs from the rows read, it advises re-running the audit.
|
|
59
|
+
|
|
60
|
+
### Security
|
|
61
|
+
|
|
62
|
+
- `fast-uri` pinned to 3.1.9 or later, closing Dependabot alerts #44–47. (#181)
|
|
63
|
+
|
|
12
64
|
## [v1.19.0](https://github.com/cclabsnz/sf-audit-plugin/releases/tag/v1.19.0) — 2026-10-23
|
|
13
65
|
|
|
14
66
|
When the audit user cannot see who holds Modify All Data or View All Data, the report now says so
|
package/lib/apps/apiLogSource.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { mkdtempSync, readFileSync, rmSync } from 'node:fs';
|
|
2
2
|
import { tmpdir } from 'node:os';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
|
+
import { apiErrorText } from '../lib/apiErrorText.js';
|
|
4
5
|
export const API_LOG_TYPES = ['RestApi', 'BulkApi2', 'GraphQlQueryExecution', 'AuraRequest'];
|
|
5
6
|
/** Thrown when the EventLogFile listing itself fails: there is no usage to analyze at all. */
|
|
6
7
|
export class ApiLogListingError extends Error {
|
|
@@ -24,7 +25,7 @@ export async function downloadApiLogs(deps, since) {
|
|
|
24
25
|
`AND LogDate = LAST_N_DAYS:${since} ORDER BY LogDate DESC`);
|
|
25
26
|
}
|
|
26
27
|
catch (e) {
|
|
27
|
-
const msg =
|
|
28
|
+
const msg = apiErrorText(e);
|
|
28
29
|
const permission = /INSUFFICIENT_ACCESS|HTTP 403|INVALID_TYPE|not supported/i.test(msg);
|
|
29
30
|
throw new ApiLogListingError(permission
|
|
30
31
|
? `Cannot list API event logs: EventLogFile is not readable (the running user needs View Event Log Files, and the org needs Event Monitoring). ${msg}`
|
|
@@ -46,7 +47,7 @@ export async function downloadApiLogs(deps, since) {
|
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
catch (e) {
|
|
49
|
-
failed.push({ id: r.Id, eventType: r.EventType, error:
|
|
50
|
+
failed.push({ id: r.Id, eventType: r.EventType, error: apiErrorText(e) });
|
|
50
51
|
}
|
|
51
52
|
finally {
|
|
52
53
|
rmSync(tmp, { force: true });
|
|
@@ -5,9 +5,21 @@ export interface AttackChainStep {
|
|
|
5
5
|
checkId?: string;
|
|
6
6
|
/** The capability this step contributes to the chain. */
|
|
7
7
|
capability: Capability;
|
|
8
|
+
/** The finding grants no capability; `capability` is a fallback and is not rendered (RULE-110). */
|
|
9
|
+
capabilityInferred?: true;
|
|
10
|
+
/** The step belongs to the named chain's break point: fixing all such steps stops the chain (RULE-111). */
|
|
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[];
|
|
8
14
|
title?: string;
|
|
9
15
|
severity?: RiskLevel;
|
|
10
16
|
}
|
|
17
|
+
/** A named chain's abuse case as rendered: roles and plain language, never finding ids (RULE-112). */
|
|
18
|
+
export interface AttackChainAbuseCase {
|
|
19
|
+
actor: string;
|
|
20
|
+
goal: string;
|
|
21
|
+
breakPoint: string;
|
|
22
|
+
}
|
|
11
23
|
export interface AttackChain {
|
|
12
24
|
id: string;
|
|
13
25
|
title: string;
|
|
@@ -15,6 +27,8 @@ export interface AttackChain {
|
|
|
15
27
|
confidence: 'named' | 'potential';
|
|
16
28
|
narrative: string;
|
|
17
29
|
remediation: string;
|
|
30
|
+
/** Named chains only; potential chains have no proven break point. */
|
|
31
|
+
abuseCase?: AttackChainAbuseCase;
|
|
18
32
|
steps: AttackChainStep[];
|
|
19
33
|
}
|
|
20
34
|
//# sourceMappingURL=AttackChain.d.ts.map
|
|
@@ -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
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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,6 +1,7 @@
|
|
|
1
1
|
import { SOURCE_CAPS, HIGH_IMPACT_SINKS } from './Capability.js';
|
|
2
2
|
import { capabilitiesFor } from './CapabilityRegistry.js';
|
|
3
|
-
import {
|
|
3
|
+
import { orderStepsByTactic, techniquesForGrant } from '../threats/attack.js';
|
|
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,
|
|
6
7
|
};
|
|
@@ -40,14 +41,23 @@ 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
|
-
|
|
44
|
+
stepFor(f, grants, role) {
|
|
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
|
};
|
|
52
|
+
if (grants.length === 0) {
|
|
53
|
+
step.capabilityInferred = true;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
const techniques = techniquesForGrant(f.id, step.capability);
|
|
57
|
+
if (techniques.length)
|
|
58
|
+
step.techniques = techniques;
|
|
59
|
+
}
|
|
60
|
+
return step;
|
|
51
61
|
}
|
|
52
62
|
runNamedPass(present, active, grantsByFinding) {
|
|
53
63
|
const out = [];
|
|
@@ -62,7 +72,8 @@ export class ChainEngine {
|
|
|
62
72
|
confidence: 'named',
|
|
63
73
|
narrative: def.narrative,
|
|
64
74
|
remediation: def.remediation,
|
|
65
|
-
|
|
75
|
+
abuseCase: { actor: def.abuseCase.actor, goal: def.abuseCase.goal, breakPoint: def.abuseCase.breakPointText },
|
|
76
|
+
steps: this.namedSteps(def, members, grantsByFinding),
|
|
66
77
|
});
|
|
67
78
|
}
|
|
68
79
|
return out;
|
|
@@ -134,12 +145,26 @@ export class ChainEngine {
|
|
|
134
145
|
narrative: `The org presents a ${this.label(src)} entry point and findings that grant ` +
|
|
135
146
|
`${this.label(sink)}. Review whether these can be combined into an exploit path.`,
|
|
136
147
|
remediation: 'Treat the contributing findings as a single risk: remediating any one of them breaks the path.',
|
|
137
|
-
steps: members.map((f) => this.stepFor(f, grantsByFinding.get(f) ?? [])),
|
|
148
|
+
steps: orderStepsByTactic(members.map((f) => this.stepFor(f, grantsByFinding.get(f) ?? []))),
|
|
138
149
|
});
|
|
139
150
|
}
|
|
140
151
|
}
|
|
141
152
|
return out;
|
|
142
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
|
+
}
|
|
143
168
|
label(c) {
|
|
144
169
|
return c.replace(/-/g, ' ');
|
|
145
170
|
}
|
|
@@ -1,14 +1,99 @@
|
|
|
1
1
|
import type { RiskLevel } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { Finding } from '../findings/Finding.js';
|
|
3
3
|
import type { Capability } from './Capability.js';
|
|
4
|
+
/**
|
|
5
|
+
* Findings a chain reads: by exact id, by id prefix, or any finding granting one of the capabilities.
|
|
6
|
+
* A group is satisfied by any one member; a chain that needs two capabilities lists two groups.
|
|
7
|
+
*/
|
|
8
|
+
export interface FindingGroup {
|
|
9
|
+
ids?: readonly string[];
|
|
10
|
+
prefixes?: readonly string[];
|
|
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;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A named chain as a structured abuse case (RULE-110). `preconditions` are the groups `match()`
|
|
20
|
+
* reads, built from the same constants; `breakPoint` indexes the one group whose complete removal
|
|
21
|
+
* stops the chain (RULE-111). The prose fields name roles, never people or finding ids (RULE-112).
|
|
22
|
+
*/
|
|
23
|
+
export interface AbuseCaseDef {
|
|
24
|
+
actor: string;
|
|
25
|
+
goal: string;
|
|
26
|
+
preconditions: readonly FindingGroup[];
|
|
27
|
+
breakPoint: number;
|
|
28
|
+
/** What to fix to break the chain, in plain language for every output. */
|
|
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
|
+
};
|
|
38
|
+
}
|
|
4
39
|
export interface NamedChainDef {
|
|
5
40
|
id: string;
|
|
6
41
|
title: string;
|
|
7
42
|
severity: RiskLevel;
|
|
8
43
|
narrative: string;
|
|
9
44
|
remediation: string;
|
|
45
|
+
abuseCase: AbuseCaseDef;
|
|
10
46
|
/** Returns the member findings (chain steps) if present in this org, else null. */
|
|
11
47
|
match(present: Set<Capability>, active: Finding[]): Finding[] | null;
|
|
12
48
|
}
|
|
49
|
+
/** True when the finding belongs to the group (a capability group matches on granted capabilities). */
|
|
50
|
+
export declare function inGroup(f: Finding, g: FindingGroup): boolean;
|
|
51
|
+
export declare const GUEST_EXPOSURE: string[];
|
|
52
|
+
export declare const LOW_TRUST_ENTRY: string[];
|
|
53
|
+
export declare const NON_ADMIN_ESCALATION: string[];
|
|
54
|
+
export declare const UNAUTH_EXFIL_STEPS: string[];
|
|
55
|
+
export declare const UNAUTH_EXFIL_WIDENERS: string[];
|
|
56
|
+
export declare const GUEST_TRAFFIC: string[];
|
|
57
|
+
export declare const GUEST_BULK_SURFACE: string[];
|
|
58
|
+
export declare const TAKEOVER_ADMIN_EVIDENCE: string[];
|
|
59
|
+
export declare const EXPOSED_SECRETS: string[];
|
|
60
|
+
export declare const EGRESS_PATHS: string[];
|
|
61
|
+
export declare const SOQL_INJECTION: string[];
|
|
62
|
+
export declare const SOQL_READ_SINKS: string[];
|
|
63
|
+
export declare const AGENT_GUEST_CHANNEL: string[];
|
|
64
|
+
export declare const AGENT_PRIVILEGE: string[];
|
|
65
|
+
export declare const AGENT_WRITE_ACTIONS: string[];
|
|
66
|
+
export declare const ACTIVE_AGENTS: string[];
|
|
67
|
+
export declare const STALE_TRUSTED_URL: string[];
|
|
68
|
+
export declare const AGENT_NO_CAPTURE: string[];
|
|
69
|
+
export declare const AGENT_QUERY_REACH: string[];
|
|
70
|
+
export declare const AGENT_OUTBOUND: string[];
|
|
71
|
+
export declare const UNTRUSTED_INPUT: string[];
|
|
72
|
+
export declare const SANDBOX_PII: string[];
|
|
73
|
+
export declare const SANDBOX_WEAK_CONTROLS: string[];
|
|
74
|
+
export declare const INSIDER_BROAD_READ: string[];
|
|
75
|
+
export declare const INSIDER_BULK_EGRESS: string[];
|
|
76
|
+
export declare const INSIDER_BLIND_SPOT: string[];
|
|
77
|
+
export declare const DETECTION_BLIND_SPOTS: string[];
|
|
78
|
+
export declare const EXPLOITABLE_ACCESS: readonly Capability[];
|
|
79
|
+
export declare const MFA_WEAKNESS: string[];
|
|
80
|
+
export declare const PRIVILEGED_ACCOUNTS: string[];
|
|
81
|
+
export declare const OAUTH_STANDING: string[];
|
|
82
|
+
export declare const OAUTH_UNCONTAINED: string[];
|
|
83
|
+
export declare const SELF_REGISTRATION: string[];
|
|
84
|
+
export declare const PORTAL_REACH: string[];
|
|
85
|
+
export declare const SOCIAL_SIGN_ON: string[];
|
|
86
|
+
export declare const SESSION_ID_LEAK: string[];
|
|
87
|
+
export declare const SESSION_UNCHECKED: string[];
|
|
88
|
+
export declare const ANONYMOUS_FILES: string[];
|
|
89
|
+
export declare const FILES_UNACCOUNTED: string[];
|
|
90
|
+
export declare const VF_XSS: string[];
|
|
91
|
+
export declare const BROWSER_WEAKENED: string[];
|
|
92
|
+
export declare const SESSION_TARGETS: string[];
|
|
93
|
+
export declare const OPEN_EMAIL_HANDLER: string[];
|
|
94
|
+
export declare const EMAIL_FOLLOW_ON: string[];
|
|
95
|
+
export declare const EVENT_SUBSCRIBER_ESCALATION: string[];
|
|
96
|
+
export declare const EVENT_PUBLISHER_FOOTHOLD: string[];
|
|
97
|
+
export declare const EVENT_PRIVILEGED_TARGETS: string[];
|
|
13
98
|
export declare const NAMED_CHAINS: NamedChainDef[];
|
|
14
99
|
//# sourceMappingURL=namedChains.d.ts.map
|