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

Weird behaviour when inputing passwords with a trailing backslash #891

Open
c13mn14k opened this issue Sep 7, 2023 · 1 comment
Open
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@c13mn14k
Copy link

c13mn14k commented Sep 7, 2023

Describe the bug / to reproduce

(Case 1)

Frontend logic removes (at least) trailing backslashes from a password input when accessing a protected share.
I had a quick look, and it's probably due to this:

export function getSharePassword(shareToken: string) {
const match = document.cookie.match(
`share-token-pw-${shareToken}=([\\d\\w]+)`
)
return match && match[1]
}

The resultant behavior is:

  1. Create a share with a password (let's say password is only [a-zA-Z]+)
  2. Access the share as an unathenticated user
  3. Input the password with a trailing backslash (or backslashes)
  4. You are authenticated and share is shown

Expected behavior:
user is not authenticated and not authorized to the share.

(Case 2)

I also checked the behavior when the password itself had a trailing backslash. For example, when password is a\, using a password that matches a\\* does not authorize to the share, sometimes throwing an internal server error. When the share password is simply \, then inputing \ results in:

2023/09/06 23:50:04 Did not find auth-token cookie
runtime error: invalid memory address or nil pointer dereference

goroutine 2257323 [running]:
runtime/debug.Stack()
...

also

Sometimes (??) when inputing password+trailing slashes I'm authorized to the share, but the image doesn't display (link to the image is unauthorized). In that case though, there are exif settings visible, so there is still info leak:
image

Expected behavior:
just normal password stuff

Your environment:
Nothing too useful, Docker-compose, Ubuntu server, postgres

version: undefined?
I pull from viktorstrate/photoview:master, 4f1126b4d5b3
image

@c13mn14k c13mn14k added the bug Something isn't working label Sep 7, 2023
@kkovaletp
Copy link
Contributor

@jordy2254, as you're working on user management epic, this issue might be interesting for you

@kkovaletp kkovaletp added the help wanted Extra attention is needed label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants