Skip to content

Commit edecf70

Browse files
authored
Merge pull request #6 from DataDog/migrate_derivitive_to_parent_child
Migrate derivative to parent child
2 parents 9f68e81 + 7e22eae commit edecf70

70 files changed

Lines changed: 8624 additions & 5731 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/CLAUDE.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,42 @@ This document contains project-specific anti-patterns and style guidelines for w
77

88
## Anti-Patterns to Avoid
99

10-
### 1. Path Name Formatting
10+
### 1. Inconsistent Terminology for Parent/Variant Relationships
11+
12+
**WRONG:** Mixing terminology inconsistently
13+
- Using "child" in UI text
14+
- Using "primary" in YAML field names
15+
- Using "parent" in user-facing documentation
16+
17+
**CORRECT:** Use terminology appropriate to context
18+
- **In YAML/code**: Always use `parent` field name
19+
- **In UI/user-facing text**: Always use "Primary Technique" and "Variants"
20+
- **In comments**: Use "primary" and "variant" for clarity
21+
22+
**Rationale**: We maintain this hybrid approach for semantic clarity:
23+
- `parent` is concise and conventional in code (`parent.id`, `parent.modification`)
24+
- "Primary Technique" conveys foundational/original technique to users
25+
- "Variant" explains what the path IS (expanded applicability) not just hierarchy
26+
27+
See [Terminology section in CLAUDE.md](../CLAUDE.md#terminology-parentchild-vs-primaryvariant) for complete guidance.
28+
29+
### 2. Path Name Formatting
1130

1231
**WRONG:** `iam:PassRole+sagemaker:CreateTrainingJob`
1332

1433
**CORRECT:** `iam:PassRole + sagemaker:CreateTrainingJob`
1534

1635
Always include spaces before and after the `+` sign when combining multiple permissions in the `name` field.
1736

18-
### 2. PowerUserAccess is NOT Administrative Access
37+
### 3. PowerUserAccess is NOT Administrative Access
1938

2039
**WRONG:** `The role must have administrative permissions (e.g., AdministratorAccess or PowerUserAccess)`
2140

2241
**CORRECT:** `The role must have administrative permissions (e.g., AdministratorAccess or an equivalent custom policy)`
2342

2443
PowerUserAccess does NOT provide administrative permissions (it specifically excludes IAM actions). When describing administrative access requirements in prerequisites, use "AdministratorAccess or an equivalent custom policy" instead.
2544

26-
### 3. Description Field Line Breaks
45+
### 4. Description Field Line Breaks
2746

2847
**WRONG:**
2948
```yaml
@@ -38,15 +57,15 @@ description: A principal with `iam:PassRole` and `ec2:RunInstances` can create a
3857
3958
Descriptions should be single-line in YAML (no artificial line breaks at ~80 characters). They will flow naturally in the UI based on container width.
4059
41-
### 4. Missing Backticks for IAM Permissions
60+
### 5. Missing Backticks for IAM Permissions
4261
4362
**WRONG:** `A principal with iam:PassRole and ec2:RunInstances...`
4463

4564
**CORRECT:** ``A principal with `iam:PassRole` and `ec2:RunInstances`...``
4665

4766
All IAM permissions in descriptions, recommendations, and text should be formatted with backticks for code styling. This applies everywhere EXCEPT in the `name` field (which should be plain text).
4867

49-
### 5. Using Legacy Permission Format
68+
### 6. Using Legacy Permission Format
5069

5170
**WRONG (deprecated format):**
5271
```yaml

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @sethsec @christophetd @raesene @andrewkrug
1+
* @sethsec @christophetd @raesene @andrewkrug

CLAUDE.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,32 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
1919
3. **Website Layer**: Static HTML/CSS/JS site for browsing paths
2020
4. **CI/CD Layer**: GitHub Actions for validation and deployment
2121

22+
## Terminology: Parent/Child vs Primary/Variant
23+
24+
We use **different terminology in different contexts** for clarity and semantic meaning:
25+
26+
### In YAML Files and Code
27+
- **`parent` field**: Points to the parent path (e.g., `parent.id: iam-002`)
28+
- **Why**: Concise, follows common data structure conventions, natural for hierarchical references
29+
30+
### In UI and Documentation
31+
- **"Primary Technique"**: The foundational/original technique (what YAML calls the "parent")
32+
- **"Variant"**: A modification that expands applicability by removing prerequisites (what YAML calls the "child")
33+
- **Why**: Semantic clarity - "variant" explains WHAT it is, not just that there's a hierarchy
34+
35+
### Key Concepts
36+
- **Primary techniques** have no `parent` field - they are the foundational attacks
37+
- **Variant techniques** have a `parent` field with `id` and `modification`
38+
- **Variants add required permissions** that remove prerequisites from the primary technique
39+
- **Example**: IAM-002 (primary) requires < 2 keys. IAM-003 (variant) adds DeleteAccessKey to work even with 2 keys.
40+
41+
### When Contributing
42+
- In YAML: Use `parent` field for variants
43+
- In documentation/comments: Refer to "primary techniques" and "variants"
44+
- In UI text: Display "Primary Technique" and "Variants (N)"
45+
46+
See [SCHEMA.md](SCHEMA.md#parent-object-optional) for detailed parent/child relationship criteria.
47+
2248
## Quick Start Commands
2349

2450
### Essential Commands

SCHEMA.md

Lines changed: 110 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,23 @@ This document defines the YAML schema used for documenting AWS IAM privilege esc
44

55
## Schema Version
66

7-
Current version: `1.4.0`
7+
Current version: `1.6.0`
88

99
### Version History
1010

11+
#### Version 1.6.0 (2025-01-15)
12+
- **Breaking change**: `parent` field changed from string to nested object
13+
- Added `parent.id` (string, required if parent present): The parent path ID
14+
- Added `parent.modification` (string, required if parent present): Explanation of what permission(s) the child adds to remove a prerequisite
15+
- Clarifies parent/child relationship: child adds required permission(s) that expand attack applicability by removing parent's prerequisites
16+
- Parent/child is specifically for variants where child works in scenarios where parent fails
17+
18+
#### Version 1.5.0 (2025-01-15)
19+
- Added `parent` optional field for structured parent-child relationships between paths
20+
- Enables filtering for primary vs. variant techniques
21+
- Supports programmatic discovery of technique families
22+
- Works alongside `discoveryAttribution.derivativeOf` for comprehensive lineage tracking
23+
1124
#### Version 1.4.0 (2025-01-11)
1225
- Added `detectionTools` optional field for documenting open source detection tool coverage
1326
- Tool metadata (names, descriptions, GitHub links) stored in `metadata.json`
@@ -349,6 +362,102 @@ discoveryAttribution:
349362

350363
### Optional Fields
351364

365+
#### `parent` (object, optional)
366+
Defines a parent-child relationship when this path is a variant that adds required permission(s) to bypass a prerequisite of the parent technique.
367+
368+
This field creates a structured parent-child relationship between paths, enabling:
369+
- Easy filtering for primary vs. variant paths in the UI
370+
- Programmatic discovery of related techniques
371+
- Clear explanation of what makes the child variant necessary
372+
373+
**Parent object structure:**
374+
- `id` (string, required): The parent path ID
375+
- `modification` (string, required): Explanation of what required permission(s) this child adds and which prerequisite it removes/bypasses
376+
377+
**Terminology Note:**
378+
We use different terminology in different contexts for clarity:
379+
- **In YAML/code**: `parent` field (concise, follows common data structure conventions)
380+
- **In UI/documentation**: "Primary Technique" and "Variants" (semantic, conveys meaning)
381+
382+
Rationale:
383+
- **`parent` field name**: Natural for pointing upward in the hierarchy (`parent.id`), concise in YAML
384+
- **"Primary Technique"**: Conveys that this is the foundational/original technique
385+
- **"Variant"**: Explains WHAT it is (a modification that expands applicability), not just that it's a child
386+
387+
This hybrid approach gives semantic clarity where users see it (UI/docs) while keeping code simple and conventional.
388+
389+
**When to use parent/child:**
390+
- ✅ Parent path is exploitable with specific prerequisites (e.g., "user must have < 2 access keys")
391+
- ✅ Child path adds required permission(s) that remove/bypass those prerequisites
392+
- ✅ Child works in scenarios where parent fails
393+
- ✅ Same core attack technique, just expanded applicability
394+
395+
**When NOT to use parent/child (use relatedPaths instead):**
396+
- ❌ Different categories (new-passrole vs existing-passrole)
397+
- ❌ Alternative approaches that don't remove prerequisites (siblings)
398+
- ❌ Neither path works without additional permissions (no true "base" case)
399+
400+
**Key principle:** Child adds permission(s) to the **required** section that expand when the attack works by removing parent's prerequisites.
401+
402+
**Examples:**
403+
404+
**Parent/Child (correct usage):**
405+
- IAM-002 (CreateAccessKey) → IAM-003 (CreateAccessKey + DeleteAccessKey)
406+
- Parent requires: User has < 2 access keys
407+
- Child removes prerequisite: Can delete existing key first
408+
- Lambda-003 (UpdateFunctionCode) → Lambda-004 (UpdateFunctionCode + InvokeFunction)
409+
- Parent requires: Function has existing trigger
410+
- Child removes prerequisite: Brings own execution via InvokeFunction
411+
412+
**Not Parent/Child (siblings - use relatedPaths):**
413+
- Glue-003 (PassRole + CreateJob + StartJobRun) and Glue-004 (PassRole + CreateJob + CreateTrigger)
414+
- Neither works without the third permission
415+
- Different execution methods, not removing prerequisites
416+
- These are alternative approaches, not variants
417+
418+
**Relationship to `discoveryAttribution`:**
419+
- The `parent` field is for machine-readable technical relationships
420+
- The `discoveryAttribution` field is for human-readable credit and attribution
421+
- Keep both - they serve different purposes
422+
423+
Example:
424+
```yaml
425+
# IAM-003 (child/variant)
426+
id: iam-003
427+
name: iam:CreateAccessKey + iam:DeleteAccessKey
428+
parent:
429+
id: iam-002
430+
modification: "Adds iam:DeleteAccessKey to enable exploitation even when the target user already has 2 access keys (AWS maximum). The attacker deletes one existing key before creating their own, removing the prerequisite that the user must have fewer than 2 keys."
431+
discoveryAttribution:
432+
firstDocumented:
433+
author: Spencer Gietzen
434+
organization: Rhino Security Labs
435+
date: 2019
436+
link: https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation/
437+
```
438+
439+
```yaml
440+
# IAM-002 (primary/parent technique)
441+
id: iam-002
442+
name: iam:CreateAccessKey
443+
# No parent field - this is a primary technique
444+
discoveryAttribution:
445+
firstDocumented:
446+
author: Spencer Gietzen
447+
organization: Rhino Security Labs
448+
date: 2019
449+
link: https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation/
450+
```
451+
452+
```yaml
453+
# Lambda-004 (child/variant)
454+
id: lambda-004
455+
name: lambda:UpdateFunctionCode + lambda:InvokeFunction
456+
parent:
457+
id: lambda-003
458+
modification: "Adds lambda:InvokeFunction to enable exploitation even when the target function has no existing trigger mechanism. Removes the prerequisite that something must already be invoking the function."
459+
```
460+
352461
#### `prerequisites` (object or array)
353462
Conditions that must be met for the escalation to work.
354463

0 commit comments

Comments
 (0)