mariadb Free
Refused logins from MariaDB's or MySQL's error log.
Download the pack tar.gz of the files listed below
Rules (2)
-
databasePassword guessing on MariaDB or MySQL — a brute-force attack on the database -
database-networkPassword guessing on MariaDB or MySQL from several addresses of one network
About this pack
Refused logins from MariaDB's or MySQL's error log
(/var/log/mysql/error.log on Debian, /var/log/mariadb/mariadb.log
elsewhere), declared as log: mysql with the database port beside it.
The parsers
mariadb-auth-fail— MariaDB (log_warnings2, the default, writes every refused login):2026-11-27 0:30:17 2245221 [Warning] Access denied for user 'root'@'192.0.2.80' (using password: YES).mysql-auth-fail— MySQL 5.7 and 8 (log_error_verbosity3 on 8):2026-11-27T16:28:54.123456Z 12 [Note] [MY-010926] [Server] Access denied for user 'root'@'192.0.2.9' (using password: YES).
Both read the line's own time, so a replay places every attempt. Both
count only when the host part of 'user'@'host' is an address, IPv4 or
IPv6: 'x'@'localhost' is a local service with the wrong password, and
a client the server writes by name (skip_name_resolve off, reverse and
forward names agreeing) is not counted either — the agent looks nothing
up. Set skip_name_resolve to have every attempt written by address.
On a machine whose database listens on the loopback only, these never
match: shield stats then shows the rules at 0 hits, a visible
statement that this door is shut.
The rules
database— refused logins from one address: three in a minute, five in a day, ten in a month (SSH's patience; the slow guessers try four times a visit, a visit every few days).database-network— refused logins from three addresses of one /24 in a day: the guessers that take turns inside a network, each address under the per-address thresholds. The /24 is banned; an origin that forbids range bans (trust.yaml) is never banned as a range.
Policy database: 6h, then 7d, 30d, 365d on a return within thirty
days, on the database port only — a customer's client with a stale
password keeps its website and its mail.
Parsers (2)
The building blocks: each parser names a log, a cheap prefilter and the regex that extracts the address.
mariadb-auth-fail mysql
# A refused database login, from MariaDB's error log (log_warnings 2, the # default, writes every one): # 2026-08-13 10:00:01 6516432 [Warning] Access denied for user 'someone'@'203.0.113.9' (using password: YES) # 2026-08-13 4:00:01 6516433 [Warning] Access denied for user 'root'@'2001:db8::7' (using password: YES) # # The host part is required to look like an address, which is what # leaves the local ones alone: 'user'@'localhost' is a service on this # machine getting its own credentials wrong, not an attack. When the # server resolves names (skip_name_resolve off), a client whose reverse # and forward names agree is written by name: such a line is not # counted either — the agent looks nothing up, by design. Set # skip_name_resolve to have every attempt written by address. # # MariaDB space-pads the hour (" 4:00:01"): Go's reader takes a run of # spaces for one and an hour of one digit, so the plain layout reads # both shapes. The time is the server's local time. parser: mariadb-auth-fail log: mysql prefilter: "Access denied for user" regex: "^(?P<time>\\d{4}-\\d\\d-\\d\\d +\\d{1,2}:\\d\\d:\\d\\d) \\d+ \\[Warning\\] Access denied for user '(?P<user>.*)'@'(?P<ip>[0-9a-fA-F.:]+)' " time_field: time time_format: "2006-01-02 15:04:05"
mysql-auth-fail mysql
# A refused database login, from MySQL's error log (5.7 and 8.x): # 2026-08-13T10:00:01.123456Z 12 [Note] [MY-010926] [Server] Access denied for user 'root'@'203.0.113.9' (using password: YES) # 2026-08-13T10:00:01.123456+02:00 12 [Note] Access denied for user 'root'@'203.0.113.9' (using password: YES) # # MySQL 8 writes these at log_error_verbosity 3 only (2 by default): # without it, the log holds nothing to read. The host part must be an # address, as for MariaDB: 'user'@'localhost', and a client written by # its name, are never counted. parser: mysql-auth-fail log: mysql prefilter: "Access denied for user" regex: "^(?P<time>\\d{4}-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d(?:\\.\\d+)?(?:Z|[+-]\\d\\d:\\d\\d)) \\d+ \\[(?:Note|Warning)\\](?: \\[MY-\\d+\\] \\[Server\\])? Access denied for user '(?P<user>.*)'@'(?P<ip>[0-9a-fA-F.:]+)' " time_field: time time_format: rfc3339
Ban policies
database 6h → 7d → 30d → 365d
# The database port alone, the ladder of SSH: whoever guesses at the # database is shut out of it, a customer's client with a stale password # keeps its website and its mail. policy: database durations: [6h, 7d, 30d, 365d] ports: service memory: 30d tighten: 2x
Reports
database-intrusion-network Several addresses of this network took turns guessing passwords on our database server (MariaDB/MySQL), a few refused logins each: credential brute force spread over the network to stay under per-address limits. The network is blocked from our database port; please look into the machines behind these addresses — compromised hosts or a deliberate attack tool.
# The range version of database-intrusion: several addresses of one # network took turns guessing passwords on the database. Nothing about # the accounts tried or the server hit goes out. report: database-intrusion-network categories: [brute-force] says: "Several addresses of this network took turns guessing passwords on our database server (MariaDB/MySQL), a few refused logins each: credential brute force spread over the network to stay under per-address limits. The network is blocked from our database port; please look into the machines behind these addresses — compromised hosts or a deliberate attack tool." brief: 'Database password guessing' include: []
database-intrusion This address is guessing passwords on our database server (MariaDB/MySQL): repeated refused logins, credential brute force. It is blocked from our database port; please look into the process behind it — a compromised machine or a deliberate attack tool.
# Categories reuse the mapping proven in production by this host's # CrowdSec notifier. `include` is empty: a report says what happened, # never who it happened to. The accounts tried, the mailboxes aimed at # and the site that was hit are all captured by the parsers and none of # them are a public database's business. report: database-intrusion categories: [brute-force] says: "This address is guessing passwords on our database server (MariaDB/MySQL): repeated refused logins, credential brute force. It is blocked from our database port; please look into the process behind it — a compromised machine or a deliberate attack tool." brief: 'Database password guessing' include: []