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

potential cross site scripting at jspreadsheet drowdown #1587

Closed
greatyy opened this issue Dec 23, 2022 · 2 comments
Closed

potential cross site scripting at jspreadsheet drowdown #1587

greatyy opened this issue Dec 23, 2022 · 2 comments

Comments

@greatyy
Copy link

greatyy commented Dec 23, 2022

reproduce

<html>
<script src="https://bossanova.uk/jspreadsheet/v4/jexcel.js"></script>
<script src="https://jsuites.net/v4/jsuites.js"></script>
<link rel="stylesheet" href="https://jsuites.net/v4/jsuites.css" type="text/css" />
<link rel="stylesheet" href="https://bossanova.uk/jspreadsheet/v4/jexcel.css" type="text/css" />

<div id="spreadsheet"></div>

<script>
    var data = [
        ['Jazz', 'Honda', '2019-02-12', '', true, '$ 2.000,00', '#777700'],
        ['Civic', 'Honda', '2018-07-11', '', true, '$ 4.000,01', '#007777'],
    ];

    jspreadsheet(document.getElementById('spreadsheet'), {
        data:data,
        columns: [
            {
                type: 'text',
                title:'Car',
                width:90
            },
            {
                type: 'dropdown',
                title:'Make',
                width:120,
                source:[
                    "Alfa Romeo<img src onerror='alert(1)'>",
                    "Audi",
                    "Bmw",
                    "Chevrolet",
                    "Chrystler",
                    // (...)
                ]
            },
            {
                type: 'calendar',
                title:'Available',
                width:120
            },
            {
                type: 'image',
                title:'Photo',
                width:120
            },
            {
                type: 'checkbox',
                title:'Stock',
                width:80
            },
            {
                type: 'numeric',
                title:'Price',
                mask:'$ #.##,00',
                width:80,
                decimal:','
            },
            {
                type: 'color',
                width:80,
                render:'square',
            },
        ]
    });
</script>
</html>

Save the above code to a file named test.html. And open it in browser.

Then double click the cross of row 1 and colume Make , js code will be executed
image

impact

xss . https://owasp.org/www-community/attacks/xss/

@hodeware
Copy link
Collaborator

Your example is not very good since you are altering the source code and not injecting something in the source code. But, from your example we have found another point that can improve and we are going to update soon. Another point is, we have already launched jSuites Version 5 which improves some security aspects of the library.

@hodeware
Copy link
Collaborator

hodeware commented Feb 12, 2023

v5.0.3 includes the necessary updates. It is already on the NPM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants