The-OP / Fox

The Unlicense
161 stars 24 forks source link

Использование JavaScript для атаки через манипуляцию с содержимым буфера обмена #57

Closed soredake closed 7 years ago

soredake commented 8 years ago

https://thejh.net/misc/website-terminal-copy-paste https://security.love/Pastejacking/ https://www.opennet.ru/opennews/art.shtml?num=44481

The-OP commented 8 years ago

Ссылки добавить куда-нибудь?

soredake commented 8 years ago

Да, стоило бы.

The-OP commented 8 years ago

Для предотвращения JS-варианта у меня такая вот конструкция работает вроде:

// ==UserScript==
// @include *
// @grant none
// @run-at document-start
// ==/UserScript==
(function() {
    var originalExecCommand = document.execCommand.bind(document);
    function hookExecCommand(aCommandName, aShowDefaultUI, aValueArgument) {
        if (aCommandName === 'copy' || aCommandName === 'cut') {
            console.log('Warning: Page has tried to copy text into clipboard.');
            return false;
        } else {
            return originalExecCommand(aCommandName, aShowDefaultUI, aValueArgument);
        }
    };
    Object.defineProperty(document, 'execCommand', {value: hookExecCommand});
})();
The-OP commented 8 years ago

d7cf55c

AlxMxlA commented 7 years ago

Настройки для отключения подобной самодеятельности есть здесь, в разделе "Настройки" Где этот раздел "Настройки"?

The-OP commented 7 years ago

Раздел "настройки" - это, очевидно, prefs. Однако к данному issue это не имеет отношения.