什么可以阻止 Windows 计算机上的欺骗性 UDP 数据包?
What could be blocking spoofed UDP packets on Windows computer?
我尝试创建一个简单的 IP 地址欺骗程序。目标是说服本地网络上的计算机游戏连接到互联网服务器。游戏只通过UDP广播发现服务器,不接受服务器IP。
所以我想通过创建一个假的 UDP 数据包来欺骗游戏,让它认为它从 Internet 服务器接收到答案信息。
我成功地使用 raw-socket
生成了带有 UDP 负载的 IPV4 数据包。只要我设置正确的 IP,它就会被发送。
但是,如果我在数据包中放入伪造的IP,它就不会出机。我在我机器上的 Wireshark 中看不到它。我还注意到某些东西纠正了我数据包上的 IPV4 校验和。我总是发送校验和 0xFFFF
,但 Wireshark 看到了这个:
我如何使用 raw-socket
发送它:
const raw = require("raw-socket");
const UDPPacket = require("../generic/UDPPacket");
const IPV4Packet = require("../generic/IPV4Packet");
var socket = raw.createSocket({ protocol: raw.Protocol.UDP });
socket.on("message", function (buffer, source) {
console.log("received " + buffer.length + " bytes from " + source);
});
// UDPPacket and IPV4 packet are classes that I wrote in order to
// generate the UDP and IPV4 byte data
const packet = new UDPPacket();
packet.srcPort = 27888;
packet.dstPort = 1234;
packet.data = responseBuffer;
const buf = packet.fullBuffer;
const ipv4packet = new IPV4Packet();
ipv4packet.payloadBuffer = buf;
// I send the message form several IPs, but only mine works
const iprand = "192.168.110.";
let ipincrement = 75 * 2;
// my actual IP right now
ipv4packet.srcAddr = "192.168.110.79";
ipv4packet.dstAddr = "192.168.110.1";
setInterval(() => {
// Try to send it from another IP
ipv4packet.srcAddr = iprand + Math.round((++ipincrement)/2);
const ipv4buf = ipv4packet.fullBuffer;
socket.send(ipv4buf, 0, ipv4buf.length, ipv4packet.dstAddr, function (error, bytes) {
// I'm not sure what does this exactly do,
// I found it on the internet ¯\_(ツ)_/¯
// But without it, I cannot send the IPV4 headers
socket.setOption(
raw.SocketLevel.IPPROTO_IP,
raw.SocketOption.IP_HDRINCL,
new Buffer([0x01, 0x00, 0x00, 0x00]),
4
);
},
function (error, bytes) {
// always prints that bytes were sent
if (error)
console.log(error.toString());
else
console.log(bytes, " bytes sent!");
}
);
}, 700)
谁在阻止和更改我的数据包?我试过禁用防火墙,没有帮助。
请注意,即使目标是本地计算机,消息也会丢失。
参见https://msdn.microsoft.com/en-us/library/windows/desktop/ms740548(v=vs.85).aspx:
在 Windows 7、Windows Vista、Windows 带有 Service Pack 2 (SP2) 的 XP 和 Windows 带有 Service Pack 3 (SP3) 的 XP 上,通过原始套接字发送流量的能力在几个方面受到限制:
源地址无效的 UDP 数据报无法通过原始套接字发送。任何传出 UDP 数据报的 IP 源地址必须存在于网络接口上,否则数据报将被丢弃。进行此更改是为了限制恶意代码创建分布式拒绝服务攻击的能力,并限制发送欺骗性数据包(TCP/IP 具有伪造源 IP 地址的数据包)的能力。
我尝试创建一个简单的 IP 地址欺骗程序。目标是说服本地网络上的计算机游戏连接到互联网服务器。游戏只通过UDP广播发现服务器,不接受服务器IP。
所以我想通过创建一个假的 UDP 数据包来欺骗游戏,让它认为它从 Internet 服务器接收到答案信息。
我成功地使用 raw-socket
生成了带有 UDP 负载的 IPV4 数据包。只要我设置正确的 IP,它就会被发送。
但是,如果我在数据包中放入伪造的IP,它就不会出机。我在我机器上的 Wireshark 中看不到它。我还注意到某些东西纠正了我数据包上的 IPV4 校验和。我总是发送校验和 0xFFFF
,但 Wireshark 看到了这个:
我如何使用 raw-socket
发送它:
const raw = require("raw-socket");
const UDPPacket = require("../generic/UDPPacket");
const IPV4Packet = require("../generic/IPV4Packet");
var socket = raw.createSocket({ protocol: raw.Protocol.UDP });
socket.on("message", function (buffer, source) {
console.log("received " + buffer.length + " bytes from " + source);
});
// UDPPacket and IPV4 packet are classes that I wrote in order to
// generate the UDP and IPV4 byte data
const packet = new UDPPacket();
packet.srcPort = 27888;
packet.dstPort = 1234;
packet.data = responseBuffer;
const buf = packet.fullBuffer;
const ipv4packet = new IPV4Packet();
ipv4packet.payloadBuffer = buf;
// I send the message form several IPs, but only mine works
const iprand = "192.168.110.";
let ipincrement = 75 * 2;
// my actual IP right now
ipv4packet.srcAddr = "192.168.110.79";
ipv4packet.dstAddr = "192.168.110.1";
setInterval(() => {
// Try to send it from another IP
ipv4packet.srcAddr = iprand + Math.round((++ipincrement)/2);
const ipv4buf = ipv4packet.fullBuffer;
socket.send(ipv4buf, 0, ipv4buf.length, ipv4packet.dstAddr, function (error, bytes) {
// I'm not sure what does this exactly do,
// I found it on the internet ¯\_(ツ)_/¯
// But without it, I cannot send the IPV4 headers
socket.setOption(
raw.SocketLevel.IPPROTO_IP,
raw.SocketOption.IP_HDRINCL,
new Buffer([0x01, 0x00, 0x00, 0x00]),
4
);
},
function (error, bytes) {
// always prints that bytes were sent
if (error)
console.log(error.toString());
else
console.log(bytes, " bytes sent!");
}
);
}, 700)
谁在阻止和更改我的数据包?我试过禁用防火墙,没有帮助。
请注意,即使目标是本地计算机,消息也会丢失。
参见https://msdn.microsoft.com/en-us/library/windows/desktop/ms740548(v=vs.85).aspx:
在 Windows 7、Windows Vista、Windows 带有 Service Pack 2 (SP2) 的 XP 和 Windows 带有 Service Pack 3 (SP3) 的 XP 上,通过原始套接字发送流量的能力在几个方面受到限制:
源地址无效的 UDP 数据报无法通过原始套接字发送。任何传出 UDP 数据报的 IP 源地址必须存在于网络接口上,否则数据报将被丢弃。进行此更改是为了限制恶意代码创建分布式拒绝服务攻击的能力,并限制发送欺骗性数据包(TCP/IP 具有伪造源 IP 地址的数据包)的能力。