Blunt Banhammer Blocks Basic Bots Ballistically

18 points by soulcutter


stephenr

Trusting XFF header blindly sounds like a bad idea to me.

If you have to use it (ie you are behind a proxy but don't control it or otherwise can't use PROXY protocol) you should generally validate that the connecting address (REMOTE_ADDR) is that proxy, before trusting XFF header - otherwise nothing stops someone from making requests to you with arbitrary XFF headers.

Checking for a valid non private IP also doesn't help you here, because you're checking the XFF headers first and exiting early so a bot spamming you with random public addresses in XFF will not be blocked and cause you to block other addresses.

It's not often I'd expect to see an easily achieved false positive and false negative concurrently.

cornel

i don’t know. it looks complicated. why not tail -f access.log | grep honey and firewall-ban the ips found!?