Detecting outgoing http attacks
If your server or website has already been compromised and your server is sending out malicious HTTP requests like scans, brute force attempts, etc. You can detect and log the outgoing packets and find out which user caused the problem by adding the following iptables rule. This rule will log any packet that leaves your server and targets port 80. It also logs the user id so you can identify which user initiated the request. To avoid flooding, we limit the number of logs to 5 per minute. You can increase or decrease this number if you need to fine tune. iptables -I OUTPUT -p tcp -m tcp --dport 80 -j LOG --log-uid -m limit --limit = 5 /minute --log-prefix BITNINJA After running this command, you have to monitor the kernel log for any captured packets. You can see the kernel logs with this command: dmesg -T Note On some older versions of dmesg the -T option is not supported. In this case you can simply run dmesg. An example of packets made by root. (UID=0 GID=0) ...