add NTLM Target Info; return broken session with error#29
add NTLM Target Info; return broken session with error#29ropnop wants to merge 4 commits intohirochachacha:masterfrom
Conversation
|
Okay, refactored a bit so the NTLMTargetInfo is now part of the NTLMInitiator instead of the Session. I can still call it from outside the package with something like this: initiator := &smb2.NTLMInitiator{
User: "thoffman",
Password: "Password1234",
}
d := &smb2.Dialer{
Initiator: initiator,
}
c, err := d.Dial(conn)
if err != nil {
fmt.Printf("signing required? %t\n", c.SigningRequired())
fmt.Printf("Target info:\n\t%+v\n", initiator.TargetInfo())
log.Fatal(err)
}I'm totally fine with that approach, it works great and seems simpler. I still think the |
|
Sorry for the late reply. I'm still unsure of the right approach here. |
a46c438 to
3cd0aae
Compare
|
Just a quick "hello" related to this issue. We modified the library for recon purpose so NTLMSSP info are easier to grab : https://github.com/LeakIX/go-smb2 It's using https://github.com/bodgit/ntlmssp instead of the "current/messy/seen everywhere" ntlm provider ( we modified it to allow anonymous logons and made a few methods public at https://github.com/LeakIX/ntlmssp ) Let us know if you'd like a pull request for it, but since it's aimed at recon we didn't test further than the test provided with this repo It could also be "another" initiator : https://github.com/LeakIX/go-smb2/blob/master/ntlmssp_initiator.go |
|
I cannot speak for @hirochachacha , but I would really like to see that merged in here. Anonymous support is a great thing. I actually tried to use the It actually doesn't implement the In any case, I would like (very much) to see the anonymous capabilities upstreamed here. What can I do to help? |
|
Asking again, what can I do to help move this along? |
|
Asking again, how can I help move this along? |
|
You probably need a custom Initiator. Example here : https://github.com/LeakIX/go-smb2/blob/master/ntlmssp_initiator.go This is custom and the upstream ntlmssp library has been updated since by it's author : https://github.com/bodgit/ntlmssp Please use it as an example and not production code, our use case is for recon and we haven't tested all scenarios. You can probably implement a Initiator in a separate repo, no need to do a PR here. |
|
Hi @gboddin ; thanks for jumping in quickly. 😄
I wanted to, but I cannot. The // Dialer contains options for func (*Dialer) Dial.
type Dialer struct {
MaxCreditBalance uint16 // if it's zero, clientMaxCreditBalance is used. (See feature.go for more details)
Negotiator Negotiator
Initiator Initiator
}which requires an type Initiator interface {
oid() asn1.ObjectIdentifier
initSecContext() ([]byte, error) // GSS_Init_sec_context
acceptSecContext(sc []byte) ([]byte, error) // GSS_Accept_sec_context
sum(bs []byte) []byte // GSS_getMIC
sessionKey() []byte // QueryContextAttributes(ctx, SECPKG_ATTR_SESSION_KEY, &out)
}All of the member functions of the If this repo changed the Did I miss something?
I don't understand. This is upstream of what? |
|
Oh I didn't remember that, indeed a good point! We used another ntlmssp library because it was cleaner than the one provided in this repo and we needed anonymous login support, so I mentioned which one. Maybe open a new issue to expose the Initiator interface members? After all that's what interfaces are for. Just tell them it'll allow custom implementation without changing a bunch of code in this repo. Otherwise your only option is to fork like we did. |
|
Maybe I will just open the PR and see. |
|
See #85; I hope @hirochachacha can accept it quickly. |
This implements my feature request #28
Here's a sample demonstrating:
Output:
Let me know what you think or if there's a cleaner way to implement this!