hierynomus / smbj

Server Message Block (SMB2, SMB3) implementation in Java
Other
713 stars 180 forks source link

STATUS_LOGON_FAILURE (0xc000006d) with smbj-0.11.5 #725

Closed cliviu closed 2 years ago

cliviu commented 2 years ago

Hi, I always got STATUS_LOGON_FAILURE. Username and password are ok because I can login with a regular client. Here are the logs: Any ideas?

2022-07-18 13:28:10,739|ProxySocketFactory|DEBUG|Connecting to /xxx.xxx.xxx.xx:445 2022-07-18 13:28:10,741|DirectTcpPacketReader|DEBUG|Starting PacketReader on thread: Packet Reader for xxx.xxx.xxx.xx 2022-07-18 13:28:10,744|SMBProtocolNegotiator|DEBUG|Negotiating dialects [SMB_2_0_2, SMB_2_1, SMB_2XX] 2022-07-18 13:28:10,747|DirectTcpTransport|DEBUG|Writing packet SMB_COM_NEGOTIATE 2022-07-18 13:28:10,750|Promise|DEBUG|Awaiting << 0 >> 2022-07-18 13:28:10,754|DirectTcpPacketReader|DEBUG|Received packet SMB2_NEGOTIATE with message id << 0 >> 2022-07-18 13:28:10,756|SMB2CreditGrantingPacketHandler|DEBUG|Server granted us 1 credits for SMB2_NEGOTIATE with message id << 0 >>, now available: 1 credits 2022-07-18 13:28:10,758|Promise|DEBUG|Setting << 0 >> to SMB2_NEGOTIATE with message id << 0 >> 2022-07-18 13:28:10,758|Connection|DEBUG|Granted 1 (out of 1) credits to SMB2_NEGOTIATE with message id << 1 >> 2022-07-18 13:28:10,759|DirectTcpTransport|DEBUG|Writing packet SMB2_NEGOTIATE with message id << 1 >> 2022-07-18 13:28:10,759|Promise|DEBUG|Awaiting << 1 >> 2022-07-18 13:28:10,760|DirectTcpPacketReader|DEBUG|Received packet SMB2_NEGOTIATE with message id << 1 >> 2022-07-18 13:28:10,761|SMB2CreditGrantingPacketHandler|DEBUG|Server granted us 1 credits for SMB2_NEGOTIATE with message id << 1 >>, now available: 1 credits 2022-07-18 13:28:10,761|Promise|DEBUG|Setting << 1 >> to SMB2_NEGOTIATE with message id << 1 >> 2022-07-18 13:28:10,761|SMBProtocolNegotiator|DEBUG|Negotiated the following connection settings: ConnectionContext{ serverGuid=073a917f-4264-4f00-9436-1525244852e2, serverName='xxx.xxx.xxx.xx', negotiatedProtocol=NegotiatedProtocol{dialect=SMB_2_1, maxTransactSize=8388608, maxReadSize=8388608, maxWriteSize=8388608}, clientGuid=026e550a-ecf8-4904-a193-f9c27b988aa8, clientCapabilities=[], serverCapabilities=[SMB2_GLOBAL_CAP_DFS, SMB2_GLOBAL_CAP_LEASING, SMB2_GLOBAL_CAP_LARGE_MTU], clientSecurityMode=1, serverSecurityMode=1, server='com.hierynomus.smbj.server.Server@588f63c' } 2022-07-18 13:28:10,762|PacketEncryptor|INFO |Initialized PacketEncryptor with Cipher << AES_128_CCM >> 2022-07-18 13:28:10,766|Connection|INFO |Successfully connected to: xxx.xxx.xxx.xx connect: using host = xxx.xxx.xxx.xx and root share Analysis with timeout 60000 and so timeout 0 [GC (Allocation Failure) 38105K->16646K(45568K), 0,0059279 secs] 2022-07-18 13:28:10,789|NtlmAuthenticator|DEBUG|Initialized Authentication of UserName using NTLM 2022-07-18 13:28:10,796|Connection|DEBUG|Granted 1 (out of 1) credits to SMB2_SESSION_SETUP with message id << 2 >> 2022-07-18 13:28:10,796|DirectTcpTransport|DEBUG|Writing packet SMB2_SESSION_SETUP with message id << 2 >> 2022-07-18 13:28:10,796|Promise|DEBUG|Awaiting << 2 >> 2022-07-18 13:28:10,797|DirectTcpPacketReader|DEBUG|Received packet SMB2_SESSION_SETUP with message id << 2 >> 2022-07-18 13:28:10,797|SMB2CreditGrantingPacketHandler|DEBUG|Server granted us 1 credits for SMB2_SESSION_SETUP with message id << 2 >>, now available: 1 credits 2022-07-18 13:28:10,798|Promise|DEBUG|Setting << 2 >> to SMB2_SESSION_SETUP with message id << 2 >> 2022-07-18 13:28:10,798|SMBSessionBuilder|DEBUG|More processing required for authentication of UserName using com.hierynomus.smbj.auth.NtlmAuthenticator@75de6341 2022-07-18 13:28:10,798|NtlmAuthenticator|DEBUG|Received token: a1 82 01 0b 30 82 01 07 a0 03 0a 01 01 a1 0c 06 0a 2b 06 01 04 01 82 37 02 02 0a a2 81 f1 04 81 ee 4e 54 4c 4d 53 53 50 00 02 00 00 00 1e 00 1e 00 38 00 00 00 15 82 8a e2 5c 8d 22 ba 26 66 d0 0c 00 00 00 00 00 00 00 00 98 00 98 00 56 00 00 00 0a 00 61 4a 00 00 00 0f 44 00 45 00 53 00 4b 00 54 00 4f 00 50 00 2d 00 30 00 37 00 30 00 52 00 30 00 4d 00 45 00 02 00 1e 00 44 00 45 00 53 00 4b 00 54 00 4f 00 50 00 2d 00 30 00 37 00 30 00 52 00 30 00 4d 00 45 00 01 00 1e 00 44 00 45 00 53 00 4b 00 54 00 4f 00 50 00 2d 00 30 00 37 00 30 00 52 00 30 00 4d 00 45 00 04 00 1e 00 44 00 45 00 53 00 4b 00 54 00 4f 00 50 00 2d 00 30 00 37 00 30 00 52 00 30 00 4d 00 45 00 03 00 1e 00 44 00 45 00 53 00 4b 00 54 00 4f 00 50 00 2d 00 30 00 37 00 30 00 52 00 30 00 4d 00 45 00 07 00 08 00 de eb bd be cb 9a d8 01 00 00 00 00 2022-07-18 13:28:10,802|ASN1InputStream|DEBUG|Read ASN.1 object: ASN1TaggedObject[ASN1Tag[CONTEXT_SPECIFIC,CONSTRUCTED,1],] 2022-07-18 13:28:10,802|ASN1InputStream|DEBUG|Read ASN.1 object: ASN1TaggedObject[ASN1Tag[CONTEXT_SPECIFIC,CONSTRUCTED,0],] 2022-07-18 13:28:10,803|ASN1InputStream|DEBUG|Read ASN.1 object: ASN1TaggedObject[ASN1Tag[CONTEXT_SPECIFIC,CONSTRUCTED,1],] 2022-07-18 13:28:10,803|ASN1InputStream|DEBUG|Read ASN.1 object: ASN1TaggedObject[ASN1Tag[CONTEXT_SPECIFIC,CONSTRUCTED,2],] 2022-07-18 13:28:10,803|ASN1InputStream|DEBUG|Read ASN.1 object: ASN1Sequence[[ASN1TaggedObject[ASN1Tag[CONTEXT_SPECIFIC,CONSTRUCTED,0],], ASN1TaggedObject[ASN1Tag[CONTEXT_SPECIFIC,CONSTRUCTED,1],], ASN1TaggedObject[ASN1Tag[CONTEXT_SPECIFIC,CONSTRUCTED,2],]]] 2022-07-18 13:28:10,803|ASN1InputStream|DEBUG|Read ASN.1 object: ASN1Enumerated[1] 2022-07-18 13:28:10,803|ASN1InputStream|DEBUG|Read ASN.1 object: ASN1ObjectIdentifier[1.3.6.1.4.1.311.2.2.10] 2022-07-18 13:28:10,803|ASN1InputStream|DEBUG|Read ASN.1 object: ASN1OctetString[[78, 84, 76, 77, 83, 83, 80, 0, 2, 0, 0, 0, 30, 0, 30, 0, 56, 0, 0, 0, 21, -126, -118, -30, 92, -115, 34, -70, 38, 102, -48, 12, 0, 0, 0, 0, 0, 0, 0, 0, -104, 0, -104, 0, 86, 0, 0, 0, 10, 0, 97, 74, 0, 0, 0, 15, 68, 0, 69, 0, 83, 0, 75, 0, 84, 0, 79, 0, 80, 0, 45, 0, 48, 0, 55, 0, 48, 0, 82, 0, 48, 0, 77, 0, 69, 0, 2, 0, 30, 0, 68, 0, 69, 0, 83, 0, 75, 0, 84, 0, 79, 0, 80, 0, 45, 0, 48, 0, 55, 0, 48, 0, 82, 0, 48, 0, 77, 0, 69, 0, 1, 0, 30, 0, 68, 0, 69, 0, 83, 0, 75, 0, 84, 0, 79, 0, 80, 0, 45, 0, 48, 0, 55, 0, 48, 0, 82, 0, 48, 0, 77, 0, 69, 0, 4, 0, 30, 0, 68, 0, 69, 0, 83, 0, 75, 0, 84, 0, 79, 0, 80, 0, 45, 0, 48, 0, 55, 0, 48, 0, 82, 0, 48, 0, 77, 0, 69, 0, 3, 0, 30, 0, 68, 0, 69, 0, 83, 0, 75, 0, 84, 0, 79, 0, 80, 0, 45, 0, 48, 0, 55, 0, 48, 0, 82, 0, 48, 0, 77, 0, 69, 0, 7, 0, 8, 0, -34, -21, -67, -66, -53, -102, -40, 1, 0, 0, 0, 0]] 2022-07-18 13:28:10,805|NtlmChallenge|DEBUG|Windows version = WindowsVersion[WINDOWS_MAJOR_VERSION_10, WINDOWS_MINOR_VERSION_0, 19041, NTLMSSP_REVISION_W2K3] 2022-07-18 13:28:10,807|NtlmAuthenticator|DEBUG|Received NTLM challenge from: MYDESKTOP [GC (Allocation Failure) 39174K->20909K(45568K), 0,0058309 secs] 2022-07-18 13:28:10,906|Connection|DEBUG|Granted 1 (out of 1) credits to SMB2_SESSION_SETUP with message id << 3 >> 2022-07-18 13:28:10,906|DirectTcpTransport|DEBUG|Writing packet SMB2_SESSION_SETUP with message id << 3 >> 2022-07-18 13:28:10,906|Promise|DEBUG|Awaiting << 3 >> 2022-07-18 13:28:10,907|DirectTcpPacketReader|DEBUG|Received packet SMB2_SESSION_SETUP with message id << 3 >> 2022-07-18 13:28:10,907|SMB2CreditGrantingPacketHandler|DEBUG|Server granted us 1 credits for SMB2_SESSION_SETUP with message id << 3 >>, now available: 1 credits 2022-07-18 13:28:10,907|Promise|DEBUG|Setting << 3 >> to SMB2_SESSION_SETUP with message id << 3 >>

Caused by: com.hierynomus.mssmb2.SMBApiException: STATUS_LOGON_FAILURE (0xc000006d): Authentication failed for 'UserName' using com.hierynomus.smbj.auth.NtlmAuthenticator@75de6341 at com.hierynomus.smbj.connection.SMBSessionBuilder.setupSession(SMBSessionBuilder.java:144) ~[smbj-0.11.5.jar:?] at com.hierynomus.smbj.connection.SMBSessionBuilder.setupSession(SMBSessionBuilder.java:142) ~[smbj-0.11.5.jar:?] at com.hierynomus.smbj.connection.SMBSessionBuilder.establish(SMBSessionBuilder.java:109) ~[smbj-0.11.5.jar:?] at com.hierynomus.smbj.connection.Connection.authenticate(Connection.java:202) ~[smbj-0.11.5.jar:?]

... 63 more
cliviu commented 2 years ago

can it be somehow related with this server answer : STATUS_MORE_PROCESSING_REQUIRED(0xC0000016L) ?

hierynomus commented 2 years ago

Did you find the issue?

cliviu commented 2 years ago

yes, some missing $ sign in the Spring context exactly for the password replacement . And, as the password is never written in the log for security reasons, nobody noticed it. Sorry for the false alarm and thanks for the support!

hierynomus commented 2 years ago

Wow, that teaches people to put weird characters in their password ;). Thanks for the response.

cliviu commented 2 years ago

it was something like this: (notice the missing $ from the password variable) <property name="user" value="${SmbService.User}" /> <property name="password" value="{SmbService.Password}" />