fortra/impacket

Unsupported data type on TDS version >=7.2

Open

#877 opened on Jun 9, 2020

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Python (12,244 stars) (3,421 forks)batch import
enhancementhelp wanted

Description

Configuration

impacket version: 0.9.21 Python version: 3.7.7 Target OS: Ubuntu 18.04

Debug Output With Command String

i.e.
smbexec -debug domain/user:password@127.0.0.1

>>> d = tds.TDS_COLMETADATA(b"\x81\x01\x00\x00\x00\x00\x00\x08\x00\x38\x09\x41\x00\x70\x00\x70\x00\x74\x00\x43\x00\x6f\x00\x6c\x00\x6f\x00\x72\x00")
>>> tds.MSSQL('bla').parseColMetaData(d)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/.local/lib/python3.7/site-packages/impacket/tds.py", line 1439, in parseColMetaData
    raise Exception("Unsupported data type: 0x%x" % colType)
Exception: Unsupported data type: 0x8

Additional context

This Column Metadata bytes was taken from pcap of TDS version 7.2.

As far as I understand, the problem is size of field userType:

  • until TDS version 7.1, userType size is 2 bytes.
  • since TDS version 7.2, userType size is 4 bytes.

The code of the library assume userType size is 2 bytes.

Contributor guide