Come on boy, most said it is not possible, but in reality it is!
I do not know if you will use this for good or if you want to give a hacker out there, what you will do with this kind of information is up to your conscience and everyone who will read it!
Thanks to peculiarities in implementing the TCP / IP stack from different vendors, it is possible to analyze and identify different operating systems / devices.
To understand how this works, it is important that you know the structure of an IP packet:
LookhowmuchinformationaTCPpacketloads,Iwillnothandleeachparameterthisisabitlengthy,whatisimportantforyoutoknowisthatsomeofthisinformationchangesfromOStoOSanditispossibletoanalyzethisusinganalysistechniquesoftraffic.
Thiscanbedonepassivelyoractively:
Active-Yourdevice(PC,etc)sendspacketstotheIPyouwantandanalyzestheresponse.Passive-Itonlyinterceptspacketsthattravelonthenetwork(sniffers).AveryrudimentarywayistoanalyzetheTimetoLive(TTL)andWindow!fields
TTL-Maximumtimethepacketscantakebeforebeingdestroyed(canbeseeninthefigureoftheIPpacketstructureintheredpart).
window-Receptionwindowsize(canbeseeninthefigureoftheIPpacketstructureintheyellowpart).
SeehowcertaindefaultsforthesetwofieldscantellyouDifferentiatedOperatingSystemsonlybyanalyzingpackagereturn:
Linux(Kernel2.4and2.6)
- TimeToLive=64
- TCPWindowSize=5840
GoogleLinux
- TimeToLive=64
- TCPWindowSize=5720
FreeBSD
- TimeToLive=64
- TCPWindowSize=65535
WindowsXP
- TimeToLive=128
- TCPWindowSize=65535
WindowsVistaand7(WindowsServer2008)
- TimeToLive=128
- TCPWindowSize=8192
iOS12.4orCiscoRouters
- TimeToLive=255
- TCPWindowSize=4128
OK,nowyouhaveanideaofhowthisispossible,imaginenowinsteadofanalyzingonlytwofields,analyzingalargerset,settingandobservingthepatternsandthusachievinggreaterconsistencyandcorrectness.Well,thisispossible,with67bitsofanalysisyouwillhaveaveryreliablesignature:
Startingpacketsize-UsingvaluesfromtheIHLfieldandTotalLengthitispossibletoknowtheinitialsizeofthepackage(16bits).TimetoLivefieldvalue(8bits).Windowfieldvalue(16bits).Maximumsegmentsize(16bits)-IntheTCPOptionsfieldcancontaintheinformationthatdefinesthemaximumsegmentreceivesize,thisinformationissentintheinitialcommunicationifthisparameterdoesnotexistanysegmentsizeisallowed.Windowscalingvalue(8bits)-IntheTCPOptionsfielditcancontaininformationallowingtoincreasethesizeofreceivedpackets."do not fragment" flag (1 bit) - In the Fragment Offset field it can contain fragmentation information or not.
"sackOK" flag (1 bit) - In the TCP Options field it can contain information about how packets are retransmitted in the event of a loss, whether selective receipts are allowed or not. >
"nop" flag (1 bit) - another option defined in the TCP Options field, the length of the TCP header must be a multiple of 4. However, We need to send some NOPs (1 bit or more) to adjust the size of the header and depending on where these NOPs are added and whether they are at the beginning or end along the options, we can identify patterns of certain OS's.
If you add up all the BITS of these 8 fields you will have 67 bits of information that vary and behave differently, you can now build a Fingerprint and outline the behavior patterns that each operating system has on the network!