In Look before you paste from a website to terminal the author rightly warns us about carelessly pasting any input from a web page into the terminal.

This LookBeforePaste Chrome Extension is a quick attempt at trying to warn the user.

Example output when pressing CTRL-C on the malicious code:

[how it looks in the
browser]

Heuristics are defined as follows. They could certainly be improved, but it's a start.

function isSuspicious(node)
{
    if (node.nodeType == node.ELEMENT_NODE) {
        var style = window.getComputedStyle(node);
        var checks = [
            ['color', style.color == style.backgroundColor],
            ['fontSize', parseInt(style.fontSize) <= 5],
            ['zIndex', parseInt(style.zIndex) < 0],
            ['userSelect', style.userSelect == 'none']
        ];
        for (var i in checks) {
            if (checks[i][1]) {
                console.log('Looks suspicious to me:')
                console.log(node)
                console.log(JSON.stringify(checks))
                return true;
            }
        }
    }
}

I couldn't be bothered uploading it to the Chrome Store. But if you want to try it, it's in the blob below:

$ tar cv lookbeforepaste/* | gzip -c | base64
lookbeforepaste/background.html
lookbeforepaste/background.js
lookbeforepaste/icon.png
lookbeforepaste/listen.js
lookbeforepaste/manifest.json

H4sIACf8iVgAA+0ZS2wkR9XehXV2kt0YkWgBIahtwU7P7qg9M56xV+NP7LUdMPHaaL0rQMZyarpr
Znq3p6vVVbNjxzF44WIfUCLBikhcSA45wgEpCClClvABlKAEiQNBnKJIHLhgIaEcVoRXXd093T3j
eA9mTaR52p3urvde1Xuv3nv1Xtmi9E6FVKlLHMw4Gapg/U7NpU3b0Oq8YfUdB+QARnI58cyPlmJP
D/KFUl9+OFcsDJdGiqPFvlx+ZKQw3Idyx7L6EdBkHLsI9bWwxYl7ON1R+E8ojItdnkyN1wk2JlMI
jTPdNR2OmKtPKBFnuM2UyfEhiQTyIUk/XqHGhvgMnnK2k1aqBw8N1uHxf5sd0xpHxH9+JBfE/2ix
WBoR8V8YHe3F/6OAoSF0s24yBP8sig1iIGojx2rWTBsJy3AtBSR3zUYZMcIRZxNXEWtNFAHJ4BeG
sFlOpe6CDW3cIGgCpRMulR5LpfS6SxtEI+uc2Myktkbt64QxXCMaNowFE8hs4qrVpq1zQKsNV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adBOxEyce1oQA5owIeW
Ct+wYcwJfHhF6N3zwdkjc2FWVjIne4XyiYZk/9fAtlkljEMHSO1jWuOo+5/RUvj3v0KxkBf3/8OF
Yq//exQgIl0JNn0NTn6RC5QyKmRFAlPEBSZ8KaLMQtJPkOcoiqgMFThmvb8ISh7F6yTDjIJYnbYY
FDfRpIUME0PShyTF69BsQGKzTKdCsWt4/YWXCgjW64ibcDpjmSJwUMEjh7ggQ4MYcv22vEpOy8ux
dnqFYZnIFNHHCqJE6lUAu+Ux+WuvSXUY0K4EvLfllxLejCjIL4sVSL9rVRdMJEjEieSPNzCHgtHn
q3PulIeGLg9dhvTpfTH/E4kyeUvOplRcMBZx16SubdHhAMVNi6+Ji1mhQnBB25YdbNKAI1OcCGJF
yRY7KATtKuTjk3a2HvSgBz3oQQ968H8B/wU1tGE0ACgAAA==

Untar with: base64 -d | gunzip -c | tar xv

Update 2017-01-27

A possible improvment to isSuspicious could be:

function isSuspicious(node)
{
    if (node.nodeType == node.ELEMENT_NODE) {
        var style = window.getComputedStyle(node);
        var autoOrZero = function(val) {
            return val == 'auto' || parseInt(val) == 0; };
        var checks = [
            ['color', style.color == style.backgroundColor, style.color],
            ['fontSize', parseInt(style.fontSize) <= 5, style.fontSize],
            ['zIndex', !autoOrZero(style.zIndex), style.zIndex],
            ['left', !autoOrZero(style.left), style.left],
            ['right', !autoOrZero(style.right), style.right],
            ['top', !autoOrZero(style.top), style.top],
            ['bottom', !autoOrZero(style.bottom), style.bottom],
            ['userSelect', style.userSelect == 'none', style.userSelect]
        ];
        var matches = 0;
        for (var i in checks) {
            if (checks[i][1]) {
                matches += 1;
            }
        }
        if (matches >= 2) {
            console.log('Looks suspicious to me:')
            console.log(node)
            console.log(JSON.stringify(checks))
            return true;
        }
    }
}

copy abuse dom