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

Fix Reflected XSS through maliciously formed URLs #176

Merged
merged 1 commit into from
Mar 8, 2018
Merged

Fix Reflected XSS through maliciously formed URLs #176

merged 1 commit into from
Mar 8, 2018

Conversation

vierbergenlars
Copy link
Member

Reflected XSS is possible in extensions that use the com.github.dynamicextensionsalfresco.webscripts.support.AbstractBundleResourceHandler.handleResourceNotFound() method to trigger an error message when a resource is not found.

Description

Example:

@Component
@WebScript(families="xss")
@Transaction(TransactionType.NONE)
public class XSSResourceWebScript extends AbstractBundleResourceHandler {

    private final String packagePath;

    public FinderResourceWebScript() {
        packagePath = this.getClass().getPackage().getName().replace('.', '/');
    
    @Uri(value = "/resources/{path}", formatStyle = FormatStyle.ARGUMENT)
    public void handleResources(@UriVariable final String path, final WebScriptResponse response, WebScriptRequest request) throws Exception {

        final URL resource = getBundleContext().getBundle().getEntry(path);
        if (resource != null) {
            sendResource(request, response, resource);
        } else {
            handleResourceNotFound(path, response);
        }
}

Visiting /alfresco/s/resources/<script>alert('XSS');</script>index.html shows a javascript alert window.

Related Issue

Private

Motivation and Context

How Has This Been Tested?

Tested that it remedies a specific XSS payload in IE11, Edge 15, Chrome latest, Firefox latest on Windows 10.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@stanmine stanmine self-requested a review March 8, 2018 10:05
@stanmine stanmine added the bug label Mar 8, 2018
@stanmine stanmine added this to the 1.7.4 milestone Mar 8, 2018
@stanmine stanmine merged commit 13163fa into xenit-eu:master Mar 8, 2018
@vierbergenlars vierbergenlars deleted the 404-xss-fix branch November 15, 2018 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants