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

Incorrect use of session object will cause requests to compete with each other and create security vulnerability #17

Open
AvedisBaghdasarian opened this issue Dec 27, 2023 · 1 comment

Comments

@AvedisBaghdasarian
Copy link

session := Session{}

session := Session{} is scoped to main(). If two users attempt to authenticate at the same time, the session object will be overwritten causing login failure for the first person.

func (session *Session) login(w http.ResponseWriter, r *http.Request, c *duouniversal.Client) {
...
		// Step 4: Generate and save a state variable
		session.duoState, err = c.GenerateState()
		if err != nil {
			log.Fatal("Error generating state: ", err)
		}

Please use something like gorrillas sessions package to manage duoState for each pre-auth session. I'm a bit busy right now but if I get some time I'll PR the right way of doing it.

https://pkg.go.dev/github.com/gorilla/sessions

@AvedisBaghdasarian AvedisBaghdasarian changed the title Incorrect use of session object will cause requests to compete with each other Incorrect use of session object will cause requests to compete with each other and create security vulnerability Jan 8, 2024
@AvedisBaghdasarian
Copy link
Author

Additionally, in this method, anyone with the correct callback url will aquire the user credentials, even if that url is all they, and they do not have the password.

If you use a preauth session like I suggest then you will have to posture an encrypted cookie holding the username and duostate, guarunteeing that you are the one who authenticated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant