Fix false positive root MFA when org centralized root access is enabled#1723
Open
raajheshkannaa wants to merge 2 commits intonccgroup:masterfrom
Open
Fix false positive root MFA when org centralized root access is enabled#1723raajheshkannaa wants to merge 2 commits intonccgroup:masterfrom
raajheshkannaa wants to merge 2 commits intonccgroup:masterfrom
Conversation
…is enabled When AWS Organizations centralized root access management is enabled and root credentials are removed from member accounts, ScoutSuite incorrectly flags "Root Account without MFA" because the credential report shows mfa_active as false. MFA cannot and need not be configured when root credentials have been centrally removed. This fix calls iam:ListOrganizationsFeatures to detect whether RootCredentialsManagement is enabled for the organization, and sets a root_credentials_managed_centrally flag on the root credential report entry. Both MFA finding rules now include a condition to skip accounts where this flag is true. The API call fails gracefully (returns False) when the account is not in an org or lacks iam:ListOrganizationsFeatures permission. Fixes nccgroup#1710
- Set mfa_active to "false" in centralized root test entry so the rule engine actually reaches the root_credentials_managed_centrally condition (previously "not_supported" short-circuited the check) - Add warning log when Organizations API call fails for debugging
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1710
When AWS Organizations centralized root access management is enabled and root credentials are removed from member accounts, ScoutSuite incorrectly flags "Root Account without MFA". This happens because the credential report shows
mfa_activeasfalsefor the root user, but MFA cannot and need not be configured when root credentials have been centrally removed.Changes:
get_organizations_root_credentials_managed()to the IAM facade, which callsiam:ListOrganizationsFeaturesto check ifRootCredentialsManagementis enabled. Fails gracefully (returnsFalse) when the account is not in an org or lacks the required permission.credentialreports.py, the result is used to set aroot_credentials_managed_centrallyflag on the root credential report entry.iam-root-account-no-mfa.jsonandiam-root-account-no-hardware-mfa.jsonrules now include a condition to skip accounts where this flag istrue.iam-root.jsonwith the new field and a test case for the centralized root access scenario.Test plan
iam:ListOrganizationsFeaturesis not permitted. Verify the API call fails silently and root MFA finding behaves as before (no regression).python -m pytest tests/test_rules_processingengine.pyto validate the rule engine test with updated fixtures.