目录

1. 漏洞的起因
2. 漏洞原理分析
3. 漏洞的影响范围
4. 漏洞的利用场景
5. 漏洞的POC、测试方法
6. 漏洞的修复Patch情况
7. 如何避免此类漏洞继续出现

1. 漏洞的起因

这次的CVE和windows的Secure Channel (Schannel)有关

The Secure Channel (Schannel) security package is a Security Support Provider (SSP) that implements the Secure Sockets Layer (SSL) and Transport Layer Security (TLS) Internet standard authentication protocols. These components are used to implement secure communications in support of several common internet and network applications, such as web browsing. Schannel is part of the security package that helps provide an authentication service to provide secure communications between client and server.

黑客通过向windows server上Secure Channel相关服务监听的端口发送畸形网络数据包,从而可以达到远程任意代码执行(RCE)的效果,获取受害者用户主机的代码执行权限

Relevant Link:

https://technet.microsoft.com/en-us/library/security/dn848375.aspx#Schannel
http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-6321
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2014-6321
https://technet.microsoft.com/library/security/ms14-066
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2014-6321

2. 漏洞原理分析

0x1: Secure Channel简介

漏洞的源头在于Secure Channel Security Package,Secure Channel Security Package是一个提供SSL(Secure Sockets Layer)和TLS(Transport Layer Security)协议实现的代码库(.dll文件),用于提供windows server和远程客户端(client)之间跨越非安全公网的安全通信通道,例如

1. WEB浏览器和WEB Server之间的HTTPS通信
2. Active Directory的身份认证
3. Secure Channel是Secure Channel Security Package代码库中的一个功能模块,主要负责提供client和server之间的身份认证服务,即,它是处理Secure Channel中和网络认证数据包有关的这部分逻辑

流程架构图

和openssl的原理类似,Secure Channel Security Package只是一个底层的代码库,它负责实现上层SSL/TLS协议的具体实现

Relevant Link:

http://blogs.dirteam.com/blogs/sanderberkouwer/archive/2014/11/11/it-s-time-to-update-your-secure-channel-ms14-066-cve-2014-6321.aspx
http://msdn.microsoft.com/en-us/library/aa380123(VS.85).aspx

0x2: 漏洞原理分析

通过对windows的path更新进行patch diff,我们可以知道,漏洞存在的DLL文件为

C:\WINDOWS\system32\schannel.dll

使用depends.exe查看schannel.dll的API

因为windows是闭源的操作系统,需要逆向才能拿到源代码,这里不做深入的代码分析了,根据微软漏洞分析团队的分析报告来看,漏洞的成因应该是如下几项

1. schannel.dll中和SSL/TLS会话数据包(非握手)的处理相关的API对数据包中的某些字段的处理流支存在缓冲区溢出相关漏洞
2. 要完成最终的POC,黑客需要进行数据包构造,这是一种数据包字段型的畸形攻击
3. 最终的POC转换为攻击还需要黑客在数据包中构造buf overflow所需要的特定shellcode

3. 漏洞的影响范围

0x1: 漏洞造成的风险

An attacker who successfully exploited this vulnerability could run arbitrary code on a target server.

通过构造畸形的恶意数据报,黑客可以在受害者的机器上执行任意的代码,并且可以绕过windows提供的安全防御机制,包括

1. Enhanced Protected Mode (EPM) sandbox in IE 11
2. Enhanced Mitigation Experience Toolkit (EMET) anti-exploitation tool 

0x2: 漏洞影响的操作系统版本

Operating System

Maximum Security Impact

Aggregate Severity Rating

Updates Replaced

Windows Server 2003

Windows Server 2003 Service Pack 2
(2992611)

Remote Code Execution

Critical

2655992 in MS12-049

Windows Server 2003 x64 Edition Service Pack 2
(2992611)

Remote Code Execution

Critical

2655992 in MS12-049

Windows Server 2003 with SP2 for Itanium-based Systems
(2992611)

Remote Code Execution

Critical

2655992 in MS12-049

Windows Vista

Windows Vista Service Pack 2
(2992611)

Remote Code Execution

Critical

2207566 in MS10-085

Windows Vista x64 Edition Service Pack 2
(2992611)

Remote Code Execution

Critical

2207566 in MS10-085

Windows Server 2008

Windows Server 2008 for 32-bit Systems Service Pack 2
(2992611)

Remote Code Execution

Critical

2207566 in MS10-085

Windows Server 2008 for x64-based Systems Service Pack 2
(2992611)

Remote Code Execution

Critical

2207566 in MS10-085

Windows Server 2008 for Itanium-based Systems Service Pack 2
(2992611)

Remote Code Execution

Critical

2207566 in MS10-085

Windows 7

Windows 7 for 32-bit Systems Service Pack 1
(2992611)

Remote Code Execution

Critical

2982378 in SA2871997

Windows 7 for x64-based Systems Service Pack 1
(2992611)

Remote Code Execution

Critical

2982378 in SA2871997

Windows Server 2008 R2

Windows Server 2008 R2 for x64-based Systems Service Pack 1
(2992611)

Remote Code Execution

Critical

2982378 in SA2871997

Windows Server 2008 R2 for Itanium-based Systems Service Pack 1
(2992611)

Remote Code Execution

Critical

2982378 in SA2871997

Windows 8 and Windows 8.1

Windows 8 for 32-bit Systems
(2992611)

Remote Code Execution

Critical

2868725 in SA2868725

Windows 8 for x64-based Systems
(2992611)

Remote Code Execution

Critical

2868725 in SA2868725

Windows 8.1 for 32-bit Systems
(2992611)

Remote Code Execution

Critical

None

Windows 8.1 for x64-based Systems
(2992611)

Remote Code Execution

Critical

None

Windows Server 2012 and Windows Server 2012 R2

Windows Server 2012
(2992611)

Remote Code Execution

Critical

2868725 in SA2868725

Windows Server 2012 R2
(2992611)

Remote Code Execution

Critical

None

Windows RT and Windows RT 8.1

Windows RT[1]
(2992611)

Remote Code Execution

Critical

2868725 in SA2868725

Windows RT 8.1[1]
(2992611)

Remote Code Execution

Critical

None

Server Core installation option

Windows Server 2008 for 32-bit Systems Service Pack 2 (Server Core installation)
(2992611)

Remote Code Execution

Critical

2207566 in MS10-085

Windows Server 2008 for x64-based Systems Service Pack 2 (Server Core installation)
(2992611)

Remote Code Execution

Critical

2207566 in MS10-085

Windows Server 2008 R2 for x64-based Systems Service Pack 1 (Server Core installation)
(2992611)

Remote Code Execution

Critical

2982378 in SA2871997

Windows Server 2012 (Server Core installation)
(2992611)

Remote Code Execution

Critical

2868725 in SA2868725

Windows Server 2012 R2 (Server Core installation)
(2992611)

Remote Code Execution

Critical

None

从微软的公告上来看,这次的漏洞覆盖了windows几乎所有的操作系统版本,属于高危级别漏洞

4. 漏洞的利用场景

这个漏洞属于底层代码库的代码漏洞,要100%验证是否存在这个漏洞需要能够根据代码的漏洞细节构造对应的畸形数据包POC,微软的研究团队并没有公布关于这个漏洞的更多细节,因此无法从源码和POC层面来进行漏洞验证,比较遗憾

5. 漏洞的POC、测试方法

0x1: 验证本机是否存在漏洞的方法

微软对存在漏洞的DLL文件进行了修复,所以我们可以根据当前系统的DLL版本号来判断当前系统是否存在安全漏洞

在命令行下执行指令,得到对应DLL文件的版本号

wmic datafile where name="C:\\Windows\\System32\\schannel.dll" get version

根据得到的版本号和微软官方给出的版本号进行对比,如果版本号不等于这个,则说明当前系统存在漏洞,需要修复

1. Windows Server 2003

Schannel.dll    5.2.3790.5462  

2. Windows Server 2008 x86

Schannel.dll    5.2.3790.5462  

3. Windows Server 2008 x64 

Schannel.dll    6.0.6002.19193

4. Windows Server 2012 x64

Schannel.dll    6.2.9200.17124

5. Windows Server 2012 R2 x64

Schannel.dll    6.3.9600.17385

0x2: 通过构造畸形数据包的方式验证本机是否存在漏洞

暂无,需要对Schannel.dll进行深入逆向分析,才能得到可以从外部打进去的畸形数据包

6. 漏洞的修复Patch情况

0x1: 使用windows自动的update服务进行自动补丁升级

最稳定有效的方案就是使用系统自带的升级程序去升级更新补丁

0x2: MS14-066单补丁修复

Windows2003   32位 中文版 补丁
http://www.microsoft.com/zh-CN/download/details.aspx?id=44649
Windows2003   32位 英文版 补丁
http://www.microsoft.com/en-us/download/details.aspx?id=44649
Windows2003   64位中文版 补丁
http://www.microsoft.com/zh-CN/download/details.aspx?id=44606
Windows2003   64 英文版 位补丁
http://www.microsoft.com/en-us/download/details.aspx?id=44606
Windows2008   32位 英文版 补丁
http://www.microsoft.com/en-us/download/details.aspx?id=44645
Windows2008   32位 中文版 补丁
http://www.microsoft.com/zh-CN/download/details.aspx?id=44645
Windows2008  64位  英文版 补丁
http://www.microsoft.com/en-us/download/details.aspx?id=44631
Windows2008  64位  中文版 补丁
http://www.microsoft.com/zh-CN/download/details.aspx?id=44631
Windows2008  R2 64位  中文版 补丁
http://www.microsoft.com/zh-CN/download/details.aspx?id=44618
Windows2008  R2 64位  英文版 补丁
http://www.microsoft.com/en-us/download/details.aspx?id=44618

Relevant Link:

http://bbs.aliyun.com/read.php?tid=182074&displayMode=1&page=1&toread=1#tpc

7. 如何避免此类漏洞继续出现

这里附带上自动化的漏洞修复程序源代码,主要做2件事

1. 自动根据操作系统版本下载对应的update修复补丁程序:从集团内部FTP上下载1) all server 2003: WindowsServer2003-KB2992611.exe2) all Windows Server 2008: WindowsServer2008-KB2992611.msu3) all Windows Server 2008 R2: WindowsServer2008-R2-KB2992611.msu4) all Windows Server 2012: WindowsServer2012-KB2992611.msu5) all Windows Server 2012 R2: WindowsServer2012-R2-KB2992611.msu
1. 自动进行静默、非重启安装
因为这次的漏洞的源头是那个DLL文件,它被加载到了LSASS系统常驻进程里面,我们安装修复补丁程序只是在进行磁盘上的DLL文件替换,要真正使本次升级生效,还需要对LSASS系统进程进行RELOAD,也就相当于重启了

code

#if (defined _WIN32 || defined __WIN32__)
#include <windows.h>
#endif#include <stdio.h>
#include <io.h>
#include <curl/curl.h>
#include <curl/easy.h>using namespace std;size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream)
{size_t written = fwrite(ptr, size, nmemb, stream);return written;
}/*
parameters:
url: 下载链接
outfilename: 要保存的文件路径
*/
void installUpdate(char * url, char * filename)
{//1. 下载升级程序文件CURL *curl;FILE *fp;CURLcode res;char* outfilename = filename;char* parame = " /quiet /norestart";char cmdline[128] = {0};memcpy(cmdline, filename, 128);strcat(cmdline, parame);//char *url = "http://localhost/aaa.txt";//char outfilename[FILENAME_MAX] = "C:\\bbb.txt";curl = curl_easy_init();if (curl){fp = fopen(outfilename,"wb");curl_easy_setopt(curl, CURLOPT_URL, url);curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);res = curl_easy_perform(curl);/* always cleanup */curl_easy_cleanup(curl);fclose(fp);}//2. 检查是否下载成功if ( !access(outfilename, 0) ){printf("update file download succussfully!\n");//3. 执行静默安装
        system(cmdline);}else{printf("update file download faild!\n");}return;
}/*
判断
return:
x64 = 1: 64位
x64 = 0: 32位
*/
int getPlatForm()
{unsigned short x64 = 0;#if defined(_MSC_VER)// vs
        __asm mov x64,gs#else// gccasm("mov %%gs, %0" : "=r"(x64));#endif//printf("In x%s OS\n", x64 ? "64" : "86");return x64;
}/*
判断操作系统的版本、32/64
*/
int GetOSVer()
{OSVERSIONINFO osver;osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);GetVersionEx(&osver);if(osver.dwPlatformId == 2){//1. windows server 2003if(osver.dwMajorVersion ==  5 && osver.dwMinorVersion == 2){printf("windows server 2003\n");//32位if(getPlatForm() == 0){installUpdate("http://xxxx/WindowsServer2003-KB2992611-32.exe", "WindowsServer2003-KB2992611-32.exe");}//64位else{installUpdate("http://xxxx/WindowsServer2003-KB2992611-64", "WindowsServer2003-KB2992611-64");}return(1);}//2. windows server 2008if(osver.dwMajorVersion ==  6 && osver.dwMinorVersion == 0){printf("windows server 2008\n");//32位if(getPlatForm() == 0){installUpdate("http://xxxx/WindowsServer2008-KB2992611-32.msu", "WindowsServer2008-KB2992611-32.msu");}//64位else{installUpdate("http://xxxx/WindowsServer2008-KB2992611-64.msu", "WindowsServer2008-KB2992611-64.msu");}return(1);}//3. windows server 2008 R2if(osver.dwMajorVersion ==  6 && osver.dwMinorVersion == 1){printf("windows server 2008 R2\n");//32位if(getPlatForm() == 0){}//64位else{installUpdate("xxxx/WindowsServer2008-R2-KB2992611-64.msu", "WindowsServer2008-R2-KB2992611-64.msu");}return(1);}//4. windows server 2012if(osver.dwMajorVersion ==  6 && osver.dwMinorVersion == 2){printf("windows server 2012\n");//32位if(getPlatForm() == 0){}//64位else{//installUpdate("xxxx/WindowsServer2012-KB2992611.msu", "WindowsServer2012-KB2992611.msu");
            }return(1);}//5. windows server 2012 R2if(osver.dwMajorVersion ==  6 && osver.dwMinorVersion == 3){printf("windows server 2012 R2\n");//32位if(getPlatForm() == 0){}//64位else{//installUpdate("xxxx/WindowsServer2012-R2-KB2992611.msu", "WindowsServer2012-R2-KB2992611.msu");
            }return(1);}}return 0;
}int main(int argc, char* argv[])
{#ifdef _WIN32printf("Hello: %d", GetOSVer());#endif#ifdef _UNIX#endif#ifdef _LINUX#endifreturn 0;
}

代码中的下载链接请自行到官网下载官方的补丁程序

对不同的操作系统测试结果

1. windows server 2003 32:
2. windows server 2003 64: 测试通过3. windows server 2008 32:
4. windows server 2008 64: 测试通过5. windows server 2008 R2 32:
6. windows server 2008 R2 64: 7. windows server 2012 32:
8. windows server 2012 64: 9. windows server 2012 R2 32:
10. windows server 2012 R2 64: 

Relevant Link:

http://files.cnblogs.com/LittleHann/vulfix.rar

Copyright (c) 2014 LittleHann All rights reserved

转载于:https://www.cnblogs.com/LittleHann/p/4092058.html

CVE-2014-6321 MS14-066 Microsoft Schannel Remote Code Execution Vulnerability Analysis相关推荐

  1. CVE: 2014-6271 Bash Specially-crafted Environment Variables Code Injection Vulnerability Analysis

    1. 漏洞的起因 这个漏洞的起因源自于Bash(Bourne Again SHell)的ENV指令 http://ss64.com/bash/env.html env: Display, set, o ...

  2. Apache Geronimo Remote Code Execute Vulnerability

    简介: Apache Geronimo 是 Apache 软件基金会的开放源码J2EE服务器,它集成了众多先进技术和设计理念. 这些技术和理念大多源自独立的项目,配置和部署模型也各不相同. Geron ...

  3. php图片写入带问号_php-fpm Remote Code Execution 分析(CVE-2019-11043)

    漏洞简介 国外安全研究员 Andrew Danau发现向服务器请求的URL中包含%0a 符号时,服务返回异常,疑似存在漏洞. Nginx+php-fpm的环境中,若Nginx上的fastcgi_spl ...

  4. 跟本菜菜一起去体验Microsoft Windows Server Code Name Longhorn Server Core

    消失的菜菜又回来了,这段时间由于很多原因没及时更新blog,忘大家见谅-还记得菜菜以前给大家介绍的Microsoft Windows Server Longhorn吗?今天我给大家带来Microsof ...

  5. Microsoft Visual Studio Code

    Microsoft Visual Studio Code 中文手册:https://www.cntofu.com/book/98/README.md Visual Studio Code 官网:htt ...

  6. php flash chat,FlashChat lt;= 4.5.7 (aedating4CMS.php) Remote File Include Vulnerability

    NeXtMaN <mc.nadz [at] gmail.com> Here are 3 RFI vulnerabilities in Flashchat i've found: Code: ...

  7. phpmyadmin 4.8.1 Remote File Inclusion Vulnerability (CVE-2018-12613)漏洞复现

    漏洞利用过程: vulhub.org docker环境启动后 1.访问 http://your-ip:8080  访问phpmyadmin. 配置的是config模式,无需输入密码,直接登录test账 ...

  8. CVE-2021-1647:Microsoft Defender远程代码执行漏洞通告

    报告编号:B6-2021-011301 报告来源:360CERT 报告作者:360CERT 更新日期:2021-01-13 0x01漏洞简述 2021年01月13日,360CERT监测发现Micros ...

  9. 近20年Windows权限提升集合

    来源:https://github.com/Ascotbe/Kernelhub 来源:https://www.ascotbe.com/2020/08/10/KernelHub/#%E5%88%A9%E ...

最新文章

  1. 基于deep learning的快速图像检索(Deep Learning of Binary Hash Codes for Fast Image Retrieval)
  2. IoT与区块链的机遇与挑战
  3. SP1026 FAVDICE - Favorite Dice 期望dp
  4. 漫步线性代数十六——投影和最小二乘
  5. 7-11 分段计算居民水费 (10 分)
  6. Umbraco中根据ID获取IPublishedContent
  7. python基础篇——列表与列表算法(下)
  8. 九度OJ题目1000: A + B(数学)
  9. 注册机是如何获取序列号的?
  10. 软件项目中的角色以及英文简称
  11. log4j2配置详解(节点和输出格式)
  12. win 10 添加网络位置提示【输入的文件夹似乎无效,请选择另一个】解决办法
  13. 什么是架构?架构师的职责是什么?
  14. chrome-功能指令
  15. word 分栏后转html,word文档分栏后的页码设置方法
  16. 信息流广告文案与创意设计
  17. C#通过函数名字符串执行相应的函数
  18. eplan好看的电缆图表_eplan,电缆图表,模板
  19. 【ABP】 框架的使用
  20. schema的基本使用

热门文章

  1. 为iPhone日历添加天气和农历
  2. 2、Terraform-安装
  3. 小熊派折叠开发板(一)- 开发板介绍
  4. android模拟器如何正确安装HAXM加速器
  5. 古代汉语 郭锡良版本 复习要点
  6. Tableau基础 Tableau 数据集的使用
  7. 【璟丰机电】美国派克Parker产品在FPD中的行业应用案例盘点
  8. 王者荣耀微信登录服务器无反应,王者荣耀微信登不上去怎么办?登陆失败解决方法...
  9. 2023 新版帝国内核试玩佣金网站系统源码
  10. java提示程序包不存在,解决:Error:java xxxx 程序包不存在