Bug 551680 - [Webapp][Security] XSS in query param of webapp war file
Summary: [Webapp][Security] XSS in query param of webapp war file
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: User Assistance (show other bugs)
Version: 3.8.2   Edit
Hardware: PC Windows 10
: P3 major (vote)
Target Milestone: 4.14 M1   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: security
Depends on:
Blocks:
 
Reported: 2019-10-01 11:39 EDT by Laurence Labonté CLA
Modified: 2019-10-02 15:49 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Laurence Labonté CLA 2019-10-01 11:39:19 EDT
This is very similar to bug #317055.

In the FramesetFiler.java servlet, we parse the url, modify it and return it to be used in the html (javascript). That url is vulnerable to a XSS attack in the javascript.

We encoded the URL (req.getPathInfo()), but not the query param (req.getQueryString()).

With url:  /topic/somehtml.html?cp=0_4_4");alert(15)//
The html will be
if( self == top ){
  var  anchorParam = location.hash.length > 0 ? '\u0026anchor=' + location.hash.substr(1) : '';
  window.location.replace( "../../../../index.jsp?topic=%2Fcom.faxserver.help%2Frefguide%2Fsite_configuration%2Fgeneral_settings_properties_ocr.html\u0026cp=0_4_4");alert(15);//" + anchorParam);
}

(Found in 3.8.2, but that code was not updated in the latest version)

Working on a patch, but the change would be to the file:
src/org/eclipse/help/internal/webapp/servlet/FramesetFilter.java
and adding:
query = URLEncoder.encode(query, "UTF-8"); //$NON-NLS-1$
at line 78, just above:
url = url + UrlUtil.JavaScriptEncode("&")  + query;  //$NON-NLS-1$ 

Should this be committers-only ?
Comment 1 Karsten Thoms CLA 2019-10-02 02:37:51 EDT
(In reply to Laurence Labonté from comment #0)
> 
> Should this be committers-only ?

You mean because the potential vulnerability? Would be better.

Could you submit the change to Gerrit, please?
Comment 2 Eclipse Genie CLA 2019-10-02 13:33:12 EDT
New Gerrit change created: https://git.eclipse.org/r/150514
Comment 4 Karsten Thoms CLA 2019-10-02 15:49:22 EDT
Thanks Laurence!