How the attack works
Every Amazon RDS DB instance and Aurora DB cluster has a master user, the administrative database account that RDS creates together with the database. ModifyDBInstance and, for Aurora, ModifyDBCluster accept a MasterUserPassword parameter that sets a new password for that user. The RDS API reference describes it as the way to regain access to the master user when the password is lost, because RDS API operations never return the password, and notes that the change causes no outage.
For an attacker this turns an AWS permission into a database credential. Whoever may call these actions on a database can choose the master password and sign in to the engine as its administrative user, provided they can reach the endpoint. The same request can also switch off the management of the password in AWS Secrets Manager, because a request that sets ManageMasterUserPassword to false must carry a new MasterUserPassword. CloudTrail records the call under rds.amazonaws.com with the caller in userIdentity. AWS's example record shows the password parameter in requestParameters as masterUserPassword with the value masked as ****, so the event shows that a password was set, never which one.
What an attacker needs
- Credentials for a principal allowed to call rds:ModifyDBInstance or rds:ModifyDBCluster on the database.
- A network path to the database endpoint for the sign-in that follows, or permissions that create one, such as making the instance publicly accessible or opening a security group.
Impact
A sign-in to the database engine as the master user, with its privileges over the data in that database. Applications and people that sign in as the master user lose access until the password is set back, which is often how the change is noticed.
Detection rules
RDS or Aurora Master User Password Reset
Detects ModifyDBInstance and ModifyDBCluster requests that carry a new master user password. AWS's example CloudTrail record for RDS shows the parameter in requestParameters as masterUserPassword with its value masked, and the RDS API reference documents MasterUserPassword as the way to set a new password for the master user of an existing database. Whoever makes the call can sign in to the database engine as its administrative user. It also matches attempts that failed (errorCode present).
title: RDS or Aurora Master User Password Reset
id: 2d617687-8207-4732-8f84-7d5b7065a0f7
status: experimental
description: >-
Detects ModifyDBInstance and ModifyDBCluster requests that carry a new master
user password. AWS's example CloudTrail record for RDS shows the parameter in
requestParameters as masterUserPassword with its value masked, and the RDS
API reference documents MasterUserPassword as the way to set a new password
for the master user of an existing database. Whoever makes the call can sign
in to the database engine as its administrative user. It also matches
attempts that failed (errorCode present).
references:
- https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/logging-using-cloudtrail.html
- https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_ModifyDBInstance.html
- https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_ModifyDBCluster.html
author: Forestall
date: 2026-11-18
tags:
- attack.persistence
- attack.privilege-escalation
- attack.t1098
logsource:
product: aws
service: cloudtrail
detection:
selection:
eventSource: rds.amazonaws.com
eventName:
- ModifyDBInstance
- ModifyDBCluster
requestParameters.masterUserPassword|exists: true
condition: selection
falsepositives:
- Database administrators who reset a lost master password, and deployment pipelines or infrastructure code that set the master password on every run. Exclude those roles by userIdentity.arn after confirming them.
level: medium
False positives
- Database administrators who reset a lost master password, and deployment pipelines or infrastructure code that set the master password on every run. Exclude those roles by userIdentity.arn after confirming them.
Triage
- Identify the caller (userIdentity.arn), the source IP address and the user agent. Is it a database administrator or the pipeline that manages this database?
- Read the database identifier of the request (the DBInstanceIdentifier or DBClusterIdentifier parameter) and find out which data the database holds.
- Check whether the same request or a following one turned off Secrets Manager management (ManageMasterUserPassword false) or made the database reachable, for example with PubliclyAccessible or a security group change.
- Check whether the owners of the database or of the secret asked for a password reset.
- Where the engine's logs are collected, look for sign-ins as the master user after the call and note their client addresses.
Response
Once the attack is confirmed:
- Set a new master password through the approved path, or turn Secrets Manager management back on, and end the database sessions of the master user.
- Contain the principal that reset the password by deactivating its access keys or revoking its role sessions.
- Undo the network changes made around the reset, such as public accessibility and new security group rules.
- Review the database audit logs, where they exist, for what the master user did since the reset, with priority on exports, new users and changed privileges.
Mitigation
- Grant rds:ModifyDBInstance and rds:ModifyDBCluster only to database administrators and the deployment roles that manage the databases, and keep them out of broad developer policies.
- Let RDS manage the master user password in AWS Secrets Manager, restrict who can read that secret, and treat any request that sets the password directly as an exception.
- Keep applications and people off the master user. Use separate database users or IAM database authentication, so that sign-ins as the master user are rare and easy to review.
- Keep databases private and limit their security groups to the networks that need them, so that a reset password cannot be used from anywhere.
Frequently asked questions
Can I see the new password in CloudTrail?
No. AWS's example CloudTrail record for an RDS request shows the masterUserPassword parameter with the value ****. The event tells you that a password was set, by whom, from where and for which database, never the password itself.
Why does AWS allow the master password to be reset through the API?
The RDS API reference describes the MasterUserPassword parameter of ModifyDBInstance as the way to regain access to the master user when the password is lost, because RDS API operations never return the password. That makes it a normal administrative action, and also a takeover path for anyone who holds the permission.
Does the rule fire when a database is created?
No. The rule matches ModifyDBInstance and ModifyDBCluster requests that carry a master user password. CreateDBInstance also carries one, but setting the first password of a new database takes over nothing.
References
- MITRE ATT&CK T1098: Account Manipulation
- Monitoring Amazon RDS API calls in AWS CloudTrail (example record with masterUserPassword)
- Amazon RDS API Reference: ModifyDBInstance
- Amazon RDS API Reference: ModifyDBCluster
- Password management with Amazon RDS and AWS Secrets Manager
- IAM database authentication for MariaDB, MySQL, and PostgreSQL
- Revoke IAM role temporary security credentials