这篇文章主要介绍“Nginx HTTP/2和mp4模块拒绝服务漏洞预警分析”,在日常操作中,相信很多人在Nginx HTTP/2和mp4模块拒绝服务漏洞预警分析问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”Nginx HTTP/2和mp4模块拒绝服务漏洞预警分析”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
Nginx 11月6日得安全更新中,修补了三个可导致拒绝服务的漏洞:CVE-2018-16843,CVE-2018-16844和CVE-2018-16845。位于nginx HTTP/2 模块和流媒体MP4模块。
CVE-2018-16843,CVE-2018-16844漏洞存在于ngx_http_v2模块之中,当用户添加http2支持时(默认不开启),攻击者可以发送特制的HTTP/2请求,消耗CPU和内存资源,最终导致DoS。
CVE-2018-16845漏洞存在于ngx_http_mp4_module模块中,当用户对Nginx添加MP4流媒体支持,恶意的MP4文件会导致处理进程无限循环、崩溃或者内存泄露。
CVE-2018-16843,CVE-2018-16844影响版本:
Mainline version :1.9.5 - 1.15.5
CVE-2018-16845 影响版本:
Mainline version :1.1.3+, 1.0.7+
file:src/http/v2/ngx_http_v2.c src/http/v2/ngx_http_v2.h
--- a/src/http/v2/ngx_http_v2.c Tue Nov 06 16:29:35 2018 +0300+++ b/src/http/v2/ngx_http_v2.c Tue Nov 06 16:29:49 2018 +0300@@ -4481,12 +4481,19 @@ #endif+ h3scf = ngx_http_get_module_srv_conf(h3c->http_connection->conf_ctx,+ ngx_http_v2_module);++ if (h3c->idle++ > 10 * h3scf->max_requests) {+ ngx_log_error(NGX_LOG_INFO, h3c->connection->log, 0,+ "http2 flood detected");+ ngx_http_v2_finalize_connection(h3c, NGX_HTTP_V2_NO_ERROR);+ return;+ }+ c->destroyed = 0; ngx_reusable_connection(c, 0);- h3scf = ngx_http_get_module_srv_conf(h3c->http_connection->conf_ctx,- ngx_http_v2_module);- h3c->pool = ngx_create_pool(h3scf->pool_size, h3c->connection->log); if (h3c->pool == NULL) { ngx_http_v2_finalize_connection(h3c, NGX_HTTP_V2_INTERNAL_ERROR);
--- a/src/http/v2/ngx_http_v2.c Tue Nov 06 16:29:18 2018 +0300+++ b/src/http/v2/ngx_http_v2.c Tue Nov 06 16:29:35 2018 +0300@@ -664,6 +664,7 @@ h3c->pool = NULL; h3c->free_frames = NULL;+ h3c->frames = 0; h3c->free_fake_connections = NULL;#if 3 (NGX_HTTP_SSL)@@ -2895,7 +2896,7 @@ frame->blocked = 0;- } else {+ } else if (h3c->frames < 10000) { pool = h3c->pool ? h3c->pool : h3c->connection->pool; frame = ngx_pcalloc(pool, sizeof(ngx_http_v2_out_frame_t));@@ -2919,6 +2920,15 @@ frame->last = frame->first; frame->handler = ngx_http_v2_frame_handler;++ h3c->frames++;++ } else {+ ngx_log_error(NGX_LOG_INFO, h3c->connection->log, 0,+ "http2 flood detected");++ h3c->connection->error = 1;+ return NULL; }#if 4 (NGX_DEBUG)
为了修补CVE-2018-16843,CVE-2018-16844漏洞,新增了idle和frames变量统计请求数,每个子进程处理的请求数远大于配置的max_requests或者超出10000,将不进行处理。
CVE-2018-16845:
file:src/http/modules/ngx_http_mp4_module.c
--- src/http/modules/ngx_http_mp4_module.c+++ src/http/modules/ngx_http_mp4_module.c@@ -942,6 +942,13 @@ ngx_http_mp4_read_atom(ngx_http_mp4_file atom_size = ngx_mp4_get_64value(atom_header + 8); atom_header_size = sizeof(ngx_mp4_atom_header64_t);+ if (atom_size < sizeof(ngx_mp4_atom_header64_t)) {+ ngx_log_error(NGX_LOG_ERR, mp4->file.log, 0,+ "\"%s\" mp4 atom is too small:%uL",+ mp4->file.name.data, atom_size);+ return NGX_ERROR;+ }+ } else { ngx_log_error(NGX_LOG_ERR, mp4->file.log, 0, "\"%s\" mp4 atom is too small:%uL",
MP4文件由若干称为Atom(或称为box)的数据对象组成,每个Atom的头部为四个字节的数据长度(Big Endian)和四个字节的类型标识,数据长度和类型标志都可以扩展。Atom可以嵌套,即其数据域可以由若干其它Atom组成,从而实现结构化的数据。为了修补CVE-2018-16845,在MP4模块中对文件的Atom头部结构进行检查,过滤掉恶意的MP4文件。
关闭http/2请求处理和MP4流媒体支持,强烈建议将Nginx 升级至1.15.6,或1.14.1 stable 最新版本。
到此,关于“Nginx HTTP/2和mp4模块拒绝服务漏洞预警分析”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。
原文链接:https://my.oschina.net/u/4600927/blog/4595270