The rule alert tcp any any -> [server IP] 80 (msg:"Malicious Server Hit!"; content:"GET"; …) is meant to detect downloading the EICAR file. Does it really detect only that download, and how could you do better?
No: it fires on any HTTP GET to that server on port 80, whatever is requested. Better rules match the requested filename in the URI, or the EICAR string in the server's response.
The rule's conditions are: TCP, to that IP, to port 80, payload contains GET. Opening the home page, loading a picture or any other request from that server matches just as well. So the alert really means "someone talked to that server", not "someone downloaded the EICAR file". It is a reputation-style rule in disguise.
More precise options:
- Match the request: look for the filename in the HTTP URI, for example
http.uri; content:"eicar.com.txt";, possibly withflow:established,to_server. - Match the content itself: look for part of the EICAR string in the traffic coming back from the server (
flow:to_clientwithcontent:"EICAR-STANDARD-ANTIVIRUS-TEST-FILE"). This catches the file wherever it is served from and whatever it is called. - Use file inspection: Suricata can extract files from HTTP and match on their hash (for example with
filemd5), which identifies the exact file.
The general lesson is that a rule should describe the thing you care about, not just something that tends to happen at the same time.
Go deeper:
Suricata: HTTP Keywords —
http.methodandhttp.uribuffers, which let a rule match the actual download instead of any GET.Suricata: Flow Keywords —
flow:established,to_serverand friends, to match the right direction of a real session.Suricata: File Extraction — matching a transferred file by its hash, the most precise way to catch a known file.