Log analysis for a web server

what is a log file for a server?
  • Every server contain some basic details of their client in from of a file
  • That file is called a “Server Log File”.
  •  It automatically saves the information about IP address, time, HTTP status code and some other details.
  • They are stored under /var/log/Apache2/access.log directory for a Linux based server.

How to check a log file?
  • To inspect a log file there are two ways
    • Manual inspection
    • Tool base inspection
  •   In most of the cases cyber expert, prefer manual inspection.

How to apply manual inspection on a log file?
  • First of open log file using cat command to inspect it.
  • You may find different data into that file.
  •  Now there is always a reason why you are applying that inspection. The answer is that there was an attack happened on your server. Now to investigate that attack you are applying inspection.
  •  Now you may find that the data are lengthy to investigate. For faster investigate you can find some words related to that attack. Suppose there is SQL-Injection attack than you can search for word “Select” or “from” etc. If there are a directory traversal attack than you have to search for word “/../” and if there is web shell or backdoor attack then you may search for word “upload”.
  • For this process follow bellowing steps:
    1. Open the log file using command : cat /var/log/apache2/access.log
    2. To find some special word use command: cat access.log | grep “word”
    3. From that output, you can easily find the attackers IP address.

How to apply automated or tool based inspection on a log file?
  • First, download any log file inspection tool.
  • Here we are using “scalp” for log analysis.
  • Scalp is a log analyse for the Apache web server that aims to look for security problems. The main idea is to look through huge log files and extract the possible attacks that have been sent through HTTP/GET.
  • For the analysis of log file follow below steps:
    1. Install scalp in Linux using command: git-clone https://github.com/neuroo/apache-scalp.git
    2. Open log file using command: ./scalp.py –l “log file” –f “filter file”  -o ”output file ”.
    3. The output will store into an output file.
    4.  After completion of scalp you need to just review output file.

How to identify that your server is under DOS or DDOS attack?
  • Now a day’s dos and ddos became famous attack to down the server. With the help of some abnormal behavior of server or website, you can easily detect that your server is under dos or ddos attack.
  • To ensure that you are under attack just ping your server if the round trip time is more than usual your server is running for a highly weighted traffic.
  • The another clue is your servers HTTP response code if the server is returning 5XX code than it means that server have some issue
In most of the case the server returns 503 error which means “Server Unavailable”
  • Now you can investigate the netstat to identifies the connection with command : Netstat -a

  • You can see that the different IP are connected to some specific port.
  • A heavy traffic can slow down the server but if an action is not going to take at that time than server may be crashed.
  • To avoid DDOS attack for a server there are multiple tools available which secure the server from the real attack. For ddos protection cloud flair is one of the most famous tool
 

Comments

Popular posts from this blog

"Coot" Ransomware

Data Recovery Tools (Disk Drill)

Ransomeware Malware