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

Security Vulnerability: unauthorized upload behaviour #256

Open
Nictheboy opened this issue Jul 21, 2024 · 0 comments
Open

Security Vulnerability: unauthorized upload behaviour #256

Nictheboy opened this issue Jul 21, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Nictheboy
Copy link
Contributor

Currently, the backend accepts uploaded file, regardless of its type, and even if there is not a token. This is extremely dangerous!

nictheboy@laptop:/tmp$ rm -r /tmp/app/*
nictheboy@laptop:/tmp$ tree /tmp/app/
/tmp/app/

0 directories, 0 files
nictheboy@laptop:/tmp$ curl -X POST http://localhost:3000/avatars -F "avatar=@bugfile;type=image/gif" && echo ""
{"code":201,"message":"Upload avatar successfully","data":{"avatarId":21}}
nictheboy@laptop:/tmp$ curl -X POST http://localhost:3000/materials -F "type=file" -F "file=@bugfile" && echo ""
{"code":401,"message":"AuthenticationRequiredError: Authentication required"}
nictheboy@laptop:/tmp$ curl -X POST http://localhost:3000/attachments -F "type=file" -F "file=@bugfile" && echo ""
{"code":401,"message":"AuthenticationRequiredError: Authentication required"}
nictheboy@laptop:/tmp$ tree /tmp/app/
/tmp/app/
└── uploads
    ├── avatars
    │   └── fd6bf3d1-0d88-4f83-a080-a95b1d62dfb7
    └── files
        ├── 0f9be690-4133-4d34-a25a-d293308ed297
        └── b7d8e04a-3a15-4688-ba24-13bfb3ebd037

4 directories, 3 files
nictheboy@laptop:/tmp$ cat app/uploads/avatars/fd6bf3d1-0d88-4f83-a080-a95b1d62dfb7 
BUG!
nictheboy@laptop:/tmp$ cat app/uploads/files/0f9be690-4133-4d34-a25a-d293308ed297 
BUG!
nictheboy@laptop:/tmp$ cat app/uploads/files/b7d8e04a-3a15-4688-ba24-13bfb3ebd037 
BUG!
nictheboy@laptop:/tmp$ 
@Nictheboy Nictheboy added the bug Something isn't working label Jul 21, 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
Projects
None yet
Development

No branches or pull requests

1 participant