I have recently switched my hosting server to AWS. and in initial all was working fine but recently I am facing issues with my server that its get down several time.
I have monitor it closely and get to know that CPU utilization goes to 100% several times and every-time I need to restart my instance.
So I have checked access log and error logs and seems some hacking activities going on my server. Please have a look below logs of my error log file:
[Wed Sep 23 14:25:56.081268 2015] [:error] [pid 18791] [client 193.0.***.***:59940] script '/var/www/html/includes/custom.php' not found or unable to stat, referer: -1' OR 2+20-20-1=0+0+0+1 or 'Q2fRfUkq'='
[Wed Sep 23 14:25:56.122526 2015] [:error] [pid 18780] [client 193.0.***.***:59939] script '/var/www/html/includes/custom.php' not found or unable to stat, referer: @@EKtcl
[Wed Sep 23 14:25:56.365583 2015] [:error] [pid 18788] [client 193.0.***.***:59930] script '/var/www/html/includes/custom.php' not found or unable to stat, referer: -1" OR 2+392-392-1=0+0+0+1 --
[Wed Sep 23 14:25:56.663520 2015] [:error] [pid 18786] [client 193.0.***.***:59908] script '/var/www/html/includes/custom.php' not found or unable to stat, referer: if(now()=sysdate(),sleep(9),0)/*'XOR(if(now()=sysdate(),sleep(9),0))OR'"XOR(if(now()=sysdate(),sleep(9),0))OR"*/
[Wed Sep 23 14:25:56.994941 2015] [:error] [pid 18791] [client 193.0.***.***:59940] script '/var/www/html/includes/custom.php' not found or unable to stat, referer: (select(0)from(select(sleep(9)))v)/*'+(select(0)from(select(sleep(9)))v)+'"+(select(0)from(select(sleep(9)))v)+"*/
Now here I can see that its trying to access non existing file and adding sql injections, and unbelievable things is its working, its using my CPU utilization to 100% and mysql service uses 90% here.
So how to prevent this, please help me on the same.
Its taking mysql access here so that happening ? As we can see there is no any custom.php available then how they are running mysql queries on the server ?
And most important thing is hacker hacking through curl or post script but not using my machine atall