2 ms·
When you saw raw packets due you mean the libc network APIs or raw sockets? It sounded like the latter but for anyone unaware such sockets require root/special
by vlovich123 6y ago
When you saw raw packets due you mean the libc network APIs or raw sockets?
It sounded like the latter but for anyone unaware such sockets require root/special privileges. It’s cool but of more limited general value and can be a security exploit as a user space exploit can launch really nasty network attacks that are otherwise impossible (hence why it’s not made available to user space).
- antoinealb 6y agoThese days can't you do it with CAP_NET_RAW linux capabilities ? It is what is used for ping traceroute et al. if I recall correctly
- vlovich123 6y agoSure but you still need to grant your binary that (eg scripting languages need that for the interpreter itself which isn’t great since all programs get it) and it’s just the administrator of the machine going “I know this is dangerous but I’m deciding to do it anyway”. It doesn’t address the underlying issues (eg if I compromise your binary with this capability I have some pretty powerful capabilities including sniffing all traffic on the machine through a promiscuous socket).
- antoinealb 6y agoDid not think about the interpreted languages use case, thanks for pointing that out.
- IgorPartola 6y agoYes raw sockets and yes it required root privileges. It’s not ideal but this is why this was a good exercise in good C practices. In my case the program was very straightforward so not a lot of attack surface to begin with. But yes overall pretty dangerous stuff. I am sure a comment about rewriting the Linux kernel and every other bit of C in Rust will materialize below sooner or later :)