@@ -177,9 +177,16 @@ SecRule REQUEST_BASENAME ".*?(\.[a-z0-9]{1,10})?$" \
177
177
#
178
178
# Check DOS Counter
179
179
# If the request count is greater than or equal to user settings,
180
- # we set the burst counter.
180
+ # we raise the burst counter. This happens via two separate rules:
181
+ # - 912160: raise from 0 to 1
182
+ # - 912161: raise from 1 to 2
181
183
#
182
- SecRule IP:DOS_COUNTER "@gt %{tx.dos_counter_threshold}" \
184
+ # This approach with two rules avoids raising the burst counter
185
+ # from 0 to 2 via two concurrent requests. We do not raise the
186
+ # burst counter beyond 2.
187
+ #
188
+ #
189
+ SecRule IP:DOS_COUNTER "@ge %{tx.dos_counter_threshold}" \
183
190
"phase:5,\
184
191
id:912160,\
185
192
t:none,\
@@ -189,9 +196,28 @@ SecRule IP:DOS_COUNTER "@gt %{tx.dos_counter_threshold}" \
189
196
tag:'language-multi',\
190
197
tag:'platform-multi',\
191
198
tag:'attack-dos',\
192
- setvar:ip.dos_burst_counter=+1,\
193
- expirevar:ip.dos_burst_counter=%{tx.dos_burst_time_slice},\
194
- setvar:!ip.dos_counter"
199
+ chain"
200
+ SecRule &IP:DOS_BURST_COUNTER "@eq 0" \
201
+ "setvar:ip.dos_burst_counter=1,\
202
+ expirevar:ip.dos_burst_counter=%{tx.dos_burst_time_slice},\
203
+ setvar:!ip.dos_counter"
204
+
205
+
206
+ SecRule IP:DOS_COUNTER "@ge %{tx.dos_counter_threshold}" \
207
+ "phase:5,\
208
+ id:912161,\
209
+ t:none,\
210
+ nolog,\
211
+ pass,\
212
+ tag:'application-multi',\
213
+ tag:'language-multi',\
214
+ tag:'platform-multi',\
215
+ tag:'attack-dos',\
216
+ chain"
217
+ SecRule &IP:DOS_BURST_COUNTER "@ge 1" \
218
+ "setvar:ip.dos_burst_counter=2,\
219
+ expirevar:ip.dos_burst_counter=%{tx.dos_burst_time_slice},\
220
+ setvar:!ip.dos_counter"
195
221
196
222
197
223
#
0 commit comments