Disclosure of Invention
The embodiment of the invention provides a method and a system for defending against DDoS (distributed denial of service) attacks based on a router, which are used for solving the problems that in the prior art, when equipment networked based on a home router is hijacked as 'broiler' to conduct DDoS attacks to the outside, the equipment cannot be discovered in time, different security protection strategies cannot be implemented aiming at different equipment, and the security protection strategies of the router cannot be intelligently and dynamically updated.
In order to achieve the above object, an aspect of the present invention provides a method for defending against DDoS attacks based on a router, which is applied to a system composed of the router, a connection device and a server, and includes the following steps: the router periodically reports the equipment information and the flow statistic information of the connection equipment to the server; the server analyzes and counts the data of the information reported by the router, and judges whether the connection equipment launches DDoS attack to the outside; when it is determined that a connection device is initiating a DDoS attack to the outside, a server sends a message instruction for capturing the specified connection device to the router, and the router sends the captured message to the server; the server generates a new security protection strategy based on the attack characteristics of the message and informs the router to download the new security protection strategy; and the router executes the new security protection strategy to carry out attack protection.
Preferably, the server side determines whether the connection device is initiating a DDoS attack to the outside, and specifically includes: the router judges according to the flow statistical data reported to the server in the last N reporting periods; and when the flow data of the connecting equipment in the flow statistical data in each of the latest N reporting periods is greater than a given monitoring flow threshold value, judging that the connecting equipment is initiating DDoS attack to the outside.
Preferably, the method further comprises the following steps: when the flow data of the connection equipment is greater than a given monitoring flow threshold value in the flow statistical data in at least N/2 periods in the last N reporting periods, judging that the connection equipment possibly launches a DDoS attack to the outside; after a server side sends a message capturing instruction to a router, analyzing a message captured by the router, and judging whether an attack flow message exists in the message or not; and when the message has an attack flow message, judging that the connection equipment is attacking the external DDoS, and informing the router that the reporting period interval of the flow statistic adjustment is the original 1/2.
Preferably, the monitoring flow threshold of the connection device includes: when the server side is initialized, an initial monitoring flow threshold value is distributed to each connecting device of the router; during operation, when a server side detects that the connection equipment does not externally initiate DDoS attack in a recent history period M, adjusting a monitoring flow threshold value of the connection equipment; updating the monitoring flow threshold value to be an average value in each reporting period statistical time period in the historical period M; and the server side stores the updated monitoring flow threshold value of each time period of the connecting equipment.
Preferably, the sending, by the server, a message instruction for capturing the specified connection device to the router specifically includes: the server sends a message instruction for periodically capturing the designated equipment to the router; the message capturing instruction specifies specific connection equipment of the router through the MAC address of the connection equipment; the message grabbing instruction comprises MAC addresses of the connecting devices of the plurality of routers.
Preferably, the server captures an attack feature of the packet based on the router, and specifically includes: the new security protection strategy is used for limiting a connection device which is initiating DDoS attack to the outside; the server side continuously generates and updates the new security protection strategy according to the periodic message replied by the router; when the server detects that the traffic statistic data of the designated connection equipment of the router does not meet the preset fault condition again, the server sends a message instruction for stopping capturing the designated connection equipment to the router; and when the reporting period interval of the router is adjusted, informing the router to restore the reporting period interval to a default value.
Another aspect provides a system for defending against DDoS attacks based on a router, including: the router, the connection equipment and the server side; the router periodically reports the equipment information and the flow statistic information of the connection equipment to the server; the server analyzes and counts the data of the information reported by the router, and judges whether the connection equipment launches DDoS attack to the outside; when it is determined that a connection device is initiating a DDoS attack to the outside, a server sends a message instruction for capturing the specified connection device to the router, and the router sends the captured message to the server; the server generates a new security protection strategy based on the attack characteristics of the message and informs the router to download the new security protection strategy; and the router executes the new security protection strategy to carry out attack protection.
Preferably, the server includes: a receiving module, configured to receive data request related information of the router, periodically reported data information, and a packet captured by the router; the analysis module is used for analyzing the equipment information and the flow statistic information reported by the router and the messages captured by the router; the storage module is used for storing the reporting cycle interval, the continuous judgment cycle number N, the monitoring flow threshold value of each connecting device in each time period in the operation cycle M and the latest safety protection strategy of the router; a judging module, configured to judge whether the connection device is initiating a DDoS attack to the outside according to the device information and traffic statistic information reported by the router and a monitored traffic threshold of the connection device; the router is used for judging whether an attack exists according to the message captured by the router; the strategy generation module generates a new safety protection strategy according to the attack characteristics of the message captured by the router; and the sending module is used for sending related information and message instructions to the router, and the related information and message instructions comprise a message instruction for capturing the specified connection equipment of the router, an instruction for adjusting the reporting period interval of the router and an instruction for informing the router to download a new security protection strategy.
Preferably, the router includes: the data receiving module is used for receiving a message instruction for capturing the specified connection equipment and an instruction for adjusting the data reporting period interval, which are sent to the router by the server; the data statistics module is used for periodically carrying out statistics on the equipment information and the flow statistics information of the router connection equipment; the message capturing module is used for capturing the message from the router according to the message capturing instruction received from the server; the security defense module is used for downloading and executing the new security protection strategy downloaded by the server side and limiting the access of the connection equipment of the DDoS attack which is initiated to the outside on the router; and the data sending module is used for requesting the relevant attribute information of the router to a server, periodically sending the equipment information and the flow statistic information of the router connecting equipment to the server, sending the captured message to a server and downloading the new security protection strategy.
The method and the system for defending against DDoS attack based on the router can prevent the connection equipment of the router from initiating the DDoS attack from the source, and the server can dynamically update the security protection parameters of the router, thereby effectively protecting the connection equipment of the router from being hijacked maliciously as an attack source.
Detailed Description
In order to make the technical solutions and advantages of the embodiments of the present invention more clear, the technical solutions of the present invention are further described in detail below with reference to the accompanying drawings and the embodiments.
Fig. 1 is a schematic diagram of a system architecture relationship of a method for defending against DDoS attacks based on a router according to an embodiment of the present invention. As shown in fig. 1, the internet of things devices and some other intelligent terminal devices related to the home environment perform external access by connecting to the home router. In a real environment, in addition to normal traffic access, a hacker may send a large amount of attack traffic to the internet by using internet of things devices and home networking devices as attack sources. The invention can find the network devices in time and collect their flow in the network by using the technical characteristics of the router, then periodically report the flow statistical data of the devices to the server, further, the server judges whether the connection device of the router initiates DDOS attack to the outside according to the flow statistical data reported by the router and the flow monitoring threshold value of the router connection device determined by historical flow data, if the DDOS attack occurs, the server captures the message by the router to analyze the characteristics of the attack message, generates the corresponding security protection strategy to limit the generation of the attack flow, thus preventing the devices from joining the botnet to participate in the DDOS attack in time. Therefore, the installation of the device of the invention on the home router can prevent the equipment in the home environment from participating in DDoS attack from the source.
Fig. 2 is a flowchart of a method for defending against DDoS attacks based on a router according to an embodiment of the present application. As shown in fig. 2, one aspect of the present invention provides a method for defending against DDoS attacks based on a router, which is applied to a system composed of the router, a connection device, and a server, and includes the following steps:
in step S201, the router periodically reports the device information and the traffic statistic information of the connected device to the server.
Specifically, the router collects device information and traffic statistical information of the router connection device, and then periodically uploads the collected information to the server.
The device information includes basic information such as Mac address, device type, device name, and IP address of the device.
Step S202, the server side carries out data analysis and statistics on the information reported by the router, and judges whether the connection equipment externally launches DDoS attack.
Specifically, the router judges according to the traffic statistical data reported to the server in the last N reporting periods;
when the flow data of the connection equipment is greater than a given monitoring flow threshold value in the flow statistical data in each of the latest N reporting periods, judging that the connection equipment is initiating a DDoS attack to the outside;
when the flow data of the connection equipment is greater than a given monitoring flow threshold value in the flow statistical data in at least N/2 periods in the last N reporting periods, judging that the connection equipment possibly launches a DDoS attack to the outside;
after the server sends a message capturing instruction to the router, analyzing messages captured by the router and judging whether attack flow messages exist in the messages or not;
when the message has an attack flow message, judging that the connection equipment is attacking the external DDoS, informing the router that the reporting period interval of the adjustment flow statistics is the original 1/2, otherwise judging that the connection equipment does not attack the external DDoS.
In the process of determining whether a connection device is initiating a DDoS attack, the monitoring traffic threshold of the connection device is an important determination criterion, and how to determine the monitoring traffic threshold of the connection device and how to perform dynamic adjustment is described below with reference to fig. 3.
Step S401, when the server side initializes, an initial monitoring flow threshold value is distributed to each connection device of the router, and then step S402 is carried out;
step S402, during the operation period, the server detects whether the connection device of the router has externally initiated DDoS attack in the latest history period M; if yes, keeping the monitoring flow threshold unchanged, continuing to execute S402, and if not, executing step S403;
step S403: updating the monitoring flow threshold value to be an average value in each reporting period statistical time period in the history period M, and then going to step S404;
step S404: and the server side stores the updated monitoring flow threshold value of each time period of the connection equipment.
In a preferred embodiment, when there is no monitoring traffic threshold of each connection device of the router at the beginning, the server pre-allocates a larger monitoring traffic threshold to each connection device; within a certain period M of operation, if it is detected that the connected equipment does not externally initiate DDoS attack, the monitoring flow threshold value can be reduced; if the connection equipment is detected to have DDoS attack, the message characteristics are analyzed by capturing the message and no attack exists, the flow in the operation process of the connection equipment is increased, and the monitoring flow threshold value can be increased; if DDoS attack is detected in the running process, the monitoring flow threshold value is kept unchanged; the adjusted monitoring flow threshold value is equal to the average value in each reporting period statistical time period in the historical period M.
Step S203, when it is determined that a connection device is initiating a DDoS attack to the outside, the server sends a message instruction for capturing the specified connection device to the router, and the router sends the captured message to the server.
The method comprises the steps that a server side sends a message instruction for capturing appointed equipment to a router, and specifically can send a message instruction for periodically capturing appointed connection equipment to the router; the specific connection device of the router is specified by the MAC address of the device in the message grabbing instruction, and the message may include MAC addresses of a plurality of router connection devices.
Step S204, the server generates a new security protection strategy based on the attack characteristics of the message and informs the router to download the new security protection strategy; and the router executes a new security protection strategy to carry out attack protection.
The server side captures the attack characteristics of the message based on the router, generates a new security protection strategy, and can limit the equipment which is only used for initiating the DDoS attack to the outside; continuously generating an updated security protection strategy according to the periodic message replied by the router; and when the server detects that the traffic statistical data of the designated equipment of the router does not meet the preset fault condition again, sending a message instruction for stopping capturing the designated equipment to the router. If the interval of the reporting period of the router is adjusted, the router is informed to restore the reporting period to a default value.
In a preferred embodiment, when determining whether the connection device is initiating a DDoS attack to the outside, if the result is a fuzzy determination result, it is determined that the router may initiate a DDoS attack to the outside, and in this case, the router needs to capture a packet for further analysis and determination. If the server side analyzes that an attack message exists through capturing the message, the sending interval of the attack flow of the attacker is smaller than the flow interval reported by the server side, at the moment, the server side informs the router to reduce the reporting period interval of the data, the value adjusted each time is equal to the original 1/2, the server side simultaneously generates a corresponding safety protection strategy according to the characteristics of the attack message, after the router downloads the new safety protection strategy, the server side judges that the attack flow is eliminated or limited according to the flow statistical data newly reported by the router, and then the server side restores the reporting period interval of the router to a default value.
Another aspect of the present invention provides a system for defending against DDoS attacks based on a router, comprising: the router, the connection equipment and the server side;
the router periodically reports the equipment information and the flow statistic information of the connection equipment to the server;
the server side carries out data analysis and statistics on the information reported by the router and judges whether the connection equipment externally launches DDoS attack or not;
when it is determined that a connection device is initiating a DDoS attack to the outside, the server sends a message instruction for capturing the specified connection device to the router, and the router sends the captured message to the server;
the server generates a new security protection strategy based on the attack characteristics of the message and informs the router of the new security protection strategy; and the router executes a new security protection strategy to carry out attack protection.
Specifically, the structure of the server is shown in fig. 5, and includes:
the receiving module is used for receiving data request related information of the router, periodically reported data information and messages captured by the router;
the analysis module is used for analyzing the equipment information and the flow statistic information reported by the router and the messages captured by the router;
the storage module is used for storing the reporting cycle interval of the router, the continuous judgment cycle number N, the monitoring flow threshold value of each connecting device in each time period in the operation cycle M and the latest security protection strategy of the router;
the judging module is used for judging whether the connection equipment externally launches DDoS attack or not according to the equipment information reported by the router, the traffic statistic information and the monitoring traffic threshold of the connection equipment; the router is used for judging whether an attack exists according to the message captured by the router;
the strategy generation module generates a new safety protection strategy according to the attack characteristics of the message captured by the router;
and the sending module is used for sending related information and message instructions to the router, wherein the related information and message instructions comprise a message instruction for capturing the equipment appointed to be connected by the router, an instruction for adjusting the reporting period interval of the router and an instruction for informing the router to download a new security protection strategy.
In the following detailed description, the workflow of each module of the server is described.
Firstly, a receiving module receives flow statistic information periodically reported by a router, then the information is sent to an analysis module for analysis, the analysis module obtains flow statistic values of all connecting devices of the router in a certain time period from the information, the information is sent to a judgment module for judgment, and meanwhile, a storage module stores the flow statistic values of all the connecting devices in the certain time period; the judging module compares a traffic statistic K1 of the connection equipment in a reporting time period of the router with a monitoring traffic threshold S1 of the connection equipment in the storage module, if K1 is greater than S1, the abnormal condition of the period is marked, if N continuous periods are abnormal, the connection equipment is judged to initiate DDoS attack to the outside, and a message capturing instruction is sent to the router through the sending module; the receiving module receives the captured message data of the router and sends the captured message data to the analysis module for analysis, the judgment module further judges whether an attack message exists or not, if the attack message exists, the judgment module sends the attack message to the strategy generation module to generate a new safety protection strategy, the sending module informs the router to download the new safety protection strategy, and meanwhile, the new safety protection strategy is stored in the storage module.
The policy generation module of the server side updates a plurality of security protection policies for the router, and mainly lists the following:
(1) setting access control policy of message
In practical application, two different access control strategies can be determined to be released or discarded according to the quintuple (source IP address, destination IP address, source port number, destination port number and protocol);
(2) modifying a protection parameter threshold value for protocol messages such as syn, ack, http and udp sent by the messages, wherein the unit of the protection parameter threshold value can be bit per second bps or packet per second bps;
(3) setting matching rules of protocol feature fields
In a specific implementation process, for some protocols, such as the udp protocol, the payload characteristics of the udp protocol in the packet captured by the router may be analyzed by the analysis module, and when configuring the protection policy, whether to discard or release the matched packet may be determined.
(4) Setting the access speed of the message
And setting speed limit parameters for sending rates of protocol messages such as syn, ack, http, udp, icmp and the like sent by the messages.
Specifically, the structure of the router is shown in fig. 6, and includes:
the data receiving module is used for receiving a message instruction for capturing the specified connection equipment and an instruction for adjusting the data reporting period interval, which are sent to the router by the server;
the data statistics module is used for periodically carrying out statistics on equipment information and flow statistics information of the router connection equipment;
the message capturing module is used for capturing messages for the router according to message capturing instructions received from the server;
the security defense module is used for downloading and executing a new security protection strategy downloaded by the server side and carrying out access limitation on the connection equipment of the DDoS attack which is initiated on the router;
and the data sending module is used for requesting the relevant attribute information of the router from the server, periodically sending the equipment information and the flow statistic information of the router connecting equipment to the server, sending the captured message to the server and downloading a new safety protection strategy.
In the following detailed description, the workflow of the modules of the router is described.
The data statistics module collects basic information of router connection equipment, such as MAC address, equipment type, equipment name, IP address of the equipment and the like; meanwhile, attribute information of the router is also collected, wherein the attribute information at least comprises the equipment number of the router, the MAC address of the router, the name of the router and the IP address of the router, and the uniqueness of the router at the whole service end is ensured. And the server forms a corresponding router information database according to the equipment information reported by the router. The router periodically sends the equipment information and the flow statistic information of the router connection equipment to the server through the data sending module according to the reporting period interval specified by the server; after analyzing the reported information of the router, if the server judges that the connecting equipment is sending DDoS attack, the server informs the router to grab the message, after receiving a message grabbing instruction through the data receiving module, the router gives the message to the message grabbing module to grab the message, and after the message grabbing is finished, the message is sent to the server through the data sending module; the server side generates a new safety protection strategy after analyzing the attack characteristics of the message, informs the router to download the new safety protection strategy, the router receives an instruction of informing the downloading of the new safety protection strategy through the data receiving module, then the safety protection module of the router initiates a request of downloading the new safety protection strategy to the server side through the data sending module, then receives the new safety protection strategy, and finally sends the new safety protection strategy to the safety protection module to execute the new safety protection strategy on the router.
According to the method and the system for defending against DDoS attack based on the router, provided by the embodiment of the invention, when the server judges that the connection equipment of the router sends the DDoS attack to the outside, the protection parameters can be dynamically updated for the router in real time; the server can dynamically adjust the period interval of the data reported by the router and the monitoring flow threshold value of the connection equipment according to the running state and the historical flow data of the connection equipment of the router, so as to monitor more intelligently; the server sends a periodic message grabbing instruction to the router, and can continuously generate an updated security protection strategy for the router until detecting that the connection equipment of the router does not meet the preset fault condition.
In conclusion, the server can intelligently and dynamically adjust the security protection strategy aiming at the continuously changing DDoS attack method, thereby reducing manual intervention, preventing the possibility that the connection equipment of the router becomes 'broiler' in advance, and preventing the DDoS attack from occurring from the source.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.