Skip to content
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

Bug: authentication failure due to bad spn #32

Open
nurfed1 opened this issue Oct 26, 2023 · 1 comment
Open

Bug: authentication failure due to bad spn #32

nurfed1 opened this issue Oct 26, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@nurfed1
Copy link

nurfed1 commented Oct 26, 2023

Hi,

I think I found a bug while testing your library in my lab.
For example using the following command:
asmbshareenum -v --url 'smb2+ntlm-password://nurfed.lab\lowpriv:password@dc01.nurfed.lab'

In the windows event log, I can see that logon succeeds but afterwards there's an 5168 File Share failure event containing the following:

Spn check for SMB/SMB2 fails.
	
...

SPN:	
	SPN Name:		cifs/dc01.nurfed.lab@nurfed.lab
	Error Code:		0xC0000022`

When I modify the code at connection.py#L683 to remove the @nurfed.lab part from the SPN, this does not happen and authentication is successful.

After some digging this seems to be related to Microsoft network server: Server SPN target name validation level.

Looking at other implementations, I think the correct might SPN format would be service/hostname, but since I'm not 100% I'd rather create an issue instead of a pull request.
Also, I'm not sure what would be the place to address this in the code. It seems the minikerberos KerberosSPN class does expect the @domain part in the SPN.

@skelsec skelsec added the bug Something isn't working label Nov 5, 2024
@skelsec
Copy link
Owner

skelsec commented Nov 5, 2024

There have been multiple issues in the SPN handling of minikerberos, haven't the time to track it down currently.
The cifs/dc01.nurfed.lab@nurfed.lab SPN looks perfectly valid to me, but it could easily be the case your setup indeed treats it as incorrect, which is definitely a bug on my end.
Will come back to this later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants