-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ascii-8bit to UTF-8 encoding in smb/psexec #11405
Comments
Hrm..... I thought I fixed this a long time ago. Can you give a little more info. What OS/language are you using? |
lsb_release -a locale Basically everything is like default kali install except input source is finnish. I also updated the metasploit to 5.0.5-dev and the same thing happens. |
Still an issue 2020.
When logging in to a Swedish locale machine where the admin account is |
Hi! This issue has been left open with no activity for a while now. We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 30 days since the last update here. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. |
I mean, yea we still want this open heh. |
@Torxed Thanks for keeping this issue alive! 👍 We've updated the issue template a bit since this ticket was raised, we've also released Metasploit 6 which made changes to SMB support. It'd be great to verify if this is still an issue, and if so - seeing a stacktrace could help us greatly. If you're able to run through these steps with a new version of Metasploit and provide the result to us, that would be great! |
@adfoster-r7 Awesome, I can give this a try next week. I think I still have a few boxes in a VM setup that runs non-us locale :) |
hi there! |
This is on me for forgetting about this issue... |
looking forward to the fix in the next update! |
OK..... I know what the problem is, and where the problem is, but I'm having some trouble fixing it. I would love it if you could run a couple commands to check things further and help me out. First, I can recreate the issue:
The reason is because the username and password are UTF-8 values, but the string they're put in is encoded in ASCII/ANSI. We can hop into an irb session and verify:
When that gets sent over to ruby_smb, the method
The optimal way to manage this is to encode in the encoding of the window we're running msfconsole in, but a second solution would be to say that the window is almost assuredly going to be utf-8, so we can just force encode the string so that when ruby_smb gets it, the encoding will match the charset, so there will be no problem calling the
That does successfully avoid the exception, but then for me it fails with a bad username/password combination. I'm fairly sure it is correct, though I'm shuffling things around on a standard English keyboard, so there could be an issue there.
Is there any chance one of you could try this again, but force the encoding before running the exploit?
I'm also going to tag @cdelafuente-r7 on this because I'd be shocked if this is the only time we ship over utf-8 chars to ruby_smb hiding in a string marked with ASCII encoding. He also might have already dealt with this problem, too, as he's kind of aweSMBe. |
Step by step, as in your post:
As you can see - all is good. PSexec in msf:
But i'm sure, that smbuser "юзер" with smbpass "123" is correct.
If you need more tests, please say me |
Hi @Mussu999, thanks for reporting this. I could reproduce the issue with a stand alone
while it works fine with a Windows client:
I compared the PCAP's and the name seems to be encoded the same way in both cases ( |
@p01terge1st Thanks so much for verifying! @cdelafuente-r7, that's super odd. I was going to dig in and compare the hex values of the string as it got passed around to see if some hidden character got injected somewhere, but if the pcaps are looking the same, that's unlikely as far as the username. It is still possible we're leaving some hidden character that gets truncated somewhere, but I'd assume we did it for both username and password... |
Hi there! May be anyone solve the problem? |
Looks like usernames are supposed to fit IA5String, per this LDAP rfc although I am not 100% sure this is the actual standard The ruby-ntlm library ensures encoding fits |
@cdelafuente-r7 were you looking into this? I want to say we chatted on it? |
I was not, but I will look at it this week, no problem! |
I submitted a fix to |
The fix has been merged and |
Steps to reproduce
set smbuser järvalv
set smbpass whatever
set rhost 192.168.1.10
run
Current behavior
Im getting failure due the character "ä" in smbuser
Exploit failed [no-access]: Rex::Proto::SMB::Exceptions::loginError Login Failed: "\xC3" from ASCII-8BIT to UTF-8
Version
4.17.23-dev on kali
I installed Metasploit with:
Came with Kali
What OS are you running Metasploit on?
Kali
Anyone have any idea how to fix this? Ive been trying for few days but cant seem to get it fixed. I guess i have to change encoding somewhere but where? And without breaking anything else..
The text was updated successfully, but these errors were encountered: