What happens if client send SYN to udp server - tcp

I want to scan udp ports with SYN flag. But how would udp server react to the SYN packet, when the udp port is open and not open?

There are not flags field (including SYN flag) in the UDP header. So, technically speaking, it is not possible to send SYN packet using UDP protocol.
If you try to send TCP-formatted packet with protocol value 17 (UDP), the checksum will not match, and the packet will be discarded.

Related

Wireshark doesnt show UDP packets

I have checked this UDP packets not displayed in Wireshark and this UDP Packet not captured by Wireshark, but is captured by UDP application , but couldnt solve my issue.
I am using Wireshark to observe traffic on an adapter I have connected to some network device- no other traffic than the one I issue is there.
Then I am using Packet Sender application to send a UDP packet to an IP address I know is on the other side of the adapter (i.e. I am 10.10.10.34, the other device is 10.10.10.1).
I can correctly ping the other device and ICMP packets are visible in Wireshark. I can sent TCP or SSL packets and see them in Wireshark. Whenever I send UDP packet, it is not seen in Wireshark- I cannot figure out why. All my settings are default ones.
The other thing I suspect that the UDP packet is not sent by the Packet Sender application, but I am not sure how to validate that.
The case was not about Wireshark, but about Packet sender. Binding the IP address as described here solved my problem:
https://github.com/dannagle/PacketSender/issues/158#issuecomment-516481820

tcp syn retransmission after recieving RST?

I am using a simulator. in this simulator when a client sends a tcp syn request to a server and server responds it with RST packet (when the requesting port is close) the same client sends tcp syn retransmission to the same server (and the same port) for four times. i want to know real networks do the same? i mean in real networks if a client sends a tcp syn to a server and recieve RST , do that client sends tcp syn retransmission to that server for four times?
It totally depends on the client implementation. If you program a client to respond to a server's RST with a SYN 4 times, then that's what it will do. It might be that the server is sending an RST because it's detecting a SYN flood (if you keep on sending SYNs unsuccessfully, eventually heuristics will class it as such).
You may want to play with Scapy so you can easily write the client for these kinds of questions.

Tracing the packets through wireshark

I am trying to capture the packets moving from my system when i searched URL www.google.com in the browser. This is the flow I am seeing in wireshark.
DNS request was made
TCP three-way handshake is done
TLSV1.2 handshake has started.
In between tlv1.2 handshake I am seeing TCP packets moving from my system to the same port. What is that traffic regarding? I am sharing the screenshot for the same.
The TCP packets with description "ACK" are TCP acknowledgement packets.
An acknowledgement packet is sent to the server for each time the client receives a TCP data packet from the server.
The TCP packets with description "TCP segment of a reassembled PDU" are TCP fragmented data packet.
TCP may divide an upper layer packet into multiple packets. A TCP fragmented data packet is a piece of a divided packet.
For example, the TLS server certificate packet (#1842) was divided into 3 packets by TCP, #1839, #1841, and #1842.

How does the server know whether it's a UDP or a TCP segment?

I'm just curious about how the server knows if the received segment is a UDP or a TCP segment, especially when the listening port can listen on both UDP and TCP.
I know the client can use SOCK_DGRAM to generate UDP segments and SOCK_STREAM for TCP segments, but the segment transmitted is still a bunch of bits. How can the server know whether it should interpret these bits as a UDP segment or as a TCP segment? What if these bits are a UDP segment, but accidentally do not mean "too weird" if they are interpreted as a TCP segment?
It's firstly an IP packet, which contains the protocol in the IP header. Inside the IP packet is a payload, which contains either a TCP segment or a UDP datagram.

how to allow TCP response packets enter network and how to configure it in access-list?

What is TCP response packets?
How to meet this requirement in access-list on a router?
You probably want to look up stateful firewalling for whatever router you're using.
TCP response packets are basically any related TCP packets that come back after an initial SYN has been sent. Typically this would be either a packet with SYN+ACK set, or one with RST if the connection was refused.
Stateful firewalls keep track of not just the source and destination of individual packets, but what connection the packets belong to. By doing this they are able to distinguish between expected, legitimate replies to SYN packets (and others) and random or malicious unrequested "replies".

Resources