Back to skill

Security audit

Ops Mysql Master Slave

Security checks for vulnerabilities and agentic risk

Overview

This is a MySQL operations guide, but it contains copy-pasteable commands that could expose database credentials or destroy a MySQL data directory if used as written.

Treat this skill as needing careful review before installation or use. It should only be used by experienced database operators in controlled maintenance windows, with tested backups, snapshots, verified host and datadir values, restricted replication hosts, strong managed secrets, pinned packages, and rollback plans. Do not copy the credential or rm -rf examples into production as written.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:65
Finding

Weak Replication Credentials and Unrestricted Source Host

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 65–67
Vulnerability Type: Weak hardcoded example credentials and overly broad network authorization
Risk Level: High

Vulnerable Code

sql
CREATE USER 'repl'@'%' IDENTIFIED BY 'password';
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%';
FLUSH PRIVILEGES;

Technical Analysis

The documented replication account uses the predictable password password and the MySQL host wildcard %. If operators copy this example without replacing and restricting its values, the account can authenticate from any network location that can reach the MySQL service.

Although REPLICATION SLAVE is narrower than full administrative access, it permits replication clients to request binary log data. Binary logs can contain sensitive application data and database changes. The wildcard host also violates least-privilege access-control principles by exposing the account beyond the intended replica.

Attack Path

  1. An operator follows the procedure without replacing the example password or restricting the account host.
  2. MySQL port 3306 becomes reachable by an attacker through a public interface, internal network, VPN, compromised host, or misconfigured security group.
  3. The attacker authenticates as repl using the predictable password.
  4. The attacker registers a replication client and requests available binary logs.
  5. Sensitive database changes contained in those logs are disclosed within the account's replication access and the server's retained log range.

Impact Assessment

A successful attacker can obtain the privileges assigned to the replication account and potentially read retained binary log events. The affected scope can include changes across all databases because the privilege is granted on *.*. This may expose customer records, application secrets stored in databases, schema changes, and other replicated data. It does not directly grant full MySQL administrative privileges.

Remediation
View remediation

Remediation Suggestions

  • Replace literal credentials with explicit placeholders that cannot be mistaken for usable production values.
  • Generate a unique, high-entropy password through an approved secret-management system.
  • Replace 'repl'@'%' with an account restricted to the replica's exact IP address or the narrowest required subnet.
  • Restrict port 3306 using host firewalls, cloud security groups, and private networking.
  • Require encrypted MySQL connections and validate server certificates where supported.
  • Store the credential in an approved secret manager and establish rotation and revocation procedures.
  • Add a warning that examples must never be copied unchanged into production.
  • Periodically audit replication users, grants, source hosts, and authentication logs.

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:152
Finding

Database Password Exposed Through Command-Line Arguments

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 152–159
Vulnerability Type: Plaintext credential exposure in process arguments and shell history
Risk Level: High

Vulnerable Code

bash
xtrabackup --backup \
  --target-dir=/tmp/backup_full \
  --compress \
  --compress-threads=4 \
  --user=root \
  --password=password

The same unsafe command pattern is repeated in the command cheat sheet at line 382:

bash
xtrabackup --backup --target-dir=/tmp/backup --user=root --password=password

Technical Analysis

Passing a password through --password=password places the secret directly in the command line. Depending on the operating system and process configuration, command-line arguments may be visible through process inspection utilities or /proc. The command may also be retained in shell history, terminal logs, session recordings, automation logs, monitoring systems, and incident captures.

The example authenticates as the MySQL root user. Consequently, exposure of the password may disclose a highly privileged database credential rather than a narrowly scoped backup credential.

Attack Path

  1. An administrator substitutes a real password into the documented command.
  2. The plaintext command is saved in shell history, operational logs, or a script, or remains visible while xtrabackup executes.
  3. A local user, support operator, monitoring integration, or attacker with access to those sources retrieves the command-line argument.
  4. The attacker uses the recovered root credential to authenticate to MySQL from an allowed host.
  5. The attacker performs any operation permitted to that root account, potentially including reading, modifying, or deleting database content and managing users.

Impact Assessment

The obtainable privileges depend on the MySQL root account's grants and network restrictions. In a typical configuration, compromise could provide complete control over the database instance, including access to ...[truncated 184 chars]

Remediation
View remediation

Remediation Suggestions

  • Do not place passwords directly in command-line arguments.
  • Use a protected MySQL option file with permissions limited to the service account, or another credential mechanism supported by XtraBackup.
  • Prefer a dedicated backup account with only the documented backup, process, reload, and replication-client privileges instead of MySQL root.
  • Retrieve secrets at runtime from an approved secret manager without writing them to shell history or logs.
  • Disable command echoing around secret retrieval in automation and redact credentials from operational logging.
  • Rotate any password that has already been used in this command form.
  • Update both the primary procedure and command cheat sheet so the insecure pattern is not reintroduced.

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:182
Finding

Destructive Database Restore Deletes the Active Data Directory Without Enforced Validation

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 182–193
Vulnerability Type: Unsafe destructive restore procedure
Risk Level: High

Vulnerable Code

bash
# Stop MySQL
systemctl stop mysqld

# Clear data directory
rm -rf /var/lib/mysql/*

# Copy back
xtrabackup --copy-back --target-dir=/tmp/backup_full

# Fix permissions
chown -R mysql:mysql /var/lib/mysql

# Start MySQL
systemctl start mysqld

Technical Analysis

The restore procedure permanently removes the contents of /var/lib/mysql before executing the copy-back operation. The document includes a prose warning, but the command sequence does not enforce validation of the current host, resolved data directory, filesystem mount, backup integrity, preparation state, available capacity, or rollback snapshot.

If the operator selects the wrong server, the configured MySQL data directory differs from expectations, or the backup is missing or unusable, the deletion occurs before restoration success is established. Shell wildcard behavior may also leave hidden entries behind, potentially producing an inconsistent restore environment.

Attack Path

  1. An operator connects to the wrong database server or selects an invalid or incomplete backup.
  2. The operator executes systemctl stop mysqld and rm -rf /var/lib/mysql/*.
  3. The active database files are permanently removed.
  4. xtrabackup --copy-back fails because the backup is unprepared, incomplete, corrupt, inaccessible, or lacks sufficient destination space.
  5. MySQL cannot restart, and recovery depends on another valid backup or infrastructure snapshot.

An attacker with influence over operational instructions or backup selection could similarly direct an administrator toward an unusable backup, causing destructive operational impact when the procedure is followed.

Impact Assessment

The immediate scope is the complete MySQL data directory on the selected host. Consequences can include loss of all locally stored dat ...[truncated 292 chars]

Remediation
View remediation

Remediation Suggestions

  • Require an explicit preflight check of hostname, environment, configured MySQL datadir, destination mount, free space, and backup path.
  • Verify the backup is complete, decompressed, prepared, readable, and protected by a validated checksum before changing the destination.
  • Create and verify a filesystem, volume, or cloud snapshot before modifying the existing data directory.
  • Prefer atomically renaming the old data directory to a rollback location rather than immediately deleting it.
  • Create a clean destination directory with restrictive ownership and permissions, then copy the backup into it.
  • Validate restored files and start MySQL under controlled observation before deleting the previous data directory.
  • Add shell safeguards such as strict error handling and explicit checks that reject empty, root-level, unresolved, or unexpected paths.
  • Require a peer-reviewed production change plan and a tested rollback procedure.

T08 · Insecure Dependencies

Warning
Location
SKILL.md:132
Finding

Unpinned Mutable Repository Bootstrap Package Installed from a Remote URL

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 132–134
Vulnerability Type: Unpinned third-party dependency from a mutable remote location
Risk Level: Medium

Vulnerable Code

bash
yum install -y https://repo.percona.com/yum/percona-release-latest.noarch.rpm
yum install -y percona-xtrabackup-24

Technical Analysis

The procedure installs a repository bootstrap package identified as latest directly from a remote URL. The artifact is not pinned to a reviewed version or checksum in the instructions. Its effective contents can therefore change after the Skill has been audited.

Package-manager signature validation may provide some protection when correctly configured, but the documented process does not explicitly verify the expected signing key fingerprint, artifact checksum, or exact package build. Installing the repository package changes package-manager trust and configuration, after which another unpinned package is installed.

Attack Path

  1. An administrator executes the commands with package-management privileges.
  2. The mutable latest resource changes, the distribution channel is compromised, or an unexpected incompatible release is published.
  3. The administrator downloads and installs an artifact different from the version previously reviewed.
  4. The repository package changes trusted repository configuration or package metadata.
  5. A compromised or unintended XtraBackup package is installed and executes package installation logic with elevated operating-system privileges.

This path requires compromise or unexpected modification of the relevant distribution channel, or inadequate verification of repository metadata and signing keys.

Impact Assessment

Package installation generally operates with root privileges. A malicious package could therefore execute arbitrary code, access database files and credentials, alter system configuration, or establish further compromise on the database host. A merely incomp ...[truncated 92 chars]

Remediation
View remediation

Remediation Suggestions

  • Pin the repository-release package to an explicitly approved version rather than using latest.
  • Pin XtraBackup to a tested package version and release build compatible with the deployed MySQL version.
  • Verify the package's vendor signature, expected signing-key fingerprint, and published cryptographic checksum before installation.
  • Obtain packages through an authenticated, internally controlled mirror where possible.
  • Maintain an allowlist of approved repository URLs and signing keys.
  • Test package updates in a non-production environment before deployment.
  • Use configuration management to record exact versions and prevent unintended upgrades.
Vulnerability Patterns
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (7)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
98% confidence
Finding

This specific destructive parameterization targets '/var/lib/mysql/*', which is the canonical MySQL data path on many systems, making accidental execution especially harmful in context. Because the skill is an operational SOP, users may trust and execute it quickly; without mandatory validation steps, the command can wipe a production database prior to successful restore.

Content

Scanner excerpt · SKILL.md (reported line 187)May include surrounding context.

md
systemctl stop mysqld

# Clear data directory
rm -rf /var/lib/mysql/*

# Copy back
xtrabackup --copy-back --target-dir=/tmp/backup_full

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
98% confidence
Finding

This specific destructive parameterization targets '/var/lib/mysql/*', which is the canonical MySQL data path on many systems, making accidental execution especially harmful in context. Because the skill is an operational SOP, users may trust and execute it quickly; without mandatory validation steps, the command can wipe a production database prior to successful restore.

Content

Scanner excerpt · SKILL.md (reported line 187)May include surrounding context.

md
systemctl stop mysqld

# Clear data directory
rm -rf /var/lib/mysql/*

# Copy back
xtrabackup --copy-back --target-dir=/tmp/backup_full

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown skill declares several generic trigger phrases without narrowing context or providing exclusion conditions. Because the skill covers destructive operational procedures, ambiguous triggers increase the chance of unintended activation for ordinary database-help requests.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The replication setup includes service restarts, read locks, dumps, imports, and replication changes without a prominent preflight warning about production impact, maintenance windows, rollback, and environment validation. In an ops skill, omission of those guardrails can lead users to execute disruptive steps on live systems, causing write blocking, downtime, or replication misconfiguration.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest describes a SOP focused on replication setup, XtraBackup migration, replica lag investigation, and cross-cloud database acceleration. However, the document also includes a standalone MySQL memory usage investigation workflow and a comprehensive cross-server migration process involving service directories, configuration changes, management database updates, and service restarts, which go beyond the stated master-slave/replication scope.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The cheatsheet presents destructive or irreversible commands such as 'RESET SLAVE ALL' and XtraBackup restore operations in a condensed form without adjacent warnings, prerequisites, or host/path validation. In a quick-reference section, users are more likely to copy-paste directly, increasing the chance of accidental data loss or replication state destruction.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
98% confidence
Finding

This file is otherwise primarily in English, but a critical safety warning is presented only in Chinese. That creates a language accessibility and locale-policy issue because users who do not read Chinese may miss important precautions.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.