Acceso inicial: superusuario de la base de datos escribe en tablas de usuario
Organízate con las colecciones
Guarda y clasifica el contenido según tus preferencias.
En este documento se describe un tipo de hallazgo de amenazas en Security Command Center. Los hallazgos de amenazas los generan los detectores de amenazas cuando detectan una amenaza potencial en tus recursos de la nube. Para ver una lista completa de las detecciones de amenazas disponibles, consulta el índice de detecciones de amenazas.
Información general
La cuenta de superusuario de la base de datos de Cloud SQL (postgres
para PostgreSQL y root para MySQL) ha escrito en tablas de usuario. Por lo general, no se debe usar el superusuario (un rol con un acceso muy amplio) para escribir en tablas de usuarios. Para las actividades diarias normales, se debe usar una cuenta de usuario con un acceso más limitado. Cuando un superusuario escribe en una tabla de usuarios, podría indicar que un atacante ha aumentado los privilegios o ha puesto en peligro al usuario de la base de datos predeterminado y está modificando los datos. También podría indicar prácticas normales, pero no seguras.
Cómo responder
Para responder a esta observación, sigue estos pasos:
Paso 1: Revisa los detalles de la detección
Abre un Initial Access: Database Superuser Writes to User Tables
tal como se indica en Revisar resultados.
En la pestaña Resumen del panel de detalles de la detección, consulta la información de las siguientes secciones:
Qué se detectó, especialmente los siguientes campos:
Nombre visible de la base de datos: el nombre de la base de datos de la instancia de Cloud SQL PostgreSQL o MySQL afectada.
Nombre de usuario de la base de datos: el superusuario.
Consulta de base de datos: la consulta de SQL que se ejecuta al escribir en tablas de usuarios.
Recurso afectado, especialmente los siguientes campos:
Nombre completo del recurso: el nombre del recurso de la instancia de Cloud SQL afectada.
Nombre completo del recurso superior: el nombre del recurso de la instancia de Cloud SQL.
Nombre completo del proyecto: el Google Cloud proyecto que contiene la instancia de Cloud SQL.
Enlaces relacionados, especialmente los siguientes campos:
URI de Cloud Logging: enlace a las entradas de registro.
Método MITRE ATT&CK: enlace a la documentación de MITRE ATT&CK.
Hallazgos relacionados: enlaces a los hallazgos relacionados.
Para ver el JSON completo de la detección, haga clic en la pestaña JSON.
Paso 2: Consulta los registros
En la Google Cloud consola, ve al Explorador de registros haciendo clic en el enlace de cloudLoggingQueryURI (en Paso 1).
La página Explorador de registros incluye todos los registros relacionados con la instancia de Cloud SQL correspondiente.
Consulta los registros de pgaudit de PostgreSQL o los registros de auditoría de Cloud SQL para MySQL, que contienen las consultas ejecutadas por el superusuario, mediante los siguientes filtros:
protoPayload.request.user="SUPERUSER"
Paso 3: Investiga los métodos de ataque y respuesta
Para determinar si son necesarias medidas correctoras adicionales, combina los resultados de tu investigación con la investigación de MITRE.
Paso 4: Implementa tu respuesta
El siguiente plan de respuesta puede ser adecuado para este resultado, pero también puede afectar a las operaciones.
Evalúa detenidamente la información que recojas en tu investigación para determinar la mejor forma de resolver los resultados.
Revisa los usuarios que tienen permiso para conectarse a la base de datos.
[[["Es fácil de entender","easyToUnderstand","thumb-up"],["Me ofreció una solución al problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Es difícil de entender","hardToUnderstand","thumb-down"],["La información o el código de muestra no son correctos","incorrectInformationOrSampleCode","thumb-down"],["Me faltan las muestras o la información que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-10 (UTC)."],[],[],null,["| Premium and Enterprise [service tiers](/security-command-center/docs/service-tiers)\n\nThis document describes a threat finding type in Security Command Center. Threat findings are generated by\n[threat detectors](/security-command-center/docs/concepts-security-sources#threats) when they detect\na potential threat in your cloud resources. For a full list of available threat findings, see [Threat findings index](/security-command-center/docs/threat-findings-index).\n\nOverview\n\nThe Cloud SQL database superuser account (`postgres`\nfor PostgreSQL and `root` for MySQL) wrote to user\ntables. The superuser (a role with very broad access) generally shouldn't be\nused to write to user tables. A user account with more limited access should be used\nfor normal daily activity. When a superuser writes to a user table, that could\nindicate that an attacker has escalated privileges or has compromised the\ndefault database user and is modifying data. It could also indicate normal but\nunsafe practices.\n\nHow to respond\n\nTo respond to this finding, do the following:\n\nStep 1: Review finding details\n\n1. Open an `Initial Access: Database Superuser Writes to User Tables` finding, as directed in [Reviewing findings](/security-command-center/docs/how-to-investigate-threats#reviewing_findings).\n2. On the **Summary** tab of the finding details panel, review the\n information in the following sections:\n\n - **What was detected** , especially the following fields:\n - **Database display name**: the name of the database in the Cloud SQL PostgreSQL or MySQL instance that was affected.\n - **Database user name**: the superuser.\n - **Database query**: the SQL query executed while writing to user tables.\n - **Affected resource** , especially the following fields:\n - **Resource full name**: the resource name of the Cloud SQL instance that was affected.\n - **Parent full name**: the resource name of the Cloud SQL instance.\n - **Project full name**: the Google Cloud project that contains the Cloud SQL instance.\n - **Related links** , especially the following fields:\n - **Cloud Logging URI**: link to Logging entries.\n - **MITRE ATT\\&CK method**: link to the MITRE ATT\\&CK documentation.\n - **Related findings**: links to any related findings.\n3. To see the complete JSON for the finding, click the **JSON** tab.\n\nStep 2: Check logs\n\n1. In the Google Cloud console, go to **Logs Explorer** by clicking the link in `cloudLoggingQueryURI` (from [Step 1](#initial_access_database_superuser_writes_to_user_tables_findings)). The **Logs Explorer** page includes all logs related to the relevant Cloud SQL instance.\n2. Check the logs for PostgreSQL pgaudit logs or Cloud SQL for MySQL audit logs, which contain the queries executed by the superuser, by using the following filters:\n - `protoPayload.request.user=\"`\u003cvar class=\"edit\" translate=\"no\"\u003eSUPERUSER\u003c/var\u003e`\"`\n\nStep 3: Research attack and response methods\n\n1. Review the MITRE ATT\\&CK framework entry for this finding type: [Exfiltration Over Web Service](https://attack.mitre.org/techniques/T1078/001/).\n2. To determine if additional remediation steps are necessary, combine your investigation results with MITRE research.\n\nStep 4: Implement your response\n\n\nThe following response plan might be appropriate for this finding, but might also impact operations.\nCarefully evaluate the information you gather in your investigation to determine the best way to\nresolve findings.\n\n- Review the users allowed to connect to the database.\n\n - For PostgreSQL, see [Create and manage users](/sql/docs/postgres/create-manage-users)\n - For MySQL, see [Manage users with built-in authentication](/sql/docs/mysql/create-manage-users)\n- Consider changing the password for the superuser.\n\n - For PostgreSQL, see [Set the password for the default user](/sql/docs/postgres/create-manage-users#user-root)\n - For MySQL, see [Set the password for the default user](/sql/docs/mysql/create-manage-users#user-root)\n- Consider creating a new, limited access user for the different types of queries used on the instance.\n\n - Grant the new user only the necessary permissions needed to execute their queries.\n\n - For PostgreSQL, see [Grant (command)](https://www.postgresql.org/docs/14/sql-grant.html)\n - For MySQL, see [Access Control and Account Management](https://dev.mysql.com/doc/refman/8.0/en/access-control.html)\n - Update the credentials for the clients that connect to the Cloud SQL instance\n\nWhat's next\n\n- Learn [how to work with threat\n findings in Security Command Center](/security-command-center/docs/how-to-investigate-threats).\n- Refer to the [Threat findings index](/security-command-center/docs/threat-findings-index).\n- Learn how to [review a\n finding](/security-command-center/docs/how-to-investigate-threats#reviewing_findings) through the Google Cloud console.\n- Learn about the [services that\n generate threat findings](/security-command-center/docs/concepts-security-sources#threats)."]]