@brad_H said:
@MBond2 said:
There is another way to approach this problem though. Instead of scanning data in advance of forwarding it up, you can copy it and scan it after it has been forwarded. if anything of interest is found, then you can flag the connection and take whatever remedial action seems good to you (black holing and tar pit schemes are especially effective as they waste the resources of your attacker).This is not gonna work, because in the case of many exploits, if you let one packet slide then the attacker all of the sudden has kernel code execution.
Umm ⦠no. A packet is simply a chunk of data in a stream that is then assembled and acted upon by recipient. What I think youāre thinking of is shellcode which takes advantage of a program āmistakeā like a buffer overflow or use after free to execute a stack pivot and begin calling gadgets; thereās a good starting point for GoogleFu to understand this here [https://securityimpact.net/2017/01/20/exploit-development-3-rop-buffer-overflow/]
Whatās important to note about this (and itās the only realistic way that an attacker can get kernel code execution due to the way that memory has execution protection these days) is that first the attacker has to spray the heap with the shellcode, then that program āmistakeā has to be able to access that sprayed shellcode ⦠neither of these is likely (or really possible, frankly) from one little packet flying around waiting to be assembled into a stream ā¦
As a good reference, hereās an article that is describing just that [https://ivanitlearning.wordpress.com/2018/10/07/exploiting-buffer-overflow-to-run-shellcode-on-ftp-client/] ⦠but note that this example is no longer possible on Win10, but itās instructive nonetheless ā¦
Can you monitor for a spray attempt? Yes (just remember that itās hard to tell a spray from legitimate data). Can you tell if a data stream is going to attempt to pivot on a program āmistakeā that is using the stream? Nope, thatās up to the receiving program, totally out of your domain. As @Anton mentioned, if youāve got a vulnerable program and thereās an attack underway then the battle has already been effectively lost ā¦