Skip to content

Commit 3904b4c

Browse files
committed
Updaed contributing guide
1 parent c149e42 commit 3904b4c

2 files changed

Lines changed: 354 additions & 203 deletions

File tree

CONTRIBUTING.md

Lines changed: 25 additions & 203 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contributing to pathfinding.cloud
22

3-
Thank you for your interest in contributing to pathfinding.cloud! This project aims to be the definitive source of truth for AWS IAM privilege escalation paths.
3+
Thank you for your interest in contributing to pathfinding.cloud! This project aims to be a comprehensive source of AWS IAM privilege escalation paths.
44

55
## How to Contribute
66

@@ -9,7 +9,7 @@ Thank you for your interest in contributing to pathfinding.cloud! This project a
99
We welcome the following types of contributions:
1010

1111
1. **New privilege escalation paths** - Document previously undiscovered or undocumented paths
12-
2. **Path variations** - Document nuances and variations of existing paths (e.g., different prerequisites)
12+
2. **Path variations** - Document nuances and variations of existing paths (e.g., different unique permissions combinations)
1313
3. **Corrections** - Fix errors in existing documentation
1414
4. **Enhancements** - Add detection rules, tool support, or additional references
1515
5. **Website improvements** - Enhance the user interface or functionality
@@ -20,79 +20,13 @@ We welcome the following types of contributions:
2020

2121
- Use the format `{service}-{number}` where number is 3 digits
2222
- For PassRole combinations, use the service of the resource being created/manipulated
23-
- Example: `iam:PassRole+ec2:RunInstances``ec2-001`
23+
- Example: `iam:PassRole + ec2:RunInstances``ec2-001` (note: spaces around +)
2424
- Check existing files to find the next available number for your service
2525
- Create the file in `data/paths/{service}/{id}.yaml`
2626

2727
### Step 2: Create the YAML File
2828

29-
Use the template below as a starting point:
30-
31-
```yaml
32-
id: "service-001"
33-
name: "iam:Permission" # or "iam:Permission1 + service:Permission2" (note spaces around +)
34-
category: "self-escalation" # or lateral-movement, service-passrole, credential-access, access-resource
35-
services:
36-
- iam
37-
- service
38-
39-
permissions:
40-
required:
41-
- permission: "iam:Permission"
42-
resourceConstraints: "Description of resource requirements"
43-
additional:
44-
- permission: "iam:ListPermissions"
45-
resourceConstraints: "Helpful for discovering resources"
46-
47-
description: Clear explanation of how this privilege escalation works, what it accomplishes, and the end result for the attacker.
48-
49-
prerequisites:
50-
admin:
51-
- "Description of condition needed for administrative access"
52-
lateral:
53-
- "Description of condition needed for lateral movement"
54-
55-
exploitationSteps:
56-
awscli:
57-
- step: 1
58-
command: |
59-
aws service action --parameters
60-
description: "What this step does"
61-
- step: 2
62-
command: |
63-
aws service action --parameters
64-
description: "What this step does"
65-
66-
recommendation: |
67-
Security recommendations for preventing and detecting this escalation path.
68-
Include monitoring strategies and best practices.
69-
70-
discoveryAttribution:
71-
firstDocumented:
72-
author: "Your Name"
73-
organization: "Your Organization (optional)"
74-
date: 2024
75-
link: "https://example.com/your-research"
76-
77-
references:
78-
- title: "Blog Post Title"
79-
url: "https://example.com/blog-post"
80-
81-
relatedPaths:
82-
- "related-001"
83-
- "related-002"
84-
85-
detectionRules:
86-
- platform: "CloudSIEM"
87-
url: "https://docs.example.com/rules/rule-id"
88-
89-
learningEnvironments:
90-
iam-vulnerable:
91-
type: open-source
92-
githubLink: https://github.com/BishopFox/iam-vulnerable
93-
scenario: IAM-SomeScenario
94-
description: "Deploy Terraform into your own AWS account and practice exploitation"
95-
```
29+
Use the template at [data/example-001.yaml] which includes all required and optional fields with detailed comments and formatting examples.
9630

9731
### Step 3: Validate Your File
9832

@@ -140,8 +74,8 @@ See [SCHEMA.md](SCHEMA.md) for complete documentation of all fields.
14074
#### `name`
14175
- Use AWS IAM permission syntax
14276
- Single permission: `iam:CreatePolicyVersion`
143-
- Multiple permissions: `iam:PassRole+ec2:RunInstances`
144-
- Separate with `+` symbol
77+
- Multiple permissions: `iam:PassRole + ec2:RunInstances` (note: **spaces around +**)
78+
- Separate with ` + ` (space-plus-space)
14579

14680
#### `category`
14781
Must be one of:
@@ -186,9 +120,12 @@ Must be one of:
186120

187121
#### `discoveryAttribution` (required)
188122
- Credit the original researcher or source
189-
- Include organization if applicable
123+
- Use `author` for individual researchers (e.g., "Spencer Gietzen")
124+
- Use `source` for organizations/websites (e.g., "HackTricks", "pathfinding.cloud")
125+
- **Do not use both** `author` and `source` - choose one
126+
- Include organization if using `author`
190127
- Add year of discovery and link to source
191-
- For derivatives, include `derivativeOf` and `ultimateOrigin` fields
128+
- For derivatives, include `derivativeOf` and optionally `ultimateOrigin` for multi-level chains
192129

193130
#### `references` (encouraged)
194131
- Link to blog posts, papers, or documentation
@@ -202,143 +139,28 @@ Must be one of:
202139
- Link to detection rules in security platforms
203140
- Include platform name and URL
204141

142+
#### `detectionTools` (optional)
143+
- Documents which open source security tools detect this path
144+
- Link directly to the source code where detection logic is implemented
145+
- Supported tools: `pmapper`, `cloudsplaining`, `pacu`, `prowler`, `scoutsuite`
146+
- Example: `pmapper: https://github.com/nccgroup/PMapper/blob/master/principalmapper/graphing/iam_edges.py#L123`
147+
205148
#### `learningEnvironments` (optional)
206149
- Documents learning labs and CTF environments where this path can be practiced
207150
- **Open-source environments**: Include `type: open-source`, `githubLink`, `description`, optional `scenario`
208151
- **Closed-source environments**: Include `type: closed-source`, `description`, `scenario`, and `scenarioPricingModel` (paid/free)
209152
- Replaces the deprecated `toolSupport` field
210153

211-
## Examples
154+
#### `attackVisualization` (optional but recommended)
155+
- Creates an interactive diagram showing the attack flow
156+
- Uses structured format with `nodes` and `edges` arrays
157+
- Node types: `principal` (users/roles), `resource` (AWS resources), `payload` (attacker actions), `outcome` (results)
158+
- Supports conditional branching for different outcomes
159+
- See `data/example-001.yaml` for a complete example
212160

213-
### Example 1: Simple Self-Escalation
214-
215-
```yaml
216-
id: "iam-001"
217-
name: "iam:CreatePolicyVersion"
218-
category: "self-escalation"
219-
services:
220-
- iam
221-
222-
permissions:
223-
required:
224-
- permission: "iam:CreatePolicyVersion"
225-
resourceConstraints: "Policy must be attached to the actor"
226-
additional:
227-
- permission: "iam:ListPolicies"
228-
resourceConstraints: "Helpful for discovering attached policies"
229-
230-
description: A principal with `iam:CreatePolicyVersion` can create a new version of an IAM policy that is already attached to them, granting themselves administrative privileges by setting the new version as default.
231-
232-
prerequisites:
233-
- "Policy must already be attached to the actor's user, role, or group"
234-
235-
exploitationSteps:
236-
awscli:
237-
- step: 1
238-
command: |
239-
aws iam create-policy-version --policy-arn <policy-arn> --policy-document file://admin.json --set-as-default
240-
description: "Create new policy version with admin permissions and set as default"
241-
242-
recommendation: |
243-
Restrict iam:CreatePolicyVersion to only necessary principals.
244-
Monitor usage with CloudTrail and CloudSIEM detections.
245-
246-
discoveryAttribution:
247-
firstDocumented:
248-
author: "Spencer Gietzen"
249-
organization: "Rhino Security Labs"
250-
date: 2019
251-
link: "https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation/"
252-
253-
learningEnvironments:
254-
iam-vulnerable:
255-
type: open-source
256-
githubLink: https://github.com/BishopFox/iam-vulnerable
257-
scenario: IAM-CreatePolicyVersion
258-
description: "Deploy Terraform into your own AWS account and practice exploitation"
259-
```
161+
## Examples
260162

261-
### Example 2: Multi-Permission Path with PassRole
262-
263-
```yaml
264-
id: "lambda-001"
265-
name: "iam:PassRole + lambda:CreateFunction + lambda:InvokeFunction"
266-
category: "service-passrole"
267-
services:
268-
- iam
269-
- lambda
270-
271-
permissions:
272-
required:
273-
- permission: "iam:PassRole"
274-
resourceConstraints: "Must be able to pass a privileged role to Lambda service"
275-
- permission: "lambda:CreateFunction"
276-
resourceConstraints: "Must be able to create Lambda functions"
277-
- permission: "lambda:InvokeFunction"
278-
resourceConstraints: "Must be able to invoke the created function"
279-
additional:
280-
- permission: "iam:ListRoles"
281-
resourceConstraints: "Helpful for discovering available privileged roles"
282-
- permission: "iam:GetRole"
283-
resourceConstraints: "Useful for viewing role permissions and trust policies"
284-
285-
description: A principal with `iam:PassRole`, `lambda:CreateFunction`, and `lambda:InvokeFunction` can create a Lambda function with a privileged role and invoke it to execute code with elevated permissions.
286-
287-
prerequisites:
288-
admin:
289-
- "A role must exist that trusts lambda.amazonaws.com to assume it"
290-
- "The role must have administrative permissions (e.g., AdministratorAccess or an equivalent custom policy)"
291-
lateral:
292-
- "A role must exist that trusts lambda.amazonaws.com to assume it"
293-
- "The role can have any level of permissions for lateral movement"
294-
295-
exploitationSteps:
296-
awscli:
297-
- step: 1
298-
command: |
299-
aws lambda create-function \
300-
--function-name exploit \
301-
--runtime python3.9 \
302-
--role arn:aws:iam::123456789012:role/PrivRole \
303-
--handler index.handler \
304-
--zip-file fileb://code.zip
305-
description: "Create Lambda function with privileged role"
306-
- step: 2
307-
command: |
308-
aws lambda invoke --function-name exploit output.txt
309-
description: "Invoke function to execute with elevated permissions"
310-
311-
recommendation: |
312-
Restrict iam:PassRole with condition keys to limit which roles can be passed
313-
to Lambda. Monitor Lambda function creation and invocation in CloudTrail.
314-
315-
discoveryAttribution:
316-
firstDocumented:
317-
author: "Spencer Gietzen"
318-
organization: "Rhino Security Labs"
319-
date: 2019
320-
link: "https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation/"
321-
322-
references:
323-
- title: "AWS Privilege Escalation Methods"
324-
url: "https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation/"
325-
326-
relatedPaths:
327-
- "ec2-001"
328-
- "cloudformation-001"
329-
330-
learningEnvironments:
331-
iam-vulnerable:
332-
type: open-source
333-
githubLink: https://github.com/BishopFox/iam-vulnerable
334-
scenario: IAM-PassRole-Lambda-CreateFunction
335-
description: "Deploy Terraform into your own AWS account and practice exploitation"
336-
pathfinder-labs:
337-
type: open-source
338-
githubLink: https://github.com/DataDog/pathfinder-labs
339-
scenario: lambda-createfunction
340-
description: "Deploy scenarios with attack and cleanup scripts"
341-
```
163+
Use the template at [data/example-001.yaml] or any of the existing paths to get started.
342164

343165
## Pull Request Guidelines
344166

0 commit comments

Comments
 (0)