Web Analytics Made Easy -
StatCounter XSS vulnerability using jquery html - CodingForum

Announcement

Collapse
No announcement yet.

XSS vulnerability using jquery html

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • XSS vulnerability using jquery html

    I have created a very basic lightweight wysiwyg editor using designMode, styleWithCSS on an iframe and execCommand on selections. The editor includes a simple 'open code view' that copies all content from the iframe to a textarea and a 'close code view' that copies from the textarea to the iframe, it's simple stuff, here's the code:
    Code:
    $('#openCodeView').click(function(){
        addToTextArea();
        // toggle textarea visability
        $("#wysiTextArea").toggle();
        // toggle buttons visability
        $("#openCodeView").toggle();
        $("#closeCodeView").toggle();
    }
    function addToTextArea(){
        // get content from iframe
        var wysiCode = window.frames['wysiFrame'].document.body.innerHTML;
        // place content into textarea
        $("#wysiTextArea").html(wysiCode);
    }
    If I open code view and enter a script, eg:
    Code:
    <script> alert('script executed'); </script>
    and then close the code view the script will execute.
    Any content sent to the server/database is cleaned with purifier as is any content received by $_POST. I can't imagine how anyone would be able run a script unless they were personally on the page entering the script themselves and therefore only gaining access to their own cookies/session id's. Is this open to XSS abuse?
    Any advice/help appreciated, thanks in advance.
Working...
X