nccgroup / opinel

Python code shared by Scout2 and AWS-Recipes
GNU General Public License v2.0
24 stars 18 forks source link

Assume role fails with mfa #34

Open IhorKravchuk opened 5 years ago

IhorKravchuk commented 5 years ago

While using opinel with scout2 or ScoutSuite with crossaccount MFA access, STS assume role failing. After investigation I found that the root cause is incorrect naming inside assume_role function credentials argument TokenCode and SerialNumber: - if 'mfa_serial' in credentials and 'mfa_code' in credentials: - sts_args['TokenCode'] = credentials['mfa_code'] - sts_args['SerialNumber'] = credentials['mfa_serial'] + if 'SerialNumber' in credentials and 'TokenCode' in credentials: + sts_args['TokenCode'] = credentials['TokenCode'] + sts_args['SerialNumber'] = credentials['SerialNumber']