Verifying detection capabilities in ICAP mode
This section explains how to verify that Kaspersky Scan Engine works correctly in ICAP mode.
Verifying that Kaspersky Scan Engine detects malicious and phishing URLs correctly
To verify that Kaspersky Scan Engine detects malicious URLs correctly:
- Make sure that the directory with response templates contains the detect_req default template.
- Configure Kaspersky Scan Engine. Set the value of the
RulesFilePath
parameter to the directory that contains kavicapd_gui_rules.conf, sample service rules file that is included in the distribution kit. - Start the kavicapd service.
- Create a .txt file with the following content:
REQMOD icap://127.0.0.1/req ICAP/1.0
Host: 127.0.0.1
Encapsulated: req-hdr=0, null-body=112
GET /TesT/Wmuf_w HTTP/1.1
Host: www.bug.qainfo.ru
Accept: text/html, text/plain
Accept-Encoding: compress
Make sure that every line ends with CRLF, as required by RFC 2616.
This is a REQMOD GET ICAP request message.
This message requests a test page that does not contain any real malicious content.
- Save the file with an appropriate name. In the following example this file is named icap_reqmod_malicious_detect.txt.
- Send the message to the port that the kavicapd service listens on (port 1344 by default).
The exact method may vary depending on the operating system. This example shows how to send the message using netcat:
cat icap_reqmod_malicious_detect.txt | nc localhost 1344
The kavicapd service will answer with the modified message headers and a response message that shows information about the blocked URL.
- Verify that the test web page was blocked.
When the web page is blocked, the kavicapd service returns the detect_req HTML response template. The response template contains the following information about the blocked web page:
Mode: REQMOD
Object name:
Date: 2017-May-31 14:13:29.295710
ICAPD version: KL ICAP Service v1.0 (KAV SDK v8.5.1.83)
KAV SDK Version: KAV SDK v8.5.1.83
URL:
http://bug.qainfo.ru/TesT/Wmuf_w
- Create a .txt file with the following content:
REQMOD icap://127.0.0.1/req ICAP/1.0
Host: 127.0.0.1
Encapsulated: req-hdr=0, null-body=114
GET /TesT/Aphish_w HTTP/1.1
Host: www.bug.qainfo.ru
Accept: text/html, text/plain
Accept-Encoding: compress
- Save the file with and appropriate name. In the following example this file is named icap_reqmod_phishing_detect.txt.
- Send the message to the port that the kavicapd service listens on.
cat icap_reqmod_phishing_detect.txt | nc localhost 1344
- Verify that the test web page was blocked.
When the web page is blocked, the kavicapd service returns the detect_req HTML response template. The response template contains the following information about the blocked web page:
Mode: REQMOD
Object name:
Date: 2017-May-31 14:13:29.295710
ICAPD version: KL ICAP Service v1.0 (KAV SDK v8.5.1.83)
KAV SDK Version: KAV SDK v8.5.1.83
URL:
http://bug.qainfo.ru/TesT/Aphish_w
Verifying that Kaspersky Scan Engine detects malicious content in HTTP traffic correctly
To verify that Kaspersky Scan Engine detects malicious content in HTTP traffic correctly:
- Make sure that the directory with response templates contains the detect_req default template.
- Configure Kaspersky Scan Engine. Set the value of the
RulesFilePath
parameter to the directory that contains kavicapd_gui_rules.conf, sample service rules file that is included in the distribution kit. - Start the kavicapd service.
- Create a .txt file with the following content:
REQMOD icap://127.0.0.1/req?arg=87 ICAP/1.0
Host: 127.0.0.1
Encapsulated: req-hdr=0, req-body=155
POST /origin-resource/form.pl HTTP/1.1
Host: www.origin-server.example.com
Accept: text/html, text/plain
Accept-Encoding: compress
Pragma: no-cache
44
X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
0
Make sure that every line ends with CRLF, as required by RFC 2616.
This is a REQMOD POST ICAP request message.
This message contains EICAR Standard Anti-Virus Test File. The EICAR Standard Anti-Virus Test File is not a virus and is often used for testing anti-virus software. For more information about EICAR, see section "About EICAR Standard Anti-Virus Test File".
- Save the file with and appropriate name. In the following example this file is named icap_reqmod_detect.txt.
- Send the message to the port that the kavicapd service listens to (port 1344 by default).
The exact method may vary depending on the operating system. This example shows how to send the message using netcat:
cat icap_reqmod_detect.txt | nc localhost 1344
The kavicapd service will answer with the modified message headers and a response message that shows information about the detected object.
- Verify that EICAR Standard Anti-Virus Test File was detected.
When the EICAR file is detected, the kavicapd service returns the detect_req HTML response template. The response template contains the following information about the detected object:
Mode: REQMOD
Object name: EICAR-Test-File
Date: 2017-May-31 14:17:12.077704
ICAPD version: KL ICAP Service v1.0 (KAV SDK v8.5.1.83)
KAV SDK Version: KAV SDK v8.5.1.83
URL: www.origin-server.example.com/origin-resource/form.pl
Verifying that File and URL Reputation Checking works correctly
To verify that File and URL Reputation Checking works correctly:
- Request the KSN test file from your Technical Account Manager. This file is not malicious, and is only used to verify that File and URL Reputation Checking works properly.
- Make sure that the directory with response templates contains the detect_req default template.
- Configure Kaspersky Scan Engine:
- Set the value of the
RulesFilePath
parameter to the directory that contains kavicapd_gui_rules.conf, sample service rules file that is included in the distribution kit. - Make sure that the
UseKSN
parameter is set to0
.
- Set the value of the
- Start the kavicapd service.
- Create a .txt file with the following content:
REQMOD icap://127.0.0.1/req?arg=87 ICAP/1.0
Host: 127.0.0.1
Encapsulated: req-hdr=0, req-body=155
POST /origin-resource/form.pl HTTP/1.1
Host: www.origin-server.example.com
Accept: text/html, text/plain
Accept-Encoding: compress
Pragma: no-cache
- Below the content you added to the .txt file, insert a new line.
- Below the new line, insert the contents of the KSN test file.
Make sure that every line ends with CRLF, as required by RFC 2616.
- Save the file with an appropriate name. In the following example this file is named icap_reqmod_detect_ksn.txt.
- Send the message to the port that the kavicapd service listens on (port 1344 by default).
The exact method may vary depending on the operating system. This example shows how to send the message by using the netcat utility:
cat icap_reqmod_detect_ksn.txt | nc localhost 1344
- Verify that the KSN test file is not detected.
- Set the value of the
UseKSN
parameter of the ICAP mode configuration file to1
. - Restart the kavicapd service.
- Send icap_reqmod_detect_ksn.txt to the kavicapd service again.
- Verify that the KSN test file is detected.