Summary
A logic error in RustFS's ImportIam admin API causes it to validate permissions using ExportIAMAction instead of ImportIAMAction, effectively treating export-only principals as authorized importers.
Under deployments where users or services are granted export-only IAM privileges, an attacker with those permissions could abuse the ImportIam endpoint to create or modify IAM entities and escalate privileges.
Affected context
This vulnerability affects RustFS deployments that expose the ImportIam administrative API in environments where:
- IAM permissions distinguish between export and import operations, and
- Certain principals are intentionally limited to export-only IAM capabilities.
Because ImportIam incorrectly reuses the ExportIAMAction permission for its authorization check, principals that should only read/export IAM data may also perform IAM imports (writes) if they can reach the admin API.
Exploit preconditions
- Attack surface: RustFS admin/API interface exposing the
ImportIamendpoint. - Required access: Valid credentials or an identity with permissions equivalent to
ExportIAMActionbut not intended to have import/write IAM rights. - Trigger point: Invocation of the
ImportIamAPI to import IAM configuration or data. - Why exploitation is possible: The implementation validates access using the wrong action (
ExportIAMAction) rather thanImportIAMAction, so the authorization layer incorrectly grants write-like IAM operations to export-only principals.
Why this happens
The core issue is an incorrect authorization decision caused by using the wrong permission/verb for access control. Instead of checking whether a caller is allowed to execute ImportIAMAction (a privileged write operation that can alter users, groups, policies, and service accounts), the ImportIam endpoint checks for ExportIAMAction, which is intended for read/export operations.
This maps to:
- CWE-285: Improper Authorization, where the system grants access that is inconsistent with intended policy.
- CWE-863: Incorrect Authorization, where the logic validates permissions but against the wrong capability or resource.
Abstractly, this is a privilege model mismatch: the code conflates two distinct operations (import vs. export) and reuses an authorization predicate that is too permissive for the more powerful operation.
Potential impact
- Unauthorized creation, update, or deletion of IAM users, groups, roles, and policies.
- Escalation of privileges by granting broader roles or permissions to attacker-controlled identities.
- Creation of backdoor service accounts or access keys for persistent unauthorized access.
- Disruption of access control by modifying or removing existing IAM policies.
- Indirect compromise of data and services that rely on RustFS IAM for authorization decisions.
General mitigation guidance
Effective mitigation centers on correctly separating and enforcing IAM actions and reducing the blast radius of administrative APIs:
- Define distinct, least-privilege actions for read/export and write/import IAM operations, and ensure each API endpoint checks only the specific action it requires.
- Use centralized authorization helpers or policy engines to avoid duplicated, ad hoc permission checks and to keep mappings between APIs and actions explicit.
- Restrict network and authentication access to administrative endpoints such as
ImportIam, limiting them to tightly controlled operators or automation roles. - Apply defense-in-depth by requiring elevated scopes, multi-party approval, or additional verification for IAM-changing operations.
- Maintain clear role definitions so that "export-only" or read-only personas cannot perform any write, import, or configuration-changing tasks, even if a single endpoint is misconfigured.
How teams detect issues like this
Organizations can look for this class of issue using:
- Static analysis and code review:
- Verify that each admin or IAM-modifying endpoint references the correct permission constant or policy action.
- Flag code where multiple endpoints share a single broad permission for conceptually different operations (e.g., export vs. import).
- Review mappings between REST/RPC methods and authorization rules for inconsistencies or copy-paste mistakes.
- Policy and configuration review:
- Periodically audit IAM roles to confirm that export-only roles do not have effective write/import capabilities via any API.
- Examine logs for export-focused principals calling IAM import or other configuration-changing operations.
- Automated checks:
- Integrate automated authorization tests in CI/CD that assert "read-only" roles cannot exercise state-changing APIs.
- Use automated security scanners or policy-as-code tools to ensure that admin endpoints always require appropriately scoped actions.

