Ajax Detection Method for website hijacking

Source: Internet
Author: User

Ajax Detection Method for website hijacking

Https can completely solve the hijacking problem. However, generally, virtual hosts do not support https. Is http only supported by rogue hackers?

Since the lottery link only appears during the first visit, we can detect it in the browser through JS. If we find the implanted code, we will automatically refresh the webpage to solve the hijacking problem.

What we need to do now is get the implanted code. I found a circle and did not find the checking tool. To transfer a website to a customer's browser, three steps are required: [1] Server> [2] OPERATOR> [3] client browser.

Hijacking occurs in step 2 because the server is out of control. However, the browser in Part 3 can be controlled through JS. You can use Ajax to upload the final obtained code to analyze the code.

The running effect is as follows:

<? Php // create different directories Based on the access domain NAME $ log_path = $ _ SERVER ['server _ name']; if (! Is_dir ($ log_path) {mkdir ($ log_path);} // records $ log_path Based on the visitor's IP address. = '/'. $ _ SERVER ['remote _ ADDR ']; if (! Is_dir ($ log_path) {mkdir ($ log_path);} // group by day $ log_path. = '/'. date ('Y-m-d', time (); if (! Is_dir ($ log_path) {mkdir ($ log_path);} // generate the file name based on time $ log_file = $ log_path. '/'. date ('his ', time ()). '_'. rand (). '.html '; // Save the log $ html = ''; $ html. = 'url :/'. post ('url '). '

The call is simple, for example, saving the above php code /log/page_tracert.phpAnd then add the following code to the entire site page to obtain all access records. After the embedded code is obtained based on the access records, the detection script can be developed.

$(function(){ $.post('/log/page_tracert.php',{ url : location.href, head : $('head').html(), body : $('body').html(), },function(){});});

Note: after obtaining the data, you must delete the test code as soon as possible. Because it will generate a large number of logs, resulting in double traffic consumption of virtual hosts.

Summary

The above is a small Editor to introduce you to the Ajax detection method for implementing website hijacking. I hope it will help you. If you have any questions, please leave a message and I will reply to you in a timely manner. Thank you very much for your support for the help House website!

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.