Skip to content

mysql-dump-hashes.nse uses password field instead of authentication_string for MySQL 5.7+ versions #2221

Description

@maksyche

Describe the bug
MySQL changed password field name to authentication_string in the 5.7 version, but mysql-dump-hashes.nse script still uses the old field name which causes this problem:

NSOCK INFO [0.7460s] nsock_trace_handler_callback(): Callback: READ SUCCESS for EID 50 [*.*.*.*:3306] (54 bytes): 2......#42S22Unknown column 'password' in 'field list'

To Reproduce
Just run nmap with mysql-dump-hashes script against MySQL 5.7+ version. For example: nmap -p 3306 <ip> --script mysql-dump-hashes --script-args='username=root,password=secret' --script-trace

Expected behavior
Script should print hashes for the MySQL 5.7+ version.

Version info (please complete the following information):

  • OS: Kali Linux 2020.4
  • Nmap version 7.91 ( https://nmap.org )
    Platform: x86_64-pc-linux-gnu
    Compiled with: liblua-5.3.3 openssl-1.1.1g libssh2-1.8.0 libz-1.2.11 libpcre-8.39 nmap-libpcap-1.7.3 nmap-libdnet-1.12 ipv6
    Compiled without:
    Available nsock engines: epoll poll select

Additional context
I see the hardcoded password field in the source code: https://github.com/nmap/nmap/blob/master/scripts/mysql-dump-hashes.nse. Line 87 "SELECT DISTINCT CONCAT(user, ':', password) FROM mysql.user WHERE password <> ''"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions