Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2022-27457

CVE-2022-27457: MariaDB Use-After-Free Vulnerability

CVE-2022-27457 is a use-after-free vulnerability in MariaDB Server v10.6.3 and earlier affecting the my_mb_wc_latin1 component. This article covers the technical details, affected versions, and mitigation strategies.

Updated:

CVE-2022-27457 Overview

CVE-2022-27457 is a use-after-free vulnerability [CWE-416] in MariaDB Server versions 10.6.3 and earlier. The flaw resides in the my_mb_wc_latin1 function within /strings/ctype-latin1.c, which handles Latin-1 character set conversions. A remote attacker can trigger the condition over the network without authentication or user interaction, leading to a denial-of-service condition that affects database availability.

Critical Impact

Remote, unauthenticated attackers can crash MariaDB Server instances by exploiting improper memory handling in Latin-1 character set processing, disrupting database availability for downstream applications.

Affected Products

  • MariaDB Server versions 10.6.3 and earlier
  • Deployments using Latin-1 character set encoding via my_mb_wc_latin1
  • NetApp products bundling affected MariaDB versions (per NetApp Security Advisory NTAP-20220526-0007)

Discovery Timeline

  • 2022-04-14 - CVE-2022-27457 published to the National Vulnerability Database
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2022-27457

Vulnerability Analysis

The vulnerability is a use-after-free condition in the my_mb_wc_latin1 function located in /strings/ctype-latin1.c. This function performs multibyte-to-wide-character conversion for the Latin-1 (latin1) character set in MariaDB. When the function references memory that has already been freed, the resulting undefined behavior can corrupt the server process state.

Exploitation impacts availability, with no direct effect on confidentiality or integrity. A successful attack causes the MariaDB Server process to crash, producing a denial-of-service condition. Because the attack vector is network-based and requires no authentication, any client capable of submitting crafted queries to the database can trigger the issue.

Root Cause

The root cause is improper memory lifecycle management in MariaDB's character set conversion routines. The my_mb_wc_latin1 routine accesses a memory region after it has been released by an earlier code path. Use-after-free conditions of this nature stem from missing or incorrect reference tracking between allocation and deallocation operations within the string handling subsystem.

Attack Vector

The attack vector is network-based with low complexity. An attacker submits crafted input that exercises the Latin-1 conversion path in my_mb_wc_latin1, causing the server to dereference freed memory. No privileges or user interaction are required. Specific reproduction details are tracked in the upstream MariaDB ticket. See the MariaDB JIRA Ticket MDEV-28098 and the NetApp Security Advisory NTAP-20220526-0007 for additional technical context.

Detection Methods for CVE-2022-27457

Indicators of Compromise

  • Unexpected MariaDB Server process crashes or restarts coinciding with client query activity
  • Segmentation fault entries in the MariaDB error log referencing string conversion routines
  • Repeated connection drops from a single source preceding server termination
  • Core dumps generated by mysqld/mariadbd containing stack frames in ctype-latin1.c

Detection Strategies

  • Inventory MariaDB Server deployments and flag any instance running version 10.6.3 or earlier
  • Monitor database error logs for crash signatures involving Latin-1 character handling
  • Correlate database service restarts with inbound client traffic patterns to identify suspicious sources
  • Apply network-level inspection on database ports to detect anomalous query payloads from untrusted clients

Monitoring Recommendations

  • Forward MariaDB error and audit logs to a centralized logging platform for crash pattern analysis
  • Alert on abnormal mysqld process exit codes or systemd service failures
  • Track query rate and connection failure metrics per source IP to surface potential exploitation attempts
  • Review access controls to ensure only trusted networks can reach MariaDB listener ports

How to Mitigate CVE-2022-27457

Immediate Actions Required

  • Upgrade MariaDB Server to a version later than 10.6.3 that includes the fix tracked in MDEV-28098
  • Restrict network exposure of the MariaDB listener to trusted application servers only
  • Apply vendor updates from downstream distributors such as NetApp where MariaDB is bundled
  • Audit existing MariaDB accounts and remove unused or overly permissive remote login privileges

Patch Information

Refer to the MariaDB JIRA Ticket MDEV-28098 for the upstream fix and patched release notes. NetApp customers should consult the NetApp Security Advisory NTAP-20220526-0007 for product-specific remediation guidance.

Workarounds

  • Place MariaDB Server behind a firewall and restrict inbound traffic to authorized application hosts
  • Require authenticated, TLS-protected connections to limit the attacker population able to submit queries
  • Disable or limit use of the Latin-1 character set where application requirements permit alternative encodings such as utf8mb4
  • Enforce query timeouts and resource limits to reduce the impact of process crashes on dependent services
bash
# Verify the installed MariaDB Server version
mariadbd --version

# Restrict network exposure via bind-address in my.cnf
# /etc/mysql/mariadb.conf.d/50-server.cnf
[mysqld]
bind-address = 10.0.0.10
skip-networking = OFF

# Restart the service to apply changes
systemctl restart mariadb

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.