MariaDB version misleading if host is not allowed

Aperta
#3,556 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
mariadb
Ambito
networking

Direzione di ricerca

The bad match rules are the two match mysql lines near 2234-2236 of the nmap-service-probes file, which key the MariaDB version range on a single byte of the 'not allowed to connect' error packet. Compare that byte against the hexdump the reporter describes for a recent MariaDB server, and check whether a version scan can still tell the versions apart. Done means the unauthorized case no longer reports a version range that the byte cannot support, verified by a -sV scan against a MariaDB server that blocks the scanning host.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Nmap

Describe the bug
An nmap version scan (-sV) can produce wrong/misleading version information for MariaDB servers in some cases. If the MariaDB server has no user configured that is allowed to connect from the scanning host (message Host 'XX.XX.XX.XX' is not allowed to connect to this MariaDB server), then the version scan reports MariaDB 10.3.23 or earlier (unauthorized), which is misleading.

The source of this issue likely lies in nmap-service-probes, lines 2234-2236:

match mysql m|^.\0\0\0\xff..Host .* is not allowed to connect to this MariaDB server$|s p/MariaDB/ v/10.3.23 or earlier/ i/unauthorized/ cpe:/a:mariadb:mariadb/
# https://jira.mariadb.org/browse/MDEV-21101
match mysql m|^.\0\0\x01\xff..Host .* is not allowed to connect to this MariaDB server$|s p/MariaDB/ v/10.3.24 or later/ i/unauthorized/ cpe:/a:mariadb:mariadb/

The distinction was done based on one byte being 0x00 in version 10.3.23 and before and 0x01 from version 10.3.24 onwards. However, the byte's value got reverted back to 0x00 some time before MariaDB version 10.6.28, which is still the case for the most recent versions.
(Note that I wasn't able to determine exactly when this was changed, I only noticed it being the case in version 10.6.28 and later. If I find time, I will have a closer look at this.)

To Reproduce

  1. Set up a MariaDB server of a recent version, e.g. in a VM
  2. Make sure that no user is allowed to connect from the remote host
  3. Perform a version scan: nmap -sV -p 3306 <host>
  4. Perhaps, double check with nc <host> 3306 | hexdump -C that the first few bytes are xx 00 00 00 instead of xx 00 00 01

Expected behavior
From what I can tell, there is no way to accurately determine the MariaDB version in recent versions if the scanning host is blocked. nmap should report the version accordingly, or that the version could not be reliably determined.

Version info (please complete the following information):

  • OS: all
  • Output of nmap --version: 7.99
Lingua principale
C
Stelle
14.1k
Fork
3k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nmap/nmap

Tutte le issue di nmap/nmap

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.