[ 
https://issues.apache.org/jira/browse/DRILL-7276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16848706#comment-16848706
 ] 

ASF GitHub Bot commented on DRILL-7276:
---------------------------------------

vvysotskyi commented on pull request #1795: DRILL-7276: Fixed an XSS 
vulnerability in Drill Web-UI query profile …
URL: https://github.com/apache/drill/pull/1795#discussion_r287689327
 
 

 ##########
 File path: exec/java-exec/src/main/resources/rest/alertModals.ftl
 ##########
 @@ -62,14 +62,18 @@
         var inputValuesKeys = Object.keys(inputValues);
         for (i=0; i<inputValuesKeys.length; ++i) {
             let currKey=inputValuesKeys[i];
-            updatedHtml=updatedHtml.replace(currKey, inputValues[currKey]);
+            updatedHtml=updatedHtml.replace(currKey, 
escapeHtml(inputValues[currKey]));
         }
         modalBody.innerHTML=updatedHtml;
       }
       //Show Alert
       $('#errorModal').modal('show');
     }
 
+    function escapeHtml(str) {
+        return 
str.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;') ;
 
 Review comment:
   Could you please escape other characters as it is described in [Cross Site 
Scripting Prevention Cheat 
Sheet](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.md#rule-1---html-escape-before-inserting-untrusted-data-into-html-element-content)?
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> xss(bug) in apache drill Web UI latest verion 1.16.0 when authenticated 
> ------------------------------------------------------------------------
>
>                 Key: DRILL-7276
>                 URL: https://issues.apache.org/jira/browse/DRILL-7276
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Web Server
>    Affects Versions: 1.16.0
>            Reporter: shuiboye
>            Assignee: Anton Gozhiy
>            Priority: Major
>             Fix For: 1.17.0
>
>         Attachments: 1.png, 2.png, 4.png
>
>
> In the query page,I select the "SQL" of the "Query Type"  and in the "Query" 
> field I input "*select '<svg/onload=alert(/xss/)>'  FROM cp.`employee.json`*".
> !1.png!
> After submitting,I get the Query Profile whose url is 
> "*[http://127.0.0.1:8047/profiles/231beb11-4b43-0762-8b90-76a9af2edd24]*";.
> !2.png!
> Any user who visits the profile page and clicks "JSON profile" at the bottom 
> to see the FULL JSON Profile will see two alert boxes as shown below.
>   !4.png!
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to