How To Mitigate Slow HTTP DoS Attacks in Apache HTTP Server
How To Mitigate Slow HTTP DoS Attacks in Apache HTTP Server
A Slow HTTP Denial of Service (DoS) attack, otherwise referred to as Slowloris HTTP DoS attack, makes use of HTTP GET requests to occupy all available HTTP connections permitted on a web server.
A Slow HTTP DoS Attack takes advantage of a vulnerability in thread-based web servers which wait for entire HTTP headers to be received before releasing the connection. While some thread-based servers such as Apache make use of a timeout to wait for incomplete HTTP requests, the timeout, which is set to 300 seconds by default, is re-set as soon as the client sends additional data.
This creates a situation where a malicious user could open several connections on a server by initiating an HTTP request but does not close it. By keeping the HTTP request open and feeding the server bogus data before the timeout is reached, the HTTP connection will remain open until the attacker closes it. Naturally, if an attacker had to occupy all available HTTP connections on a web server, legitimate users would not be able to have their HTTP requests processed by the server, thus experiencing a denial of service.
This enables an attacker to restrict access to a specific server with very low utilization of bandwidth. This breed of DoS attack is starkly different from other DoS attacks such as SYN flood attacks which misuse the TCP SYN (synchronization) segment during a TCP three-way-handshake.
How it works
An analysis of an HTTP GET request helps further explain how and why a Slow HTTP DoS attack is possible. A complete HTTP GET request resembles the following.
|
1
2
3
4
5
6
7
8
|
GET /index.php HTTP/1.1[CRLF]Pragma: no-cache[CRLF]Cache-Control: no-cache[CRLF]Host: testphp.vulnweb.com[CRLF]Connection: Keep-alive[CRLF]Accept-Encoding: gzip,deflate[CRLF]User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.63 Safari/537.36[CRLF]Accept: */*[CRLF][CRLF] |
Something that is of particular interest is the [CRLF] in the GET request above. Carriage Return Line Feed (CRLF), is a non-printable character that is used to denote the end of a line. Similar to text editors, an HTTP request would contain a [CRLF] at the end of a line to start a fresh line and two [CRLF] characters to denote a blank line. The HTTP protocol defines a blank line as the completion of a header. A Slow HTTP DoS takes advantage of this by not sending a finishing blank line to complete the HTTP header.
To make matters worse, a Slow HTTP DoS attack is not commonly detected by Intrusion Detection Systems (IDS) since the attack does not contain any malformed requests. The HTTP request will seem legitimate to the IDS and will pass it onto the web server.
Identifying and Mitigating Slow HTTP DoS Attacks
Slow HTTP DoS attacks are only significantly effective against thread-based web servers such as Apache anddhttpd and not against event-based web servers such as nginx and lighttpd which are built to handle large numbers of simultaneous connections.
Acunetix Web Vulnerability Scanner is capable of identifying Slow HTTP DoS attacks. When running a scan on a website that is vulnerable to a Slow HTTP DoS attack, an alert is raised by Acunetix Web Vulnerability Scanner that looks similar to hereunder.

Preventing and Mitigating Slow HTTP DoS Attacks in Apache HTTP Server
A number of techniques exist for preventing and mitigating slow HTTP DoS attacks in Apache HTTP server. A description of three of the most popular and easiest to implement techniques are listed hereunder. Of course other techniques for preventing and mitigating slow HTTP DoS attacks exist; namely through the use of load balancers and iptables.
Using mod_reqtimeout
Since Apache HTTP Server 2.2.15, mod_reqtimeout is included by default. mod_reqtimeout can be used to set timeouts for receiving the HTTP request headers and the HTTP request body from a client. As a result, if a client fails to send header or body data within the configured time, a 408 REQUEST TIME OUT error is sent by the server.
The following is an example of a configuration that can be used with mod_reqtimeout.
|
1
2
3
|
<IfModule mod_reqtimeout.c> RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500</IfModule> |
The above configuration allows up to 20 seconds for header data to be sent by a client. Provided that a client sends header data at a rate of 500 bytes per second, the server will allow a maximum 40 seconds for the headers to complete.
Additionally, the configuration will allow for up to 20 seconds for body data to be sent by the client. As long as the client sends header data at a rate of 500 bytes per second, the server will wait for up to 40 seconds for the body of the request to complete.
Using mod_qos
mod_qos is a quality of service module for the Apache HTTP Server which allows the implementation of control mechanisms that can provide different levels of priority to different HTTP requests.
The following is an example of how to configure mod_qos to mitigate slow HTTP DoS attacks.
|
1
2
3
4
5
6
7
8
9
10
11
12
|
<IfModule mod_qos.c> # handle connections from up to 100000 different IPs QS_ClientEntries 100000 # allow only 50 connections per IP QS_SrvMaxConnPerIP 50 # limit maximum number of active TCP connections limited to 256 MaxClients 256 # disables keep-alive when 180 (70%) TCP connections are occupied QS_SrvMaxConnClose 180 # minimum request/response speed (deny slow clients blocking the server, keeping connections open without requesting anything QS_SrvMinDataRate 150 1200</IfModule> |
The above configuration tracks up to 100,000 connections and limits the server to a maximum of 256 connections. In addition, the configuration limits each IP address to a maximum of 50 connections and disables HTTP KeepAlive when 180 connections are used (70% of the connections in this case). Finally, the configuration requires a minimum of 150 bytes per second per connection, and limits the connection to 1200 bytes per second when MaxClients is reached.
Using mod_security
mod_security is an open source web application firewall (WAF) that may be used with Apache HTTP server. mod_security makes use of rules that can be applied to carry out specific functions.
The following rules may be used to mitigate a slow HTTP DoS attack.
|
1
2
3
4
5
|
SecRule RESPONSE_STATUS "@streq 408" "phase:5,t:none,nolog,pass, setvar:ip.slow_dos_counter=+1, expirevar:ip.slow_dos_counter=60, id:'1234123456'"SecRule IP:SLOW_DOS_COUNTER "@gt 5" "phase:1,t:none,log,drop, msg:'Client Connection Dropped due to high number of slow DoS alerts', id:'1234123457'" |
The above rules identifies when Apache HTTP server triggers a 408 status code and tracks how many times this happened while keeping the data in IP-based persistent storage so it can correlate across requests. If this event has happened more than 5 times in 60 seconds, subsequent requests for that IP address will be dropped by mod_security for a period of 5 minutes.
How To Mitigate Slow HTTP DoS Attacks in Apache HTTP Server的更多相关文章
- HTTP慢速拒绝服务攻击(Slow HTTP Dos)
HTTP慢速拒绝服务攻击简介 HTTP慢速攻击是利用HTTP合法机制,以极低的速度往服务器发送HTTP请求,尽量长时间保持连接,不释放,若是达到了Web Server对于并发连接数的上限,同时恶意占用 ...
- struts2 CVE-2014-0050(DoS), CVE-2014-0094(ClassLoader manipulation) S2-20 DoS attacks and ClassLoader manipulation
catalog . Description . Effected Scope . Exploit Analysis . Principle Of Vulnerability . Patch Fix 1 ...
- 从DOS bat启动停止SQL Server (MSSQLSERVER)服务
由于机器上装了SQL Server2008,导致机器开机变慢,没办法只能让SQL Server (MSSQLSERVER) 服务默认不启动.但是每次要使用SQL Server时就必须从控制面板-管理 ...
- Preventing Web Attacks with Apache
http://www.boyunjian.com/do/article/snapshot.do?uid=net.csdn.blog/wurangy050/article/details/5287235
- 科普HTTP Slow Attack 和 Apache DOS 漏洞的修复
导读 HTTP 的 Slow Attack 有着悠久历史的 HTTP DOS 攻击方式,最早大约追溯到 5 年前,按理说早该修复了,但是 Apache 的默认配置中仍然没有添加相关配置,或者他们认为这 ...
- 关于Slow HTTP Denial of Service Attack slowhttptest的几种慢攻击DOS原理
关于Slow HTTP Denial of Service Attack slowhttptest的几种慢攻击DOS原理 http://www.myhack58.com/Article/60/sor ...
- 【漏洞学习】slowHTTPtest 慢速 DOS 攻击方法 修复方案
日期:2018-05-28 21:41:59 更新:2019-07-05 23:15:21 作者:Bay0net 介绍:学习一下 slowHTTPtest 的攻击及防御. 0x01. 安装 下载链接 ...
- dos攻击与防御
SYN Flood攻击 标准的TCP三次握手过程如下: 客户端发送一个包含SYN标志的TCP报文,SYN即同步(Synchronize),同步报文会指明客户端使用的端口以及TCP连接的初始序号: 服 ...
- Django : Security in Django
Security in Django https://docs.djangoproject.com/en/1.10/topics/security/ 1 Cross site scripting (X ...
随机推荐
- POJ2389 Bull Math【大数】
Bull Math Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 15040 Accepted: 7737 Descri ...
- Nginx入门及如何反向代理解决生产环境跨域问题
1.Nginx入门与基本操作篇 注:由于服务器是windows系统,所以本文主要讲解Nginx在windows下的操作. 首先下载Nginx 解压缩,我们所有的配置基本都在万能的 nginx/conf ...
- Https双向验证与Springboot整合测试-人来人往我只认你
1 简介 不知不觉Https相关的文章已经写了6篇了,本文将是这个专题的最后一篇,起码近期是最后一篇.前面6篇讲的全都是单向的Https验证,本文将重点介绍一下双向验证.有兴趣的同学可以了解一下之前的 ...
- windows下flume 采集如何支持TAILDIR和tail
一.问题:Windows 下 flume采集配置TAILDIR的时候,会报如下错误: agent.sources.seqGenSrc.type = TAILDIR agent.sources.seqG ...
- Java——多线程之对象及变量的并发访问
Java多线系列文章是Java多线程的详解介绍,对多线程还不熟悉的同学可以先去看一下我的这篇博客Java基础系列3:多线程超详细总结,这篇博客从宏观层面介绍了多线程的整体概况,接下来的几篇文章是对多线 ...
- POJ2376Cleaning Shifts(区间覆盖贪心)
应该还是蛮简单的一题,但是因为模拟太差,一直没调出来....... \(显而易见的应该按照左区间从小到大排序,相等按照右区间大到小排序\). \(那么第一个区间的l一定要是1,而且必拿(否则没有区间能 ...
- LateX公式表
转载自xkgjfl 话说为什么LateX公式这么难记 markdown最全数学公式 我们在用markdown写文档时有时候少不了需要插入一些公式,然而markdown公式输入远没有word这么直观,有 ...
- learn from collection framework design
最难忍受的痛苦,也许是想干一件事情而又不去干.--罗曼·罗兰 前言 本篇文章算是拾人牙慧吧,偶尔谷歌到一个能很好把collection framework design讲好的文档,一是为了总结提升,也 ...
- OpenWrt(LEDE)2020.4.29更新 UPnP+NAS+多拨+网盘+DNS优化+帕斯沃 无缝集成+软件包
交流群:QQ 1030484865 电报: t_homelede 固件说明 基于Lede OpenWrt R2020.4.8版本(源码截止2020.4.29)Lienol Feed及若干自行维护 ...
- 带你看看Java的锁(三)-CountDownLatch和CyclicBarrier
带你看看Java中的锁CountDownLatch和CyclicBarrier 前言 基本介绍 使用和区别 核心源码分析 总结 前言 Java JUC包中的文章已经写了好几篇了,首先我花了5篇文章从源 ...