p0dalirius/smbclient-ng

[bug] Emoji in filename breaks get command in smbclient-ng, (root cause in impacket)

Opened this issue ยท 3 comments

When using smbclientng, and there is a file that contains a emoji in it's filename, for example: 'Fixed issue ๐ŸŽ„ .msg', smbclientng results in being stuck. It is not possible to skip the file either, the entire smbclientng program hangs.

The 'get' command is ran on *.msg:

get *.msg
[..]
[error] [!] SMB Error: SMB SessionError: STATUS_OBJECT_NAME_NOT_FOUND(The object name is not found.)                                              
[1;92mโบ[0m[[1;94m\\10.0.0.1\test\docu\[0m]>                                                                                            
'19931232 Fixed issue ๐ŸŽ„ .msg' โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 0.0% โ€ข 0.0/123.1 kB โ€ข ? โ€ข -:--:--
[1;92mโบ[0m[[1;94m\\10.0.0.1\test\docu\[0m]>                                                                                            
'19931232 Fixed issue ๐ŸŽ„ .msg' โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 0.0% โ€ข 0.0/123.1 kB โ€ข ? โ€ข -:--:--
[1;92mโบ[0m[[1;94m\\10.0.0.1\test\docu\[0m]>

Pressing ctrl + c does not seem to kill it too.

Checked if the impacket dependency is the problem. Seems like impacket filters the emoji titles out? Couldn't find it using smbclient from impacket.

That is weird, I did not know that.

I will look into it

Hi,

So I reproduced your environment and the problem comes from impacket:

image

It also crashes from the orginal smbclient.py:

image

So the handling of encoding seems to be broken in the get file of impacket..

Best regards