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

Reflected Cross-Site Scripting (XSS) in Upload Error Messages #338

Closed
l4rm4nd opened this issue Mar 8, 2021 · 3 comments
Closed

Reflected Cross-Site Scripting (XSS) in Upload Error Messages #338

l4rm4nd opened this issue Mar 8, 2021 · 3 comments
Assignees
Labels
bug Something isn't working good issue Well described issue low impact In context of security issue security
Milestone

Comments

@l4rm4nd
Copy link

l4rm4nd commented Mar 8, 2021

Affected versions: potentially >= 1.5.2

Hey @ciur,

unfortunately, I've again identified an XSS issue. However, the likelihood for exploitation is very low, since it is a reflected self-xss, which cannot be exploited by a remote attacker.

Description

Although the application successfully blocks uploaded filenames with unsafe characters, the displayed error message does not properly sanitize the reflected filename. Therefore, if a user uploads a filename with an XSS payload, the file gets successfully blocked and is not uploaded into the application, but the XSS filename is reflected in the displayed error message and instantly executed by the browser.

Example filenames to trigger XSS:

Sun'><img src=x onerror=alert(1)>set.jpg
XSS"><iframe src=" javascript:alert('XSS');">.pdf

Note: Filenames with special chars are usually only allowed in Unix/Linux operating systems.

image

image

Recommendation

Escape all untrusted user input before storing it into the database or reflecting it in the web application. If user input is always properly escaped, there might be even no need for blocking specific characters.

@l4rm4nd l4rm4nd added the bug Something isn't working label Mar 8, 2021
@ciur
Copy link
Owner

ciur commented Mar 8, 2021

@l4rm4nd, thanks for detailed report, I highly appreciate it!

@ciur
Copy link
Owner

ciur commented Mar 20, 2021

Here is the fix.

ciur added a commit to papermerge/papermerge-core that referenced this issue Mar 20, 2021
@ciur ciur added this to the v2.0.0 milestone Mar 20, 2021
@ciur
Copy link
Owner

ciur commented Apr 6, 2021

Fix is now part of version 2.0

@ciur ciur closed this as completed Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good issue Well described issue low impact In context of security issue security
Projects
None yet
Development

No branches or pull requests

2 participants