javascript - Is calling a method of `unsafeWindow` in GM script with privileges a vulnerable practice? -


i have script like

// ==userscript== // @grant       gm_getvalue // @grant       gm_setvalue // @include     * // @run-at      document-start // ==/userscript==  var foo = gm_getvalue('foo'); var _open = unsafewindow.open; unsafewindow.open = function(){    if( /* */ ){       _open();    }    settimeout(function() {         gm_setvalue('bar', 'bar');     }, 0); } 

maybe malicious site could

  • add getter window.open execute malicious code when var _open = unsafewindow.open
  • add setter window.open execute malicious code when unsafewindow.open = /*...*/
  • replace window.open malicious function, execute when use _open()

could way malicious site gain privileges use gm_getvalue or gm_setvalue, or variables defined in script (like foo)?


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -