Skip to content

SQL wrong output for "binary" data types #2043

@gabrielg5

Description

@gabrielg5

Configuration

impacket version: 0.13-dev
Python version: 3

(Coming from #2037 (comment))

binary data types are wrongly printed in SQL output. Check UserID or SID columns below...

Debug Output With Command String

──(kali㉿kali)-[~/Desktop/impacket/examples]
└─$ python mssqlclient.py host
Impacket v0.13.0.dev0+20250919.210843.8426ec99 - Copyright Fortra, LLC and its affiliated companies 

[*] Encryption required, switching to TLS
[*] ENVCHANGE(DATABASE): Old Value: master, New Value: master
[*] ENVCHANGE(LANGUAGE): Old Value: , New Value: us_english
[*] ENVCHANGE(PACKETSIZE): Old Value: 4096, New Value: 16192
[*] INFO: Line 1: Changed database context to 'master'.
[*] INFO: Line 1: Changed language setting to us_english.
[*] ACK: Result: 1 - Microsoft SQL Server 2019  (15.0.2145)
[!] Press help for extra shell commands
SQL> enum_users
UserName             RoleName   LoginName   DefDBName   DefSchemaName       UserID     SID   
------------------   --------   ---------   ---------   -------------   ----------   -----   
dbo                  db_owner   sa          master      dbo             b'1         '   b'01'   
guest                public     NULL        NULL        guest           b'2         '   b'00'   
INFORMATION_SCHEMA   public     NULL        NULL        NULL            b'3         '    NULL   
sys                  public     NULL        NULL        NULL            b'4         '    NULL   

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions