The content of the invention
In order to solve above-mentioned technical problem, it is an object of the invention to provide one kind can accurately find and filter UDP attack streams
Cleaning method and system that a kind of UDP FLOOD of amount are attacked.
The technical solution used in the present invention is:
The cleaning method that a kind of UDP FLOOD are attacked, comprises the following steps:
A, default particular detection port is initialized;
B, when message is received, whether the type for judging the message is UDP messages, if so, then execution step C;Conversely, then putting
The capable message;
C, the source address for obtaining the message, source port, target port and message checking code;
D, the source address according to the message, source port, target port and message checking code, calculate the load contents of the message
Check code;
E, according to the load contents check code of the message, so as to carry out traditional UDP attack detecting, and the message by detecting is held
Row step F;Conversely, being then marked and execution step G to load contents detection state;
F, according to default particular detection port, carry out novel trans emitting UDP attack detecting to message, and to the report by detection
Literary execution step G;Conversely, execution step G again after being then marked to Port detecting state;
G, judge that whether load contents detection state or Port detecting state are to need to filter, if so, then abandon the message;Conversely,
Mutation UDP attack detectings are then carried out, and to message execution step H by detection;
H, burst detection is carried out to the message, and the message by detecting is let pass.
The further improvement of the cleaning method attacked as a kind of described UDP FLOOD, step E includes:
E1, according to the load contents check code of the message, frequency statistics is carried out to load contents, obtain load contents frequency;
E2, the load contents frequency is judged whether more than default load contents frequency threshold, if so, then detect load contents
Status indication is to need to filter, and execution step G;Conversely, then execution step F.
The further improvement of the cleaning method attacked as a kind of described UDP FLOOD, step F includes:
F1, message frequencies statistics is carried out to default particular detection port, obtain port message frequencies;
F2, port message frequencies are judged whether more than default port frequency threshold value, if so, then by Port detecting status indication be
Need to filter, and execution step G;Conversely, then direct execution step G.
The further improvement of the cleaning method attacked as a kind of described UDP FLOOD, described mutation UDP attacks inspection
Survey, it is specially:
According to 16 bytes before the load contents of the message, judge whether to be satisfied by following all conditions:
1st byte=the 2nd byte;
1st~2 byte=the 3rd~4 byte;
1st~4 byte=the 5th~8 byte;
1st~8 byte=the 9th~16 byte;
If so, the message is then abandoned;Conversely, then the message passes through mutation UDP attack detectings.
The further improvement of the cleaning method attacked as a kind of described UDP FLOOD, step H includes:
Whether H1, the type for judging the message are burst, if so, then execution step H2;Conversely, then the source address of the message is deposited
Enter and let pass in record and the message of letting pass;
H2, judge the source address of the message whether in record of letting pass, the message of if so, letting pass;Conversely, then abandoning the message.
Another technical scheme of the present invention is:
The purging system that a kind of UDP FLOOD are attacked, including:
Port initialization unit, for initializing to default particular detection port;
UDP judging units, for when message is received, judging whether the type of the message is UDP messages, is if so, then performed
Information acquisition unit;Conversely, the message of then letting pass;
Information acquisition unit, for obtaining source address, source port, target port and the message checking code of the message;
Check code computing unit, for according to the source address of the message, source port, target port and message checking code, calculating
Go out the load contents check code of the message;
Traditional attack detecting unit, for according to the load contents check code of the message, so as to carry out traditional UDP attack detecting,
And reflection-type attack detecting unit is performed to the message by detection;Conversely, being then marked simultaneously to load contents detection state
Perform and filter judging unit;
Reflection-type attack detecting unit, attacks for according to default particular detection port, carrying out novel trans emitting UDP to message
Detection, and filtration judging unit is performed to the message by detection;Conversely, performing again after being then marked to Port detecting state
Filter judging unit;
Judging unit is filtered, for judging whether load contents detection state or Port detecting state are to need to filter, and are if so, then lost
Abandon the message;Conversely, then carrying out mutation UDP attack detectings, and burst detector unit is performed to the message by detection;
Burst detector unit, for carrying out burst detection to the message, and lets pass to the message by detecting.
The further improvement of the purging system attacked as a kind of described UDP FLOOD, traditional attack detecting list
Unit includes:
Load contents frequency statistics unit, for according to the load contents check code of the message, load contents to be entered with line frequency system
Meter, obtains load contents frequency;
Load contents frequency judging unit, for judging the load contents frequency whether more than default load contents frequency threshold
Value, if so, then by load contents detection status indication to need to filter, and performs filtration judging unit;Conversely, then performing reflection-type
Attack detecting unit.
The further improvement of the purging system attacked as a kind of described UDP FLOOD, the reflection-type attack detecting
Unit includes:
Port message frequencies statistic unit, for carrying out message frequencies statistics to default particular detection port, obtains port report
Literary frequency;
Port message frequencies judging unit, for judging whether port message frequencies are more than default port frequency threshold value, if so,
Then by Port detecting status indication to need to filter, and perform filtration judging unit;Conversely, then directly perform filtering judging unit.
The further improvement of the purging system attacked as a kind of described UDP FLOOD, described mutation UDP attacks inspection
Survey, it is specially:
According to 16 bytes before the load contents of the message, judge whether to be satisfied by following all conditions:
1st byte=the 2nd byte;
1st~2 byte=the 3rd~4 byte;
1st~4 byte=the 5th~8 byte;
1st~8 byte=the 9th~16 byte;
If so, the message is then abandoned;Conversely, then the message passes through mutation UDP attack detectings.
The further improvement of the purging system attacked as a kind of described UDP FLOOD, the burst detector unit bag
Include:
Burst judging unit, for judging whether the type of the message is burst, if so, then execution step H2;Conversely, then should
The source address of message is stored in clearance record and the message of letting pass;
Source address judging unit, for judging the source address of the message whether in record of letting pass, the message of if so, letting pass;Instead
It, then abandon the message.
The invention has the beneficial effects as follows:
The port message frequency that the cleaning method and system that a kind of UDP FLOOD of the present invention are attacked passes through the default particular port of statistics
Rate, can accurately find and filter novel trans emitting attack traffic, and by count load contents true verification code frequency and
Feature 16 byte before load contents is taken, traditional UDP attack traffics can be accurately identified.The present invention is accurately differentiating new
On the basis of old UDP flow amount, further filter UDP and attack produced burst flow, compare traditional current-limiting mode, the present invention
The performance loss for going that in large quantities accounting message characteristic strip comes can be exempted, even if in the face of the flow of tens of Gbps, similarly can be light
Pine reply, greatly improves elimination effect.
Specific embodiment
With reference to Fig. 1, the cleaning method that a kind of UDP FLOOD of the invention are attacked is comprised the following steps:
A, default particular detection port is initialized;
B, when message is received, whether the type for judging the message is UDP messages, if so, then execution step C;Conversely, then putting
The capable message;
C, the source address for obtaining the message, source port, target port and message checking code;
D, the source address according to the message, source port, target port and message checking code, calculate the load contents of the message
Check code;
E, according to the load contents check code of the message, so as to carry out traditional UDP attack detecting, and the message by detecting is held
Row step F;Conversely, being then marked and execution step G to load contents detection state;
F, according to default particular detection port, carry out novel trans emitting UDP attack detecting to message, and to the report by detection
Literary execution step G;Conversely, execution step G again after being then marked to Port detecting state;
G, judge that whether load contents detection state or Port detecting state are to need to filter, if so, then abandon the message;Conversely,
Mutation UDP attack detectings are then carried out, and to message execution step H by detection;
H, burst detection is carried out to the message, and the message by detecting is let pass.
With reference to Fig. 2, it is further used as preferred embodiment, step E includes:
E1, according to the load contents check code of the message, frequency statistics is carried out to load contents, obtain load contents frequency;
E2, the load contents frequency is judged whether more than default load contents frequency threshold, if so, then detect load contents
Status indication is to need to filter, and execution step G;Conversely, then execution step F.
With reference to Fig. 3, it is further used as preferred embodiment, step F includes:
F1, message frequencies statistics is carried out to default particular detection port, obtain port message frequencies;
F2, port message frequencies are judged whether more than default port frequency threshold value, if so, then by Port detecting status indication be
Need to filter, and execution step G;Conversely, then direct execution step G.
It is further used as preferred embodiment, described mutation UDP attack detectings, it is specially:
According to 16 bytes before the load contents of the message, judge whether to be satisfied by following all conditions:
1st byte=the 2nd byte;
1st~2 byte=the 3rd~4 byte;
1st~4 byte=the 5th~8 byte;
1st~8 byte=the 9th~16 byte;
If so, the message is then abandoned;Conversely, then the message passes through mutation UDP attack detectings.
With reference to Fig. 4, it is further used as preferred embodiment, step H includes:
Whether H1, the type for judging the message are burst, if so, then execution step H2;Conversely, then the source address of the message is deposited
Enter and let pass in record and the message of letting pass;
H2, judge the source address of the message whether in record of letting pass, the message of if so, letting pass;Conversely, then abandoning the message.
Wherein, easily produce IP fragmentation because some UDP FLOOD are attacked, because IP fragmentation does not have UDP heading words
Section, the normal source address that this method is let pass by record, clearance fragment message is selected with this, and reaching being capable of thoroughly cleaning UDP
The purpose of FLOOD attack traffics.
In the embodiment of the present invention, default load contents frequency threshold is set to 100, and default port frequency threshold value is set to
100, then specific embodiment is as follows:
S1, set up global array reply_sport, and initialize default particular detection port reply_sport [53,
1900,123,19,520,5353,17,137,138,139,111,161,69] value is 1;
S2, global array sport_count, check_count of foundation, accept_ip, drop_sport, drop_check;
S3, when message is received, whether the type for judging the message is UDP messages, if so, then execution step S4;Conversely, then
Let pass the message;
S4, taking-up message source address sip, source port sport, target port dport, check code check;
S5, the source address according to the message, source port, target port and message checking code, calculate as follows message screen
Cover the load contents check code after source address, source port and target port:
sum=0, o1=sip>>16, o2=sip&0xffff;
sum += (ntohs(o1) + ntohs(o2) + (~ntohs(0) & 0xffff) + (~ntohs(0) &
0xffff));
sum += (ntohs(sport) + (~(0) & 0xffff));
sum += (ntohs(dport) + (~(0) & 0xffff));
sum += check;
sum = (sum & 0xffff) + (sum >> 16);
Sum is the load contents check code for finally obtaining;
S6, according to the load contents check code of the message, frequency statistics is carried out to load contents, obtain load contents frequency
Check_count [sum], and judge whether to meet check_count [sum]>100, then load contents detection state drop_
Check [check]=1, and execution step S8;
S7, judge whether to meet reply_sport [sport]=1, if then showing that it is default particular detection port, then hold
Mouth message frequencies sport_count [sport] ++, if port message frequencies sport_count [sport] for finally obtaining>
100, then Port detecting state drop_sport [sport]=1;
If S8, Port detecting state drop_sport [sport] or load contents detection state drop_check [check] are 1,
Then abandon the message;Conversely, then execution step S9
S9, according to 16 bytes before the load contents of the message, judge whether to be satisfied by following all conditions:1st byte=2nd
Byte, the 1st~2 byte=the 3rd~4 byte, the 1st~4 byte=the 5th~8 byte, the 1st~8 byte=the 9th~16 byte, meet
Four conditions of the above, then abandon the message;Conversely, then execution step S10;
Whether S10, the type for judging the message are burst, and the source address of the message is not in record of letting pass, i.e. the source address
Release status accept_ip [sip] not be 1, then abandon the message;Conversely, then by the release status accept_ of the source address
Ip [sip] is set to 1, and the message of letting pass.
With reference to Fig. 5, the purging system that a kind of UDP FLOOD of the invention are attacked, including:
Port initialization unit, for initializing to default particular detection port;
UDP judging units, for when message is received, judging whether the type of the message is UDP messages, is if so, then performed
Information acquisition unit;Conversely, the message of then letting pass;
Information acquisition unit, for obtaining source address, source port, target port and the message checking code of the message;
Check code computing unit, for according to the source address of the message, source port, target port and message checking code, calculating
Go out the load contents check code of the message;
Traditional attack detecting unit, for according to the load contents check code of the message, so as to carry out traditional UDP attack detecting,
And reflection-type attack detecting unit is performed to the message by detection;Conversely, being then marked simultaneously to load contents detection state
Perform and filter judging unit;
Reflection-type attack detecting unit, attacks for according to default particular detection port, carrying out novel trans emitting UDP to message
Detection, and filtration judging unit is performed to the message by detection;Conversely, performing again after being then marked to Port detecting state
Filter judging unit;
Judging unit is filtered, for judging whether load contents detection state or Port detecting state are to need to filter, and are if so, then lost
Abandon the message;Conversely, then carrying out mutation UDP attack detectings, and burst detector unit is performed to the message by detection;
Burst detector unit, for carrying out burst detection to the message, and lets pass to the message by detecting.
It is further used as preferred embodiment, traditional attack detecting unit includes:
Load contents frequency statistics unit, for according to the load contents check code of the message, load contents to be entered with line frequency system
Meter, obtains load contents frequency;
Load contents frequency judging unit, for judging the load contents frequency whether more than default load contents frequency threshold
Value, if so, then by load contents detection status indication to need to filter, and performs filtration judging unit;Conversely, then performing reflection-type
Attack detecting unit.
It is further used as preferred embodiment, the reflection-type attack detecting unit includes:
Port message frequencies statistic unit, for carrying out message frequencies statistics to default particular detection port, obtains port report
Literary frequency;
Port message frequencies judging unit, for judging whether port message frequencies are more than default port frequency threshold value, if so,
Then by Port detecting status indication to need to filter, and perform filtration judging unit;Conversely, then directly perform filtering judging unit.
It is further used as preferred embodiment, described mutation UDP attack detectings, it is specially:
According to 16 bytes before the load contents of the message, judge whether to be satisfied by following all conditions:
1st byte=the 2nd byte;
1st~2 byte=the 3rd~4 byte;
1st~4 byte=the 5th~8 byte;
1st~8 byte=the 9th~16 byte;
If so, the message is then abandoned;Conversely, then the message passes through mutation UDP attack detectings.
It is further used as preferred embodiment, the burst detector unit includes:
Burst judging unit, for judging whether the type of the message is burst, if so, then execution step H2;Conversely, then should
The source address of message is stored in clearance record and the message of letting pass;
Source address judging unit, for judging the source address of the message whether in record of letting pass, the message of if so, letting pass;Instead
It, then abandon the message.
From the foregoing it can be that the cleaning method and system of a kind of UDP FLOOD attacks of the invention are by counting default
The port message frequencies of particular port, can accurately find and filter novel trans emitting attack traffic, and by statistics load
Hold true verification code frequency and take feature 16 byte before load contents, traditional UDP attack traffics can be accurately identified.
The present invention filters UDP and attacks produced burst flow on the basis of new and old UDP flow amount is accurately differentiated, further, compares
Traditional current-limiting mode, the present invention can exempt the performance loss for going that in large quantities accounting message characteristic strip comes, even if in the face of tens of
The flow of Gbps, similarly can easily tackle, and greatly improve elimination effect.
It is more than that the preferable enforcement to the present invention is illustrated, but the invention is not limited to the enforcement
Example, those of ordinary skill in the art can also make a variety of equivalent variations on the premise of without prejudice to spirit of the invention or replace
Change, the deformation or replacement of these equivalents are all contained in the application claim limited range.