-
Notifications
You must be signed in to change notification settings - Fork 180
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
Null pointer when authenticating as guest #792
Comments
@dkocher Which version? I fixed a similar bug for anonymous authentication in v0.12.2, and I thought I had checked guest then also. |
Running |
@dkocher Which authenticator are you using? |
This is using |
Even, I'm facing the same Nullpointer exception when trying with anonymous login:
It is happening after upgrade to smbj library 0.12.2 and my target server Windows 11 (protocol: SMB_3_1_1), I've tried to allow insecure guest logons as well in my Local group policy editor. Not sure if this is relevant but found this while debugging that this can be the cause:
session key is set to context when it is neither anonymous nor guest, meaning only for user context, thus later in the derivekeys, this ended up in NullPointer. Is there any update on the issue, whether if it's server configuration issue or bug in the actual code? |
@karthik-119 points out this may be a regression of 4633709. |
This should fix the NPE that occurs when authenticating with guest or anonymous credentials and the server treating it as a regular account
@dkocher @karthik-119 Can you try with the fix from #800? |
I tested and:
So that issue has already been fixed by a commit post v0.12.2 it seems. |
@bubbleguuum Now that's even weirder, as Git doesn't show any change which could have anything to do with that on the current |
Yes please disregard, I did my testing wrong (was actually using v0.11.1 instead of git master!). |
Still crashing using master git + the 1 line PR.
|
@hierynomus , let me try to verify the fix. |
I realized that this project needs to be built with gradle which I'm not used to and have no correct configuration on my system. I'm afraid I can't verify the fix when it is still on issue branch. Is there any possibility to build the project using maven? |
There should be no need to set it up. You can use |
For building you need to use Java11 (or higher) |
Thanks, I'm able to build project with Java 11, can you please update Readme, it still says Java 7? thanks. I'll test the jar and update results here. |
Verified and can still see same NullPointerException.
I think the issue is within NtlmAuthenticatior logic itself (in doAuthenticate()): // [MS-NLMP] 3.2.2 -- Special case for anonymous authentication
if (context.isAnonymous()) {
NtlmAuthenticate msg = new NtlmAuthenticate(null, null, context.getUsername(), context.getDomain(),
config.getWorkstationName(), null, negotiateFlags, config.getWindowsVersion());
response.setNegToken(negTokenTarg(msg));
return response;
} for anonymous context, response neither have any session key set nor sessions flags updated later in authentication logic of SMBSessionBuilder. Compared to older 11.x version where for anonymous context, session key is set based on ntlm server challenge response. if (dialect.isSmb3x() &&
!response.getSessionFlags().contains(SMB2SessionSetup.SMB2SessionFlags.SMB2_SESSION_FLAG_IS_NULL) &&
!response.getSessionFlags().contains(SMB2SessionSetup.SMB2SessionFlags.SMB2_SESSION_FLAG_IS_GUEST)) { where it looks like this logic is not required for anonymous or guest context but session flags for response is not updated anywhere if that is proven. ((Note: I'm no expert in smb subject or this lib code, just trying to infer based on my understanding in debug sessions, I might be wrong in my statements, please correct me)) |
Any update on this? |
Indeed any update on this issue? Using SMBj 0.11.5 when an anonymous logon (no username nor password set) was done the sessionFlag SMB2_SESSION_FLAG_IS_GUEST was set and the logon succeeded. Doubt if this was for the correct reason, would have expected that sessionFlag "SMB2_SESSION_FLAG_IS_NULL" was set instead of "SMB2_SESSION_FLAG_IS_GUEST". |
To work around regression in SMB anonymous authentication. See also hierynomus/smbj#792 This reverts commit d9ce4e6. Bug: #1181
* Ref: hierynomus/smbj#792 * Related: zhanghai/MaterialFiles@2d425a6 Change-Id: I82b9ae5e9f61e5c2886e782537579a9347e92b70
Any update on this? |
There is an open PR for this issue: #800 We can't get unauthenticated samba connection to work using smbj 0.13.0 due to this issue. Here is a stack trace:
|
…mus#792) This should fix the NPE that occurs when authenticating with guest or anonymous credentials and the server treating it as a regular account
Attempting to authenticate as guest using
AuthenticationContext.guest()
results in an exceptionThe server is running
SMB_3_1_1
(Windows Server 2022)The text was updated successfully, but these errors were encountered: