CC Attack Reason
The principle of the CC attack is that the attacker controls some hosts to keep sending a large number of packets to the other server, causing the server to run out of resources until downtime crashes. CC is primarily used to attack pages, everyone has this experience: when a Web page visits a very large number of times, open the page is slow, CC is to simulate multiple users (how many threads are many users) Non-stop access to those who need a lot of data operations (that is, the need for a large amount of CPU time) of the page, Cause the waste of server resources, CPU for a long time in 100%, always have to deal with the connection until the network congestion, normal access was aborted.
CC Attack Refresh page does not make any sense to us, to say meaningful is to use our website resources.
Defense cc attacks can be done in a variety of ways, prohibit the site proxy access, as far as possible to make the site static page, limit the number of connections, modify the maximum timeout time.
Example
The code is as follows |
Copy Code |
<?php Proxy IP exit directly Empty ($_server[' Http_via ') or exit (' Access Denied '); Prevent quick Flushes Session_Start (); $seconds = ' 3 '; Time period [sec] $refresh = ' 5 '; Refresh Times Setting up monitoring variables $cur _time = time (); if (Isset ($_session[' last_time ')) { $_session[' refresh_times '] + + 1; }else{ $_session[' refresh_times '] = 1; $_session[' last_time ' = $cur _time; } Process monitoring Results if ($cur _time-$_session[' last_time '] < $seconds) { if ($_session[' refresh_times '] >= $refresh) { Jump to the attacker's server address Header (sprintf (' location:%s ', ' http://127.0.0.1 ')); Exit (' Access Denied '); } }else{ $_session[' refresh_times '] = 0; $_session[' last_time ' = $cur _time; } ?> |
The firewall is a very good solution to the CC attack, not only does it have any impact on the server but also effectively prevents CC attacks
The
Recommended small webmaster can use a security dog to do a CC attack or use Linux iptalbs to prevent CC attacks, as well as my server has a computer room firewall will automatically intercept these types of attacks oh.