Skip to content

XSS on tasks page #650

@nt0xa

Description

@nt0xa

When task url is for example like http://localhost/?q=<script>alert(1)</script>
you can see alert on /tasks page:

screen shot 2016-12-12 at 18 47 31

This happened because data was not properly escaped here:
https://github.com/mher/flower/blob/master/flower/static/js/flower.js#L800-L804

The fix for this issue I think will be like this:

  }, {
    targets: 4,
    data: 'kwargs',
    visible: isColumnVisible('kwargs'),
    render: function (data) {
        var entityMap = {
            '&': '&amp;',
            '<': '&lt;',
            '>': '&gt;',
            '"': '&quot;',
            '\'': '&#39;',
            '/': '&#x2F;'
        };
        return data.replace(/[&<>"'\/]/g, function (s) {
            return entityMap[s];
        });
    }
}, {

Or like this:

}, {
    targets: 4,
    data: 'kwargs',
    visible: isColumnVisible('kwargs'),
    render: $.fn.dataTable.render.text()
}, {

$.fn.dataTable.render.text appeared in DataTables 1.10.10 (see https://datatables.net/manual/security)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions