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

Potentail XSS vulnerability #731

Open
gomez114 opened this issue Sep 10, 2020 · 0 comments
Open

Potentail XSS vulnerability #731

gomez114 opened this issue Sep 10, 2020 · 0 comments

Comments

@gomez114
Copy link

gomez114 commented Sep 10, 2020

The input variable 'operation'

// handle contextMenu triggers
    $.fn.contextMenu = function (operation) {
        var $t = this, $o = operation;
        if (this.length > 0) {  // this is not a build on demand menu
            if (typeof operation === 'undefined') {
                this.first().trigger('contextmenu');
   ...
   ...
            } else if ($.isPlainObject(operation)) {
                operation.context = this;
                $.contextMenu('create', operation);

then call the function 'contexMenu', the operation pass to options, and pass to o

$.contextMenu = function (operation, options) {
        if (typeof operation !== 'string') {
            options = operation;
            operation = 'create';
        }

        if (typeof options === 'string') {
            options = {selector: options};
        } else if (typeof options === 'undefined') {
            options = {};
        }

        // merge with default options
        var o = $.extend(true, {}, defaults, options || {});

in the end, o pass to contex,$-function evaluates its input as JavaScript-code instead of as a CSS-selector.The problem is that $(context) will execute JavaScript code if the value of context is a string like "<img src=x onerror=alert(1)>".

           case 'destroy':
                var $visibleMenu;
                if (_hasContext) {
                    // get proper options
                    var context = o.context;
                    $.each(menus, function (ns, o) {

                        if (!o) {
                            return true;
                        }

                        // Is this menu equest to the context called from
                        if (!$(context).is(o.selector)) {
                            return true;
                        }
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

1 participant