伺服器軟體Nginx兩模組瑕疵恐衍生DoS
- 發布單位:TWCERT/CC
- 更新日期:2019-04-03
- 點閱次數:431
CVE編號
內文
●概述:
2004年由Igor Sysoev以C語言開發Nginx,其為異步架構Web伺服器,也可用於反向代理或負載平衡,此款免費開源軟體,至2018年初已遍及全球30.46%網站,常見於Linux環境,Nginx特色是模組化設計,其中兩模組易遭遠距觸發DoS,ngx_http_v2_module設定為守聽http2協定流量時,處理惡意request將導致CPU及記憶體消耗殆盡,掏空硬體資源;而ngx_http_mp4_module接收到偽冒mp4檔案亦將導致無限迴圈,甚至暴露資料,NGINX, Inc於11月6日釋出更新版,改善前述缺失,網站營運業者請關注設備修補進度。
●編註:
(1)弱點概況
(1-1) ngx_http_v2_module
組譯nginx程式時,ngx_http_v2_module並非預設模組,然若該模組被納入,編輯listen指令且配賦http2選項,示意如下:
server {
listen 443 ssl http2 default_server;
ssl_certificate server.crt;
ssl_certificate_key server.key;
… }
當上述組態成立,則Nginx伺服器運行時,接收處理惡意HTTP/2 request,將觸發CPU及記憶體資源耗盡,延宕硬體效能。
(1-2) ngx_http_mp4_module
ngx_http_mp4_module主要作用為支援H.264壓縮編碼格式檔案,解析mp4、m4v、m4a等檔案媒體串流,模組編輯語法範例為:
location /video/ {
mp4;
mp4_buffer_size 1m;
mp4_max_buffer_size 5m; }
ngx_http_mp4_module本身亦非預設模組,但建構Nginx伺服器將之包含在內,且指令明確定義mp4,則漏洞存在,接收偽造mp4檔,處理程序可能發生無限迴圈,讓process失效,甚至洩露記憶體內容。
(2) HTTP 2.0簡介
HTTP/2為超文字傳輸協定第2版,起初命名HTTP 2.0,相較於前代,改善了底層通訊封包運作,基本操作如GET/POST、HTTP Status Code、各類Headers均無調整,完全與HTTP 1.1相容。
因HTTP/1.1缺陷在於每個對伺服器的Request,必須佔用一個連線(TCP connection),檔案傳完一個再傳下一個,最多同時六個連線,HTTP/2只需要單一TCP connection,即可從伺服器下載所需資源,節省連線建立時間;而連線多工(Multiplexing)在單一連線上可傳輸多個Request 和 Response,有利圖檔存取;另外優先傳送權、Header壓縮、二進位封包結構,均精簡頻寬占用率。
(3)資料勘誤
(3-1)在securitytracker網站介紹上述漏洞,與nginx.org、MITRE記載有出入,securitytracker描述ngx_http_v2_module,提及listen及”https”,nginx官網則為”http2”。
(3-2)另securitytracker指出駭客變造ngx_http_mp4_module可造成crash,然正確觀念應是駭客變造mp4以觸發模組弱點,在程式完成組譯後,變更模組是毫無意義的。
影響產品
解決辦法
相關連結
- http://mailman.nginx.org/pipermail/nginx-announce/2018/000220.html
- https://tengine.taobao.org/nginx_docs/cn/docs/http/ngx_http_mp4_module.html
- https://www.keakon.net/2018/03/07/NGINX%25E6%2594%25AF%25E6%258C%2581HTTP/2serverpush%25E4%25BA%2586
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-16844
- http://blog.yancoder.com/2017/06/15/%25E9%2583%25A8%25E7%25BD%25B2HTTP2%25E8%25B8%25A9%25E5%259D%259
- https://nginx.org/
- https://securitytracker.com/id/1042038
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-16843
- http://nginx.org/download/patch.2018.mp4.txt
- http://mailman.nginx.org/pipermail/nginx-announce/2018/000221.html
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-16845
- https://zh.wikipedia.org/wiki/HTTP/2
- https://ihower.tw/blog/archives/8489
- https://zh.wikipedia.org/wiki/Nginx
- https://securitytracker.com/id/1042039
- https://nginx.org/nginx.png