basil00 / WinDivert

WinDivert: Windows Packet Divert
https://reqrypt.org/windivert.html
Other
2.56k stars 512 forks source link

DNS-Malformed Packet #351

Closed BadBoy-a closed 7 months ago

BadBoy-a commented 12 months ago

Hi,I intercepted all DNS messages but no response was received.Through Wireshark packet capturing, I found that the packet is incorrect.After comparing with the correct packets,I found an error byte--'2e',which should have been the length. Here is my code:

void main() { HANDLE handle; unsigned char packet[65535]; UINT packet_len; WINDIVERT_ADDRESS addr; handle = WinDivertOpen("udp.DstPort == 53", WINDIVERT_LAYER_NETWORK, 0, 0); if (handle == INVALID_HANDLE_VALUE) { printf("WinDivertOpen error:", GetLastError()); return; } while (1) { if (!WinDivertRecv(handle, packet, sizeof(packet), &packet_len, &addr)) { printf("WinDivertRecv error:", GetLastError()); continue; } WinDivertHelperCalcChecksums(packet, packet_len, &addr, 0); WinDivertSend(handle, packet, packet_len, NULL, &addr); } }

Screenshot of Wireshark: correct error

majibow commented 11 months ago

Have you tried the netdump.exe example program on your system? Seems to work on mine... see highlight 03

image

basil00 commented 7 months ago

I think this is unlikely this is a WinDivert bug, or else there should be a flood of similar reports.