question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Seems like the drag template is vulnerable for XSS attacks

See original GitHub issue

We create a drag item template which is based on user’s input (e.g. item name). Seems that this behaviour is vulnerable for XSS attack, in case the user put a script tag in the item name. We can sanitize user’s input, but as developers usually rely on Angular automatic sanitization process, we think that the data-jqyoui-options directive should take care of this as well, if possible.

For example, try to define this draggable item:

<div
   data-drag="true"
   jqyoui-draggable
   data-jqyoui-options="{helper: getItemDragTemplate(), appendTo: 'body'}">

Where the getItemDragTemlpate is:

<div>item.name</div>

Where item.name is some user malicious input, for example:

<script>alert('hello')</script>

Dragging such an item will cause the script to run.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
benbrachacommented, Jun 29, 2016

I’m not sure I follow… because jqueryUI draggable, which you use, allows to change the markup. This is done by providing a function through an “helper” property: https://api.jqueryui.com/draggable/#option-helper

All I’m saying is that, if helper is a function - it must return a DOM element, which means it should be sanitized (or at least optional sanitized…).

0reactions
codef0rmercommented, Jun 29, 2016

@benbracha I really appreciate your efforts in providing the solution. However, not everybody allows to modify the markup before dragging/dropping unlike your requirement. That’s why I did not want to add the fix in angular-dragdrop. I hope it clarifies the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cross-site Scripting (XSS) in microweber/microweber | Snyk
microweber/microweber is a new generation CMS with drag and drop. Affected versions of this package are vulnerable to Cross-site Scripting ...
Read more >
Cross-site Scripting (XSS): What Is It and How to Fix it?
The problem is that not all WordPress plugins and themes are 100% secure and many of them do, in fact, have XSS vulnerabilities....
Read more >
Cross Site Scripting (XSS) Attack Tutorial with Examples ...
Cross Site Scripting (XSS) is a commonly known vulnerable attack for every advanced tester. In this XSS tutorial learn XSS attack with XSS ......
Read more >
XSS 101 - Brute XSS
XSS attacks abuse the dynamic way websites interact with their clients, the browsers. It makes possible, for an attacker, to control the ...
Read more >
In Login page of web application, I have allowed drag and ...
An XSS attack is performed by injecting malicious code to be displayed to another user. To use a standard login form for an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found