Browse code

Moved the UserManual markdown content to the Cisco-Talos clamav-faq Github repository.

Micah Snyder authored on 2019/01/30 07:14:18
Showing 35 changed files
... ...
@@ -9,7 +9,13 @@ ClamAV 0.102.0 is in development.
9 9
 
10 10
 ### Notable changes in 0.102
11 11
 
12
--
12
+- The documentation has moved.
13
+  - Users should navigate to [ClamAV.net](http://www.clamav.net/documents/)
14
+    to view the documentation.
15
+  - The documentation will continue to be provided in HTML format with each
16
+    release for offline viewing in the `docs/html` directory.
17
+  - The new home for the documentation markdown is in our
18
+    [ClamAV FAQ Github repository](https://github.com/Cisco-Talos/clamav-faq)
13 19
 
14 20
 ### Acknowledgements
15 21
 
... ...
@@ -1,18 +1,23 @@
1 1
 # ClamAV
2 2
 
3 3
 ClamAV® is an open source antivirus engine for detecting trojans, viruses,
4
- malware & other malicious threats.
4
+malware & other malicious threats.
5 5
 
6 6
 ## Documentation & FAQ
7 7
 
8
-The ClamAV documentation can be found in the [ClamAV User Manual](docs/UserManual.md) with
9
- additional information online in
10
-[our FAQ](https://www.clamav.net/documents).
8
+Official documentation can be found online at
9
+[ClamAV.net](https://www.clamav.net/documents).
10
+Our source code release tarballs also includes a copy of the documentation for
11
+[offline](docs/html/UserManual.html) reading.
11 12
 
12 13
 ## ClamAV Signatures
13 14
 
14 15
 Anyone can learn to read and write ClamAV signatures. Take a look
15
- at the [signature writing documentation](docs/UserManual/Signatures.md) and [phishing signature writing documentation](docs/UserManual/PhishSigs.md) to get started!
16
+at the
17
+[signature writing documentation](https://www.clamav.net/documents/creating-signatures-for-clamav)
18
+and
19
+[phishing signature writing documentation](https://www.clamav.net/documents/phishsigs)
20
+to get started!
16 21
 
17 22
 ## Installation Instructions
18 23
 
... ...
@@ -24,7 +29,8 @@ For basic compile and install instructions on Linux/Unix platforms, check out
24 24
 the [install instructions](INSTALL.md).
25 25
 
26 26
 For detailed instructions specific to building ClamAV please investigate
27
-our the [Linux/Unix/Mac Install instructions in the User Manual](docs/UserManual/Installation-Unix.md).
27
+our the
28
+[Linux/Unix/Mac Install instructions in the User Manual](https://www.clamav.net/documents/installing-clamav-on-unix-linux-macos-from-source).
28 29
 
29 30
 #### Install from a binary package
30 31
 
... ...
@@ -48,7 +54,7 @@ for users that may wish to run ClamAV without installing it to a system-owned
48 48
 directory.
49 49
 
50 50
 For details on how to use either option, head over to the
51
-[Windows Install instructions in the User Manual](docs/UserManual/Installation-Windows.md).
51
+[Windows Install instructions in the User Manual](https://www.clamav.net/documents/installing-clamav-on-windows).
52 52
 
53 53
 ### Upgrading from a previous version
54 54
 
... ...
@@ -57,23 +63,24 @@ Some tips on [how to upgrade](https://www.clamav.net/documents/upgrading-clamav)
57 57
 
58 58
 ## ClamAV News
59 59
 
60
-For information about the features in this and prior releases, read [the news](NEWS.md).
60
+For information about the features in this and prior releases, read
61
+[the news](NEWS.md).
61 62
 
62 63
 Catch up on the latest about ClamAV by reading our
63
- [blog](http://blog.clamav.net) and follow us on Twitter @clamav.
64
+[blog](http://blog.clamav.net) and follow us on Twitter @clamav.
64 65
 
65 66
 ## Join the ClamAV Community
66 67
 
67 68
 The best way to get in touch with the ClamAV community is to join our
68
- [our mailing lists](https://www.clamav.net/documents/mailing-lists-faq), and
69
- tune to #clamav on [IRC](irc.freenode.net).
69
+[our mailing lists](https://www.clamav.net/documents/mailing-lists-faq), and
70
+tune to #clamav on [IRC](irc.freenode.net).
70 71
 
71 72
 ## Want to make a contribution?
72 73
 
73 74
 The ClamAV development team welcomes
74
- [code contributions](https://github.com/Cisco-Talos/clamav-devel),
75
- improvements to [our FAQ](https://github.com/Cisco-Talos/clamav-faq), and also
76
- [bug reports](https://bugzilla.clamav.net/). Thanks for joining us!
75
+[code contributions](https://github.com/Cisco-Talos/clamav-devel),
76
+improvements to [our documentation](https://github.com/Cisco-Talos/clamav-faq), and also
77
+[bug reports](https://bugzilla.clamav.net/). Thanks for joining us!
77 78
 
78 79
 ## Credits
79 80
 
80 81
deleted file mode 100644
... ...
@@ -1,26 +0,0 @@
1
-# Clam AntiVirus 0.101.1 *User Manual*
2
-
3
-![image](UserManual/images/demon.png)
4
-
5
-
6
-Table Of Contents
7
-
8
-1. [Introduction to ClamAV](UserManual/Introduction.md)
9
-2. Installing ClamAV
10
-    * [Unix/Linux/macOS](UserManual/Installation-Unix.md)
11
-    * [Windows](UserManual/Installation-Windows.md)
12
-3. [Using ClamAV](UserManual/Usage.md)
13
-4. [ClamAV Developer Tips and Tricks](UserManual/development.md)
14
-5. [Build \[lib\]ClamAV Into Your Programs](UserManual/libclamav.md)
15
-6. [Writing ClamAV Signatures](UserManual/Signatures.md)
16
-
17
-
18
-ClamAV User Manual © 2019 Cisco Systems, Inc.
19
-
20
-This document is distributed under the terms of the GNU General Public License v2.
21
-
22
-Clam AntiVirus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23
-
24
-ClamAV and Clam AntiVirus are trademarks of Cisco Systems, Inc.
25 1
deleted file mode 100644
... ...
@@ -1,261 +0,0 @@
1
-# Installing ClamAV on Unix / Linux / macOS from Source
2
-
3
-## The TL;DR Step-by-Step Instructions
4
-
5
-- [Debian & Ubuntu](Installation-Unix/Steps-Debian-Ubuntu.md)
6
-- [Redhat & CentOS](Installation-Unix/Steps-REdhat-CentOS.md)
7
-- [macOS](Installation-Unix/Steps-macOS.md)
8
-
9
-## Requirements
10
-
11
-The following is an overview of the tools, libraries, and steps needed to build ClamAV.
12
-
13
-Required tools:
14
-
15
-- `gcc` or `clang`
16
-- GNU Make (`gmake` on UNIX systems)
17
-
18
-Recommended tools:
19
-
20
-- `check` unit testing framework
21
-
22
-***Required*** libraries (including development sources (i.e. `...-dev` or `...-devel`)):
23
-
24
-- zlib
25
-- openssl version 0.9.8 or higher
26
-
27
-**Recommended** libraries (including development sources (i.e. `...-dev` or `...-devel`)):
28
-
29
-- pcre2
30
-- bzip2
31
-- libxml2
32
-
33
-Optional libraries (including development sources (i.e. `...-dev` or `...-devel`)):
34
-
35
-- curl library:     _required for clamsubmit_
36
-- json-c library:   _required for clamsubmit_
37
-- ncurses library:  _required for clamdtop_
38
-
39
-ClamAV may execute Bytecode signatures using:
40
-
41
-- ClamAV's built-in bytecode interpreter
42
-- LLVM for Just-In-Time (JIT) compilation*
43
-  - System-installed LLVM library (3.2-3.6)
44
-  - ClamAV's built-in version of LLVM 2.8
45
-
46
-    *The performance difference between using LLVM and using the interpeter is negligible. If you prefer to use LLVM / JIT for bytecode signature execution, be advised that we presently only support up to LLVM version 3.6.
47
-
48
-The following are thus optional, but *required* to use LLVM in place of the bytecode interpeter:
49
-
50
-- LLVM 3.2 - 3.6
51
-- A supported CPU for LLVM JIT, either of: X86, X86-64, PowerPC, PowerPC64
52
-
53
-The following are optional, but needed for the LLVM JIT unit tests:
54
-
55
-- GNU Make (version 3.79, recommended 3.81 or newer)
56
-- Python (version 2.5.4)
57
-
58
-## Installing ClamAV
59
-
60
-### Private installation on local shell account
61
-
62
-To install ClamAV locally on an unprivileged shell account you need not create any additional users or groups. Assuming your home directory is `/home/gary` you should build it as follows:
63
-
64
-```bash
65
-./configure --prefix=/home/gary/clamav --disable-clamav
66
-make; make install
67
-```
68
-
69
-The `--disable-clamav` switch disables the check for existence of the `clamav` user and group but `clamscan` would still require an unprivileged account to work in a superuser mode.
70
-
71
-### Global installation in system-owned directories
72
-
73
-#### Adding new system user and group
74
-
75
-If installing to the system, it is recommended to set up at least one special user account to run `freshclam` and `clamd`. You may choose to set up two separate accounts, one for each. You only need to create these accounts the first time you install ClamAV.
76
-
77
-These are instructions specific to some popular operating systems:
78
-
79
-- [Debian, Ubuntu, etc](Installation-Unix/Steps-Debian-Ubuntu.md#Users-and-on-user-privileges)
80
-- [Redhat, CentOS, etc](Installation-Unix/Steps-Redhat-CentOS.md#Users-and-on-user-privileges)
81
-- [macOS](Installation-Unix/Steps-macOS.md#Users-and-on-user-privileges)
82
-
83
-If your operating system isn't specified above, and your OS does not have the `groupadd` and `useradd` utilities, consult a system manual. **Don’t forget to lock access to the account!**
84
-
85
-#### Compiling ClamAV for global installation
86
-
87
-Once you have created the clamav user and group, please extract the archive:
88
-
89
-```bash
90
-tar xzf clamav-<ver>.tar.gz
91
-cd clamav-<ver>
92
-```
93
-
94
-Assuming you want to install the configuration files in `/etc`, configure and build the software as follows:
95
-
96
-```bash
97
-./configure --sysconfdir=/etc
98
-make
99
-su -c "make install"
100
-```
101
-
102
-In the last step, the software is installed into the `/usr/local` directory and the config files into `/etc`. **WARNING: Never enable the SUID or SGID bits for Clam AntiVirus binaries.**
103
-
104
-### First-time set-up
105
-
106
-First, create a database directory. This would be located under the install path `share/clamav`. For example:
107
-
108
-- `/usr/local/share/clamav`
109
-- `~/clamav/share/clamav`
110
-
111
-You will need to create `freshclam.conf` and `clamd.conf` files in the config directory. In the above example, we chose `/etc`, so run the following.
112
-
113
-```bash
114
-sudo cp /etc/freshclam.conf.sample /etc/freshclam.conf
115
-sudo cp /etc/clamd.conf.sample /etc/clamd.conf
116
-```
117
-
118
-At a minimum, you will need to edit each file and remove or comment-out the `Example` line. In addition, for `clamd.conf` you will need to enable either `LocalSocket` or `TCPSocket`.
119
-
120
-For additional recommendations, please read:
121
-
122
-- [Debian, Ubuntu, etc](Installation-Unix/Steps-Debian-Ubuntu.md#First-time-set-up)
123
-- [Redhat, CentOS, etc](Installation-Unix/Steps-Redhat-CentOS.md#First-time-set-up)
124
-- [macOS](Installation-Unix/Steps-macOS.md#First-time-set-up)
125
-
126
-### Test your installation
127
-
128
-To test your local installation execute:
129
-
130
-```bash
131
-~/clamav/bin/freshclam
132
-~/clamav/bin/clamscan ~
133
-```
134
-
135
-To test your system installation execute:
136
-
137
-```bash
138
-sudo freshclam
139
-sudo clamscan ~
140
-```
141
-
142
-## Compilation with clamav-milter enabled
143
-
144
-The `libmilter` package and its development files are required. To enable clamav-milter, configure ClamAV with
145
-
146
-```bash
147
-./configure --enable-milter
148
-```
149
-
150
-## Using a system-installed LLVM library
151
-
152
-To configure ClamAV to use a system-installed LLVM library:
153
-
154
-```bash
155
-./configure --with-system-llvm=/myllvm/bin/llvm-config
156
-make
157
-sudo make install
158
-```
159
-
160
-The argument to `--with-system-llvm` indicates the path name of the LLVM configuration utility (llvm-config). Alternatively, you may use `--enable-llvm` and `./configure` will search for LLVM in /usr/local/ and then /usr.
161
-
162
-Recommended versions of LLVM are 3.2 - 3.6. Some installations have reported problems using earlier LLVM versions. Versions of LLVM beyond 3.6 are not currently supported in ClamAV.
163
-
164
-## Running unit tests
165
-
166
-ClamAV includes unit tests that allow you to test that the compiled binaries work correctly on your platform.
167
-
168
-The first step is to use your OS’s package manager to install the `check` package. If your OS doesn’t have that package, you can download it from <http://check.sourceforge.net/>, build it and install it.
169
-
170
-To help clamav’s configure script locate `check`, it is recommended that you install `pkg-config`, preferably using your OS’s package manager, or from <http://pkg-config.freedesktop.org>.
171
-
172
-The recommended way to run unit-tests is the following, which ensures you will get an error if unit tests cannot be built:
173
-
174
-```bash
175
-./configure --enable-check
176
-make
177
-make check
178
-```
179
-
180
-When `make check` is finished, you should get a message similar to this:
181
-
182
-```bash
183
-==================
184
-All 8 tests passed
185
-==================
186
-```
187
-
188
-If a unit test fails, you get a message similar to the following. Note that in older versions of make check may report failures due to the absence of optional packages. Please make sure you have the latest versions of the components noted in section /refsec:components. See the next section on how to report a bug when a unit test fails.
189
-
190
-```bash
191
-========================================
192
-1 of 8 tests failed
193
-Please report to https://bugzilla.clamav.net/
194
-========================================
195
-```
196
-
197
-If unit tests are disabled (and you didn’t use -–enable-check), you will get this message:
198
-
199
-```bash
200
-*** Unit tests disabled in this build
201
-*** Use ./configure --enable-check to enable them
202
-
203
-SKIP: check_clamav
204
-PASS: check_clamd.sh
205
-PASS: check_freshclam.sh
206
-PASS: check_sigtool.sh
207
-PASS: check_clamscan.sh
208
-======================
209
-All 4 tests passed
210
-(1 tests were not run)
211
-======================
212
-```
213
-
214
-Running `./configure --enable-check` should tell you why.
215
-
216
-## Reporting a unit test failure bug
217
-
218
-If `make check` reports failed tests, we encourage you to report a bug on [bugzilla](https://bugzilla.clamav.net).
219
-
220
-When writing a bug report regarding failed unit tests, please provide the following:
221
-
222
-- The exact output from `make check`
223
-- Output of `uname -mrsp`
224
-- your `config.log`
225
-- The following files from the `unit_tests/` directory:
226
-  - `test.log`
227
-  - `clamscan.log`
228
-  - `clamdscan.log`
229
-
230
-- `/tmp/clamd-test.log` if it exists
231
-- where and how you installed the check package
232
-- Output of `pkg-config check --cflags --libs`
233
-- Optionally if `valgrind` is available on your platform, the output of the following:
234
-    ```bash
235
-    make check
236
-    CK_FORK=no ./libtool --mode=execute valgrind unit_tests/check_clamav
237
-    ```
238
-
239
-## Obtain Latest ClamAV anti-virus signature databases
240
-
241
-Before you can run `clamd`, `clamdscan`, or `clamscan`, you must have ClamAV Virus Database (.cvd) file(s) installed in the appropriate location on your system. The default location for these database files are `/usr/local/share/clamav`.
242
-
243
-Here is a listing of currently available ClamAV Virus Database Files:
244
-
245
-- bytecode.cvd (signatures to detect bytecode in files)
246
-- main.cvd (main ClamAV virus database file)
247
-- daily.cvd (daily update file for ClamAV virus databases)
248
-- safebrowsing.cvd (virus signatures for safe browsing)
249
-
250
-These files should be downloaded using the `freshclam` utility on a periodic basis. While using HTTPS to directly download the CVDs is possible, using `freshclam` is the preferred method of keeping the ClamAV virus database files up to date. `freshclam` can download database difference files (`.cdiff`) to get the latest signature definitions without downloading whole CVD files. This saves a considerable amount of bandwidth.
251
-
252
-For more information on how to configure `freshclam` to do automatic/scheduled updates, see the [freshclam configuration section](Configuration.md#Setting-up-auto\-updating) of our Configuration guide.
253
-
254
-Please see the [freshclam usage section](Usage.md#freshclam) for additional details on freshclam).
255
-
256
-## Binary packages
257
-
258
-As an alternative to building and installing from source, most Linux package managers provide pre-compiled ClamAV packages.
259
-
260
-For more information about installing ClamAV via a Package Manager, please visit
261
-the ["other versions" section on the ClamAV.net Downloads page](https://www.clamav.net/download.html#otherversions).
262 1
deleted file mode 100644
... ...
@@ -1,313 +0,0 @@
1
-# Installation on Debian and Ubuntu Linux Distributions
2
-
3
-Below are the steps for installing ClamAV from source on Debian and Ubuntu Linux.
4
-
5
-## Install prerequisites
6
-
7
-1. Install ClamAV dependencies
8
-    1. Install the developer tools
9
-        ```bash
10
-        sudo apt-get install build-essential
11
-        ```
12
-    2. Install library dependencies
13
-        ```bash
14
-        sudo apt-get install openssl libssl-dev libcurl4-openssl-dev zlib1g-dev libpng-dev libxml2-dev libjson-c-dev libbz2-dev libpcre3-dev ncurses-dev
15
-        ```
16
-    3. (very optional) Those wishing to use clamav-milter may wish to install the following
17
-        ```bash
18
-        sudo apt-get install libmilter1.0.1 libmilter-dev
19
-        ```
20
-
21
-2. Install the unit testing dependencies
22
-    ```bash
23
-    sudo apt-get valgrind check
24
-    ```
25
-
26
-_Note_: LLVM is also an optional dependency. LLVM will not provide any additional features, but is an alternative method for executing bytecode signatures versus using the built-in bytecode interpreter. Limited performance testing between LLVM and the bytecode interpreter did not yield conclusive evidence that one is "better" than the other. For the sake of simplicity, it is not recommended to install LLVM.
27
-
28
-## Download the latest stable release
29
-
30
-1. Open a browser and navigate to [the ClamAV downloads page](http://www.clamav.net/downloads)
31
-2. Click `clamav-<version>.tar.gz` link to download the latest stable release.
32
-
33
-## Extract the source archive
34
-
35
-```bash
36
-cd ~/Downloads
37
-tar xzf clamav-<ver>.tar.gz
38
-cd clamav-<ver>.tar.gz
39
-```
40
-
41
-## Configure the build
42
-
43
-ClamAV's configure script should detect each of the above dependencies automatically.
44
-
45
-### Typical `./configure` usage
46
-
47
-```bash
48
-./configure --enable-check
49
-```
50
-
51
-Once `./configure` completes, it will print a summary. Verify that the packages you installed are in fact being detected.
52
-
53
-Example configure summary output:
54
-
55
-```bash
56
-configure: Summary of detected features follows
57
-              OS          : linux-gnu
58
-              pthreads    : yes (-lpthread)
59
-configure: Summary of miscellaneous features
60
-              check       : -lcheck_pic -pthread -lrt -lm -lsubunit
61
-              fanotify    : yes
62
-              fdpassing   : 1
63
-              IPv6        : yes
64
-configure: Summary of optional tools
65
-              clamdtop    : -lncurses (auto)
66
-              milter      : yes (disabled)
67
-              clamsubmit  : yes (libjson-c-dev found at /usr), libcurl-devel found at /usr)
68
-configure: Summary of engine performance features
69
-              release mode: yes
70
-              llvm        : no (disabled)
71
-              mempool     : yes
72
-configure: Summary of engine detection features
73
-              bzip2       : ok
74
-              zlib        : /usr
75
-              unrar       : yes
76
-              preclass    : yes (libjson-c-dev found at /usr)
77
-              pcre        : /usr
78
-              libmspack   : yes (Internal)
79
-              libxml2     : yes, from /usr
80
-              yara        : yes
81
-              fts         : yes (libc)
82
-
83
-```
84
-
85
-### Additional popular `./configure` options
86
-
87
-* `--with-systemdsystemunitdir` - Do not install `systemd` socket files. This option disables systemd support, but will allow you to `make install` to a user-owned directory without requiring `sudo`/root privileges:
88
-    ```bash
89
-    ./configure --with-systemdsystemunitdir=no
90
-    ```
91
-* `--sysconfdir` - Install the configuration files to `/etc` instead of `/usr/local/etc`:
92
-    ```bash
93
-    ./configure -–sysconfdir=/etc
94
-    ```
95
-* `--prefix` - Install ClamAV to a directory other than `/usr/local/`:
96
-    * Example 1: Install to a local `./install` directory.
97
-        ```bash
98
-        ./configure --prefix=`pwd`/install
99
-        ```
100
-    * Example 2: Install ClamAV locally on an unprivileged shell account.
101
-        ```bash
102
-        ./configure --prefix=$HOME/clamav --disable-clamav --with-systemdsystemunitdir=no
103
-        ```
104
-* `--disable-clamav` - _Don't_ drop super-user priveleges to run `freshclam` or `clamd` as the `clamav`* user.
105
-    ```bash
106
-    ./configure --disable-clamav
107
-    ```
108
-    *_Tip_: Using this `--disable-clamav` means that `freshclam` and `clamd` will run with _root privleges_ if invoked using `sudo`. Running `clamd` or `clamscan` as root is **not recommended**. Instead of using this option, you can configure `freshclam` or `clamd` to drop to any other user by:
109
-    * setting the `DatabaseOwner` option in `freshclam.conf` and
110
-    * setting the `User` option in `clamd.conf`.
111
-
112
-Please see the `./configure --help` for additional options.
113
-
114
-### Compile ClamAV
115
-
116
-Compile ClamAV with:
117
-```bash
118
-make -j2
119
-```
120
-
121
-### Run ClamAV Unit Tests (Optional)
122
-
123
-For peace of mind, it can be helpful to run a small suite of unit and system tests.
124
-
125
-Run:
126
-```bash
127
-make check
128
-```
129
-
130
-All tests should pass.* Output will look something like this:
131
-
132
-```bash.
133
-    ...
134
-PASS: check_clamav
135
-PASS: check_freshclam.sh
136
-PASS: check_sigtool.sh
137
-PASS: check_unit_vg.sh
138
-PASS: check1_clamscan.sh
139
-PASS: check2_clamd.sh
140
-PASS: check3_clamd.sh
141
-PASS: check4_clamd.sh
142
-PASS: check5_clamd_vg.sh
143
-PASS: check6_clamd_vg.sh
144
-SKIP: check7_clamd_hg.sh
145
-PASS: check8_clamd_hg.sh
146
-PASS: check9_clamscan_vg.sh
147
-    ...
148
-============================================================================
149
-Testsuite summary for ClamAV 0.100.2
150
-============================================================================
151
-# TOTAL: 13
152
-# PASS:  12
153
-# SKIP:  1
154
-# XFAIL: 0
155
-# FAIL:  0
156
-# XPASS: 0
157
-# ERROR: 0
158
-```
159
-
160
-_Notes_:
161
-
162
-* The `*.vg.sh` tests will be skipped unless you run `make check VG=1`.
163
-* The `check7_clamd.hg.sh` (helgrind) is presently disabled and will be skipped.
164
-  * For details, see: [the Git commit](https://github.com/Cisco-Talos/clamav-devel/commit/2a5d51809a56be9a777ded02969a7427a3c26713)
165
-
166
-If you have a failure or an error in the unit tests, it could be that you are missing one or more of the prerequisites.
167
-
168
-If you are investigating a failure, please do the following:
169
-
170
-`cd unit_tests`
171
-
172
-Use `less` to read the log for the failed test.
173
-Example:
174
-
175
-```bash
176
-less check4_clamd.sh.log`
177
-```
178
-
179
-To submit a bug report regarding unit text failures, please follow these [bug reporting steps](../Installation-Unix.md#Reporting-a-unit-test-failure-bug).
180
-
181
-### Install ClamAV
182
-
183
-Install ClamAV with:
184
-```bash
185
-make install
186
-```
187
-
188
-_Tip_: If installing to the default or other system-owned directory, you may need to use `sudo`.
189
-
190
-### First time set-up
191
-
192
-_Note_: The following instructions assume you used the default install paths (i.e. `/usr/local`). If you modified the install locations using `--prefix` or `--sysconfdir` options, replace `/usr/local` with your chosen install path.
193
-
194
-#### `freshclam` config
195
-
196
-Before you can use `freshclam` to download updates, you need to create a `freshclam` config. A sample config is provided for you.
197
-
198
-1. Copy the sample config. You may need to use `sudo`:
199
-    ```bash
200
-    cp /usr/local/etc/freshclam.conf.sample /usr/local/etc/freshclam.conf
201
-    ```
202
-2. Modify the config file using your favourite text editor. Again, you may need to use `sudo`.
203
-    * At a minimum, remove the `Example` line so `freshclam` can use the config.
204
-
205
-    Take the time to look through the options. You can enable the sample options by deleting the `#` comment characters.
206
-
207
-    Some popular options to enable include:
208
-
209
-    * `LogTime`
210
-    * `LogRotate`
211
-    * `NotifyClamd`
212
-    * `DatabaseOwner`
213
-
214
-3. Create the database directory. *Tip: _You may need to use `sudo`._
215
-    ```bash
216
-    mkdir /usr/local/share/clamav
217
-    ```
218
-
219
-#### `clamd` config (optional)
220
-
221
-You can run `clamscan` without setting the config options for `clamd`. However, the `clamd` scanning daemon allows you to use `clamdscan` to perform faster a-la-carte scans, allows you to run multi-threaded scans, and allows you to use `clamav-milter` if you want to use ClamAV as a mail filter if you host an email server.
222
-
223
-Additionally, if you are a running modern versions of Linux where the FANOTIFY kernel feature is enabled, `clamd` has a feature run with On-Access Scanning*. *When properly configured*, On-Access Scanning can scan files as they are accessed and optionally block access to the file in the event that a signature alerted.
224
-
225
-  _Note_: At this time, for On-Access Scanning to work, `clamd` must run with `sudo`/root privileges. For more details, please see our documentation on On-Access Scanning.
226
-
227
-1. Copy the sample config. You may need to use `sudo`:
228
-    ```bash
229
-    cp /usr/local/etc/clamd.conf.sample /usr/local/etc/clamd.conf
230
-    ```
231
-2. Modify the config file using your favourite text editor. Again, you may need to use `sudo`.
232
-    * At a minimum, remove the `Example` line so `freshclam` can use the config.
233
-    * You also _need_ to select a Socket option for `clamd` so `clamdscan` and other utilities can communicate with `clamd`. You must enable _one_ of the following.
234
-        * `LocalSocket`
235
-        * `TCPSocket`
236
-
237
-    Take the time to look through the options. You can enable the sample options by deleting the `#` comment characters.
238
-
239
-    Some popular options to enable include:
240
-
241
-    * `LogTime`
242
-    * `LogClean`
243
-    * `LogRotate`
244
-    * `User`
245
-    * `ScanOnAccess`
246
-        * `OnAccessIncludePath`
247
-        * `OnAccessExcludePath`
248
-        * `OnAccessPrevention`
249
-
250
-#### Configure SELinux for ClamAV
251
-
252
-Certain distributions (notably RedHat variants) when operating with SELinux enabled use the non-standard `antivirus_can_scan_system` SELinux option instead of `clamd_can_scan_system`.
253
-
254
-At this time, libclamav only sets the `clamd_can_scan_system` option, so you may need to manually enable `antivirus_can_scan_system`. If you don't perform this step, freshclam will log something like this when it tests the newly downloaded signature databases:
255
-
256
-```
257
-During database load : LibClamAV Warning: RWX mapping denied: Can't allocate RWX Memory: Permission denied
258
-```
259
-
260
-To allow ClamAV to operate under SELinux, run the following:
261
-```bash
262
-setsebool -P antivirus_can_scan_system 1
263
-```
264
-
265
-#### Download / Update the signature database
266
-
267
-Before you can run a scan, you'll need to download the signature databases. Once again, you may need to run with `sudo`/root privileges.
268
-
269
-If you installed to a location in your system PATH:
270
-```bash
271
-freshclam
272
-```
273
-
274
-If you installed to another location:
275
-```bash
276
-/<path>/<to>/<clamav>/<bin>/freshclam
277
-```
278
-
279
-  _Important_: It is common on Ubuntu after a fresh install to see the following error the first time you use ClamAV:
280
-  ```bash
281
-  $ freshclam
282
-  freshclam: error while loading shared libraries: libclamav.so.7: cannot open shared object   file: No such file or directory
283
-  ```
284
-
285
-  You can fix this error by using ldconfig to rebuild the library search path.
286
-  ```bash
287
-  sudo ldconfig
288
-  ```
289
-
290
-#### Users and on user privileges
291
-
292
-If you are running `freshclam` and `clamd` as root or with `sudo`, and you did not explicitely configure with `--disable-clamav`, you will want to ensure that the `DatabaseOwner` user specified in `freshclam.conf` owns the database directory so it can download signature udpates.
293
-
294
-The user that `clamd`, `clamdscan`, and `clamscan` run as may be the same user, but if it isn't -- it merely needs _read_ access to the database directory.
295
-
296
-If you choose to use the default `clamav` user to run `freshclam` and `clamd`, you'll need to create the clamav group and the clamav user account the first time you install ClamAV.
297
-
298
-```bash
299
-groupadd clamav
300
-useradd -g clamav -s /bin/false -c "Clam Antivirus" clamav
301
-```
302
-
303
-Finally, you will want to set user ownership of the database directory.
304
-For example:
305
-```bash
306
-sudo chown -R clamav:clamav /usr/local/share/clamav
307
-```
308
-
309
-### Usage
310
-
311
-You should be all set up to run scans.
312
-
313
-Take a look at our [usage documentation](../Usage.md) to learn about how to use ClamAV each of the utilities.
314 1
deleted file mode 100644
... ...
@@ -1,302 +0,0 @@
1
-# Installation on Redhat and CentOS Linux Distributions
2
-
3
-Below are the steps for installing ClamAV from source on Redhat and CentOS Linux.
4
-
5
-## Install prerequisites
6
-
7
-1. Install ClamAV dependencies
8
-    1. Install the developer tools
9
-        ```bash
10
-        sudo yum groupinstall "Development Tools"
11
-        ```
12
-    2. Install library dependencies
13
-        ```bash
14
-        sudo yum install openssl openssl-devel libcurl-devel zlib-devel libpng-devel libxml2-devel json-c-devel bzip2-devel pcre2-devel ncurses-devel
15
-        ```
16
-    3. (very optional) Those wishing to use clamav-milter may wish to install the following
17
-        ```bash
18
-        sudo yum install sendmail sendmail-devel
19
-        ```
20
-
21
-2. Install the unit testing dependencies
22
-    ```bash
23
-    sudo yum valgrind check
24
-    ```
25
-
26
-_Note_: LLVM is also an optional dependency. LLVM will not provide any additional features, but is an alternative method for executing bytecode signatures versus using the built-in bytecode interpreter. Limited performance testing between LLVM and the bytecode interpreter did not yield conclusive evidence that one is "better" than the other. For the sake of simplicity, it is not recommended to install LLVM.
27
-
28
-## Download the latest stable release
29
-
30
-1. Open a browser and navigate to [the ClamAV downloads page](http://www.clamav.net/downloads)
31
-2. Click `clamav-<version>.tar.gz` link to download the latest stable release.
32
-
33
-## Extract the source archive
34
-
35
-```bash
36
-cd ~/Downloads
37
-tar xzf clamav-<ver>.tar.gz
38
-cd clamav-<ver>.tar.gz
39
-```
40
-
41
-## Configure the build
42
-
43
-ClamAV's configure script should detect each of the above dependencies automatically.
44
-
45
-### Typical `./configure` usage
46
-
47
-```bash
48
-./configure --enable-check
49
-```
50
-
51
-Once `./configure` completes, it will print a summary. Verify that the packages you installed are in fact being detected.
52
-
53
-Example configure summary output:
54
-
55
-```bash
56
-configure: Summary of detected features follows
57
-              OS          : linux-gnu
58
-              pthreads    : yes (-lpthread)
59
-configure: Summary of miscellaneous features
60
-              check       : -lcheck_pic -pthread -lrt -lm -lsubunit
61
-              fanotify    : yes
62
-              fdpassing   : 1
63
-              IPv6        : yes
64
-configure: Summary of optional tools
65
-              clamdtop    : -lncurses (auto)
66
-              milter      : yes (disabled)
67
-              clamsubmit  : yes (libjson-c-dev found at /usr), libcurl-devel found at /usr)
68
-configure: Summary of engine performance features
69
-              release mode: yes
70
-              llvm        : no (disabled)
71
-              mempool     : yes
72
-configure: Summary of engine detection features
73
-              bzip2       : ok
74
-              zlib        : /usr
75
-              unrar       : yes
76
-              preclass    : yes (libjson-c-dev found at /usr)
77
-              pcre        : /usr
78
-              libmspack   : yes (Internal)
79
-              libxml2     : yes, from /usr
80
-              yara        : yes
81
-              fts         : yes (libc)
82
-
83
-```
84
-
85
-### Additional popular `./configure` options
86
-
87
-* `--with-systemdsystemunitdir` - Do not install `systemd` socket files. This option disables systemd support, but will allow you to `make install` to a user-owned directory without requiring `sudo`/root privileges:
88
-    ```bash
89
-    ./configure --with-systemdsystemunitdir=no
90
-    ```
91
-* `--sysconfdir` - Install the configuration files to `/etc` instead of `/usr/local/etc`:
92
-    ```bash
93
-    ./configure -–sysconfdir=/etc
94
-    ```
95
-* `--prefix` - Install ClamAV to a directory other than `/usr/local/`:
96
-    * Example 1: Install to a local `./install` directory.
97
-        ```bash
98
-        ./configure --prefix=`pwd`/install
99
-        ```
100
-    * Example 2: Install ClamAV locally on an unprivileged shell account.
101
-        ```bash
102
-        ./configure --prefix=$HOME/clamav --disable-clamav --with-systemdsystemunitdir=no
103
-        ```
104
-* `--disable-clamav` - _Don't_ drop super-user priveleges to run `freshclam` or `clamd` as the `clamav`* user.
105
-    ```bash
106
-    ./configure --disable-clamav
107
-    ```
108
-    *_Tip_: Using this `--disable-clamav` means that `freshclam` and `clamd` will run with _root privleges_ if invoked using `sudo`. Running `clamd` or `clamscan` as root is **not recommended**. Instead of using this option, you can configure `freshclam` or `clamd` to drop to any other user by:
109
-    * setting the `DatabaseOwner` option in `freshclam.conf` and
110
-    * setting the `User` option in `clamd.conf`.
111
-
112
-Please see the `./configure --help` for additional options.
113
-
114
-### Compile ClamAV
115
-
116
-Compile ClamAV with:
117
-```bash
118
-make -j2
119
-```
120
-
121
-### Run ClamAV Unit Tests (Optional)
122
-
123
-For peace of mind, it can be helpful to run a small suite of unit and system tests.
124
-
125
-Run:
126
-```bash
127
-make check
128
-```
129
-
130
-All tests should pass.* Output will look something like this:
131
-
132
-```bash.
133
-    ...
134
-PASS: check_clamav
135
-PASS: check_freshclam.sh
136
-PASS: check_sigtool.sh
137
-PASS: check_unit_vg.sh
138
-PASS: check1_clamscan.sh
139
-PASS: check2_clamd.sh
140
-PASS: check3_clamd.sh
141
-PASS: check4_clamd.sh
142
-PASS: check5_clamd_vg.sh
143
-PASS: check6_clamd_vg.sh
144
-SKIP: check7_clamd_hg.sh
145
-PASS: check8_clamd_hg.sh
146
-PASS: check9_clamscan_vg.sh
147
-    ...
148
-============================================================================
149
-Testsuite summary for ClamAV 0.100.2
150
-============================================================================
151
-# TOTAL: 13
152
-# PASS:  12
153
-# SKIP:  1
154
-# XFAIL: 0
155
-# FAIL:  0
156
-# XPASS: 0
157
-# ERROR: 0
158
-```
159
-
160
-_Notes_:
161
-
162
-* The `*.vg.sh` tests will be skipped unless you run `make check VG=1`.
163
-* The `check7_clamd.hg.sh` (helgrind) is presently disabled and will be skipped.
164
-  * For details, see: [the Git commit](https://github.com/Cisco-Talos/clamav-devel/commit/2a5d51809a56be9a777ded02969a7427a3c26713)
165
-
166
-If you have a failure or an error in the unit tests, it could be that you are missing one or more of the prerequisites.
167
-
168
-If you are investigating a failure, please do the following:
169
-
170
-`cd unit_tests`
171
-
172
-Use `less` to read the log for the failed test.
173
-Example:
174
-
175
-```bash
176
-less check4_clamd.sh.log`
177
-```
178
-
179
-To submit a bug report regarding unit text failures, please follow these [bug reporting steps](../Installation-Unix.md#Reporting-a-unit-test-failure-bug).
180
-
181
-### Install ClamAV
182
-
183
-Install ClamAV with:
184
-```bash
185
-make install
186
-```
187
-
188
-_Tip_: If installing to the default or other system-owned directory, you may need to use `sudo`.
189
-
190
-### First time set-up
191
-
192
-_Note_: The following instructions assume you used the default install paths (i.e. `/usr/local`). If you modified the install locations using `--prefix` or `--sysconfdir` options, replace `/usr/local` with your chosen install path.
193
-
194
-#### `freshclam` config
195
-
196
-Before you can use `freshclam` to download updates, you need to create a `freshclam` config. A sample config is provided for you.
197
-
198
-1. Copy the sample config. You may need to use `sudo`:
199
-    ```bash
200
-    cp /usr/local/etc/freshclam.conf.sample /usr/local/etc/freshclam.conf
201
-    ```
202
-2. Modify the config file using your favourite text editor. Again, you may need to use `sudo`.
203
-    * At a minimum, remove the `Example` line so `freshclam` can use the config.
204
-
205
-    Take the time to look through the options. You can enable the sample options by deleting the `#` comment characters.
206
-
207
-    Some popular options to enable include:
208
-
209
-    * `LogTime`
210
-    * `LogRotate`
211
-    * `NotifyClamd`
212
-    * `DatabaseOwner`
213
-
214
-3. Create the database directory. *Tip: _You may need to use `sudo`._
215
-    ```bash
216
-    mkdir /usr/local/share/clamav
217
-    ```
218
-
219
-#### `clamd` config (optional)
220
-
221
-You can run `clamscan` without setting the config options for `clamd`. However, the `clamd` scanning daemon allows you to use `clamdscan` to perform faster a-la-carte scans, allows you to run multi-threaded scans, and allows you to use `clamav-milter` if you want to use ClamAV as a mail filter if you host an email server.
222
-
223
-Additionally, if you are a running modern versions of Linux where the FANOTIFY kernel feature is enabled, `clamd` has a feature run with On-Access Scanning*. *When properly configured*, On-Access Scanning can scan files as they are accessed and optionally block access to the file in the event that a signature alerted.
224
-
225
-  _Note_: At this time, for On-Access Scanning to work, `clamd` must run with `sudo`/root privileges. For more details, please see our documentation on On-Access Scanning.
226
-
227
-1. Copy the sample config. You may need to use `sudo`:
228
-    ```bash
229
-    cp /usr/local/etc/clamd.conf.sample /usr/local/etc/clamd.conf
230
-    ```
231
-2. Modify the config file using your favourite text editor. Again, you may need to use `sudo`.
232
-    * At a minimum, remove the `Example` line so `freshclam` can use the config.
233
-    * You also _need_ to select a Socket option for `clamd` so `clamdscan` and other utilities can communicate with `clamd`. You must enable _one_ of the following.
234
-        * `LocalSocket`
235
-        * `TCPSocket`
236
-
237
-    Take the time to look through the options. You can enable the sample options by deleting the `#` comment characters.
238
-
239
-    Some popular options to enable include:
240
-
241
-    * `LogTime`
242
-    * `LogClean`
243
-    * `LogRotate`
244
-    * `User`
245
-    * `ScanOnAccess`
246
-        * `OnAccessIncludePath`
247
-        * `OnAccessExcludePath`
248
-        * `OnAccessPrevention`
249
-
250
-#### Configure SELinux for ClamAV
251
-
252
-Certain distributions (notably RedHat variants) when operating with SELinux enabled use the non-standard `antivirus_can_scan_system` SELinux option instead of `clamd_can_scan_system`.
253
-
254
-At this time, libclamav only sets the `clamd_can_scan_system` option, so you may need to manually enable `antivirus_can_scan_system`. If you don't perform this step, freshclam will log something like this when it tests the newly downloaded signature databases:
255
-
256
-```
257
-During database load : LibClamAV Warning: RWX mapping denied: Can't allocate RWX Memory: Permission denied
258
-```
259
-
260
-To allow ClamAV to operate under SELinux, run the following:
261
-```bash
262
-setsebool -P antivirus_can_scan_system 1
263
-```
264
-
265
-#### Download / Update the signature database
266
-
267
-Before you can run a scan, you'll need to download the signature databases. Once again, you may need to run with `sudo`/root privileges.
268
-
269
-If you installed to a location in your system PATH:
270
-```bash
271
-freshclam
272
-```
273
-
274
-If you installed to another location:
275
-```bash
276
-/<path>/<to>/<clamav>/<bin>/freshclam
277
-```
278
-
279
-#### Users and on user privileges
280
-
281
-If you are running `freshclam` and `clamd` as root or with `sudo`, and you did not explicitely configure with `--disable-clamav`, you will want to ensure that the `DatabaseOwner` user specified in `freshclam.conf` owns the database directory so it can download signature udpates.
282
-
283
-The user that `clamd`, `clamdscan`, and `clamscan` run as may be the same user, but if it isn't -- it merely needs _read_ access to the database directory.
284
-
285
-If you choose to use the default `clamav` user to run `freshclam` and `clamd`, you'll need to create the clamav group and the clamav user account the first time you install ClamAV.
286
-
287
-```
288
-groupadd clamav
289
-useradd -g clamav -s /bin/false -c "Clam Antivirus" clamav
290
-```
291
-
292
-Finally, you will want to set user ownership of the database directory.
293
-For example:
294
-```bash
295
-sudo chown -R clamav:clamav /usr/local/share/clamav
296
-```
297
-
298
-### Usage
299
-
300
-You should be all set up to run scans.
301
-
302
-Take a look at our [usage documentation](../Usage.md) to learn about how to use ClamAV each of the utilities.
303 1
deleted file mode 100644
... ...
@@ -1,364 +0,0 @@
1
-# Installation on macOS (Mac OS X)
2
-
3
-Below are the steps for installing ClamAV from source on Apple macOS.
4
-
5
-## Install prerequisites
6
-
7
-The easiest way to install prerequisites on macOS is to use [Homebrew](https://brew.sh/)
8
-
9
-1. Install Homebrew
10
-    ```bash
11
-    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
12
-    ```
13
-
14
-2. Install ClamAV dependencies
15
-    1. Install XCode's Command Line Tools
16
-        ```bash
17
-        xcode-select --install
18
-        ```
19
-    2. Install library dependencies
20
-        ```bash
21
-        brew install pcre2 openssl json-c
22
-        ```
23
-
24
-3. Install the unit testing dependencies
25
-    ```bash
26
-    sudo apt-get valgrind check
27
-    ```
28
-
29
-    _Tip_: Valgrind may not be available in Homebrew for the latest version of macOS.
30
-
31
-_Note_: LLVM is also an optional dependency. LLVM will not provide any additional features, but is an alternative method for executing bytecode signatures versus using the built-in bytecode interpreter. Limited performance testing between LLVM and the bytecode interpreter did not yield conclusive evidence that one is "better" than the other. For the sake of simplicity, it is not recommended to install LLVM.
32
-
33
-## Download the latest stable release
34
-
35
-1. Open a browser and navigate to [the ClamAV downloads page](http://www.clamav.net/downloads)
36
-2. Click `clamav-<version>.tar.gz` link to download the latest stable release.
37
-
38
-## Extract the source archive
39
-
40
-```bash
41
-cd ~/Downloads
42
-tar xzf clamav-<ver>.tar.gz
43
-cd clamav-<ver>.tar.gz
44
-```
45
-
46
-## Configure the build
47
-
48
-Homebrew installs libraries and applications under `/usr/local/Cellar/<app>/<ver>/`.
49
-
50
-To configure the ClamAV build using our homebrew-installed dependencies, you may need to reference some of them explicitly. Others may be detected automatically.
51
-
52
-### Typical `./configure` usage
53
-
54
-*_Note_: Your Homebrew-installed package version directories may differ slightly.
55
-
56
-```bash
57
-./configure --with-openssl=/usr/local/Cellar/openssl/1.0.2l --with-libjson=yes --enable-check
58
-```
59
-
60
-Once `./configure` completes, it will print a summary. Verify that the packages you installed are in fact being detected.
61
-
62
-Example configure summary output:
63
-
64
-```bash
65
-configure: Summary of detected features follows
66
-            OS          : darwin17.2.0
67
-            pthreads    : yes ()
68
-configure: Summary of miscellaneous features
69
-            check       : -L/usr/local/lib -lcheck -R/usr/local/lib  (auto)
70
-            fanotify    : no (disabled)
71
-            fdpassing   : 1
72
-            IPv6        : yes
73
-configure: Summary of optional tools
74
-            clamdtop    : -lncurses (auto)
75
-            milter      : yes (disabled)
76
-            clamsubmit  : yes (libjson-c-dev found at /usr/local), libcurl-devel found at /usr)
77
-configure: Summary of engine performance features
78
-            release mode: yes
79
-            llvm        : no (disabled)
80
-            mempool     : yes
81
-configure: Summary of engine detection features
82
-            bzip2       : ok
83
-            zlib        : /usr
84
-            unrar       : yes
85
-            preclass    : yes (libjson-c-dev found at /usr/local)
86
-            pcre        : /usr/local/Cellar/pcre2/10.32
87
-            libmspack   : yes (Internal)
88
-            libxml2     : yes, from /usr
89
-            yara        : yes
90
-            fts         : yes (libc)
91
-```
92
-
93
-If you experience an error wherein `configure` output claims that `gcc` is unable to build an executable -- please see the [Troubleshooting section at the bottom](#configure----gcc-failed-to-build-executable).
94
-
95
-### Additional popular `./configure` options
96
-
97
-* `--sysconfdir` - Install the configuration files to `/etc` instead of `/usr/local/etc`:
98
-    ```bash
99
-    ./configure -–sysconfdir=/etc
100
-    ```
101
-* `--prefix` - Install ClamAV to a directory other than `/usr/local/`:
102
-    * Example 1: Install to a local `./install` directory.
103
-        ```bash
104
-        ./configure --prefix=`pwd`/install
105
-        ```
106
-    * Example 2: Install ClamAV locally on an unprivileged shell account.
107
-        ```bash
108
-        ./configure --prefix=$HOME/clamav --disable-clamav
109
-        ```
110
-* `--disable-clamav` - _Don't_ drop super-user priveleges to run `freshclam` or `clamd` as the `clamav`* user.
111
-    ```bash
112
-    ./configure --disable-clamav
113
-    ```
114
-    *_Tip_: Using this `--disable-clamav` means that `freshclam` and `clamd` will run with _root privleges_ if invoked using `sudo`. Running `clamd` or `clamscan` as root is **not recommended**. Instead of using this option, you can configure `freshclam` or `clamd` to drop to any other user by:
115
-    * setting the `DatabaseOwner` option in `freshclam.conf` and
116
-    * setting the `User` option in `clamd.conf`.
117
-
118
-Please see the `./configure --help` for additional options.
119
-
120
-### Compile ClamAV
121
-
122
-Compile ClamAV with:
123
-```bash
124
-make -j2
125
-```
126
-
127
-If you experience error messages wherein the compiler is unable to find the correct openssl header or library files, you may need to reconfigure and provide explicit header and library paths. See the [Troubleshooting section below for details](#make----failed-to-find-correct-openssl-header-or-library-files).
128
-
129
-### Run ClamAV Unit Tests (Optional)
130
-
131
-For peace of mind, it can be helpful to run a small suite of unit and system tests.
132
-
133
-Run:
134
-```bash
135
-make check
136
-```
137
-
138
-All tests should pass.* Output will look something like this:
139
-
140
-```bash.
141
-    ...
142
-PASS: check_clamav
143
-PASS: check_freshclam.sh
144
-PASS: check_sigtool.sh
145
-PASS: check_unit_vg.sh
146
-PASS: check1_clamscan.sh
147
-PASS: check2_clamd.sh
148
-PASS: check3_clamd.sh
149
-PASS: check4_clamd.sh
150
-PASS: check5_clamd_vg.sh
151
-PASS: check6_clamd_vg.sh
152
-SKIP: check7_clamd_hg.sh
153
-PASS: check8_clamd_hg.sh
154
-PASS: check9_clamscan_vg.sh
155
-    ...
156
-============================================================================
157
-Testsuite summary for ClamAV 0.100.2
158
-============================================================================
159
-# TOTAL: 13
160
-# PASS:  12
161
-# SKIP:  1
162
-# XFAIL: 0
163
-# FAIL:  0
164
-# XPASS: 0
165
-# ERROR: 0
166
-```
167
-
168
-_Notes_:
169
-
170
-* The `*.vg.sh` tests will be skipped unless you run `make check VG=1`.
171
-  * _Under macOS_, `*.vg.sh` (valgrind) tests _will fail_ due to false alerts.
172
-  * Valgrind may not be available via Homebrew for the latest version of macOS.
173
-* The `check7_clamd.hg.sh` (helgrind) is presently disabled and will be skipped.
174
-  * For details, see: [the Git commit](https://github.com/Cisco-Talos/clamav-devel/commit/2a5d51809a56be9a777ded02969a7427a3c26713)
175
-
176
-If you have a failure or an error in the unit tests, it could be that you are missing one or more of the prerequisites or that there is miss-match in the header files after upgrading to a newer version of macOS. If the latter, please see the [Troubleshooting section at the bottom](#make-check----unit-tests-failed-for-seemingly-no-reason).
177
-
178
-If you are investigating a failure, please do the following:
179
-
180
-`cd unit_tests`
181
-
182
-Use `less` to read the log for the failed test.
183
-Example:
184
-
185
-```bash
186
-less check4_clamd.sh.log`
187
-```
188
-
189
-To submit a bug report regarding unit text failures, please follow these [bug reporting steps](../Installation-Unix.md#Reporting-a-unit-test-failure-bug).
190
-
191
-### Install ClamAV
192
-
193
-Install ClamAV with:
194
-```bash
195
-make install
196
-```
197
-
198
-_Tip_: If installing to the default or other system-owned directory, you may need to use `sudo`.
199
-
200
-### First time set-up
201
-
202
-_Note_: The following instructions assume you used the default install paths (i.e. `/usr/local`). If you modified the install locations using `--prefix` or `--sysconfdir` options, replace `/usr/local` with your chosen install path.
203
-
204
-#### `freshclam` config
205
-
206
-Before you can use `freshclam` to download updates, you need to create a `freshclam` config. A sample config is provided for you.
207
-
208
-1. Copy the sample config. You may need to use `sudo`:
209
-    ```bash
210
-    cp /usr/local/etc/freshclam.conf.sample /usr/local/etc/freshclam.conf
211
-    ```
212
-2. Modify the config file using your favourite text editor. Again, you may need to use `sudo`.
213
-    * At a minimum, remove the `Example` line so `freshclam` can use the config.
214
-
215
-    Take the time to look through the options. You can enable the sample options by deleting the `#` comment characters.
216
-
217
-    Some popular options to enable include:
218
-
219
-    * `LogTime`
220
-    * `LogRotate`
221
-    * `NotifyClamd`
222
-    * `DatabaseOwner`
223
-
224
-3. Create the database directory. *Tip: _You may need to use `sudo`._
225
-    ```bash
226
-    mkdir /usr/local/share/clamav
227
-    ```
228
-
229
-#### `clamd` config (optional)
230
-
231
-You can run `clamscan` without setting the config options for `clamd`. However, the `clamd` scanning daemon allows you to use `clamdscan` to perform faster a-la-carte scans, allows you to run multi-threaded scans, and allows you to use `clamav-milter` if you want to use ClamAV as a mail filter if you host an email server.
232
-
233
-1. Copy the sample config. You may need to use `sudo`:
234
-    ```bash
235
-    cp /usr/local/etc/clamd.conf.sample /usr/local/etc/clamd.conf
236
-    ```
237
-2. Modify the config file using your favourite text editor. Again, you may need to use `sudo`.
238
-    * At a minimum, remove the `Example` line so `freshclam` can use the config.
239
-    * You also _need_ to select a Socket option for `clamd` so `clamdscan` and other utilities can communicate with `clamd`. You must enable _one_ of the following.
240
-        * `LocalSocket`
241
-        * `TCPSocket`
242
-
243
-    Take the time to look through the options. You can enable the sample options by deleting the `#` comment characters.
244
-
245
-    Some popular options to enable include:
246
-
247
-    * `LogTime`
248
-    * `LogClean`
249
-    * `LogRotate`
250
-    * `User`
251
-
252
-#### Download / Update the signature database
253
-
254
-Before you can run a scan, you'll need to download the signature databases. Once again, you may need to run with `sudo`/root privileges.
255
-
256
-If you installed to a location in your system PATH:
257
-```bash
258
-freshclam
259
-```
260
-
261
-If you installed to another location:
262
-```bash
263
-/<path>/<to>/<clamav>/<bin>/freshclam
264
-```
265
-
266
-#### Users and on user privileges
267
-
268
-If you are running `freshclam` and `clamd` as root or with `sudo`, and you did not explicitely configure with `--disable-clamav`, you will want to ensure that the `DatabaseOwner` user specified in `freshclam.conf` owns the database directory so it can download signature udpates.
269
-
270
-The user that `clamd`, `clamdscan`, and `clamscan` run as may be the same user, but if it isn't -- it merely needs _read_ access to the database directory.
271
-
272
-If you choose to use the default `clamav` user to run `freshclam` and `clamd`, you'll need to create the clamav group and the clamav user account the first time you install ClamAV.
273
-
274
-Prep by identifying an unused group id (gid), and an unused user UniqueID.
275
-
276
-This command will display all current group PrimaryGroupIDs:
277
-```bash
278
-dscl . list /Groups PrimaryGroupID | tr -s ' ' | sort -n -t ' ' -k2,2
279
-```
280
-
281
-This command will display all current user UniqueIDs:
282
-```bash
283
-dscl . list /Users UniqueID | tr -s ' ' | sort -n -t ' ' -k2,2
284
-```
285
-
286
-Then, these commands can be used to create the `clamav` group and `clamav` user.
287
-```bash
288
-sudo dscl . create /Groups/clamav
289
-sudo dscl . create /Groups/clamav RealName "Clam Antivirus Group"
290
-sudo dscl . create /Groups/clamav gid 799           # Ensure this is unique!
291
-sudo dscl . create /Users/clamav
292
-sudo dscl . create /Users/clamav RealName "Clam Antivirus User"
293
-sudo dscl . create /Users/clamav UserShell /bin/false
294
-sudo dscl . create /Users/clamav UniqueID 599       # Ensure this is unique!
295
-sudo dscl . create /Users/clamav PrimaryGroupID 799 # Must match the above gid!
296
-```
297
-
298
-Finally, you will want to set user ownership of the database directory.
299
-For example:
300
-```bash
301
-sudo chown -R clamav:clamav /usr/local/share/clamav
302
-```
303
-
304
-### Usage
305
-
306
-You should be all set up to run scans.
307
-
308
-Take a look at our [usage documentation](../Usage.md) to learn about how to use ClamAV each of the utilities.
309
-
310
-### Troubleshooting
311
-
312
-#### Configure -- `gcc` failed to build executable
313
-
314
-It is possible that `gcc`/`clang` is misconfigured. This is particularly likely after an upgrade to a newer versions of macOS (e.g after an upgrade from macOS High Sierra to macOS Mojave).
315
-
316
-Open Terminal, and run the following:
317
-
318
-```bash
319
-xcode-select --install
320
-```
321
-
322
-This will download and install xcode developer tools and fix the problem. _You will be prompted (in the macOS GUI) to accept the license agreement before it will continue._
323
-As a follow on step, you _may_ need to reset the path to Xcode if you have several versions or want the command line tools to run without Xcode.
324
-
325
-```bash
326
-xcode-select --switch /Applications/Xcode.app
327
-xcode-select --switch /Library/Developer/CommandLineTools
328
-```
329
-
330
-> Solution shamelessly lifted from [apple stackexchange](https://apple.stackexchange.com/questions/254380/macos-mojave-invalid-active-developer-path)
331
-
332
-#### Make -- failed to find correct openssl header or library files
333
-
334
-Homebrew provides symlinks in `/usr/local/opt` to aid in the linking process:
335
-
336
-```bash
337
-$ ls -l /usr/local/opt/openssl*
338
-
339
-lrwxr-xr-x  1 gary  admin    24B Aug 21 12:39 /usr/local/opt/openssl@ -> ../Cellar/openssl/1.0.2p
340
-lrwxr-xr-x  1 gary  admin    24B Aug 21 12:39 /usr/local/opt/openssl@1.0@ -> ../Cellar/openssl/1.0.2p
341
-lrwxr-xr-x  1 gary  admin    28B Nov 20  2017 /usr/local/opt/openssl@1.1@ -> ../Cellar/openssl@1.1/1.1.0g
342
-```
343
-
344
-If they aren't automatically detected you may experience issues linking openssl. You can work around this by explicitly listing the include `-I` and library `-L` paths.
345
-
346
-For example:
347
-
348
-```bash
349
-./configure --with-openssl=/usr/local/Cellar/openssl/1.0.2l --with-libjson=yes --enable-check CPPFLAGS="-I/usr/local/opt/openssl@1.0/include" LDFLAGS="-L/usr/local/opt/openssl@1.0/lib/"
350
-```
351
-
352
-#### Make check -- unit tests failed for seemingly no reason
353
-
354
-Similar to the above issue, it is possible for a mismatch in your development header files resulting in a working build that may fail the `check` test suite.
355
-
356
-If you're seeing one or more failed tests on a stable release of ClamAV on macOS, the following may resolve the issue:
357
-
358
-Open Terminal, and run the following:
359
-
360
-```bash
361
-sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
362
-```
363
-
364
-> Solution shamelessly lifted from [the pyenv github issue tracker](https://github.com/pyenv/pyenv/issues/1219)
365 1
deleted file mode 100644
... ...
@@ -1,106 +0,0 @@
1
-# Installing ClamAV on Windows
2
-
3
-If you wish to build ClamAV from source using Visual Studio 2015, please head over to the [Win32 ClamAV Build Instructions](win32/README.md) located in our source release materials on [ClamAV.net](https://www.clamav.net/downloads) and on [GitHub](https://github.com/Cisco-Talos/clamav-devel).
4
-
5
-## Install using the ClamAV Windows Installer
6
-
7
-Important: Installing ClamAV using the Installer will require Administrator privileges.
8
-
9
-1. Download: http://www.clamav.net/downloads/production/ClamAV-0.101.1.exe
10
-2. Locate the file in your Downloads directory.
11
-3. Right-click on `ClamAV-0.101.1.exe` and select `Run as administrator`. You may receive a warning message along the lines of "Windows protected your PC".  Select `More info` and then select `Run anyway`.
12
-4. Select `I accept the agreement` and click `Next`.
13
-5. Click `Next` again. If you've removed a previous installation of ClamAV, you may receive the prompt "The folder ... already exists...". If you do, select `Yes`.
14
-6. Click `Install`.
15
-7. Click `Finish`.
16
-8. Press the Windows-key and type `powershell` but _DO NOT_ press `Enter`. Right-click on `Windows PowerShell` at the top of the menu and select `Run as administrator`. Your computer may warn you `Do you want to allow this app to make changes to your device?`  Click `Yes`.
17
-9. Verify that the prompt in the PowerShell window looks like this:
18
-    ```powershell
19
-    PS C:\WINDOWS\system32>
20
-    ```
21
-
22
-10. In the Adminstrator PowerShell window, enter the following to navigate to the ClamAV install directory:
23
-    ```powershell
24
-    cd "c:\program files\clamav"
25
-    ```
26
-
27
-Continue on to "First Time Set-Up" below...
28
-
29
-## Install using the ClamAV Portable Install Package
30
-
31
-1. Download: https://www.clamav.net/downloads/production/clamav-0.101.1-win-x64-portable.zip
32
-2. Unzip it.
33
-3. Open the `clamav-0.101.1-win-x64-portable` directory.
34
-4. Hold down Shift and then right-click on the background in the current directory (but not on one of the files). Select `"Open PowerShell window here"`. If that option doesn't appear, try again.
35
-
36
-Continue on to "First Time Set-Up"...
37
-
38
-## First Time Set-Up
39
-
40
-In the PowerShell window, perform the following tasks:
41
-
42
-* Run:
43
-    ```powershell
44
-    copy .\conf_examples\freshclam.conf.sample .\freshclam.conf
45
-    ```
46
-* Run:
47
-    ```powershell
48
-    write.exe .\freshclam.conf
49
-    ```
50
-* WordPad will pop up. Delete the line that says "Example". Save the file and close WordPad.
51
-
52
-## Next Steps
53
-
54
-### Download the Signature Databases
55
-
56
-Before you can start the ClamAV scanning engine (using either `clamd` or `clamscan`), you must _first_ have ClamAV Virus Database (.cvd) file(s) installed in the appropriate location on your system. The default location for these database files is C:\Program Files\ClamAV\database, the database directory of your ` (in Windows).
57
-
58
-Continuing in the PowerShell window:
59
-
60
-1. Run:
61
-    ```powershell
62
-    .\freshclam.exe
63
-    ```
64
-2. freshclam will download some files and drop them in the database directory. This can take a minute or two depending on how fast your internet connection is. The files are a pretty large.
65
-3. You are now ready to perform scans with ClamAV. If you using the portable install package, you may now copy the entire `clamav-0.100.1-win-x64-portable` directory to the computer(s) you wish to scan.
66
-
67
-### Steps to Perform Basic Scanning
68
-
69
-* Run this to scan the files in the current directory:
70
-    ```powershell
71
-    .\clamscan.exe .
72
-    ```
73
-
74
-  This will scan the current directory. At the end of the scan, it will display a summary. If you notice in the clamscan output, it only scanned something like 60 files, even though there are more files in subdirectories. By default, clamscan will only scan files in the current directory.
75
-
76
-* Run this to scan all the files in the current directory:
77
-    ```powershell
78
-    .\clamscan.exe --recursive .
79
-    ```
80
-
81
-* Run this to scan ALL the files on your C: drive, it will take **quite** a while. Keep in mind that you can cancel it at any time by pressing `Ctrl-C`:
82
-    ```powershell
83
-    .\clamscan --recursive C:\
84
-    ```
85
-
86
-* For more information on ways you can use clamscan, run:
87
-    ```powershell
88
-    .\clamscan.exe --help
89
-    ```
90
-
91
-### Faster a-la-carte Scanning with `clamd`
92
-
93
-You may have noticed that `clamscan` takes a while to get started. This is because it loads the signature database each time you start a scan. If you require faster scanning of individual files, you will want to use `clamd` with `clamdscan` instead.
94
-
95
-Continuing in the PowerShell window:
96
-
97
-1. Run:
98
-    ```powershell
99
-    .\clamd.exe
100
-    ```
101
-    The application will take a moment to load and then appear to hang, but it is in fact waiting for scanning commands from `clamdscan`.
102
-2. Open a second PowerShell window as you did above, in the same directory.
103
-3. In the second PowerShell window, you can now run `clamdscan` much the same way you did with `clamscan` above.
104
-    ```powershell
105
-    .\clamdscan.exe .
106
-    ```
107 1
deleted file mode 100644
... ...
@@ -1,145 +0,0 @@
1
-# Introduction
2
-
3
-Clam AntiVirus is an open source (GPLv2) anti-virus toolkit, designed especially for e-mail scanning on mail gateways.  It provides a number of utilities including a flexible and scalable multi-threaded daemon, a command line scanner and advanced tool for automatic database updates.  The core of the package is an anti-virus engine available in a form of shared library.
4
-
5
-## Features
6
-
7
-### Capabilities
8
-
9
-- ClamAV is designed to scan files quickly.
10
-- Real time protection (Linux only).  Our scanning daemon supports on-access scanning on modern versions of Linux, including the ability to block file access until a file has been scanned.
11
-- ClamAV detects over 1 million viruses, worms and trojans, including Microsoft Office macro viruses, mobile malware, and other threats.
12
-- The built-in bytecode interpreter allows the ClamAV signature writers to create and distribute very complex detection routines and remotely enhance the scanner’s functionality.
13
-- Signed signature databases ensure that ClamAV will only execute trusted signature definitions.
14
-- ClamAV scans within archives and compressed files but also protects against archive bombs.  Built-in archive extraction capabilities include:
15
-  - Zip (including SFX)
16
-  - RAR (including SFX)
17
-  - 7Zip
18
-  - ARJ (including SFX)
19
-  - Tar
20
-  - CPIO
21
-  - Gzip
22
-  - Bzip2
23
-  - DMG
24
-  - IMG
25
-  - ISO 9660
26
-  - PKG
27
-  - HFS+ partition
28
-  - HFSX partition
29
-  - APM disk image
30
-  - GPT disk image
31
-  - MBR disk image
32
-  - XAR
33
-  - XZ
34
-  - MS OLE2
35
-  - MS Cabinet Files (including SFX)
36
-  - MS CHM (Compiled HTML)
37
-  - MS SZDD compression format
38
-  - BinHex
39
-  - SIS (SymbianOS packages)
40
-  - AutoIt
41
-  - InstallShield
42
-- Supports Windows executable file parsing, also known as Portable Executables (PE) both 32/64-bit, including PE files that are compressed or obfuscated with:
43
-  - AsPack
44
-  - UPX
45
-  - FSG
46
-  - Petite
47
-  - PeSpin
48
-  - NsPack
49
-  - wwpack32
50
-  - MEW
51
-  - Upack
52
-  - Y0da Cryptor
53
-- Supports ELF and Mach-O files (both 32- and 64-bit)
54
-- Supports almost all mail file formats
55
-- Support for other special files/formats includes:
56
-  - HTML
57
-  - RTF
58
-  - PDF
59
-  - Files encrypted with CryptFF and ScrEnc
60
-  - uuencode
61
-  - TNEF (winmail.dat)
62
-- Advanced database updater with support for scripted updates, digital signatures and DNS based database version queries
63
-
64
-### License
65
-
66
-ClamAV is licensed under the GNU General Public License, Version 2.
67
-
68
-### Supported platforms
69
-
70
-Clam AntiVirus is highly cross-platform.  The development team cannot test every OS, so we have chosen to test ClamAV using the two most recent Long Term Support (LTS) versions of each of the most popular desktop operating systems.  Our regularly tested operating systems include:
71
-
72
-- GNU/Linux
73
-  - Ubuntu
74
-    - 16.04
75
-    - 18.04
76
-  - Debian
77
-    - 7
78
-    - 8
79
-  - CentOS
80
-    - 6
81
-    - 7
82
-- UNIX
83
-  - Solaris
84
-    - 11
85
-  - FreeBSD
86
-    - 10
87
-    - 11
88
-  - macOS
89
-    - 10.13 (High Sierra)
90
-    - 10.14 (Mojave)
91
-- Windows
92
-  - 7
93
-  - 10
94
-
95
-## Recommended System Requirements
96
-
97
-The following minimum recommended system requirements are for using `clamscan` or `clamd` and `clamdscan` binaries with the standard ClamAV signature database provided by Cisco.
98
-
99
-Minimum recommended RAM:
100
-
101
-- FreeBSD and Linux server edition: 1 GiB+
102
-- Linux non-server edition: 2 GiB+
103
-- Windows 7 & 10 32-bit: 2 GiB+
104
-- Windows 7 & 10 64-bit: 3 GiB+
105
-- macOS: 3 GiB+
106
-
107
-Minimum recommended CPU:
108
-
109
-- FreeBSD and Linux systems: 1 CPU 2.0 Ghz+
110
-- Windows 7 & 10: 1 CPU 2.0 Ghz+
111
-- OSX: 2 CPUs at 2.0 Ghz+
112
-
113
-Minimum available hard disk space required:
114
-
115
-For the ClamAV application we recommend having 5 GB of free space available. This recommendation is in addition to the recommended disk space for each OS.
116
-
117
-_Please note_: The tests to determine these minimum requirements were performed on systems that were not running other applications. If other applications are being run on the system, additional resources will be required in addition to our recommended minimums.
118
-
119
-## Mailing lists and IRC channel
120
-
121
-If you have a trouble installing or using ClamAV try asking on our mailing lists. There are four lists available:
122
-
123
-- **clamav-announce\*lists.clamav.net** - info about new versions, moderated
124
-- **clamav-users\*lists.clamav.net** - user questions
125
-- **clamav-devel\*lists.clamav.net** - technical discussions
126
-- **clamav-virusdb\*lists.clamav.net** - database update announcements, moderated
127
-
128
-You can subscribe and search the mailing list archives at: <https://www.clamav.net/contact.html#ml>
129
-
130
-Alternatively you can try asking on the `#clamav` IRC channel - launch your favourite irc client and type:
131
-
132
-```bash
133
-    /server irc.freenode.net
134
-    /join #clamav
135
-```
136
-
137
-## Submitting New or Otherwise Undetected Malware
138
-
139
-If you've got a virus which is not detected by the current version of ClamAV using the latest signature databases, please submit the sample for review at our website:
140
-
141
-<https://www.clamav.net/reports/malware>
142
-
143
-Likewise, if you have a benign file that is flagging as a virus and you wish to report a False Positive, please submit the sample for review at our website:
144
-
145
-<https://www.clamav.net/reports/fp>
146 1
deleted file mode 100644
... ...
@@ -1,115 +0,0 @@
1
-# On-Access Scanning
2
-
3
-
4
-## Purpose
5
-
6
-
7
-This guide is for users interested in leveraging and understanding ClamAV's On-Access Scanning feature. It will walk through how to set up and use the On-Access Scanner and step through some common issues and their solutions.
8
-
9
-
10
-## Requirements
11
-
12
-
13
-On-Access is only available on Linux systems. On Linux, On-Access requires a `kernel version >= 3.8`. This is because it leverages a kernel api called [fanotify](http://man7.org/linux/man-pages/man7/fanotify.7.html) to perform its blocking.
14
-
15
-
16
-## General Use
17
-
18
-
19
-To use ClamAV's On-Access Scanner, simply open `clamd.conf`, set the `ScanOnAccess` option to `yes`, and then specify the path(s) you would like to recursively watch with the `OnAccessIncludePath` option. Finally, set `OnAccessPrevention` to `yes`. Then, run `clamd` with elevated permissions (e.g. `sudo clamd`). If all went well, the On-Access scanner will now be actively protecting the specified path(s). You can test this by dropping an eicar file into the specified path, and attempting to read/access it (e.g. `cat eicar.txt`). This will result in an "Operation not permitted" message, triggered by fanotify blocking the access attempt at the kernel level.
20
-
21
-
22
-## Troubleshooting
23
-
24
-Some OS distributors have disabled fanotify, despite kernel support. You can check for fanotify support on your kernel by running the command:
25
-
26
-> $ cat /boot/config-<kernel_version> | grep FANOTIFY
27
-
28
-You should see the following:
29
-
30
-```
31
-CONFIG_FANOTIFY=y
32
-CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y
33
-```
34
-
35
-If you see:
36
-
37
-```
38
-# CONFIG_FANOTIFY_ACCESS_PERMISSIONS is not set
39
-```
40
-
41
-Then ClamAV's On-Access Scanner will still function, scanning and alerting on files normally in real time. However, it will be unable to block access attempts on malicious files. We call this `notify-only` mode.
42
-
43
-
44
-ClamAV's On-Access Scanning system uses a scheme called Dynamic Directory Determination (DDD for short) which is a shorthand way of saying that it tracks the layout of every directory specified with `OnAccessIncludePath` dynamically, and recursively, in real time. It does this by leveraging [inotify](http://man7.org/linux/man-pages/man7/inotify.7.html) which by default has a limited number of watchpoints available for use by a process at any given time. Given the complexity of some directory hierarchies, ClamAV may warn you that it has exhausted its supply of inotify watchpoints (8192 by default). To increase the number of inotify watchpoints available for use by ClamAV (to 524288), run the following command:
45
-
46
-> $ echo 524288 | sudo tee -a /proc/sys/fs/inotify/max_user_watches
47
-
48
-
49
-The `OnAccessIncludePath` option will not accept `/` as a valid path. This is because fanotify works by blocking a process' access to a file until a access_ok or access_denied determination has been made by the original fanotify calling process. Thus, by placing fanotify watchpoints on the entire filesystem, key system files may have their access blocked at the kernel level, which will result in a system lockup.
50
-
51
-This restriction was made to prevent users from "shooting themselves in the foot." However, clever users will find it's possible to circumvent this restriction by using multiple `OnAccessIncludePath` options to protect most all the filesystem anyways, or simply the paths they truly care about.
52
-
53
-
54
-The `OnAccessMountPath` option uses a different fanotify api configuration which makes it incompatible with `OnAccessIncludePath` and the DDD System. Therefore, inotify will not be a concern when using this option. Unfortunately, this also means `OnAccessExtraScanning` (which is built around catching inotify events), and `OnAccessExcludePath` (which is built upon the DDD System) cannot be used in conjunction with `OnAccessMountPath`.
55
-
56
-
57
-## Configuration and Recipes
58
-
59
-
60
-More nuanced behavior can be coerced from ClamAV's On-Access Scanner via careful modification to `clamd.conf`. Each option related to On-Access Scanning is easily identified by looking for the `OnAccess` prefix pre-pended to each option. The default `clamd.conf` file contains descriptions of each option, along with any documented limitations or safety features.
61
-
62
-Below are examples of common use cases, recipes for the correct minimal configuration, and the expected behavioral result.
63
-
64
-
65
-#### Use Case 0x0
66
-  - User needs to watch the entire file system, but blocking malicious access attempts isn't a concern
67
-  ```
68
-  ScanOnAccess yes
69
-  OnAccessMountPath /
70
-  OnAccessExcludeRootUID yes
71
-  ```
72
-
73
-  This configuration will put the On-Access Scanner into `notify-only` mode. It will also ensure only non-root, non-clam, user processes will trigger scans against the filesystem.
74
-
75
-
76
-#### Use Case 0x1
77
-  - System Administrator needs to watch the home directory of multiple Users, but not all users. Blocking access attempts is un-needed.
78
-  ```
79
-  ScanOnAccess yes
80
-  OnAccessIncludePath /home
81
-  OnAccessExcludePath /home/user2
82
-  OnAccessExcludePath /home/user4
83
-  ```
84
-
85
-  With this configuration, the On-Access Scanner will watch the entirety of the `/home` directory recursively in `notify-only` mode. However, it will recursively exclude the `/home/user2` and `/home/user4` directories.
86
-
87
-
88
-#### Use Case 0x2
89
-  - The user needs to protect a single directory non-recursively and ensure all access attempts on malicious files are blocked.
90
-  ```
91
-  ScanOnAccess yes
92
-  OnAccessIncludePath /home/user/Downloads
93
-  OnAccessPrevention yes
94
-  OnAccessDisableDDD yes
95
-  ```
96
-
97
-  The configuration above will result in non-recursive real-time protection of the `/home/user/Downloads` directory by ClamAV's On-Access Scanner. Any access attempts that ClamAV detects on malicious files within the top level of the directory hierarchy will be blocked by fanotify at the kernel level.
98
-
99 1
deleted file mode 100644
... ...
@@ -1,412 +0,0 @@
1
-# Creating signatures for ClamAV
2
-
3
-Table of Contents
4
-
5
-- [Creating signatures for ClamAV](#creating-signatures-for-clamav)
6
-    - [Introduction](#introduction)
7
-    - [Database formats](#database-formats)
8
-        - [Settings databases](#settings-databases)
9
-        - [Signature databases](#signature-databases)
10
-            - [Body-based Signatures](#body-based-signatures)
11
-            - [Hash-based Signatures](#hash-based-signatures)
12
-            - [Alternative signature support](#alternative-signature-support)
13
-        - [Other database files](#other-database-files)
14
-        - [Signature names](#signature-names)
15
-    - [Signature Writing Tips and Tricks](#signature-writing-tips-and-tricks)
16
-        - [Testing rules with `clamscan`](#testing-rules-with-clamscan)
17
-        - [Debug information from libclamav](#debug-information-from-libclamav)
18
-        - [Writing signatures for special files](#writing-signatures-for-special-files)
19
-            - [HTML](#html)
20
-            - [Text files](#text-files)
21
-            - [Compressed Portable Executable files](#compressed-portable-executable-files)
22
-        - [Using `sigtool`](#using-sigtool)
23
-        - [Inspecting signatures inside a CVD file](#inspecting-signatures-inside-a-cvd-file)
24
-        - [External tools](#external-tools)
25
-
26
-## Introduction
27
-
28
-In order to detect malware and other file-based threats, ClamAV relies on signatures to differentiate clean and malicious/unwanted files.  ClamAV signatures are primarily text-based and conform to one of the ClamAV-specific signature formats associated with a given method of detection.  These formats are explained in the [Signature formats](#signature-formats) section below.  In addition, ClamAV 0.99 and above support signatures written in the YARA format.  More information on this can be found in the [Using YARA rules in ClamAV](#using-yara-rules-in-clamav) section.
29
-
30
-The ClamAV project distributes a collection of signatures in the form of CVD (ClamAV Virus Database) files.  The CVD file format provides a digitally-signed container that encapsulates the signatures and ensures that they can't be modified by a malicious third-party.  This signature set is actively maintained by [Cisco Talos](https://www.talosintelligence.com/) and can be downloaded using the `freshclam` application that ships with ClamAV.  For more details on this, see the [CVD file](#inspecting-signatures-inside-a-CVD-file) section.
31
-
32
-## Database formats
33
-
34
-ClamAV CVD and CLD database archives may be unpacked to the current directory using `sigtool -u <database name>`. For more details on inspecting CVD and CLD files, see [Inspecting signatures inside a CVD file](#inspecting-signatures-inside-a-cvd-file). Once unpacked, you'll observe a large collection of database files with various extensions described below.
35
-
36
-The CVD and CLD database archives may be supplemented with custom database files in the formats described to gain additional detection functionality. This is done simply by adding files of the following formats to the database directory, typically `/usr/local/share/clamav` or `"C:\Program Files\ClamAV\database"`. Alternatively, `clamd` and `clamscan` can be instructed to load the database from an alternative database file or database directory manually using the `clamd` `DatabaseDirectory` config option or the `clamscan -d` command line option.
37
-
38
-### Settings databases
39
-
40
-ClamAV provides a handful of configuration related databases along side the signature definitions.
41
-
42
-`*.cfg`: [Dynamic config settings](Signatures/DynamicConfig.md)
43
-
44
-`*.cat` `*.crb`: [Trusted and revoked PE certs](Signatures/AuthenticodeRules.md)
45
-
46
-`*.ftm`: [File Type Magic (FTM)](Signatures/FileTypeMagic.md)
47
-
48
-### Signature databases
49
-
50
-_Note_: Signature databases with an extension ending in `u` are only loaded when Potentially Unwanted Application (PUA) signatures are enabled (default: off).
51
-
52
-#### Body-based Signatures
53
-
54
-Body-based signature content is a definition that matches not based on a hash but based on the specific sequences of bytes exhibited by the target file.
55
-
56
-ClamAV body-based signature content has a [special format](BodySignatureFormat.md) to allow regex-like matching of data that is not entirely known. This format is used extensively in both Extended Signatures and Logical Signatures.
57
-
58
-`*.ndb` `*.ndu`: [Extended signatures](Signatures/ExtendedSignatures.md)
59
-
60
-`*.ldb` `*.ldu`; `*.idb`: [Logical Signatures](Signatures/LogicalSignatures.md)
61
-
62
-`*.cdb`: [Container Metadata Signatures](Signatures/ContainerMetadata.md)
63
-
64
-`*.cbc`: [Bytecode Signatures](Signatures/BytecodeSignatures.md)
65
-
66
-`*.pdb` `*.gdb` `*.wdb`: [Phishing URL Signatures](Signatures/PhishSigs.md)
67
-
68
-#### Hash-based Signatures
69
-
70
-`*.hdb` `*.hsb` `*.hdu` `*.hsu`: File hash signatures
71
-
72
-`*.mdb` `*.msb` `*.mdu` `*.msu`: PE section hash signatures
73
-
74
-[Hash-based Signature format](Signatures/HashSignatures.md)
75
-
76
-#### Alternative signature support
77
-
78
-`*.yar` `*.yara`: [Yara rules](Signatures/YaraRules.md)
79
-
80
-### Other database files
81
-
82
-`*.fp` `*.sfp` `*.ign` `*.ign2`: [Whitelisted files, signatures](Signatures/Whitelists.md)
83
-
84
-`*.pwdb`: [Encrypted archive passwords](Signatures/EncryptedArchives.md)
85
-
86
-`*.info`: [Database information](Signatures/DatabaseInfo.md)`
87
-
88
-### Signature names
89
-
90
-ClamAV uses the following prefixes for signature names:
91
-
92
-- *Worm* for Internet worms
93
-- *Trojan* for backdoor programs
94
-- *Adware* for adware
95
-- *Flooder* for flooders
96
-- *HTML* for HTML files
97
-- *Email* for email messages
98
-- *IRC* for IRC trojans
99
-- *JS* for Java Script malware
100
-- *PHP* for PHP malware
101
-- *ASP* for ASP malware
102
-- *VBS* for VBS malware
103
-- *BAT* for BAT malware
104
-- *W97M*, *W2000M* for Word macro viruses
105
-- *X97M*, *X2000M* for Excel macro viruses
106
-- *O97M*, *O2000M* for generic Office macro viruses
107
-- *DoS* for Denial of Service attack software
108
-- *DOS* for old DOS malware
109
-- *Exploit* for popular exploits
110
-- *VirTool* for virus construction kits
111
-- *Dialer* for dialers
112
-- *Joke* for hoaxes
113
-
114
-Important rules of the naming convention:
115
-
116
-- always use a -zippwd suffix in the malware name for signatures of type zmd,
117
-- always use a -rarpwd suffix in the malware name for signatures of type rmd,
118
-- only use alphanumeric characters, dash (-), dot (.), underscores (_) in malware names, never use space, apostrophe or quote mark.
119
-
120
-## Signature Writing Tips and Tricks
121
-
122
-### Testing rules with `clamscan`
123
-
124
-To test a new signature, first create a text file with the extension corresponding to the signature type (Ex: `.ldb` for logical signatures).  Then, add the signature as it's own line within the file. This file can be passed to `clamscan` via the `-d` option, which tells ClamAV to load signatures from the file specified.  If the signature is not formatted correctly, ClamAV will display an error - run `clamscan` with `--debug --verbose` to see additional information about the error message.  Some common causes of errors include:
125
-
126
-- The signature file has the incorrect extension type for the signatures contained within
127
-- The file has one or more blank lines
128
-- For logical signatures, a semicolon exists at the end of the file
129
-
130
-If the rule is formatted correctly, `clamscan` will load the signature(s) in and scan any files specified via the command line invocation (or all files in the current directory if none are specified).  A successful detection will look like the following:
131
-
132
-```bash
133
-clamscan -d test.ldb text.exe
134
-test.exe: Win.Malware.Agent.UNOFFICIAL FOUND
135
-
136
-Known viruses: 1
137
-Engine version: 0.100.0
138
-Scanned directories: 0
139
-Scanned files: 1
140
-Infected files: 1
141
-Data scanned: 17.45 MB
142
-Data read: 17.45 MB (ratio 1.00:1)
143
-Time: 0.400 sec (0 m 0 s)
144
-```
145
-
146
-If the rule did not match as intended:
147
-
148
-- The file may have exceeded one or more of the default scanning limits built-in to ClamAV.  Try running `clamscan` with the following options to see if raising the limits addresses the issue: `--max-filesize=2000M --max-scansize=2000M --max-files=2000000 --max-recursion=2000000 --max-embeddedpe=2000M --max-htmlnormalize=2000000 --max-htmlnotags=2000000 --max-scriptnormalize=2000000 --max-ziptypercg=2000000 --max-partitions=2000000 --max-iconspe=2000000 --max-rechwp3=2000000 --pcre-match-limit=2000000 --pcre-recmatch-limit=2000000 --pcre-max-filesize=2000M`.
149
-- If matching on HTML or text files, ClamAV might be performing normalization that causes the content of the scanned file to change.  See the [HTML](#html) and [Text file](#text-file) sections for more details.
150
-- libclamav may have been unable to unpack or otherwise process the file.  See [Debug information from libclamav](#debug-information-from-libclamav) for more details.
151
-
152
-NOTE: If you run `clamscan` with a `-d` flag, ClamAV will not load in the signatures downloaded via `freshclam`.  This means that:
153
-
154
-- some of ClamAV's unpacking support might be disabled, since some unpackers are implemented as bytecode signatures
155
-- PE whitelisting based on Authenticode signatures won't work, since this functionality relies on `.crb` rules
156
-
157
-If any of this functionality is needed, load in the CVD files manually with additional `-d` flags.
158
-
159
-### Debug information from libclamav
160
-
161
-In order to create efficient signatures for ClamAV it’s important to understand how the engine handles input files. The best way to see how it works is having a look at the debug information from libclamav. You can do it by calling `clamscan` with the `--debug` and `--leave-temps` flags. The first switch makes `clamscan` display all the interesting information from libclamav and the second one avoids deleting temporary files so they can be analyzed further.
162
-
163
-The now important part of the info is:
164
-
165
-```bash
166
-$ clamscan --debug attachment.exe
167
-[...]
168
-LibClamAV debug: Recognized MS-EXE/DLL file
169
-LibClamAV debug: Matched signature for file type PE
170
-LibClamAV debug: File type: Executable
171
-```
172
-
173
-The engine recognized a windows executable.
174
-
175
-```bash
176
-LibClamAV debug: Machine type: 80386
177
-LibClamAV debug: NumberOfSections: 3
178
-LibClamAV debug: TimeDateStamp: Fri Jan 10 04:57:55 2003
179
-LibClamAV debug: SizeOfOptionalHeader: e0
180
-LibClamAV debug: File format: PE
181
-LibClamAV debug: MajorLinkerVersion: 6
182
-LibClamAV debug: MinorLinkerVersion: 0
183
-LibClamAV debug: SizeOfCode: 0x9000
184
-LibClamAV debug: SizeOfInitializedData: 0x1000
185
-LibClamAV debug: SizeOfUninitializedData: 0x1e000
186
-LibClamAV debug: AddressOfEntryPoint: 0x27070
187
-LibClamAV debug: BaseOfCode: 0x1f000
188
-LibClamAV debug: SectionAlignment: 0x1000
189
-LibClamAV debug: FileAlignment: 0x200
190
-LibClamAV debug: MajorSubsystemVersion: 4
191
-LibClamAV debug: MinorSubsystemVersion: 0
192
-LibClamAV debug: SizeOfImage: 0x29000
193
-LibClamAV debug: SizeOfHeaders: 0x400
194
-LibClamAV debug: NumberOfRvaAndSizes: 16
195
-LibClamAV debug: Subsystem: Win32 GUI
196
-LibClamAV debug: ------------------------------------
197
-LibClamAV debug: Section 0
198
-LibClamAV debug: Section name: UPX0
199
-LibClamAV debug: Section data (from headers - in memory)
200
-LibClamAV debug: VirtualSize: 0x1e000 0x1e000
201
-LibClamAV debug: VirtualAddress: 0x1000 0x1000
202
-LibClamAV debug: SizeOfRawData: 0x0 0x0
203
-LibClamAV debug: PointerToRawData: 0x400 0x400
204
-LibClamAV debug: Section's memory is executable
205
-LibClamAV debug: Section's memory is writeable
206
-LibClamAV debug: ------------------------------------
207
-LibClamAV debug: Section 1
208
-LibClamAV debug: Section name: UPX1
209
-LibClamAV debug: Section data (from headers - in memory)
210
-LibClamAV debug: VirtualSize: 0x9000 0x9000
211
-LibClamAV debug: VirtualAddress: 0x1f000 0x1f000
212
-LibClamAV debug: SizeOfRawData: 0x8200 0x8200
213
-LibClamAV debug: PointerToRawData: 0x400 0x400
214
-LibClamAV debug: Section's memory is executable
215
-LibClamAV debug: Section's memory is writeable
216
-LibClamAV debug: ------------------------------------
217
-LibClamAV debug: Section 2
218
-LibClamAV debug: Section name: UPX2
219
-LibClamAV debug: Section data (from headers - in memory)
220
-LibClamAV debug: VirtualSize: 0x1000 0x1000
221
-LibClamAV debug: VirtualAddress: 0x28000 0x28000
222
-LibClamAV debug: SizeOfRawData: 0x200 0x1ff
223
-LibClamAV debug: PointerToRawData: 0x8600 0x8600
224
-LibClamAV debug: Section's memory is writeable
225
-LibClamAV debug: ------------------------------------
226
-LibClamAV debug: EntryPoint offset: 0x8470 (33904)
227
-```
228
-
229
-The section structure displayed above suggests the executable is packed
230
-with UPX.
231
-
232
-```bash
233
-LibClamAV debug: ------------------------------------
234
-LibClamAV debug: EntryPoint offset: 0x8470 (33904)
235
-LibClamAV debug: UPX/FSG/MEW: empty section found - assuming
236
-                 compression
237
-LibClamAV debug: UPX: bad magic - scanning for imports
238
-LibClamAV debug: UPX: PE structure rebuilt from compressed file
239
-LibClamAV debug: UPX: Successfully decompressed with NRV2B
240
-LibClamAV debug: UPX/FSG: Decompressed data saved in
241
-                 /tmp/clamav-90d2d25c9dca42bae6fa9a764a4bcede
242
-LibClamAV debug: ***** Scanning decompressed file *****
243
-LibClamAV debug: Recognized MS-EXE/DLL file
244
-LibClamAV debug: Matched signature for file type PE
245
-```
246
-
247
-Indeed, libclamav recognizes the UPX data and saves the decompressed
248
-(and rebuilt) executable into
249
-`/tmp/clamav-90d2d25c9dca42bae6fa9a764a4bcede`. Then it continues by
250
-scanning this new file:
251
-
252
-```bash
253
-LibClamAV debug: File type: Executable
254
-LibClamAV debug: Machine type: 80386
255
-LibClamAV debug: NumberOfSections: 3
256
-LibClamAV debug: TimeDateStamp: Thu Jan 27 11:43:15 2011
257
-LibClamAV debug: SizeOfOptionalHeader: e0
258
-LibClamAV debug: File format: PE
259
-LibClamAV debug: MajorLinkerVersion: 6
260
-LibClamAV debug: MinorLinkerVersion: 0
261
-LibClamAV debug: SizeOfCode: 0xc000
262
-LibClamAV debug: SizeOfInitializedData: 0x19000
263
-LibClamAV debug: SizeOfUninitializedData: 0x0
264
-LibClamAV debug: AddressOfEntryPoint: 0x7b9f
265
-LibClamAV debug: BaseOfCode: 0x1000
266
-LibClamAV debug: SectionAlignment: 0x1000
267
-LibClamAV debug: FileAlignment: 0x1000
268
-LibClamAV debug: MajorSubsystemVersion: 4
269
-LibClamAV debug: MinorSubsystemVersion: 0
270
-LibClamAV debug: SizeOfImage: 0x26000
271
-LibClamAV debug: SizeOfHeaders: 0x1000
272
-LibClamAV debug: NumberOfRvaAndSizes: 16
273
-LibClamAV debug: Subsystem: Win32 GUI
274
-LibClamAV debug: ------------------------------------
275
-LibClamAV debug: Section 0
276
-LibClamAV debug: Section name: .text
277
-LibClamAV debug: Section data (from headers - in memory)
278
-LibClamAV debug: VirtualSize: 0xc000 0xc000
279
-LibClamAV debug: VirtualAddress: 0x1000 0x1000
280
-LibClamAV debug: SizeOfRawData: 0xc000 0xc000
281
-LibClamAV debug: PointerToRawData: 0x1000 0x1000
282
-LibClamAV debug: Section contains executable code
283
-LibClamAV debug: Section's memory is executable
284
-LibClamAV debug: ------------------------------------
285
-LibClamAV debug: Section 1
286
-LibClamAV debug: Section name: .rdata
287
-LibClamAV debug: Section data (from headers - in memory)
288
-LibClamAV debug: VirtualSize: 0x2000 0x2000
289
-LibClamAV debug: VirtualAddress: 0xd000 0xd000
290
-LibClamAV debug: SizeOfRawData: 0x2000 0x2000
291
-LibClamAV debug: PointerToRawData: 0xd000 0xd000
292
-LibClamAV debug: ------------------------------------
293
-LibClamAV debug: Section 2
294
-LibClamAV debug: Section name: .data
295
-LibClamAV debug: Section data (from headers - in memory)
296
-LibClamAV debug: VirtualSize: 0x17000 0x17000
297
-LibClamAV debug: VirtualAddress: 0xf000 0xf000
298
-LibClamAV debug: SizeOfRawData: 0x17000 0x17000
299
-LibClamAV debug: PointerToRawData: 0xf000 0xf000
300
-LibClamAV debug: Section's memory is writeable
301
-LibClamAV debug: ------------------------------------
302
-LibClamAV debug: EntryPoint offset: 0x7b9f (31647)
303
-LibClamAV debug: Bytecode executing hook id 257 (0 hooks)
304
-attachment.exe: OK
305
-[...]
306
-```
307
-
308
-No additional files get created by libclamav. By writing a signature for the decompressed file you have more chances that the engine will detect the target data when it gets compressed with another packer.
309
-
310
-This method should be applied to all files for which you want to create signatures. By analyzing the debug information you can quickly see how the engine recognizes and preprocesses the data and what additional files get created. Signatures created for bottom-level temporary files are usually more generic and should help detecting the same malware in different forms.
311
-
312
-### Writing signatures for special files
313
-
314
-#### HTML
315
-
316
-ClamAV contains HTML normalization code which makes it easier to write signatures for HTML data that might differ based on white space, capitalization, and other insignificant differences. Running `sigtool --html-normalise` on a HTML file can be used to see what a file's contents will look like after normalization.  This command should generate the following files:
317
-
318
-- nocomment.html - the file is normalized, lower-case, with all comments and superfluous white space removed
319
-
320
-- notags.html - as above but with all HTML tags removed
321
-
322
-- javascript - any script contents are normalized and the results appended to this file
323
-
324
-The code automatically decodes JScript.encode parts and char ref’s (e.g. `&#102;`). To create a successful signature for the input file type, the rule must match on the contents of one of the created files.  Signatures matching on normalized HTML should have a target type of 3.  For reference, see [Target Types](Signatures/FileTypes.md#Target-Types).
325
-
326
-#### Text files
327
-
328
-Similarly to HTML all ASCII text files get normalized (converted to lower-case, all superfluous white space and control characters removed, etc.) before scanning. Running `sigtool --ascii-normalise` on a text file will result in a normalized version being written to the file named 'normalised\_text'.  Rules matching on normalized ASCII text should have a target type of 7.  For reference, see [Target Types](Signatures/FileTypes.md#Target-Types).
329
-
330
-#### Compressed Portable Executable files
331
-
332
-If the file is compressed with UPX, FSG, Petite or another PE packer supported by libclamav, ClamAV will attempt to automatically unpack the executable and evaluate signatures against the unpacked executable.  To inspect the executable that results from ClamAV's unpacking process, run `clamscan` with `--debug --leave-temps`. Example output for a FSG compressed file:
333
-
334
-```bash
335
-LibClamAV debug: UPX/FSG/MEW: empty section found - assuming compression
336
-LibClamAV debug: FSG: found old EP @119e0
337
-LibClamAV debug: FSG: Unpacked and rebuilt executable saved in
338
-/tmp/clamav-f592b20f9329ac1c91f0e12137bcce6c
339
-
340
-```
341
-
342
-In the example above, `/tmp/clamav-f592b20f9329ac1c91f0e12137bcce6c` is the unpacked executable, and a signature can be written based off of this file.
343
-
344
-### Using `sigtool`
345
-
346
-`sigtool` pulls in libclamav and provides shortcuts to doing tasks that `clamscan` does behind the scenes.  These can be really useful when writing a signature or trying to get information about a signature that might be causing FPs or performance problems.
347
-
348
-The following `sigtool` flags can be especially useful for signature writing:
349
-
350
-- `--md5` / `--sha1` / `--sha256`: Generate the MD5/SHA1/SHA256 hash and calculate the file size, outputting both as a properly-formatted `.hdb`/`.hsb` signature
351
-
352
-- `--mdb`: Generate section hashes of the specified file.  This is useful when generating `.mdb` signatures.
353
-
354
-- `--decode`: Given a ClamAV signature from STDIN, show a more user-friendly representation of it.  An example usage of this flag is `cat test.ldb | sigtool --decode`.
355
-
356
-- `--hex-dump`: Given a sequence of bytes from STDIN, print the hex equivalent. An example usage of this flag is `echo -n "Match on this" | sigtool --hex-dump`.
357
-
358
-- `--html-normalise`: Normalize the specified HTML file in the way that `clamscan` will before looking for rule matches.  Writing signatures off of these files makes it easier to write rules for target type HTML (you'll know what white space, capitalization, etc. to expect). See the [HTML](#html) section for more details.
359
-
360
-- `--ascii-normalise`: Normalize the specified ASCII text file in the way that `clamscan` will before looking for rule matches. Writing signatures off of this normalized file data makes it easier to write rules for target type Txt (you'll know what white space, capitalization, etc. to expect). See the [Text files](#text-files) sectino for more details.
361
-
362
-- `--print-certs`: Print the Authenticode signatures of any PE files specified.
363
-  This is useful when writing signature-based `.crb` rule files.
364
-
365
-- `--vba`: Extract VBA/Word6 macro code
366
-
367
-- `--test-sigs`: Given a signature and a sample, determine whether the signature matches and, if so, display the offset into the file where the match occurred.  This can be useful for investigating false positive matches in clean files.
368
-
369
-### Inspecting signatures inside a CVD file
370
-
371
-CVD (ClamAV Virus Database) is a digitally signed container that includes signature databases in various text formats. The header of the container is a 512 bytes long string with colon separated fields:
372
-
373
-```
374
-ClamAV-VDB:build time:version:number of signatures:functionality level required:MD5 checksum:digital signature:builder name:build time (sec)
375
-```
376
-
377
-`sigtool --info` displays detailed information about a given CVD file:
378
-
379
-```bash
380
-zolw@localhost:/usr/local/share/clamav$ sigtool -i main.cvd
381
-File: main.cvd
382
-Build time: 09 Dec 2007 15:50 +0000
383
-Version: 45
384
-Signatures: 169676
385
-Functionality level: 21
386
-Builder: sven
387
-MD5: b35429d8d5d60368eea9630062f7c75a
388
-Digital signature: dxsusO/HWP3/GAA7VuZpxYwVsE9b+tCk+tPN6OyjVF/U8
389
-JVh4vYmW8mZ62ZHYMlM903TMZFg5hZIxcjQB3SX0TapdF1SFNzoWjsyH53eXvMDY
390
-eaPVNe2ccXLfEegoda4xU2TezbGfbSEGoU1qolyQYLX674sNA2Ni6l6/CEKYYh
391
-Verification OK.
392
-```
393
-
394
-The ClamAV project distributes a number of CVD files, including `main.cvd` and `daily.cvd`.
395
-
396
-To view the signature associated with a given detection name, the CVD files can be unpacked and the underlying text files searched for a rule definition using a tool like `grep`.  To do this, use `sigtool`'s `--unpack` flag as follows:
397
-
398
-```bash
399
-$ mkdir /tmp/clamav-sigs
400
-$ cd /tmp/clamav-sigs/
401
-$ sigtool --unpack /var/lib/clamav/main.cvd
402
-$ ls
403
-COPYING   main.fp   main.hsb   main.mdb  main.ndb
404
-main.crb  main.hdb  main.info  main.msb  main.sfp
405
-```
406
-
407
-### External tools
408
-
409
-Below are tools that can be helpful when writing ClamAV signatures:
410
-
411
-- [CASC](https://github.com/Cisco-Talos/CASC) - CASC is a plugin for IDA Pro that allows the user to highlight sections of code and create a signature based on the underlying instructions (with options to ignore bytes associated with registers, addresses, and offsets).  It also contains SigAlyzer, a tool to take an existing signature and locate the regions within the binary that match the subsignatures.
412 1
deleted file mode 100644
... ...
@@ -1,34 +0,0 @@
1
-# Trusted and Revoked Certificates
2
-
3
-Clamav 0.98 checks signed PE files for certificates and verifies each certificate in the chain against a database of trusted and revoked certificates. The signature format is
4
-
5
-```
6
-    Name;Trusted;Subject;Serial;Pubkey;Exponent;CodeSign;TimeSign;CertSign;
7
-    NotBefore;Comment[;minFL[;maxFL]]
8
-```
9
-
10
-where the corresponding fields are:
11
-
12
-- `Name:` name of the entry
13
-
14
-- `Trusted:` bit field, specifying whether the cert is trusted. 1 for trusted. 0 for revoked
15
-
16
-- `Subject:` sha1 of the Subject field in hex
17
-
18
-- `Serial:` the serial number as clamscan –debug –verbose reports
19
-
20
-- `Pubkey:` the public key in hex
21
-
22
-- `Exponent:` the exponent in hex. Currently ignored and hardcoded to 010001 (in hex)
23
-
24
-- `CodeSign:` bit field, specifying whether this cert can sign code. 1 for true, 0 for false
25
-
26
-- `TimeSign:` bit field. 1 for true, 0 for false
27
-
28
-- `CertSign:` bit field, specifying whether this cert can sign other certs. 1 for true, 0 for false
29
-
30
-- `NotBefore:` integer, cert should not be added before this variable. Defaults to 0 if left empty
31
-
32
-- `Comment:` comments for this entry
33
-
34
-The signatures for certs are stored inside `.crb` files.
35 1
deleted file mode 100644
... ...
@@ -1,90 +0,0 @@
1
-# Body-based Signature Content Format
2
-
3
-ClamAV stores all body-based signatures in a hexadecimal format. In this section by a hex-signature we mean a fragment of malware’s body converted into a hexadecimal string which can be additionally extended using various wildcards.
4
-
5
-## Hexadecimal format
6
-
7
-You can use `sigtool --hex-dump` to convert any data into a hex-string:
8
-
9
-```bash
10
-zolw@localhost:/tmp/test$ sigtool --hex-dump
11
-How do I look in hex?
12
-486f7720646f2049206c6f6f6b20696e206865783f0a
13
-```
14
-
15
-## Wildcards
16
-
17
-ClamAV supports the following wildcards for hex-signatures:
18
-
19
-- `??`
20
-
21
-  Match any byte.
22
-
23
-- `a?`
24
-
25
-  Match a high nibble (the four high bits).
26
-
27
-- `?a`
28
-
29
-  Match a low nibble (the four low bits).
30
-
31
-- `*`
32
-
33
-  Match any number of bytes.
34
-
35
-- `{n}`
36
-
37
-  Match `n` bytes.
38
-
39
-- `{-n}`
40
-
41
-  Match `n` or less bytes.
42
-
43
-- `{n-}`
44
-
45
-  Match `n` or more bytes.
46
-
47
-- `{n-m}`
48
-
49
-  Match between `n` and `m` bytes (where `m > n`).
50
-
51
-- `HEXSIG[x-y]aa` or `aa[x-y]HEXSIG`
52
-
53
-  Match `aa` anchored to a hex-signature, see [Bugzilla ticket 776](https://bugzilla.clamav.net/show_bug.cgi?id=776) for discussion and
54
-  examples.
55
-
56
-The range signatures `*` and `{}` virtually separate a hex-signature into two parts, eg. `aabbcc*bbaacc` is treated as two sub-signatures `aabbcc` and `bbaacc` with any number of bytes between them. It’s a requirement that each sub-signature includes a block of two static characters somewhere in its body. Note that there is one exception to this restriction; that is when the range wildcard is of the form `{n}` with `n<128`. In this case, ClamAV uses an optimization and translates `{n}` to the string consisting of `n ??` character wildcards. Character wildcards do not divide hex signatures into two parts and so the two static character requirement does not apply.
57
-
58
-## Character classes
59
-
60
-ClamAV supports the following character classes for hex-signatures:
61
-
62
-- `(B)`
63
-
64
-  Match word boundary (including file boundaries).
65
-
66
-- `(L)`
67
-
68
-  Match CR, CRLF or file boundaries.
69
-
70
-- `(W)`
71
-
72
-  Match a non-alphanumeric character.
73
-
74
-## Alternate strings
75
-
76
-- Single-byte alternates (clamav-0.96) `(aa|bb|cc|...)` or `!(aa|bb|cc|...)` Match a member from a set of bytes (eg: `aa`, `bb`, `cc`, ...).
77
-  - Negation operation can be applied to match any non-member, assumed to be one-byte in length.
78
-  - Signature modifiers and wildcards cannot be applied.
79
-
80
-- Multi-byte fixed length alternates `(aaaa|bbbb|cccc|...)` or `!(aaaa|bbbb|cccc|...)` Match a member from a set of multi-byte alternates (eg: aaaa, bbbb, cccc, ...) of n-length.
81
-  - All set members must be the same length.
82
-  - Negation operation can be applied to match any non-member, assumed to be n-bytes in length (clamav-0.98.2).
83
-  - Signature modifiers and wildcards cannot be applied.
84
-
85
-- Generic alternates (clamav-0.99) `(alt1|alt2|alt3|...)` Match a member from a set of alternates (eg: alt1, alt2, alt3, ...) that can be of variable lengths.
86
-  - Negation operation cannot be applied.
87
-  - Signature modifiers and nibble wildcards (eg: `??, a?, ?a`) can be applied.
88
-  - Ranged wildcards (eg: `{n-m}`) are limited to a fixed range of less than 128 bytes (eg: `{1} -> {127}`).
89
-
90
-Note that using signature modifiers and wildcards classifies the alternate type to be a generic alternate. Thus single-byte alternates and multi-byte fixed length alternates can use signature modifiers and wildcards but will be classified as generic alternate. This means that negation cannot be applied in this situation and there is a slight performance impact.
91 1
deleted file mode 100644
... ...
@@ -1,11 +0,0 @@
1
-# Bytecode Signatures
2
-
3
-Bytecode Signatures are the means by which more complex matching can be performed by writing C code to parse sample content at various stages in file extraction.
4
-
5
-It is less complicated than it sounds. Essentially the signature author writes a function in C is compiled down to an intermediate language called "bytecode". This bytecode is encoded in ASCII `.cbc` file and distributed in `bytecode.[cvd|cld]`. When the database is loaded, ClamAV can interpret this bytecode to execute the function.
6
-
7
-Bytecode functions are provided with a set of API's that may be used to access the sample data, and to access what metadata ClamAV already has concerning the sample.
8
-
9
-The function may at any time call an API to flag the sample as malicious, and may provide the signature/virus name at that time. This means a single bytecode signature (function) is written to handle a given file type and may trigger different alerts with different signature names as additional malicious characteristics for the file type are identified. That isn't to say that only one bytecode signature may be assigned to a given filetype, but that a single author may find it to be more efficient to use a bytecode signature to identify more than one type of malware.
10
-
11
-The specifics on how to write and compile bytecode signatures are outside of the scope of this documentation. Extensive documentation on ClamAV Bytecode Signatures are provided with the [ClamAV Bytecode Compiler](https://github.com/vrtadmin/clamav-bytecode-compiler).
12 1
deleted file mode 100644
... ...
@@ -1,44 +0,0 @@
1
-# Signatures based on container metadata
2
-
3
-ClamAV 0.96 allows creating generic signatures matching files stored inside different container types which meet specific conditions. The signature format is:
4
-
5
-```
6
-    VirusName:ContainerType:ContainerSize:FileNameREGEX:
7
-    FileSizeInContainer:FileSizeReal:IsEncrypted:FilePos:
8
-    Res1:Res2[:MinFL[:MaxFL]]
9
-```
10
-
11
-where the corresponding fields are:
12
-
13
-- `VirusName:` Virus name to be displayed when signature matches.
14
-
15
-- `ContainerType:` The file type containing the target file.  For example:
16
-  - `CL_TYPE_ZIP`,
17
-  - `CL_TYPE_RAR`,
18
-  - `CL_TYPE_ARJ`,
19
-  - `CL_TYPE_MSCAB`,
20
-  - `CL_TYPE_7Z`,
21
-  - `CL_TYPE_MAIL`,
22
-  - `CL_TYPE_(POSIX|OLD)_TAR`,
23
-  - `CL_TYPE_CPIO_(OLD|ODC|NEWC|CRC)`
24
-
25
-  Use `*` as a wild card to indicate that container type may be any file type.
26
-  For a full list of ClamAV file types, see the [ClamAV File Types Reference](ClamAVFileTypes.md).
27
-
28
-- `ContainerSize:` size of the container file itself (eg. size of the zip archive) specified in bytes as absolute value or range `x-y`.
29
-
30
-- `FileNameREGEX:` regular expression describing name of the target file
31
-
32
-- `FileSizeInContainer:` usually compressed size; for MAIL, TAR and CPIO == `FileSizeReal`; specified in bytes as absolute value or range.
33
-
34
-- `FileSizeReal:` usually uncompressed size; for MAIL, TAR and CPIO == `FileSizeInContainer`; absolute value or range.
35
-
36
-- `IsEncrypted:` 1 if the target file is encrypted, 0 if it’s not and `*` to ignore
37
-
38
-- `FilePos:` file position in container (counting from 1); absolute value or range.
39
-
40
-- `Res1:` when `ContainerType` is `CL_TYPE_ZIP` or `CL_TYPE_RAR` this field is treated as a CRC sum of the target file specified in hexadecimal format; for other container types it’s ignored.
41
-
42
-- `Res2:` not used as of ClamAV 0.96.
43
-
44
-The signatures for container files are stored inside `.cdb` files.
45 1
deleted file mode 100644
... ...
@@ -1,15 +0,0 @@
1
-# Database Info
2
-
3
-The `.info` file format specifies information about the other database files unpacked from a CVD or CLD database archive. This file exists for the purposes of validating the correctness of the official ClamAV database container files and cannot be loaded a la carte.
4
-
5
-The format is simply:
6
-
7
-```
8
-name:size:sha256
9
-```
10
-
11
-`name`: The database file name.
12
-
13
-`size`: The size in bytes of the database.
14
-
15
-`sha256`: A SHA256 hash of the database.
16 1
deleted file mode 100644
... ...
@@ -1,81 +0,0 @@
1
-# Dynamic Configuration (DCONF)
2
-
3
-ClamAV supports a limited set of configuration options that may be enabled or disabled via settings in the `*.cfg` database. At this time, these settings are distributed in `daily.cfg`.
4
-
5
-The goal of DCONF is to enable the ClamAV team to rapidly disable new or experimental features for specific ClamAV versions if a significant defect is discovered after release.
6
-
7
-This database is small, and the settings are largely vestigial. The team has not had a need to disable many features in a long time, and so the ClamAV versions in the settings at this time should no longer be in use.
8
-
9
-The strings and values referenced in `daily.cfg` are best cross-referenced with the macros and structures defined here:
10
-
11
-* https://github.com/Cisco-Talos/clamav-devel/blob/dev/0.101/libclamav/dconf.h#L49
12
-* https://github.com/Cisco-Talos/clamav-devel/blob/dev/0.101/libclamav/dconf.c#L54
13
-
14
-The format for a DCONF signature is:
15
-
16
-```
17
-Category:Flags:StartFlevel:EndFlevel
18
-```
19
-
20
-`Category` may be one of:
21
-
22
-* PE
23
-* ELF
24
-* MACHO
25
-* ARCHIVE
26
-* DOCUMENT
27
-* MAIL
28
-* OTHER
29
-* PHISHING
30
-* BYTECODE
31
-* STATS
32
-* PCRE
33
-
34
-`Flags`:
35
-
36
-Every feature that may be configured via DCONF is listed in `struct dconf_module modules` in `libclamav/dconf.c`. Any given feature may be default-on or default-off. Default-on features have the 4th field set to a `1` and default off are set to `0`. The `Flags` field for a given `Category` overrides the defaults for all of the options listed under that category. 
37
-
38
-A settings of `0x0`, for example, means that all options the category be disabled.
39
-
40
-The macros listed in `libclamav/dconf.h` will help you identify which bits to set to get the desired results.
41
-
42
-`StartFlevel`:
43
-
44
-This is the [FLEVEL](FunctionalityLevels.md) of the minimum ClamAV engine for which you want the settings to be in effect.
45
-
46
-`EndFlevel`:
47
-
48
-This is the [FLEVEL](FunctionalityLevels.md) of the maximum ClamAV engine for which you want the settings to be in effect.  You may wish to select `255` to override the defaults of future releases.
49
-
50
-## Example
51
-
52
-Consider the `OTHER_CONF_PDFNAMEOBJ` option in the `category` `OTHER`.
53
-
54
-```c
55
-#define OTHER_CONF_UUENC        0x1     // Default: 1
56
-#define OTHER_CONF_SCRENC       0x2     // Default: 1
57
-#define OTHER_CONF_RIFF         0x4     // Default: 1
58
-#define OTHER_CONF_JPEG         0x8     // Default: 1
59
-#define OTHER_CONF_CRYPTFF      0x10    // Default: 1
60
-#define OTHER_CONF_DLP          0x20    // Default: 1
61
-#define OTHER_CONF_MYDOOMLOG    0x40    // Default: 1
62
-#define OTHER_CONF_PREFILTERING 0x80    // Default: 1
63
-#define OTHER_CONF_PDFNAMEOBJ   0x100   // Default: 1
64
-#define OTHER_CONF_PRTNINTXN    0x200   // Default: 1
65
-#define OTHER_CONF_LZW          0x400   // Default: 1
66
-```
67
-
68
-All of the `OTHER` options, including `OTHER_CONF_PDFNAMEOBJ` are default-on. To disable the option for ClamAV v0.100.X but leave the other options in their default settings, we would need to set the flags to:
69
-
70
-```binary
71
-0110 1111 1111
72
-   ^pdfnameobj off
73
-```
74
-
75
-Or in hex: `0x6FF`
76
-
77
-The example setting to place in `daily.cfg` then woudl be:
78
-
79
-```
80
-OTHER:0x6FF:90:99
81
-```
82 1
deleted file mode 100644
... ...
@@ -1,23 +0,0 @@
1
-# Passwords for archive files \[experimental\]
2
-
3
-ClamAV 0.99 allows for users to specify password attempts for certain password-compatible archives. Passwords will be attempted in order of appearance in the password signature file which use the extension of `.pwdb`. If no passwords apply or none are provided, ClamAV will default to the original behavior of parsing the file. Currently, as of ClamAV 0.99 \[flevel 81\], only `.zip` archives using the traditional PKWARE encryption are supported. The signature format is
4
-
5
-```
6
-SignatureName;TargetDescriptionBlock;PWStorageType;Password
7
-```
8
-
9
-where:
10
-
11
-- `SignatureName`: name to be displayed during debug when a password is successful
12
-
13
-- `TargetDescriptionBlock`: provides information about the engine and target file with comma separated Arg:Val pairs
14
-  - `Engine:X-Y`: Required engine functionality level. See the [FLEVEL reference](FunctionalityLevels.md) for details.
15
-  - `Container:CL_TYPE_*`: File type of applicable containers
16
-
17
-- `PWStorageType`: determines how the password field is parsed
18
-  - 0 = cleartext
19
-  - 1 = hex
20
-
21
-- `Password`: value used in password attempt
22
-
23
-The signatures for password attempts are stored inside `.pwdb` files.
24 1
deleted file mode 100644
... ...
@@ -1,37 +0,0 @@
1
-# Extended signature format
2
-
3
-The extended signature format is ClamAV's most basic type of body-based signature since the deprecation of the original `.db` database format.
4
-
5
-Extended sigantures allow for specification of additional information beyond just hexidecimal content such as a file "target type", virus offset, or engine functionality level (FLEVEL), making the detection more reliable.
6
-
7
-The format is:
8
-
9
-```
10
-    MalwareName:TargetType:Offset:HexSignature[:min_flevel:[max_flevel]]
11
-```
12
-
13
-`MalwareName`: The virus name. Should conform to the standards defined [here](../Signatures.md#Signature-names).
14
-
15
-`TargetType`: A number specifying the type of the target file: [Target Types](FileTypes.md#Target-Types)
16
-
17
-`Offset`: An asterisk or a decimal number `n` possibly combined with a special modifier:
18
-
19
-- `*` = any
20
-- `n` = absolute offset
21
-- `EOF-n` = end of file minus `n` bytes
22
-
23
-Signatures for PE, ELF and Mach-O files additionally support:
24
-
25
-- `EP+n` = entry point plus n bytes (`EP+0` for `EP`)
26
-- `EP-n` = entry point minus n bytes
27
-- `Sx+n` = start of section `x`’s (counted from 0) data plus `n` bytes
28
-- `SEx` = entire section `x` (offset must lie within section boundaries)
29
-- `SL+n` = start of last section plus `n` bytes
30
-
31
-All the above offsets except `*` can be turned into **floating offsets** and represented as `Offset,MaxShift` where `MaxShift` is an unsigned integer. A floating offset will match every offset between `Offset` and `Offset+MaxShift`, eg. `10,5` will match all offsets from 10 to 15 and `EP+n,y` will match all offsets from `EP+n` to `EP+n+y`. Versions of ClamAV older than 0.91 will silently ignore the `MaxShift` extension and only use `Offset`. Optional `MinFL` and `MaxFL` parameters can restrict the signature to specific engine releases. All signatures in the extended format must be placed inside `*.ndb` files.
32
-
33
-`HexSignature`: The body-based content matching [format](BodySignatureFormat.md).
34
-
35
-`min_flevel`: (optional) The minimum ClamAV engine that the file type signature works with. See the [FLEVEL reference](FunctionalityLevels.md) for details. To be used in the event that file type support has been recently added.
36
-
37
-`max_flevel`: (optional, requires `min_flevel`) The maximum ClamAV engine that the file type signature works with. To be used in the event that file type support has been recently removed.
38 1
deleted file mode 100644
... ...
@@ -1,33 +0,0 @@
1
-# File Type Magic
2
-
3
-ClamAV's primary mechanism for determining file types is to match the file with a File Type Magic signature. These file type signatures are compiled into ClamAV, and may also be overridden dynamically using the definition founds found in a `*.ftm` file.
4
-
5
-The ClamAV standard signature database includes these definitions in `daily.ftm`.
6
-
7
-The signature format is not too disimilar from NDB body-based signatures.
8
-
9
-The format is:
10
-
11
-```
12
-    magictype:offset:magicbytes:name:type:type[:min_flevel[:max_flevel]]
13
-```
14
-
15
-Where:
16
-
17
-`magictype`: Supported magic types include:
18
-
19
-* 0 - direct memory comparison of `magicbytes` for file types
20
-* 1 - The `magicbytes` use the body-based content matching [format](BodySignatureFormat.md).
21
-* 4 - direct memory comparison of `magicbytes` for partition types (HFS+, HFSX)
22
-
23
-`offset`: The offset from start of the file to match against.  May be `*` if `magictype` is 1.
24
-
25
-`name`: A descriptive name for the file type.
26
-
27
-`rtype`: Usually CL_TYPE_ANY.
28
-
29
-`type`: The CL_TYPE corresponding with the file type signature. See the [CL_TYPE reference](ClamAVFileTypes.md) for details.
30
-
31
-`min_flevel`: (optional) The minimum ClamAV engine that the file type signature works with. See the [FLEVEL reference](FunctionalityLevels.md) for details. To be used in the event that file type support has been recently added.
32
-
33
-`max_flevel`: (optional, requires `min_flevel`) The maximum ClamAV engine that the file type signature works with. To be used in the event that file type support has been recently removed.
34 1
deleted file mode 100644
... ...
@@ -1,120 +0,0 @@
1
-# ClamAV File Types
2
-
3
-ClamAV maintains it's own file typing format and assigns these types using either:
4
-
5
-- Evaluation of a unique sequence of bytes at the start of a file ([File Type Magic](Signatures/FileTypeMagic.md)).
6
-- File type indicators when parsing container files.
7
-  - For example:
8
-    CL_TYPE_SCRIPT may be assigned to data contained in a PDF when the PDF indicates that a stream of bytes is "Javascript"
9
-- File type determination based on the names or characteristics contained within the file.
10
-  - For example:
11
-    CL_TYPE_OOXML_WORD may be assigned to a Zip file containing files with specific names.
12
-
13
-## Target Types
14
-
15
-A Target Type is an integer that indicates which kind of file the signature will match against. Target Type notation was first created for the purposes writing efficient signatures. A signature with a target type of `0` will be run against every file type, and thus is not ideal. However, the Target Type notation is limited and it may be unavoidable.
16
-
17
-Although the newer CL_TYPE string name notation has replaced the Target Type for some signature formats, many signature formats require a target type number.
18
-
19
-This is the current list of available Targe Types:
20
-
21
-- 0 = any file
22
-- 1 = Portable Executable, both 32- and 64-bit.
23
-- 2 = OLE2 containers, including their specific macros. The OLE2 format is primarily used by MS Office and MSI installation files.
24
-- 3 = HTML (normalized)
25
-- 4 = Mail file
26
-- 5 = Graphics
27
-- 6 = ELF
28
-- 7 = ASCII text file (normalized)
29
-- 8 = Unused
30
-- 9 = Mach-O files
31
-- 10 = PDF files
32
-- 11 = Flash files
33
-- 12 = Java class files
34
-
35
-**_Important_: HTML, ASCII, Javascript are all normalized.
36
-
37
-- ASCII:
38
-  - All lowercase.
39
-- HTML:
40
-  - Whitespace transformed to spaces, tags/tag attributes normalized, all lowercase.
41
-- Javascript:
42
-  - All strings are normalized (hex encoding is decoded), numbers are parsed and normalized, local variables/function names are normalized to ’n001’ format, argument to eval() is parsed as JS again, unescape() is handled, some simple JS packers are handled, output is whitespace normalized.
43
-
44
-## CL_TYPEs
45
-
46
-ClamAV Types are prefixed with `CL_TYPE_`.  The following is an exhaustive list of all current CL_TYPE's.
47
-
48
-| CL_TYPE                | Description                                                  |
49
-|------------------------|--------------------------------------------------------------|
50
-| `CL_TYPE_7Z`           | 7-Zip Archive                                                |
51
-| `CL_TYPE_7ZSFX`        | Self-Extracting 7-Zip Archive                                |
52
-| `CL_TYPE_APM`          | Disk Image - Apple Partition Map                             |
53
-| `CL_TYPE_ARJ`          | ARJ Archive                                                  |
54
-| `CL_TYPE_ARJSFX`       | Self-Extracting ARJ Archive                                  |
55
-| `CL_TYPE_AUTOIT`       | AutoIt Automation Executable                                 |
56
-| `CL_TYPE_BINARY_DATA`  | binary data                                                  |
57
-| `CL_TYPE_BINHEX`       | BinHex Macintosh 7-bit ASCII email attachment encoding       |
58
-| `CL_TYPE_BZ`           | BZip Compressed File                                         |
59
-| `CL_TYPE_CABSFX`       | Self-Extracting Microsoft CAB Archive                        |
60
-| `CL_TYPE_CPIO_CRC`     | CPIO Archive (CRC)                                           |
61
-| `CL_TYPE_CPIO_NEWC`    | CPIO Archive (NEWC)                                          |
62
-| `CL_TYPE_CPIO_ODC`     | CPIO Archive (ODC)                                           |
63
-| `CL_TYPE_CPIO_OLD`     | CPIO Archive (OLD, Little Endian or Big Endian)              |
64
-| `CL_TYPE_CRYPTFF`      | Files encrypted by CryptFF malware                           |
65
-| `CL_TYPE_DMG`          | Apple DMG Archive                                            |
66
-| `CL_TYPE_ELF`          | ELF Executable (Linux/Unix program or library)               |
67
-| `CL_TYPE_GPT`          | Disk Image - GUID Partition Table                            |
68
-| `CL_TYPE_GRAPHICS`     | TIFF (Little Endian or Big Endian)                           |
69
-| `CL_TYPE_GZ`           | GZip Compressed File                                         |
70
-| `CL_TYPE_HTML_UTF16`   | Wide-Character / UTF16 encoded HTML                          |
71
-| `CL_TYPE_HTML`         | HTML data                                                    |
72
-| `CL_TYPE_HWP3`         | Hangul Word Processor (3.X)                                  |
73
-| `CL_TYPE_HWPOLE2`      | Hangul Word Processor embedded OLE2                          |
74
-| `CL_TYPE_INTERNAL`     | Internal properties                                          |
75
-| `CL_TYPE_ISHIELD_MSI`  | Windows Install Shield MSI installer                         |
76
-| `CL_TYPE_ISO9660`      | ISO 9660 file system for optical disc media                  |
77
-| `CL_TYPE_JAVA`         | Java Class File                                              |
78
-| `CL_TYPE_LNK`          | Microsoft Windows Shortcut File                              |
79
-| `CL_TYPE_MACHO_UNIBIN` | Universal Binary/Java Bytecode                               |
80
-| `CL_TYPE_MACHO`        | Apple/NeXTSTEP Mach-O Executable file format                 |
81
-| `CL_TYPE_MAIL`         | Email file                                                   |
82
-| `CL_TYPE_MBR`          | Disk Image - Master Boot Record                              |
83
-| `CL_TYPE_MHTML`        | MHTML Saved Web Page                                         |
84
-| `CL_TYPE_MSCAB`        | Microsoft CAB Archive                                        |
85
-| `CL_TYPE_MSCHM`        | Microsoft CHM help archive                                   |
86
-| `CL_TYPE_MSEXE`        | Microsoft EXE / DLL Executable file                          |
87
-| `CL_TYPE_MSOLE2`       | Microsoft OLE2 Container file                                |
88
-| `CL_TYPE_MSSZDD`       | Microsoft Compressed EXE                                     |
89
-| `CL_TYPE_NULSFT`       | NullSoft Scripted Installer program                          |
90
-| `CL_TYPE_OLD_TAR`      | TAR archive (old)                                            |
91
-| `CL_TYPE_OOXML_HWP`    | Hangul Office Open Word Processor (5.X)                      |
92
-| `CL_TYPE_OOXML_PPT`    | Microsoft Office Open XML PowerPoint                         |
93
-| `CL_TYPE_OOXML_WORD`   | Microsoft Office Open Word 2007+                             |
94
-| `CL_TYPE_OOXML_XL`     | Microsoft Office Open Excel 2007+                            |
95
-| `CL_TYPE_PART_HFSPLUS` | Apple HFS+ partition                                         |
96
-| `CL_TYPE_PDF`          | Adobe PDF document                                           |
97
-| `CL_TYPE_POSIX_TAR`    | TAR archive                                                  |
98
-| `CL_TYPE_PS`           | Postscript                                                   |
99
-| `CL_TYPE_RAR`          | RAR Archive                                                  |
100
-| `CL_TYPE_RARSFX`       | Self-Extracting RAR Archive                                  |
101
-| `CL_TYPE_RIFF`         | Resource Interchange File Format container formatted file    |
102
-| `CL_TYPE_RTF`          | Rich Text Format document                                    |
103
-| `CL_TYPE_SCRENC`       | Files encrypted by ScrEnc malware                            |
104
-| `CL_TYPE_SCRIPT`       | Generic type for scripts (Javascript, Python, etc)           |
105
-| `CL_TYPE_SIS`          | Symbian OS Software Installation Script Archive              |
106
-| `CL_TYPE_SWF`          | Adobe Flash File (LZMA, Zlib, or uncompressed)               |
107
-| `CL_TYPE_TEXT_ASCII`   | ASCII text                                                   |
108
-| `CL_TYPE_TEXT_UTF16BE` | UTF-16BE text                                                |
109
-| `CL_TYPE_TEXT_UTF16LE` | UTF-16LE text                                                |
110
-| `CL_TYPE_TEXT_UTF8`    | UTF-8 text                                                   |
111
-| `CL_TYPE_TNEF`         | Microsoft Outlook & Exchange email attachment format         |
112
-| `CL_TYPE_UUENCODED`    | UUEncoded (Unix-to-Unix) binary file (Unix email attachment) |
113
-| `CL_TYPE_XAR`          | XAR Archive                                                  |
114
-| `CL_TYPE_XDP`          | Adobe XDP - Embedded PDF                                     |
115
-| `CL_TYPE_XML_HWP`      | Hangul Word Processor XML (HWPML) Document                   |
116
-| `CL_TYPE_XML_WORD`     | Microsoft Word 2003 XML Document                             |
117
-| `CL_TYPE_XML_XL`       | Microsoft Excel 2003 XML Document                            |
118
-| `CL_TYPE_XZ`           | XZ Archive                                                   |
119
-| `CL_TYPE_ZIP`          | Zip Archive                                                  |
120
-| `CL_TYPE_ZIPSFX`       | Self-Extracting Zip Archive                                  |
121 1
deleted file mode 100644
... ...
@@ -1,30 +0,0 @@
1
-# Functionality Levels (FLEVELs)
2
-
3
-The Functionality Level (or FLEVEL) is an integer that signatures may use to define which versions of ClamAV the signature features support. It is up to the signature writers to select the correct FLEVEL or range of FLEVELs when writing a signature so that it does not cause failures in older versions of ClamAV.
4
-
5
-Setting appropriate FLEVELs in signatures is particularly crucial when using features added in the last 3-4 major release versions.
6
-
7
-## ClamAV Version to FLEVEL chart
8
-
9
-| flevel | version | release | new signature features                                                 |
10
-|--------|---------|---------|------------------------------------------------------------------------|
11
-| 41     | 0.95.0  | 3/2009  | Ignores use ign format (including line number).                        |
12
-| 51     | 0.96.0  | 3/2010  | Bytecode & CDB sigs. Start using ign2.                                 |
13
-| 56     | 0.96.4  | 10/2010 | Min level for bytecode sigs.                                           |
14
-| 60     | 0.97.0  | 2/2011  |                                                                        |
15
-| 74     | 0.98.0  | 9/2013  | ISO9660 scanning support. All-match feature.                           |
16
-|        |         |         | Wild card bracket notation{} for body-based signatures.                |
17
-|        |         |         | "SE" offset modifier.                                                  |
18
-|        |         |         | Target types 10 - 13: (PDF, (SWF) Flash, Java, Internal).              |
19
-| 76     | 0.98.1  | 1/2014  | XZ support and ForceToDisk scan option.                                |
20
-|        |         |         | Libxml2, XAR, DMG, HFS+/HFSX.                                          |
21
-|        |         |         | FTM type 4 (in-buffer partition magic, analogous to type 0 for files). |
22
-| 79     | 0.98.5  | 11/2014 | File properties (preclass). Target type 13: for preclass feature.      |
23
-| 81     | 0.99.0  | 11/2015 | Yara and PCRE support. Target type 14: non-listed types ("other").     |
24
-| 82     | 0.99.1  | 2/2016  | Hangul Word Processor (HWP) type file parser.                          |
25
-| 90     | 0.100   | 4/2018  | "Intermediates" logical sig expression option.                         |
26
-|        |         |         | MHTML and PostScript types.                                            |
27
-|        |         |         | Substring wildcard (*) fix: order matters, substrings can't overlap.   |
28
-| 100    | 0.101   | 12/2018 | "Byte-Compare" Logical subsignature. Windows Shortcut (LNK) type.      |
29
-
30
-For more inforamtion on ClamAV file type support, see the [File Types Reference](FileTypes.md).
31 1
deleted file mode 100644
... ...
@@ -1,67 +0,0 @@
1
-# File hash signatures
2
-
3
-The easiest way to create signatures for ClamAV is to use filehash checksums, however this method can be only used against static malware.
4
-
5
-## MD5 hash-based signatures
6
-
7
-To create a MD5 signature for `test.exe` use the `--md5` option of
8
-sigtool:
9
-
10
-```bash
11
-zolw@localhost:/tmp/test$ sigtool --md5 test.exe > test.hdb
12
-zolw@localhost:/tmp/test$ cat test.hdb
13
-48c4533230e1ae1c118c741c0db19dfb:17387:test.exe
14
-```
15
-
16
-That’s it! The signature is ready for use:
17
-
18
-```bash
19
-zolw@localhost:/tmp/test$ clamscan -d test.hdb test.exe
20
-test.exe: test.exe FOUND
21
-
22
-Known viruses: 1
23
-Scanned directories: 0
24
-Engine version: 0.92.1
25
-Scanned files: 1
26
-Infected files: 1
27
-Data scanned: 0.02 MB
28
-Time: 0.024 sec (0 m 0 s)
29
-```
30
-
31
-You can change the name (by default sigtool uses the name of the file) and place it inside a `*.hdb` file. A single database file can include any number of signatures. To get them automatically loaded each time `clamscan`/`clamd` starts just copy the database file(s) into the local virus database directory (eg. `/usr/local/share/clamav`).
32
-
33
-*The hash-based signatures shall not be used for text files, HTML and any other data that gets internally preprocessed before pattern matching. If you really want to use a hash signature in such a case, run `clamscan` with `--debug` and `--leave-temps` flags as described above and create a signature for a preprocessed file left in `/tmp`. Please keep in mind that a hash signature will stop matching as soon as a single byte changes in the target file.*
34
-
35
-## SHA1 and SHA256 hash-based signatures
36
-
37
-ClamAV 0.98 has also added support for SHA1 and SHA256 file checksums. The format is the same as for MD5 file checksum. It can differentiate between them based on the length of the hash string in the signature. For best backwards compatibility, these should be placed inside a `*.hsb` file. The format is:
38
-
39
-```
40
-HashString:FileSize:MalwareName
41
-```
42
-
43
-## Hash signatures with unknown size
44
-
45
-ClamAV 0.98 has also added support for hash signatures where the size is not known but the hash is. It is much more performance-efficient to use signatures with specific sizes, so be cautious when using this feature. For these cases, the ’\*’ character can be used in the size field. To ensure proper backwards compatibility with older versions of ClamAV, these signatures must have a minimum functional level of 73 or higher. Signatures that use the wildcard size without this level set will be rejected as malformed.
46
-
47
-Sample .hsb signature matching any size:
48
-```
49
-    HashString:*:MalwareName:73
50
-```
51
-Sample .msb signature matching any size:
52
-```
53
-    *:PESectionHash:MalwareName:73
54
-```
55
-
56
-## PE section based hash signatures
57
-
58
-You can create a hash signature for a specific section in a PE file. Such signatures shall be stored inside `.mdb` (MD5) and `.msb` files in the following format:
59
-
60
-```
61
-    PESectionSize:PESectionHash:MalwareName
62
-```
63
-
64
-The easiest way to generate MD5 based section signatures is to extract target PE sections into separate files and then run sigtool with the option `--mdb`
65
-
66
-ClamAV 0.98 has also added support for SHA1 and SHA256 section based signatures. The format is the same as for MD5 PE section based signatures. It can differentiate between them based on the length of the hash string in the signature. For best backwards compatibility, these should be placed inside a `*.msb` file.
67 1
deleted file mode 100644
... ...
@@ -1,351 +0,0 @@
1
-# Logical signatures
2
-
3
-Logical signatures allow combining of multiple signatures in extended format using logical operators. They can provide both more detailed and flexible pattern matching. The logical sigs are stored inside `*.ldb` files in the following format:
4
-
5
-```
6
-SignatureName;TargetDescriptionBlock;LogicalExpression;Subsig0;
7
-Subsig1;Subsig2;...
8
-```
9
-
10
-where:
11
-
12
-- `TargetDescriptionBlock` provides information about the engine and target file with comma separated `Arg:Val` pairs. For args where `Val` is a range, the minimum and maximum values should be expressed as `min-max`.
13
-
14
-- `LogicalExpression` specifies the logical expression describing the relationship between `Subsig0...SubsigN`. **Basis clause:** 0,1,...,N decimal indexes are SUB-EXPRESSIONS representing `Subsig0, Subsig1,...,SubsigN` respectively. **Inductive clause:** if `A` and `B` are SUB-EXPRESSIONS and `X, Y` are decimal numbers then `(A&B)`, `(A|B)`, `A=X`, `A=X,Y`, `A>X`, `A>X,Y`, `A<X` and `A<X,Y` are SUB-EXPRESSIONS
15
-
16
-- `SubsigN` is n-th subsignature in extended format possibly preceded with an offset. There can be specified up to 64 subsigs.
17
-
18
-Keywords used in `TargetDescriptionBlock`:
19
-
20
-- `Target:X`: A number specifying the type of the target file: [Target Types](FileTypes.md#Target-Types).
21
-
22
-- `Engine:X-Y`: Required engine functionality level (range; 0.96). Note that if the `Engine` keyword is used, it must be the first one in the `TargetDescriptionBlock` for backwards compatibility. See the [FLEVEL reference](FunctionalityLevels.md) for details.
23
-
24
-- `FileSize:X-Y`: Required file size (range in bytes; 0.96)
25
-
26
-- `EntryPoint`: Entry point offset (range in bytes; 0.96)
27
-
28
-- `NumberOfSections`: Required number of sections in executable (range; 0.96)
29
-
30
-- `Container:CL_TYPE_*`: File type of the container which stores the scanned file.
31
-
32
-  Specifying `CL_TYPE_ANY` matches on root objects only (i.e. the target file is explicitely _not_ in a container). Chances slim that you would want to use `CL_TYPE_ANY` in a signature, because placing the malicious file in an archive will then prevent it from alerting.
33
-
34
-  Every ClamAV file type has the potential to be a container for additional files, although some are more likely than others. When a file is parsed and data in the file is identified to be scanned as a unique type, that parent file becomes a container the moment the embedded content is scanned. For a list of possible CL_TYPEs, refer to the [File Types Reference](ClamAVFileTypes.md).
35
-
36
-- `Intermediates:CL_TYPE_*>CL_TYPE_*`: Specify one or more layers of file types containing the scanned file. _This is an alternative to using `Container`._
37
-
38
-  You may specify up to 16 layers of file types separated by ’`>`’ in top-down order. Note that the ’`>`’ separator is not needed if you only specify a single container. The last type should be the immediate container containing the malicious file. Unlike with the `Container` option, `CL_TYPE_ANY` can be used as a wildcard file type. (expr; 0.100.0)
39
-
40
-  For a list of possible CL_TYPEs, refer to the [File Types Reference](ClamAVFileTypes.md).
41
-
42
-- `IconGroup1`: Icon group name 1 from .idb signature Required engine functionality (range; 0.96)
43
-
44
-- `IconGroup2`: Icon group name 2 from .idb signature Required engine functionality (range; 0.96)
45
-
46
-Modifiers for subexpressions:
47
-
48
-- `A=X`: If the SUB-EXPRESSION A refers to a single signature then this signature must get matched exactly X times; if it refers to a (logical) block of signatures then this block must generate exactly X matches (with any of its sigs).
49
-
50
-- `A=0` specifies negation (signature or block of signatures cannot be matched)
51
-
52
-- `A=X,Y`: If the SUB-EXPRESSION A refers to a single signature then this signature must be matched exactly X times; if it refers to a (logical) block of signatures then this block must generate X matches and at least Y different signatures must get matched.
53
-
54
-- `A>X`: If the SUB-EXPRESSION A refers to a single signature then this signature must get matched more than X times; if it refers to a (logical) block of signatures then this block must generate more than X matches (with any of its sigs).
55
-
56
-- `A>X,Y`: If the SUB-EXPRESSION A refers to a single signature then this signature must get matched more than X times; if it refers to a (logical) block of signatures then this block must generate more than X matches _and_ at least Y different signatures must be matched.
57
-
58
-- `A<X`: Just like `A>Z` above with the change of "more" to "less".
59
-
60
-  If the SUB-EXPRESSION A refers to a single signature then this signature must get matched less than X times; if it refers to a (logical) block of signatures then this block must generate less than X matches (with any of its sigs).
61
-
62
-- `A<X,Y`: Similar to `A>X,Y`. If the SUB-EXPRESSION A refers to a single signature then this signature must get matched less than X times; if it refers to a (logical) block of signatures then this block must generate less than X matches _and_ at least Y different signatures must be matched.
63
-
64
-Examples:
65
-
66
-```
67
-Sig1;Target:0;(0&1&2&3)&(4|1);6b6f74656b;616c61;7a6f6c77;7374656
68
-6616e;deadbeef
69
-
70
-Sig2;Target:0;((0|1|2)>5,2)&(3|1);6b6f74656b;616c61;7a6f6c77;737
71
-46566616e
72
-
73
-Sig3;Target:0;((0|1|2|3)=2)&(4|1);6b6f74656b;616c61;7a6f6c77;737
74
-46566616e;deadbeef
75
-
76
-Sig4;Engine:51-255,Target:1;((0|1)&(2|3))&4;EP+123:33c06834f04100
77
-f2aef7d14951684cf04100e8110a00;S2+78:22??232c2d252229{-15}6e6573
78
-(63|64)61706528;S3+50:68efa311c3b9963cb1ee8e586d32aeb9043e;f9c58
79
-dcf43987e4f519d629b103375;SL+550:6300680065005c0046006900
80
-```
81
-
82
-## Subsignature Modifiers
83
-
84
-ClamAV (clamav-0.99) supports a number of additional subsignature
85
-modifiers for logical signatures. This is done by specifying `::`
86
-followed by a number of characters representing the desired options.
87
-Signatures using subsignature modifiers require `Engine:81-255` for
88
-backwards-compatibility.
89
-
90
-- Case-Insensitive \[`i`\]
91
-
92
-  Specifying the `i` modifier causes ClamAV to match all alphabetic hex bytes as case-insensitive. All patterns in ClamAV are case-sensitive by default.
93
-
94
-- Wide \[`w`\]
95
-
96
-  Specifying the `w` causes ClamAV to match all hex bytes encoded with two bytes per character. Note this simply interweaves each character with NULL characters and does not truly support UTF-16 characters. Wildcards for ’wide’ subsignatures are not treated as wide (i.e. there can be an odd number of intermittent characters). This can be combined with `a` to search for patterns in both wide and ascii.
97
-
98
-- Fullword \[`f`\]
99
-
100
-  Match subsignature as a fullword (delimited by non-alphanumeric characters).
101
-
102
-- Ascii \[`a`\]
103
-
104
-  Match subsignature as ascii characters. This can be combined with `w` to search for patterns in both ascii and wide.
105
-
106
-Examples:
107
-
108
-```
109
-clamav-nocase-A;Engine:81-255,Target:0;0&1;41414141::i;424242424242::i
110
-    -matches 'AAAA'(nocase) and 'BBBBBB'(nocase)
111
-
112
-clamav-fullword-A;Engine:81-255,Target:0;0&1;414141;68656c6c6f::f
113
-    -matches 'AAA' and 'hello'(fullword)
114
-clamav-fullword-B;Engine:81-255,Target:0;0&1;414141;68656c6c6f::fi
115
-    -matches 'AAA' and 'hello'(fullword nocase)
116
-
117
-clamav-wide-B2;Engine:81-255,Target:0;0&1;414141;68656c6c6f::wa
118
-    -matches 'AAA' and 'hello'(wide ascii)
119
-clamav-wide-C0;Engine:81-255,Target:0;0&1;414141;68656c6c6f::iwfa
120
-    -matches 'AAA' and 'hello'(nocase wide fullword ascii)
121
-```
122
-
123
-## Special Subsignature Types
124
-
125
-### Macro subsignatures
126
-
127
-Introduced in ClamAV 0.96
128
-
129
-Format: `${min-max}MACROID$`
130
-
131
-Macro subsignatures are used to combine a number of existing extended
132
-signatures (`.ndb`) into a on-the-fly generated alternate string logical
133
-signature (`.ldb`). Signatures using macro subsignatures require
134
-`Engine:51-255` for backwards-compatibility.
135
-
136
-Example:
137
-
138
-```
139
-      test.ldb:
140
-        TestMacro;Engine:51-255,Target:0;0&1;616161;${6-7}12$
141
-
142
-      test.ndb:
143
-        D1:0:$12:626262
144
-        D2:0:$12:636363
145
-        D3:0:$30:626264
146
-```
147
-
148
-The example logical signature `TestMacro` is functionally equivalent
149
-to:
150
-
151
-```
152
-`TestMacro;Engine:51-255,Target:0;0;616161{3-4}(626262|636363)`
153
-```
154
-
155
-- `MACROID` points to a group of signatures; there can be at most 32 macro groups.
156
-
157
-  - In the example, `MACROID` is `12` and both `D1` and `D2` are members of macro group `12`. `D3` is a member of separate macro group `30`.
158
-
159
-- `{min-max}` specifies the offset range at which one of the group signatures should match; the offset range is relative to the starting offset of the preceding subsignature. This means a macro subsignature cannot be the first subsignature.
160
-
161
-  - In the example, `{min-max}` is `{6-7}` and it is relative to the start of a `616161` match.
162
-
163
-- For more information and examples please see <https://bugzilla.clamav.net/show_bug.cgi?id=164>.
164
-
165
-### Byte Compare Subsignatures
166
-
167
-Introduced in ClamAV 0.101
168
-
169
-Format: `subsigid_trigger(offset#byte_options#comparisons)`
170
-
171
-Byte compare subsignatures can be used to evaluate a numeric value at a given offset from the start of another (matched) subsignature within the same logical signature. These are executed after all other subsignatures within the logical subsignature are fired, with the exception of PCRE subsignatures. They can evaluate offsets only from a single referenced subsignature, and that subsignature must give a valid match for the evaluation to occur.
172
-
173
-- `subsigid_trigger` is a required field and may refer to any single non-PCRE, non-Byte Compare subsignature within the lsig. The byte compare subsig will evaluate if `subsigid_trigger` matches. Triggering on multiple subsigs or logic based triggering is not currently supported.
174
-
175
-- `offset` is a required field that consists of an `offset_modifier` and a numeric `offset` (hex or decimal offsets are okay).
176
-
177
-  - `offset_modifier` can be either `>>` or `<<` where the former denotes a positive offset and the latter denotes a negative offset. The offset is calculated from the start of `subsigid_trigger`, which allows for byte extraction before the specified match, after the match, and within the match itself.
178
-
179
-  - `offset` must be a positive hex or decimal value. This will be the number of bytes from the start of the referenced `subsigid_trigger` match within the file buffer to begin the comparison.
180
-
181
-- `byte_options` are used to specify the numeric type and endianess of the extracted byte sequence in that order as well as the number of bytes to be read. By default ClamAV will attempt to matchup up to the number of byte specified, unless the `e` (exact) option is specified or the numeric type is `b` (binary).  This field follows the form `[h|d|a|i][l|b][e]num_bytes`
182
-
183
-  - `h|d|a|i` where `h` specifies the byte sequence will be in hex, `d` decimal, `a` automatic detection of hex or decimal at runtime, and `i` signifies raw binary data.
184
-
185
-  - `l|b` where `l` specifies the byte sequence will be in little endian order and `b` big endian. If decimal `d` is specified, big-endian is implied and using `l` will result in a malformed database error.
186
-
187
-  - `e` specifies that ClamAV will only evaluate the comparison if it can extract the exact number of bytes specified. This option is implicitly declared when using the `i` flag.
188
-
189
-  - `num_bytes` specifies the number of bytes to extract. This can be a hex or decimal value. If `i` is specified only 1, 2, 4, and 8 are valid options.
190
-
191
-- `comparisons` are a required field which denotes how to evaluate the extracted byte sequence. Each Byte Compare signature can have one or two `comparison_sets` separated by a comma. Each `comparison_set` consists of a `Comparison_symbol` and a `Comparison_value` and takes the form `Comparison_symbolComparison_value`. Thus, `comparisons` takes the form `comparison_set[,comparison_set]`
192
-
193
-  - `Comparison_symbol` denotes the type of comparison to be done. The supported comparison symbols are `<`, `>`, `=`.
194
-
195
-  - `Comparison_value` is a required field which must be a numeric hex or decimal value. If all other conditions are met, the byte compare subsig will evalutate the extracted byte sequence against this number based on the provided `comparison_symbol`.
196
-
197
-### PCRE subsignatures
198
-
199
-Introduced in ClamAV 0.99
200
-
201
-Format: `Trigger/PCRE/[Flags]`
202
-
203
-PCRE subsignatures are used within a logical signature (`.ldb`) to specify regex matches that execute once triggered by a conditional based on preceding subsignatures. Signatures using PCRE subsignatures require `Engine:81-255` for backwards-compatibility.
204
-
205
-- `Trigger` is a required field that is a valid `LogicalExpression` and may refer to any subsignatures that precede this subsignature. Triggers cannot be self-referential and cannot refer to subsequent subsignatures.
206
-
207
-- `PCRE` is the expression representing the regex to execute. `PCRE` must be delimited by ’/’ and usage of ’/’ within the expression need to be escaped. For backward compatibility, ’;’ within the expression must be expressed as ’`\x3B`’. `PCRE` cannot be empty and (?UTF\*) control sequence is not allowed. If debug is specified, named capture groups are displayed in a post-execution report.
208
-
209
-- `Flags` are a series of characters which affect the compilation and execution of `PCRE` within the PCRE compiler and the ClamAV engine. This field is optional.
210
-
211
-  - `g [CLAMAV_GLOBAL]` specifies to search for ALL matches of PCRE (default is to search for first match). NOTE: INCREASES the time needed to run the PCRE.
212
-
213
-  - `r [CLAMAV_ROLLING]` specifies to use the given offset as the starting location to search for a match as opposed to the only location; applies to subsigs without maxshifts. By default, in order to facilatate normal ClamAV offset behavior, PCREs are auto-anchored (only attempt match on first offset); using the rolling option disables the auto-anchoring.
214
-
215
-  - `e [CLAMAV_ENCOMPASS]` specifies to CONFINE matching between the specified offset and maxshift; applies only when maxshift is specified. Note: DECREASES time needed to run the PCRE.
216
-
217
-  - `i [PCRE_CASELESS]`
218
-
219
-  - `s [PCRE_DOTALL]`
220
-
221
-  - `m [PCRE_MULTILINE]`
222
-
223
-  - `x [PCRE_EXTENDED]`
224
-
225
-  - `A [PCRE_ANCHORED]`
226
-
227
-  - `E [PCRE_DOLLAR_ENODNLY]`
228
-
229
-  - `U [PCRE_UNGREEDY]`
230
-
231
-Examples:
232
-
233
-```
234
-Find.All.ClamAV;Engine:81-255,Target:0;1;6265676c6164697427736e6f7462797465636f6465;0/clamav/g
235
-
236
-Find.ClamAV.OnlyAt.299;Engine:81-255,Target:0;2;7374756c747a67657473;7063726572656765786c6f6c;299:0&1/clamav/
237
-
238
-Find.ClamAV.StartAt.300;Engine:81-255,Target:0;3;616c61696e;62756731393238;636c6f736564;300:0&1&2/clamav/r
239
-
240
-Find.All.Encompassed.ClamAV;Engine:81-255,Target:0;3;7768796172656e2774;796f757573696e67;79617261;200,300:0&1&2/clamav/ge
241
-
242
-Named.CapGroup.Pcre;Engine:81-255,Target:0;3;636f75727479617264;616c62756d;74657272696572;50:0&1&2/variable=(?<nilshell>.{16})end/gr
243
-
244
-Firefox.TreeRange.UseAfterFree;Engine:81-255,Target:0,Engine:81-255;0&1&2;2e766965772e73656c656374696f6e;2e696e76616c696461746553656c656374696f6e;0&1/\x2Eview\x2Eselection.*?\x2Etree\s*\x3D\s*null.*?\x2Einvalidate/smi
245
-
246
-Firefox.IDB.UseAfterFree;Engine:81-255,Target:0;0&1;4944424b657952616e6765;0/^\x2e(only|lowerBound|upperBound|bound)\x28.*?\x29.*?\x2e(lower|upper|lowerOpen|upperOpen)/smi
247
-
248
-Firefox.boundElements;Engine:81-255,Target:0;0&1&2;6576656e742e6
249
-26f756e64456c656d656e7473;77696e646f772e636c6f7365;0&1/on(load|click)\s*=\s*\x22?window\.close\s*\x28/si
250
-```
251
-
252
-## Signatures for Version Information (VI) metadata in PE files
253
-
254
-Starting with ClamAV 0.96 it is possible to easily match certain information built into PE files (executables and dynamic link libraries). Whenever you lookup the properties of a PE executable file in windows, you are presented with a bunch of details about the file itself.
255
-
256
-These info are stored in a special area of the file resources which goes under the name of `VS_VERSION_INFORMATION` (or versioninfo for short). It is divided into 2 parts. The first part (which is rather uninteresting) is really a bunch of numbers and flags indicating the product and file version. It was originally intended for use with installers which, after parsing it, should be able to determine whether a certain executable or library are to be upgraded/overwritten or are already up to date. Suffice to say, this approach never really worked and is generally never used.
257
-
258
-The second block is much more interesting: it is a simple list of key/value strings, intended for user information and completely ignored by the OS. For example, if you look at ping.exe you can see the company being *"Microsoft Corporation"*, the description *"TCP/IP Ping command"*, the internal name *"ping.exe"* and so on... Depending on the OS version, some keys may be given peculiar visibility in the file properties dialog, however they are internally all the same.
259
-
260
-To match a versioninfo key/value pair, the special file offset anchor `VI` was introduced. This is similar to the other anchors (like `EP` and `SL`) except that, instead of matching the hex pattern against a single offset, it checks it against each and every key/value pair in the file. The `VI` token doesn’t need nor accept a `+/-` offset like e.g. `EP+1`. As for the hex signature itself, it’s just the utf16 dump of the key and value. Only the `??` and `(aa|bb)` wildcards are allowed in the signature. Usually, you don’t need to bother figuring it out: each key/value pair together with the corresponding VI-based signature is printed by `clamscan` when the `--debug` option is given.
261
-
262
-For example `clamscan --debug freecell.exe` produces:
263
-
264
-```bash
265
-[...]
266
-Recognized MS-EXE/DLL file
267
-in cli_peheader
268
-versioninfo_cb: type: 10, name: 1, lang: 410, rva: 9608
269
-cli_peheader: parsing version info @ rva 9608 (1/1)
270
-VersionInfo (d2de): 'CompanyName'='Microsoft Corporation' -
271
-VI:43006f006d00700061006e0079004e0061006d006500000000004d006900
272
-630072006f0073006f0066007400200043006f00720070006f0072006100740
273
-069006f006e000000
274
-VersionInfo (d32a): 'FileDescription'='Entertainment Pack
275
-FreeCell Game' - VI:460069006c006500440065007300630072006900700
276
-0740069006f006e000000000045006e007400650072007400610069006e006d
277
-0065006e00740020005000610063006b0020004600720065006500430065006
278
-c006c002000470061006d0065000000
279
-VersionInfo (d396): 'FileVersion'='5.1.2600.0 (xpclient.010817
280
--1148)' - VI:460069006c006500560065007200730069006f006e00000000
281
-0035002e0031002e0032003600300030002e003000200028007800700063006
282
-c00690065006e0074002e003000310030003800310037002d00310031003400
283
-380029000000
284
-VersionInfo (d3fa): 'InternalName'='freecell' - VI:49006e007400
285
-650072006e0061006c004e0061006d006500000066007200650065006300650
286
-06c006c000000
287
-VersionInfo (d4ba): 'OriginalFilename'='freecell' - VI:4f007200
288
-6900670069006e0061006c00460069006c0065006e0061006d0065000000660
289
-0720065006500630065006c006c000000
290
-VersionInfo (d4f6): 'ProductName'='Sistema operativo Microsoft
291
-Windows' - VI:500072006f0064007500630074004e0061006d00650000000
292
-000530069007300740065006d00610020006f00700065007200610074006900
293
-76006f0020004d006900630072006f0073006f0066007400ae0020005700690
294
-06e0064006f0077007300ae000000
295
-VersionInfo (d562): 'ProductVersion'='5.1.2600.0' - VI:50007200
296
-6f006400750063007400560065007200730069006f006e00000035002e00310
297
-02e0032003600300030002e0030000000
298
-[...]
299
-```
300
-
301
-Although VI-based signatures are intended for use in logical signatures you can test them using ordinary `.ndb` files. For example:
302
-
303
-```
304
-    my_test_vi_sig:1:VI:paste_your_hex_sig_here
305
-```
306
-
307
-Final note. If you want to decode a VI-based signature into a human readable form you can use:
308
-
309
-```bash
310
-echo hex_string | xxd -r -p | strings -el
311
-```
312
-
313
-For example:
314
-
315
-```bash
316
-$ echo 460069006c0065004400650073006300720069007000740069006f006e
317
-000000000045006e007400650072007400610069006e006d0065006e007400200
318
-05000610063006b0020004600720065006500430065006c006c00200047006100
319
-6d0065000000 | xxd -r -p | strings -el
320
-FileDescription
321
-Entertainment Pack FreeCell Game
322
-```
323
-
324
-## Icon Signatures for PE files
325
-
326
-While Icon Signatures are stored in a `.idb` file, they are a feature of Logical Signatures.
327
-
328
-ClamAV 0.96 includes an approximate/fuzzy icon matcher to help detecting malicious executables disguising themselves as innocent looking image files, office documents and the like.
329
-
330
-Icon matching is only triggered by Logical Signatures (`.ldb`) using the special attribute tokens `IconGroup1` or `IconGroup2`. These identify two (optional) groups of icons defined in a `.idb` database file. The format of the `.idb` file is:
331
-
332
-```
333
-    ICONNAME:GROUP1:GROUP2:ICON_HASH
334
-```
335
-
336
-where:
337
-
338
-- `ICON_NAME` is a unique string identifier for a specific icon,
339
-
340
-- `GROUP1` is a string identifier for the first group of icons (`IconGroup1`)
341
-
342
-- `GROUP2` is a string identifier for the second group of icons (`IconGroup2`),
343
-
344
-- `ICON_HASH` is a fuzzy hash of the icon image
345
-
346
-The `ICON_HASH` field can be obtained from the debug output of libclamav. For example:
347
-
348
-```bash
349
-LibClamAV debug: ICO SIGNATURE:
350
-ICON_NAME:GROUP1:GROUP2:18e2e0304ce60a0cc3a09053a30000414100057e000afe0000e 80006e510078b0a08910d11ad04105e0811510f084e01040c080a1d0b0021000a39002a41
351
-```
352 1
deleted file mode 100644
... ...
@@ -1,682 +0,0 @@
1
-# PhishSigs
2
-
3
-Table of Contents
4
-- [PhishSigs](#phishsigs)
5
-- [Database file format](#database-file-format)
6
-    - [PDB format](#pdb-format)
7
-    - [GDB format](#gdb-format)
8
-    - [WDB format](#wdb-format)
9
-    - [Hints](#hints)
10
-    - [Examples of PDB signatures](#examples-of-pdb-signatures)
11
-    - [Examples of WDB signatures](#examples-of-wdb-signatures)
12
-    - [Example for how the URL extractor works](#example-for-how-the-url-extractor-works)
13
-    - [How matching works](#how-matching-works)
14
-        - [RealURL, displayedURL concatenation](#realurl-displayedurl-concatenation)
15
-        - [What happens when a match is found](#what-happens-when-a-match-is-found)
16
-        - [Extraction of realURL, displayedURL from HTML tags](#extraction-of-realurl-displayedurl-from-html-tags)
17
-        - [Example](#example)
18
-    - [Simple patterns](#simple-patterns)
19
-    - [Regular expressions](#regular-expressions)
20
-    - [Flags](#flags)
21
-- [Introduction to regular expressions](#introduction-to-regular-expressions)
22
-    - [Special characters](#special-characters)
23
-    - [Character classes](#character-classes)
24
-    - [Escaping](#escaping)
25
-    - [Alternation](#alternation)
26
-    - [Optional matching, and repetition](#optional-matching-and-repetition)
27
-    - [Groups](#groups)
28
-- [How to create database files](#how-to-create-database-files)
29
-    - [How to create and maintain the whitelist (daily.wdb)](#how-to-create-and-maintain-the-whitelist-dailywdb)
30
-    - [How to create and maintain the domainlist (daily.pdb)](#how-to-create-and-maintain-the-domainlist-dailypdb)
31
-    - [Dealing with false positives, and undetected phishing mails](#dealing-with-false-positives-and-undetected-phishing-mails)
32
-        - [False positives](#false-positives)
33
-        - [Undetected phish mails](#undetected-phish-mails)
34
-
35
-# Database file format
36
-
37
-## PDB format
38
-
39
-This file contains urls/hosts that are target of phishing attempts. It
40
-contains lines in the following format:
41
-
42
-```
43
-    R[Filter]:RealURL:DisplayedURL[:FuncLevelSpec]
44
-    H[Filter]:DisplayedHostname[:FuncLevelSpec]
45
-```
46
-
47
-- `R`
48
-
49
-  regular expression, for the concatenated URL
50
-
51
-- `H`
52
-
53
-  matches the `DisplayedHostname` as a simple pattern (literally, no regular expression)
54
-
55
-  - the pattern can match either the full hostname
56
-
57
-  - or a subdomain of the specified hostname
58
-
59
-  - to avoid false matches in case of subdomain matches, the engine checks that there is a dot(`.`) or a space(` `) before the matched portion
60
-
61
-- `Filter`
62
-
63
-  is ignored for R and H for compatibility reasons
64
-
65
-- `RealURL`
66
-
67
-  is the URL the user is sent to, example: *href* attribute of an html anchor (*\<a\> tag*)
68
-
69
-- `DisplayedURL`
70
-
71
-  is the URL description displayed to the user, where its *claimed* they are sent, example: contents of an html anchor (*\<a\> tag*)
72
-
73
-- `DisplayedHostname`
74
-
75
-  is the hostname portion of the DisplayedURL
76
-
77
-- `FuncLevelSpec`
78
-
79
-  an (optional) functionality level, 2 formats are possible:
80
-
81
-  - `minlevel` all engines having functionality level \>= `minlevel` will load this line
82
-
83
-  - `minlevel-maxlevel` engines with functionality level \(>=\) `minlevel`, and \(<\) `maxlevel` will load this line
84
-
85
-## GDB format
86
-
87
-This file contains URL hashes in the following format:
88
-
89
-    S:P:HostPrefix[:FuncLevelSpec]
90
-    S:F:Sha256hash[:FuncLevelSpec]
91
-    S1:P:HostPrefix[:FuncLevelSpec]
92
-    S1:F:Sha256hash[:FuncLevelSpec]
93
-    S2:P:HostPrefix[:FuncLevelSpec]
94
-    S2:F:Sha256hash[:FuncLevelSpec]
95
-    S:W:Sha256hash[:FuncLevelSpec]
96
-
97
-- `S:`
98
-
99
-  These are hashes for Google Safe Browsing - malware sites, and should not be used for other purposes.
100
-
101
-- `S2:`
102
-
103
-  These are hashes for Google Safe Browsing - phishing sites, and should not be used for other purposes.
104
-
105
-- `S1:`
106
-
107
-  Hashes for blacklisting phishing sites. Virus name: Phishing.URL.Blacklisted
108
-
109
-- `S:W:`
110
-
111
-  Locally whitelisted hashes.
112
-
113
-- `HostPrefix`
114
-
115
-  4-byte prefix of the sha256 hash of the last 2 or 3 components of the hostname. If prefix doesn’t match, no further lookups are performed.
116
-
117
-- `Sha256hash`
118
-
119
-  sha256 hash of the canonicalized URL, or a sha256 hash of its prefix/suffix according to the Google Safe Browsing “Performing Lookups” rules. There should be a corresponding `:P:HostkeyPrefix` entry for the hash to be taken into consideration.
120
-
121
-To see which hash/URL matched, look at the `clamscan --debug` output, and look for the following strings: `Looking up hash`, `prefix matched`, and `Hash matched`. Local whitelisting of .gdb entries can be done by creating a local.gdb file, and adding a line `S:W:<HASH>`.
122
-
123
-## WDB format
124
-
125
-This file contains whitelisted url pairs It contains lines in the following format:
126
-
127
-```
128
-    X:RealURL:DisplayedURL[:FuncLevelSpec]
129
-    M:RealHostname:DisplayedHostname[:FuncLevelSpec]
130
-```
131
-
132
-- `X`
133
-
134
-  regular expression, for the *entire URL*, not just the hostname
135
-
136
-  - The regular expression is by default anchored to start-of-line and end-of-line, as if you have used `^RegularExpression$`
137
-
138
-  - A trailing `/` is automatically added both to the regex, and the input string to avoid false matches
139
-
140
-  - The regular expression matches the *concatenation* of the RealURL, a colon(`:`), and the DisplayedURL as a single string. It doesn’t separately match RealURL and DisplayedURL\!
141
-
142
-- `M`
143
-
144
-  matches hostname, or subdomain of it, see notes for H above
145
-
146
-## Hints
147
-
148
-- empty lines are ignored
149
-
150
-- the colons are mandatory
151
-
152
-- Don’t leave extra spaces on the end of a line\!
153
-
154
-- if any of the lines don’t conform to this format, clamav will abort with a Malformed Database Error
155
-
156
-- see section [Extraction-of-realURL](#Extraction-of-realURL,-displayedURL-from-HTML-tags) for more details on realURL/displayedURL
157
-
158
-## Examples of PDB signatures
159
-
160
-To check for phishing mails that target amazon.com, or subdomains of
161
-amazon.com:
162
-
163
-```
164
-    H:amazon.com
165
-```
166
-
167
-To do the same, but for amazon.co.uk:
168
-
169
-```
170
-    H:amazon.co.uk
171
-```
172
-
173
-To limit the signatures to certain engine versions:
174
-
175
-```
176
-    H:amazon.co.uk:20-30
177
-    H:amazon.co.uk:20-
178
-    H:amazon.co.uk:0-20
179
-```
180
-
181
-First line: engine versions 20, 21, ..., 29 can load it
182
-
183
-Second line: engine versions \>= 20 can load it
184
-
185
-Third line: engine versions \< 20 can load it
186
-
187
-In a real situation, you’d probably use the second form. A situation like that would be if you are using a feature of the signatures not available in earlier versions, or if earlier versions have bugs with your signature. Its neither case here, the above examples are for illustrative purposes only.
188
-
189
-## Examples of WDB signatures
190
-
191
-To allow amazon’s country specific domains and amazon.com, to mix domain names in DisplayedURL, and RealURL:
192
-
193
-    X:.+\.amazon\.(at|ca|co\.uk|co\.jp|de|fr)([/?].*)?:.+\.amazon\.com([/?].*)?:17-
194
-
195
-Explanation of this signature:
196
-
197
-- `X:`
198
-
199
-  this is a regular expression
200
-
201
-- `:17-`
202
-
203
-  load signature only for engines with functionality level \>= 17 (recommended for type X)
204
-
205
-The regular expression is the following (X:, :17- stripped, and a / appended)
206
-
207
-```
208
-    .+\.amazon\.(at|ca|co\.uk|co\.jp|de|fr)([/?].*)?:.+\.amazon\.com([/?].*)?/
209
-```
210
-
211
-Explanation of this regular expression (note that it is a single regular expression, and not 2 regular expressions splitted at the :).
212
-
213
-- `.+`
214
-
215
-  any subdomain of
216
-
217
-- `\.amazon\.`
218
-
219
-  domain we are whitelisting (RealURL part)
220
-
221
-- `(at|ca|co\.uk|co\.jp|de|fr)`
222
-
223
-  country-domains: at, ca, co.uk, co.jp, de, fr
224
-
225
-- `([/?].*)?`
226
-
227
-  recomended way to end real url part of whitelist, this protects against embedded URLs (evilurl.example.com/amazon.co.uk/)
228
-
229
-- `:`
230
-
231
-  RealURL and DisplayedURL are concatenated via a :, so match a literal : here
232
-
233
-- `.+`
234
-
235
-  any subdomain of
236
-
237
-- `\.amazon\.com`
238
-
239
-  whitelisted DisplayedURL
240
-
241
-- `([/?].*)?`
242
-
243
-  recommended way to end displayed url part, to protect against embedded URLs
244
-
245
-- `/`
246
-
247
-  automatically added to further protect against embedded URLs
248
-
249
-When you whitelist an entry make sure you check that both domains are owned by the same entity. What this whitelist entry allows is: Links claiming to point to amazon.com (DisplayedURL), but really go to country-specific domain of amazon (RealURL).
250
-
251
-## Example for how the URL extractor works
252
-
253
-Consider the following HTML file:
254
-
255
-```html
256
-    <html>
257
-    <a href="http://1.realurl.example.com/">
258
-      1.displayedurl.example.com
259
-    </a>
260
-    <a href="http://2.realurl.example.com">
261
-      2 d<b>i<p>splayedurl.e</b>xa<i>mple.com
262
-    </a>
263
-    <a href="http://3.realurl.example.com"> 
264
-      3.nested.example.com
265
-      <a href="http://4.realurl.example.com">
266
-        4.displayedurl.example.com
267
-      </a>
268
-    </a>
269
-    <form action="http://5.realurl.example.com">
270
-      sometext
271
-      <img src="http://5.displayedurl.example.com/img0.gif"/>
272
-      <a href="http://5.form.nested.displayedurl.example.com">
273
-        5.form.nested.link-displayedurl.example.com
274
-      </a>
275
-    </form>
276
-    <a href="http://6.realurl.example.com">
277
-      6.displ
278
-      <img src="6.displayedurl.example.com/img1.gif"/>
279
-      ayedurl.example.com
280
-    </a>
281
-    <a href="http://7.realurl.example.com">
282
-      <iframe src="http://7.displayedurl.example.com">
283
-    </a>
284
-```
285
-
286
-The phishing engine extract the following
287
-RealURL/DisplayedURL pairs from it:
288
-
289
-```
290
-    http://1.realurl.example.com/
291
-    1.displayedurl.example.com
292
-
293
-    http://2.realurl.example.com
294
-    2displayedurl.example.com
295
-
296
-    http://3.realurl.example.com
297
-    3.nested.example.com
298
-
299
-    http://4.realurl.example.com
300
-    4.displayedurl.example.com
301
-
302
-    http://5.realurl.example.com
303
-    http://5.displayedurl.example.com/img0.gif
304
-
305
-    http://5.realurl.example.com
306
-    http://5.form.nested.displayedurl.example.com
307
-
308
-    http://5.form.nested.displayedurl.example.com
309
-    5.form.nested.link-displayedurl.example.com
310
-
311
-    http://6.realurl.example.com
312
-    6.displayedurl.example.com
313
-
314
-    http://6.realurl.example.com
315
-    6.displayedurl.example.com/img1.gif
316
-```
317
-
318
-## How matching works
319
-
320
-### RealURL, displayedURL concatenation
321
-
322
-The phishing detection module processes pairs of RealURL/DisplayedURL. Matching against daily.wdb is done as follows: the realURL is concatenated with a `:`, and with the DisplayedURL, then that *line* is matched against the lines in daily.wdb/daily.pdb
323
-
324
-So if you have this line in daily.wdb:
325
-
326
-    M:www.google.ro:www.google.com
327
-
328
-and this href: `<a href='http://www.google.ro'>www.google.com</a>` then it will be whitelisted, but: `<a href='http://images.google.com'>www.google.com</a>` will not.
329
-
330
-### What happens when a match is found
331
-
332
-In the case of the whitelist, a match means that the RealURL/DisplayedURL combination is considered clean, and no further checks are performed on it.
333
-
334
-In the case of the domainlist, a match means that the RealURL/displayedURL is going to be checked for phishing attempts.
335
-
336
-Furthermore you can restrict what checks are to be performed by specifying the 3-digit hexnumber.
337
-
338
-### Extraction of realURL, displayedURL from HTML tags
339
-
340
-The html parser extracts pairs of realURL/displayedURL based on the following rules.
341
-
342
-In version 0.93: After URLs have been extracted, they are normalized, and cut after the hostname. `http://test.example.com/path/somecgi?queryparameters` becomes `http://test.example.com/`
343
-
344
-- `a`
345
-
346
-  (anchor) the *href* is the realURL, its *contents* is the displayedURL
347
-
348
-  - contents
349
-    is the tag-stripped contents of the \<a\> tags, so for example \<b\> tags are stripped (but not their contents)
350
-
351
-  nesting another \<a\> tag withing an \<a\> tag (besides being invalid html) is treated as a \</a\>\<a..
352
-
353
-- `form`
354
-
355
-  the *action* attribute is the realURL, and a nested \<a\> tag is the displayedURL
356
-
357
-- `img/area`
358
-
359
-  if nested within an *\<a\>* tag, the realURL is the *href* of the a tag, and the *src/dynsrc/area* is the displayedURL of the img
360
-
361
-  if nested withing a *form* tag, then the action attribute of the *form* tag is the realURL
362
-
363
-- `iframe`
364
-
365
-  if nested withing an *\<a\>* tag the *src* attribute is the displayedURL, and the *href* of its parent *a* tag is the realURL
366
-
367
-  if nested withing a *form* tag, then the action attribute of the *form* tag is the realURL
368
-
369
-### Example
370
-
371
-Consider this html file:
372
-
373
-```html
374
-<a href=”evilurl”\>www.paypal.com\</a\>*
375
-
376
-<a href=”evilurl2” title=”www.ebay.com”\>click here to sign
377
-in\</a\>*
378
-
379
-<form action=”evilurl_form”\>*
380
-
381
-*Please sign in to \<a href=”cgi.ebay.com”\>Ebay\</a\using this
382
-form*
383
-
384
-<input type=’text’ name=’username’\>Username\</input\>*
385
-
386
-*....*
387
-
388
-</form\>*
389
-
390
-<a href=”evilurl”\>\<img src=”images.paypal.com/secure.jpg”\>\</a\>*
391
-```
392
-
393
-The resulting realURL/displayedURL pairs will be (note that one tag can generate multiple pairs):
394
-
395
-- evilurl / www.paypal.com
396
-
397
-- evilurl2 / click here to sign in
398
-
399
-- evilurl2 / www.ebay.com
400
-
401
-- evilurl_form / cgi.ebay.com
402
-
403
-- cgi.ebay.com / Ebay
404
-
405
-- evilurl / image.paypal.com/secure.jpg
406
-
407
-## Simple patterns
408
-
409
-Simple patterns are matched literally, i.e. if you say:
410
-
411
-```
412
-www.google.com
413
-```
414
-
415
-it is going to match *www.google.com*, and only that. The *. (dot)* character has no special meaning (see the section on regexes [\[sec:Regular-expressions\]](#sec:Regular-expressions) for how the *.(dot)* character behaves there)
416
-
417
-## Regular expressions
418
-
419
-POSIX regular expressions are supported, and you can consider that internally it is wrapped by *^*, and *$.* In other words, this means that the regular expression has to match the entire concatenated (see section [RealURL,-displayedURL-concatenation](#RealURL,-displayedURL-concatenation) for details on concatenation) url.
420
-
421
-It is recomended that you read section [Introduction-to-regular](#Introduction-to-regular) to learn how to write regular expressions, and then come back and read this for hints.
422
-
423
-Be advised that clamav contains an internal, very basic regex matcher to reduce the load on the regex matching core. Thus it is recomended that you avoid using regex syntax not supported by it at the very beginning of regexes (at least the first few characters).
424
-
425
-Currently the clamav regex matcher supports:
426
-
427
-- `.` (dot) character
428
-
429
-- `\(\backslash\)` (escaping special characters)
430
-
431
-- `|` (pipe) alternatives
432
-
433
-- `\[\]` (character classes)
434
-
435
-- `()` (parenthesis for grouping, but no group extraction is performed)
436
-
437
-- other non-special characters
438
-
439
-Thus the following are not supported:
440
-
441
-- `\+` repetition
442
-
443
-- `\*` repetition
444
-
445
-- `{}` repetition
446
-
447
-- backreferences
448
-
449
-- lookaround
450
-
451
-- other “advanced” features not listed in the supported list ;)
452
-
453
-This however shouldn’t discourage you from using the “not directly supported features “, because if the internal engine encounters unsupported syntax, it passes it on to the POSIX regex core (beginning from the first unsupported token, everything before that is still processed by the internal matcher). An example might make this more clear:
454
-
455
-*www\(\backslash\).google\(\backslash\).(com|ro|it) (\[a-zA-Z\])+\(\backslash\).google\(\backslash\).(com|ro|it)*
456
-
457
-Everything till *(\[a-zA-Z\])+* is processed internally, that parenthesis (and everything beyond) is processed by the posix core.
458
-
459
-Examples of url pairs that match:
460
-
461
-- *www.google.ro images.google.ro*
462
-
463
-- www.google.com images.google.ro
464
-
465
-Example of url pairs that don’t match:
466
-
467
-- www.google.ro images1.google.ro
468
-
469
-- images.google.com image.google.com
470
-
471
-## Flags
472
-
473
-Flags are a binary OR of the following numbers:
474
-
475
-- HOST_SUFFICIENT
476
-
477
-  1
478
-
479
-- DOMAIN_SUFFICIENT
480
-
481
-  2
482
-
483
-- DO_REVERSE_LOOKUP
484
-
485
-  4
486
-
487
-- CHECK_REDIR
488
-
489
-  8
490
-
491
-- CHECK_SSL
492
-
493
-  16
494
-
495
-- CHECK_CLOAKING
496
-
497
-  32
498
-
499
-- CLEANUP_URL
500
-
501
-  64
502
-
503
-- CHECK_DOMAIN_REVERSE
504
-
505
-  128
506
-
507
-- CHECK_IMG_URL
508
-
509
-  256
510
-
511
-- DOMAINLIST_REQUIRED
512
-
513
-  512
514
-
515
-The names of the constants are self-explanatory.
516
-
517
-These constants are defined in libclamav/phishcheck.h, you can check there for the latest flags.
518
-
519
-There is a default set of flags that are enabled, these are currently:
520
-
521
-    ( CLEANUP_URL | CHECK_SSL | CHECK_CLOAKING | CHECK_IMG_URL )
522
-
523
-ssl checking is performed only for a tags currently.
524
-
525
-You must decide for each line in the domainlist if you want to filter any flags (that is you don’t want certain checks to be done), and then calculate the binary OR of those constants, and then convert it into a 3-digit hexnumber. For example you devide that domain_sufficient shouldn’t be used for ebay.com, and you don’t want to check images either, so you come up with this flag number: \(2|256\Rightarrow\)258\((decimal)\Rightarrow102(hexadecimal)\)
526
-
527
-So you add this line to daily.wdb:
528
-
529
-- R102 www.ebay.com .+
530
-
531
-# Introduction to regular expressions
532
-
533
-Recomended reading:
534
-
535
-- http://www.regular-expressions.info/quickstart.html
536
-
537
-- http://www.regular-expressions.info/tutorial.html
538
-
539
-- regex(7) man-page: http://www.tin.org/bin/man.cgi?section=7\&topic=regex
540
-
541
-## Special characters
542
-
543
-- \[
544
-
545
-  the opening square bracket - it marks the beginning of a character class, see section[Character-classes](#Character-classes)
546
-
547
-- \(\backslash\)
548
-
549
-  the backslash - escapes special characters, see section [Escaping](#Escaping)
550
-
551
-- ^
552
-
553
-  the caret - matches the beginning of a line (not needed in clamav regexes, this is implied)
554
-
555
-- $
556
-
557
-  the dollar sign - matches the end of a line (not needed in clamav regexes, this is implied)
558
-
559
-- ̇
560
-
561
-  the period or dot - matches *any* character
562
-
563
-- |
564
-
565
-  the vertical bar or pipe symbol - matches either of the token on its left and right side, see section [Alternation](#sub:Alternation)
566
-
567
-- ?
568
-
569
-  the question mark - matches optionally the left-side token, see section[Optional-matching,-and](Optional-matching,-and)
570
-
571
-- \*
572
-
573
-  the asterisk or star - matches 0 or more occurences of the left-side token, see section [Optional-matching,-and](Optional-matching,-and)
574
-
575
-- +
576
-
577
-  the plus sign - matches 1 or more occurences of the left-side token, see section [Optional-matching,-and](Optional-matching,-and)
578
-
579
-- (
580
-
581
-  the opening round bracket - marks beginning of a group, see section [Groups](Groups)
582
-
583
-- )
584
-
585
-  the closing round bracket - marks end of a group, see section[Groups](Groups)
586
-
587
-## Character classes
588
-
589
-## Escaping
590
-
591
-Escaping has two purposes:
592
-
593
-- it allows you to actually match the special characters themselves, for example to match the literal *+*, you would write *\(\backslash\)+*
594
-
595
-- it also allows you to match non-printable characters, such as the tab (*\(\backslash\)t*), newline (*\(\backslash\)n*), ..
596
-
597
-However since non-printable characters are not valid inside an url, you won’t have a reason to use them.
598
-
599
-## Alternation
600
-
601
-## Optional matching, and repetition
602
-
603
-## Groups
604
-
605
-Groups are usually used together with repetition, or alternation. For example: *(com|it)+* means: match 1 or more repetitions of *com* or *it,* that is it matches: com, it, comcom, comcomcom, comit, itit, ititcom,... you get the idea.
606
-
607
-Groups can also be used to extract substring, but this is not supported by the clam engine, and not needed either in this case.
608
-
609
-# How to create database files
610
-
611
-## How to create and maintain the whitelist (daily.wdb)
612
-
613
-If the phishing code claims that a certain mail is phishing, but its not, you have 2 choices:
614
-
615
-- examine your rules daily.pdb, and fix them if necessary (see: section[How-to-create](How-to-create))
616
-
617
-- add it to the whitelist (discussed here)
618
-
619
-Lets assume you are having problems because of links like this in a mail:
620
-
621
-```html
622
-    <a href=''http://69.0.241.57/bCentral/L.asp?L=XXXXXXXX''>
623
-      http://www.bcentral.it/
624
-    </a>
625
-```
626
-
627
-After investigating those sites further, you decide they are no threat, and create a line like this in daily.wdb:
628
-
629
-```
630
-R http://www\(\backslash\).bcentral\(\backslash\).it/.+
631
-http://69\(\backslash\).0\(\backslash\).241\(\backslash\).57/bCentral/L\(\backslash\).asp?L=.+
632
-```
633
-
634
-Note: urls like the above can be used to track unique mail recipients, and thus know if somebody actually reads mails (so they can send more spam). However since this site required no authentication information, it is safe from a phishing point of view.
635
-
636
-## How to create and maintain the domainlist (daily.pdb)
637
-
638
-When not using –phish-scan-alldomains (production environments for example), you need to decide which urls you are going to check.
639
-
640
-Although at a first glance it might seem a good idea to check everything, it would produce false positives. Particularly newsletters, ads, etc. are likely to use URLs that look like phishing attempts.
641
-
642
-Lets assume that you’ve recently seen many phishing attempts claiming they come from Paypal. Thus you need to add paypal to daily.pdb:
643
-
644
-```
645
-R .+ .+\(\backslash\).paypal\(\backslash\).com
646
-```
647
-
648
-The above line will block (detect as phishing) mails that contain urls that claim to lead to paypal, but they don’t in fact.
649
-
650
-Be carefull not to create regexes that match a too broad range of urls though.
651
-
652
-## Dealing with false positives, and undetected phishing mails
653
-
654
-### False positives
655
-
656
-Whenever you see a false positive (mail that is detected as phishing, but its not), you need to examine *why* clamav decided that its phishing. You can do this easily by building clamav with debugging (./configure –enable-experimental –enable-debug), and then running a tool:
657
-
658
-```bash
659
-$contrib/phishing/why.py phishing.eml
660
-```
661
-
662
-This will show the url that triggers the phish verdict, and a reason why that url is considered phishing attempt.
663
-
664
-Once you know the reason, you might need to modify daily.pdb (if one of yours rules inthere are too broad), or you need to add the url to daily.wdb. If you think the algorithm is incorrect, please file a bug report on bugzilla.clamav.net, including the output of *why.py*.
665
-
666
-### Undetected phish mails
667
-
668
-Using why.py doesn’t help here unfortunately (it will say: clean), so all you can do is:
669
-
670
-```bash
671
-$clamscan/clamscan –phish-scan-alldomains undetected.eml
672
-```
673
-
674
-And see if the mail is detected, if yes, then you need to add an appropriate line to daily.pdb (see section [How-to-create](How-to-create)).
675
-
676
-If the mail is not detected, then try using:
677
-
678
-```bash
679
-$clamscan/clamscan –debug undetected.eml|less
680
-```
681
-
682
-Then see what urls are being checked, see if any of them is in a whitelist, see if all urls are detected, etc.
683 1
deleted file mode 100644
... ...
@@ -1,23 +0,0 @@
1
-# Whitelist databases
2
-
3
-## File whitelists
4
-
5
-To whitelist a specific file use the MD5 signature format and place it inside a database file with the extension of `.fp`. To whitelist a specific file with the SHA1 or SHA256 file hash signature format, place the signature inside a database file with the extension of `.sfp`.
6
-
7
-## Signature whitelists
8
-
9
-To whitelist a specific signature from the database you just add the signature name into a local file with the `.ign2` extension and store it inside the database directory.
10
-
11
-E.g:
12
-
13
-```
14
-    Eicar-Test-Signature
15
-```
16
-
17
-Additionally, you can follow the signature name with the MD5 of the entire database entry for this signature. In such a case, the signature will no longer be whitelisted when its entry in the database gets modified (eg. the signature gets updated to avoid false alerts). E.g:
18
-
19
-```
20
-    Eicar-Test-Signature:bc356bae4c42f19a3de16e333ba3569c
21
-```
22
-
23
-Historically, signature whitelists were added to `.ign` files.  This format is still functional, though it has been replaced by the `.ign2` database.
24 1
deleted file mode 100644
... ...
@@ -1,37 +0,0 @@
1
-# Using YARA rules in ClamAV
2
-
3
-ClamAV version 0.99 and above can process YARA rules. ClamAV virus database file names ending with “.yar” or “.yara” are parsed as yara rule files. The link to the YARA rule grammar documentation may be found at http://plusvic.github.io/yara/. There are currently a few limitations on using YARA rules within ClamAV:
4
-
5
-- YARA modules are not yet supported by ClamAV. This includes the “import” keyword and any YARA module-specific keywords.
6
-
7
-- Global rules(“global” keyword) are not supported by ClamAV.
8
-
9
-- External variables(“contains” and “matches” keywords) are not supported.
10
-
11
-- YARA rules pre-compiled with the *yarac* command are not supported.
12
-
13
-- As in the ClamAV logical and extended signature formats, YARA strings and segments of strings separated by wild cards must represent at least two octets of data.
14
-
15
-- There is a maximum of 64 strings per YARA rule.
16
-
17
-- YARA rules in ClamAV must contain at least one literal, hexadecimal, or regular expression string.
18
-
19
-In addition, there are a few more ClamAV processing modes that may affect the outcome of YARA rules.
20
-
21
-- *File decomposition and decompression* - Since ClamAV uses file decomposition and decompression to find viruses within de-archived and uncompressed inner files, YARA rules executed by ClamAV will match against these files as well.
22
-
23
-- *Normalization* - By default, ClamAV normalizes HTML, JavaScript, and ASCII text files. YARA rules in ClamAV will match against the normalized result. The effects of normalization of these file types may be captured using `clamscan --leave-temps --tempdir=mytempdir`. YARA rules may then be written using the normalized file(s) found in `mytempdir`. Alternatively, starting with ClamAV 0.100.0, `clamscan --normalize=no` will prevent normalization and only scan the raw file. To obtain similar behavior prior to 0.99.2, use `clamscan --scan-html=no`. The corresponding parameters for clamd.conf are `Normalize` and `ScanHTML`.
24
-
25
-- *YARA conditions driven by string matches* - All YARA conditions are driven by string matches in ClamAV. This saves from executing every YARA rule on every file. Any YARA condition may be augmented with a string match clause which is always true, such as:
26
-
27
-```yara
28
-  rule CheckFileSize
29
-  {
30
-    strings:
31
-      $abc = "abc"
32
-    condition:
33
-      ($abc or not $abc) and filesize < 200KB
34
-  }
35
-```
36
-
37
-This will ensure that the YARA condition always performs the desired action (checking the file size in this example),
38 1
deleted file mode 100644
... ...
@@ -1,69 +0,0 @@
1
-# Usage
2
-
3
-
4
-<!-- TOC depthFrom:2 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->
5
-
6
-- [Usage](#usage)
7
-  - [Purpose](#purpose)
8
-  - [Daemon](#daemon)
9
-  - [Scanner](#scanner)
10
-  - [Signature Testing and Management](#signature-testing-and-management)
11
-  - [Configuration](#configuration)
12
-
13
-<!-- /TOC -->
14
-
15
-
16
-## Purpose
17
-
18
-
19
-This User Guide presents an overview of the various ways that *libclamav* can be used through the tools provided by ClamAV. To learn more about how to better use each facet of ClamAV that interests you, please follow the links provided.
20
-
21
-
22
-## Daemon
23
-
24
-
25
-The ClamAV Daemon, or [`clamd`](Usage/Scanning.md#clamd), is a multi-threaded daemon that uses *libclamav* to [scan files for viruses](Usage/Scanning.md). ClamAV provides a number of tools which interface with this daemon. They are, as follows:
26
-
27
-  - [`clamdscan`](Usage/Scanning.md#clamdscan) - a simple scanning client
28
-  - [`on-access scanning`](Usage/Scanning.md#On-access-scanning) - provides real-time protection via a `clamd` instance
29
-  - [`clamdtop`](Usage/Scanning.md#clamdtop) - a resource monitoring interface for `clamd`
30
-
31
-
32
-## Scanner
33
-
34
-
35
-ClamAV also provides a command-line tool for [simple scanning](Usage/Scanning.md) tasks with *libclamav* called [`clamscan`](Usage/Scanning.md#clamscan). Unlike the daemon, `clamscan` is not a persistent process and is best suited for use cases where one-time scanning with minimal setup is needed.
36
-
37
-
38
-## Signature Testing and Management
39
-
40
-
41
-A number of tools allow for [testing and management of signatures](Usage/SignatureManagement.md). Of note are the following:
42
-
43
-  - [`clambc`](Usage/SignatureManagement.md#clambc) - specifically for testing bytecode
44
-  - [`sigtool`](Usage/SignatureManagement.md#sigtool) - for general signature testing and analysis
45
-  - [`freshclam`](Usage/SignatureManagement.md#freshclam) - used to update signature database sets to the latest version
46
-
47
-
48
-## Configuration
49
-
50
-
51
-The more complex tools ClamAV provides each require some degree of [configuration](Usage/Configuration.md). ClamAV supplies two example configuration files:
52
-
53
-  - [`clamd.conf`](Usage/Configuration.md#clamdconf) - for configuring the behaviour of the ClamAV Daemon `clamd` and associated tools
54
-  - [`freschclam.conf`](Usage/Configuration.md#freshclamconf) - for configuring the behaviour of the signature database update tool, `freshclam`
55
-
56
-ClamAV also provides a mail filtering tool called [`clamav-milter`](Usage/Configuration.md#clamav-milter) which can be attached to a `clamd` instance for mail scanning purposes.
57
-
58
-Additionally, a tool called [`clamconf`](Usage/Configuration.md#clamconf) allows users to check the configurations used by each other tool, pulling information from the configuration files listed above, alongside other relevant information.
59 1
deleted file mode 100644
... ...
@@ -1,149 +0,0 @@
1
-# Configuration
2
-
3
-
4
-<!-- TOC depthFrom:2 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->
5
-
6
-- [clamconf](#clamconf)
7
-- [clamd.conf](#clamdconf)
8
-	- [On-Access Scanning](#on-access-scanning)
9
-- [freshclam.conf](#freshclamconf)
10
-- [clamav-milter](#clamav-milter)
11
-
12
-<!-- /TOC -->
13
-
14
-
15
-## clamconf
16
-
17
-
18
-`clamconf` is a tool ClamAV provides for checking your entire system configuration, as it relates to your ClamAV installation. When run, it displays values used when configuring ClamAV at compilation time, important OS details, the contents (and validity) of both `clamd.conf` and `freshclam.conf`, along with other important engine, database, platform, and build information.
19
-
20
-It can also generate example configuration files for [`clamd.conf`](#clamdconf) and [`freshclam.conf`](#freshclamconf).
21
-
22
-To use `clamconf`, and see all the information it provides, simply run the following command:
23
-
24
-> `$ clamconf`
25
-
26
-For more detailed information on `clamconf`, run:
27
-
28
-> `$ man clamconf`
29
-
30
-or
31
-
32
-> `$ clamconf --help`
33
-
34
-
35
-## clamd.conf
36
-
37
-
38
-Currently, ClamAV requires users to edit their `clamd.conf.example` file before they can run the daemon. At a bare minimum, users will need to comment out the line that reads "Example", else `clamd` will consider the configuration invalid, ala:
39
-
40
-<pre>
41
-  7 # Comment or remove the line below.
42
-  8 #Example
43
-</pre>
44
-
45
-You will also need to rename `clamd.conf.example` to `clamd.conf` via:
46
-
47
-> `$ mv ./clamd.conf.example ./clamd.conf`
48
-
49
-If you are setting up a simple, local [`clamd` instance](Scanning.md#clamd) then some other configuration options of interests to you will be as follows:
50
-
51
-<pre>
52
-	91 # Path to a local socket file the daemon will listen on.
53
-	92 # Default: disabled (must be specified by a user)
54
-	93 LocalSocket /tmp/clamd.socket
55
-
56
-	...
57
-
58
-	99 # Sets the permissions on the unix socket to the specified mode.
59
-	100 # Default: disabled (socket is world accessible)
60
-	101 LocalSocketMode 660
61
-</pre>
62
-
63
-Beyond that, `clamd.conf` is well commented and configuration should be straightforward.
64
-
65
-If needed, you can find out even more about the formatting and options available in `clamd.conf` with the command:
66
-
67
-> `man clamd.conf`
68
-
69
-
70
-### On-Access Scanning
71
-
72
-
73
-You can configure On-Access Scanning through `clamd.conf`.  Configuration for On-Access Scanning starts at *line 613* in `clamd.conf.example`.
74
-
75
-Please read the [on-access](Usage.md#On-access-Scanning) section of the Usage manual for further details on using On-Access Scanning.
76
-
77
-
78
-## freshclam.conf
79
-
80
-
81
-`freshclam` is the automatic database update tool for Clam AntiVirus. It can be configured to work in two modes:
82
-
83
-- interactive - on demand from command line
84
-- daemon - silently in the background
85
-
86
-`freshclam` is an advanced tool: it supports scripted updates (instead of transferring the whole CVD file at each update it only transfers the differences between the latest and the current database via a special script), database version checks through DNS, proxy servers (with authentication), digital signatures and various error scenarios.
87
-
88
-**Quick test: run freshclam (as superuser) with no parameters and check the output.**
89
-
90
-> `$ freshclam`
91
-
92
-If everything is OK you may create the log file in /var/log (ensure the directory is owned either by *clamav* or whichever user `freshclam` will be running as):
93
-
94
-<pre>
95
-	# touch /var/log/freshclam.log
96
-	# chmod 600 /var/log/freshclam.log
97
-	# chown clamav /var/log/freshclam.log
98
-</pre>
99
-
100
-Now you *should* edit the configuration file `freshclam.conf` and point the *UpdateLogFile* directive to the log file. Finally, to run `freshclam` in the daemon mode, execute:
101
-
102
-<pre>
103
-	# freshclam -d
104
-</pre>
105
-
106
-The other way is to use the *cron* daemon. You have to add the following line to the *crontab* of **root** or **clamav** user:
107
-
108
-<pre>
109
-	N * * * *   /usr/local/bin/freshclam --quiet
110
-</pre>
111
-
112
-to check for a new database every hour. **N should be a number between 3 and 57 of your choice. Please don’t choose any multiple of 10, because there are already too many clients using those time slots.** Proxy settings are only configurable via the configuration file and `freshclam` will require strict permission settings for the config file when `HTTPProxyPassword` is turned on.
113
-
114
-<pre>
115
-	HTTPProxyServer myproxyserver.com
116
-	HTTPProxyPort 1234
117
-	HTTPProxyUsername myusername
118
-	HTTPProxyPassword mypass
119
-</pre>
120
-
121
-
122
-## clamav-milter
123
-
124
-
125
-ClamAV includes a mail filtering tool called `clamav-milter`. This tool interfaces directly with `clamd`, and thus requires a working [`clamd` instance](Scanning.md#clamd) to run. However, `clamav-milter`'s configuration and log files are separate from that of `clamd`.
126
-
127
-Ensuring ClamAV compiles with `clamav-milter` must be done at configure time with the command:
128
-
129
-> `$ ./configure [options] --enable-milter`
130
-
131
-This requires having the milter library installed on your system. If *libmilter* is not installed, `./configure` will exit with this error message:
132
-
133
-<pre>
134
-	checking for mi_stop in -lmilter... no
135
-	configure: error: Cannot find libmilter
136
-</pre>
137
-
138
-While not necessarily *complicated*, setting up the `clamav-milter` is an involved process. Thus, we recommend consulting your MTA’s manual on how to best connect ClamAV with the `clamav-milter`.
139 1
deleted file mode 100644
... ...
@@ -1,131 +0,0 @@
1
-# Scanning
2
-<!-- TOC depthFrom:2 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->
3
-
4
-- [Daemon](#daemon)
5
-	- [clamd](#clamd)
6
-	- [clamdscan](#clamdscan)
7
-	- [clamdtop](#clamdtop)
8
-	- [On-Access Scanning](#on-access-scanning)
9
-- [One-Time Scanning](#one-time-scanning)
10
-	- [clamscan](#clamscan)
11
-
12
-<!-- /TOC -->
13
-
14
-## Daemon
15
-
16
-### clamd
17
-
18
-`clamd` is a multi-threaded daemon that uses *libclamav* to scan files for viruses. Scanning behaviour can be fully configured to fit most needs by modifying `clamd.conf`.
19
-
20
-As `clamd` requires a virus signature database to run, we recommend setting up ClamAV's official signatures before running `clamd` using `freshclam`.
21
-
22
-The daemon works by listening for commands on the sockets specified in `clamd.conf`. Listening is supported over both unix local sockets and TCP sockets.
23
-
24
-**IMPORTANT:** `clamd` does not currently protect or authenticate traffic coming over the TCP socket, meaning it will accept any and all of the following commands listed from *any* source. Thus, we strongly recommend following best networking practices when setting up your `clamd` instance. I.e. don't expose your TCP socket to the Internet.
25
-
26
-Here is a quick list of the commands accepted by `clamd` over the socket.
27
-
28
-- `PING`
29
-- `VERSION`
30
-- `RELOAD`
31
-- `SHUTDOWN`
32
-- `SCAN` *file/directory*
33
-- `RAWSCAN` *file/directory*
34
-- `CONTSCAN` *file/directory*
35
-- `MULTISCAN` *file/directory*
36
-- `ALLMATCHSCAN` *file/directory*
37
-- `INSTREAM`
38
-- `FILDES`
39
-- `STATS`
40
-- `IDSESSION, END`
41
-
42
-As with most ClamAV tools, you can find out more about these by invoking the command:
43
-
44
-> `$ man clamd`
45
-
46
-The daemon also handles the following signals as so:
47
-
48
-- `SIGTERM` - perform a clean exit
49
-- `SIGHUP` - reopen the log file
50
-- `SIGUSR2` - reload the database
51
-
52
-It should be noted that `clamd` should not be started using the shell operator `&` or other external tools which would start it as a background process. Instead, you should run `clamd` which will load the database and then daemonize itself (unless you have specified otherwise in `clamd.conf`). After that, clamd is ready to accept connections and perform file scanning.
53
-
54
-Once you have set up your configuration to your liking, and understand how you will be sending commands to the daemon, running `clamd` itself is simple. Simply execute the command:
55
-
56
-> `$ clamd`
57
-
58
-### clamdscan
59
-
60
-`clamdscan` is a `clamd` client, which greatly simplifies the task of scanning files with `clamd`. It sends commands to the `clamd` daemon across the socket specified in `clamd.conf` and generates a scan report after all requested scanning has been completed by the daemon.
61
-
62
-Thus, **to run `clamdscan`, you must have an instance of `clamd` already running** as well.
63
-
64
-Please keep in mind, that as a simple scanning client, `clamdscan` cannot change scanning and engine configurations. These are tied to the `clamd` instance and the configuration you set up in `clamd.conf`. Therefore, while `clamdscan` will accept many of the same commands as its sister tool `clamscan`, it will simply ignore most of them as (by design) no mechanism exists to make ClamAV engine configuration changes over the `clamd` socket.
65
-
66
-Again, running `clamdscan`, once you have a working `clamd` instance, is simple:
67
-
68
-> `$ clamdscan [*options*] [*file/directory/-*]`
69
-
70
-### clamdtop
71
-
72
-`clamdtop` is a tool to monitor one or multiple instances of `clamd`. It has a colorized *ncurses* interface, which shows each job queued, memory usage, and information about the loaded signature database for the connected `clamd` instance(s). By default it will attempt to connect to the local `clamd` as defined in `clamd.conf`. However, you can specify other `clamd` instances at the command line.
73
-
74
-To learn more, use the commands
75
-
76
-> `$ man clamdtop`
77
-
78
-or
79
-
80
-> `$ clamdtop --help`
81
-
82
-### On-Access Scanning
83
-
84
-The ClamAV daemon can be configured to perform On-Access Scanning under Linux. ClamAV's On-Access Scanning runs *alongside* the `clamd` instance, and shares the same engine and virus signature database with the daemon used to kick it off. The On-Access Scanner is capable of blocking access to/from any malicious files it discovers, but by default it is configured to only alert the user if it detects a malicious file.
85
-
86
-You can can set-up On-Access Scanning [through `clamd.conf`](Configuration.md#on-access-scanning) and learn more about the options available to you by reading the [On-Access Scanning User Guide](../OnAccess.md).
87
-
88
-Once you have set up the On-Access Scanner (and `clamd`) to your liking, you will need to run `clamd` as *root* (or another user with elevated permissions) to start it:
89
-
90
-> `$ sudo clamd`
91
-
92
-## One-Time Scanning
93
-
94
-### clamscan
95
-
96
-`clamscan` is a command line tool which uses *libclamav* to scan files and/or directories for viruses. Unlike `clamdscan`, `clamscan` does *not* require a running `clamd` instance to function. Instead, `clamscan` will create a new engine and load in the virus database each time it is run. It will then scan the files and/or directories specified at the command line, create a scan report, and exit.
97
-
98
-By default, when loading databases, `clamscan` will check the location to which `freshclam` installed the virus database signatures. This behaviour, along with a myriad of other scanning and engine controls, can be modified by providing flags and other options at the command line.
99
-
100
-There are too many options to list all of them here. So we'll only cover a few common and more interesting ones:
101
-
102
-- `--log=FILE` - save scan report to FILE
103
-- `--database=FILE/DIR` - load virus database from FILE or load all supported db files from DIR
104
-- `--official-db-only[=yes/no(*)]` - only load official signatures
105
-- `--max-filesize=#n` - files larger than this will be skipped and assumed clean
106
-- `--max-scansize=#n` - the maximum amount of data to scan for each container file
107
-- `--leave-temps[=yes/no(*)]`- do not remove temporary files
108
-- `--file-list=FILE` - scan files from FILE
109
-- `--quiet` - only output error messages
110
-- `--bell` - sound bell on virus detection
111
-- `--cross-fs[=yes(*)/no]` - scan files and directories on other filesystems
112
-- `--move=DIRECTORY` - move infected files into DIRECTORY
113
-- `--copy=DIRECTORY` - copy infected files into DIRECTORY
114
-- `--bytecode-timeout=N` - set bytecode timeout (in milliseconds)
115
-- `--heuristic-alerts[=yes(*)/no]` - toggles heuristic alerts
116
-- `--alert-encrypted[=yes/no(*)]` - alert on encrypted archives and documents
117
-- `--nocerts` - disable authenticode certificate chain verification in PE files
118
-- `--disable-cache` - disable caching and cache checks for hash sums of scanned files
119
-
120
-To learn more about the options available when using `clamscan` please reference:
121
-
122
-> `$ man clamscan`
123
-
124
-and
125
-
126
-> `$ clamscan --help`
127
-
128
-
129
-Otherwise, the general usage of clamscan is:
130
-
131
-> `clamscan [options] [file/directory/-]`
132 1
deleted file mode 100644
... ...
@@ -1,83 +0,0 @@
1
-# Signature Testing and Management
2
-
3
-
4
-<!-- TOC depthFrom:2 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->
5
-
6
-- [freshclam](#freshclam)
7
-- [sigtool](#sigtool)
8
-- [clambc](#clambc)
9
-
10
-<!-- /TOC -->
11
-
12
-
13
-## freshclam
14
-
15
-
16
-The tool `freshclam` is used to download and update ClamAV’s official virus signature databases. While easy to use in its base configuration, `freshclam` does require a working [`freshclam.conf` configuration file](Configuration.md#freshclam) to run (the location of which can be passed in via command line if the default search location does not fit your needs).
17
-
18
-Once you have a valid configuration file, you can invoke freshclam with the following command:
19
-
20
-> $ freshclam
21
-
22
-By default, `freshclam` will then attempt to connect to ClamAV's virus signature database distribution network. If no databases exist in the directory specified, `freshclam` will do a fresh download of the requested databases. Otherwise, `freshclam` will attempt to update existing databases, pairing them against downloaded cdiffs. If a database is found to be corrupted, it is not updated and instead replaced with a fresh download.
23
-
24
-Of course, all this behaviour--and more--can be changed to suit your needs by [modifying `freshclam.conf` and/or using various command line options](Configuration.md#freshclamconf).
25
-
26
-You can find more information about freshclam with the commands:
27
-
28
-> $ `man freshclam`
29
-
30
-and
31
-
32
-> $ `freshclam --help`
33
-
34
-
35
-## sigtool
36
-
37
-
38
-ClamAV provides `sigtool` as a command-line testing tool for assisting users in their efforts creating and working with virus signatures. While sigtool has many uses--including crafting signatures--of particular note, is sigtool's ability to help users and analysts in determining if a file detected by *libclamav*'s virus signatures is a false positive.
39
-
40
-This can be accomplished by using the command:
41
-
42
-> $ `sigtool --unpack=FILE`
43
-
44
-Where FILE points to your virus signature databases. Then, once `sigtool` has finished unpacking the database into the directory from which you ran the command, you can search for the offending signature name (provided either by [`clamscan`](./Scanning.md#clamscan) scan reports or [`clamd`](./Scanning.md#clamd) logs). As an example:
45
-
46
-> $ `grep "Win.Test.EICAR" ./*`
47
-
48
-Or, do all that in one step with:
49
-
50
-> $ `sigtool --find="Win.Test.EICAR"`
51
-
52
-This should give you the offending signature(s) in question, which can then be included as part of your [false positive report](https://www.clamav.net/reports/fp).
53
-
54
-To learn more in depth information on how `sigtool` can be used to help create virus signatures and work with malicious (and non-malicious) files please reference the many online tutorials on the topic.
55
-
56
-Otherwise, information on available sigtool functions can be easily referenced with:
57
-
58
-> $ `sigtool --help`
59
-
60
-and
61
-
62
-> $ `man sigtool`
63
-
64
-
65
-## clambc
66
-
67
-
68
-`clambc` is Clam Anti-Virus’ bytecode signature testing tool. It can be used to test newly crafted bytecode signatures or to help verify existing bytecode is executing against a sample as expected.
69
-
70
-For more detailed help, please use:
71
-
72
-> $ `man clambc`
73
-
74
-or
75
-
76
-> $ `clambc --help`
77 1
deleted file mode 100644
... ...
@@ -1,395 +0,0 @@
1
-# ClamAV Development
2
-
3
-Table of Contents
4
-
5
-- [ClamAV Development](#clamav-development)
6
-    - [Introduction](#introduction)
7
-    - [Building ClamAV for Development](#building-clamav-for-development)
8
-        - [Satisfying Build Dependencies](#satisfying-build-dependencies)
9
-            - [Debian/Ubuntu](#debianubuntu)
10
-            - [CentOS/RHEL/Fedora](#centosrhelfedora)
11
-            - [Solaris (using OpenCSW)](#solaris-using-opencsw)
12
-            - [FreeBSD](#freebsd)
13
-        - [Download the Source](#download-the-source)
14
-        - [Running ./configure](#running-configure)
15
-        - [Running make](#running-make)
16
-        - [Downloading the Official Ruleset](#downloading-the-official-ruleset)
17
-    - [General Debugging](#general-debugging)
18
-        - [Useful clamscan Flags](#useful-clamscan-flags)
19
-        - [Using gdb](#using-gdb)
20
-    - [Hunting for Memory Leaks](#hunting-for-memory-leaks)
21
-    - [Computing Code Coverage](#computing-code-coverage)
22
-    - [Profiling - Flame Graphs](#profiling---flame-graphs)
23
-    - [Profiling - Callgrind](#profiling---callgrind)
24
-    - [System Call Tracing / Fault Injection](#system-call-tracing--fault-injection)
25
-
26
-## Introduction
27
-
28
-This page aims to provide information useful when developing, debugging, or profiling ClamAV.
29
-
30
-## Building ClamAV for Development
31
-
32
-Below are some recommendations for building ClamAV so that it's easy to debug.
33
-
34
-### Satisfying Build Dependencies
35
-
36
-To satisify all build dependencies:
37
-
38
-#### Debian/Ubuntu
39
-
40
-```bash
41
-sudo apt-get install libxml2-dev libxml2 libbz2-dev bzip2 check make libssl-dev openssl zlib1g zlib1g-dev gcc gettext autoconf automake libtool cmake autoconf-archive pkg-config g++-multilib libmilter1.0.1 libmilter-dev valgrind libcurl4-openssl-dev libjson-c-dev ncurses-dev libpcre3-dev
42
-```
43
-
44
-#### CentOS/RHEL/Fedora
45
-
46
-```bash
47
-sudo yum install libxml2-devel libxml2 bzip2-devel bzip2 check make openssl-devel openssl zlib zlib-devel gcc gettext autoconf automake libtool cmake autoreconf pkg-config g++-multilib sendmail sendmail-devel libtool-ltdl-devel valgrind
48
-
49
-sudo yum groupinstall "Development Tools"
50
-```
51
-
52
-#### Solaris (using OpenCSW)
53
-
54
-```bash
55
-sudo /opt/csw/bin/pkgutil -y -i common coreutils automake autoconf libxml2_2 libxml2_dev bzip2 libbz2_dev libcheck0 libcheck_dev gmake cmake libssl1_0_0 libssl_dev openssl_utilslibgcc_s1 libiconv2 zlib1 libstdc++6 libpcre1 libltdl7 lzlib_stub zlib_stub libmilter libtool ggrep gsed pkgconfig ggettext gcc4core gcc4g++ libgcc_s1 libgccpp1
56
-
57
-sudo pkg install system/header
58
-
59
-sudo ln -sf /opt/csw/bin/gnm /usr/bin/nm
60
-sudo ln -sf /opt/csw/bin/gsed /usr/bin/sed
61
-sudo ln -sf /opt/csw/bin/gmake /usr/bin/make
62
-```
63
-
64
-If you receive an error message like `gcc: error: /opt/csw/lib/libstdc++.so: No such file or directory`, change versions with `/opt/csw/sbin/alternatives --config automake`
65
-
66
-#### FreeBSD
67
-
68
-The easiest way to install dependencies for FreeBSD is to just rely on ports:
69
-
70
-```bash
71
-cd /usr/ports/security/clamav
72
-make
73
-```
74
-
75
-### Download the Source
76
-
77
-```bash
78
-git clone https://github.com/Cisco-Talos/clamav-devel.git
79
-cd clamav-devel
80
-```
81
-
82
-If you intend to make changes and submit a pull request, fork the clamav-devel repo first and then clone your fork of the repository.
83
-
84
-### Running ./configure
85
-
86
-Suggestions:
87
-
88
-- Modify the `CFLAGS` variable as follows (assuming you're build with gcc):
89
-
90
-  - Include `gdb` debugging information (`-ggdb`).  This will make it easier to debug with `gdb`.
91
-
92
-  - Disable optimizations (`-O0`).  This will ensure the line numbers you see in `gdb` match up with what is actually being executed.
93
-
94
-- Run configure with the following options:
95
-
96
-  - ``--prefix=`pwd`/build``: This will cause `make install` to install into the specified directory to avoid potentially tainting a release install of ClamAV that you may have.
97
-
98
-  - `--enable-debug`: This will define *CL_DEBUG*, which mostly just enables additional print statements that are useful for debugging.
99
-
100
-  - `--enable-check`: Enables the unit tests, which can be run with `make check`.
101
-
102
-  - `--enable-coverage`: If using gcc, sets `-fprofile-arcs -ftest-coverage` so that code coverage metrics will get generated when the program is run. Note that the code inserted to store program flow data may show up in any generated flame graphs or profiling output, so if you don't care about code coverage, omit this.
103
-
104
-  - `--enable-libjson`: Enables `libjson`, which enables the `--gen-json` option. The json output contains additional metadata that might be helpful when debugging.
105
-
106
-  - `--with-systemdsystemunitdir=no`: Don't try to register `clamd` as a `systemd` service (on systems that use `systemd`). You likely don't want this development build of `clamd` to register as a service, and this eliminates the need to run `make install` with `sudo`.
107
-
108
-  - You might want to include the following flags also so that the optional functionality is enabled: `--enable-experimental --enable-clamdtop --enable-libjson --enable-milter --enable-xml --enable-pcre`. Note that this may require you to install additional development libraries.
109
-
110
-  - `--disable-llvm`: When enabled, LLVM provides the capability to just-in-time compile ClamAV bytecode signatures. Without LLVM, ClamAV uses a built-in bytecode interpreter to execute bytecode signatures. The mechanism is different, but the results are same and the performance overall is comparable.  At present only LLVM versions up to LLVM 3.6.2 are supported by ClamAV, and LLVM 3.6.2 is old enough that newer distributions no longer provide it. Therefore, we recommend using the `--disable-llvm` configure option.
111
-
112
-Altogether, the following configure command can be used:
113
-
114
-```bash
115
-CFLAGS="-ggdb -O0" ./configure --prefix=`pwd`/installed --enable-debug --enable-check --enable-coverage --enable-libjson --with-systemdsystemunitdir=no --enable-experimental --enable-clamdtop --enable-libjson --enable-xml --enable-pcre --disable-llvm
116
-```
117
-
118
-NOTE: It is possible to build libclamav as a static library and have it statically linked into clamscan/clamd (to do this, run `./configure` with `--enable-static --disable-shared`).  This is useful for using tools like `gprof` that do not support profiling code in shared objects.  However, there are two drawbacks to doing this:
119
-
120
-- `clamscan`/`clamd` will not be able to extract files from RAR archives.  Based on the software license of the unrar library that ClamAV uses, the library can only be dynamically loaded.  ClamAV will attempt to dlopen the unrar library shared object and will continue on without RAR extraction support if the library can't be found (or if it doesn't get built, which is what happens if you indicate that shared libraries should not be built).
121
-
122
-- If you make changes to libclamav, you'll need to `make clean`, `make`, and `make install` again to have `clamscan`/`clamd` rebuilt using the new `libclamav.a`.  The makefiles don't seem to know to rebuild `clamscan`/`clamd` when `libclamav.a` changes (TODO, fix this).
123
-
124
-### Running make
125
-
126
-Run the following to finishing building.  `-j2` in the code below is used to indicate that the build process should use 2 cores.  Increase this if your machine is more powerful.
127
-
128
-```bash
129
-make -j2
130
-make install
131
-```
132
-
133
-Also, you can run `make check` to run the unit tests
134
-
135
-### Downloading the Official Ruleset
136
-
137
-If you plan to use custom rules for testing, you can invoke `clamscan` via `./installed/bin/clamscan`, specifying your custom rule files via `-d` parameters.
138
-
139
-If you want to download the official ruleset to use with `clamscan`, do the following:
140
-
141
-1. Run `mkdir -p installed/share/clamav`
142
-2. Comment out line 8 of etc/freshclam.conf.sample
143
-3. Run `./installed/bin/freshclam --config-file etc/freshclam.conf.sample`
144
-
145
-## General Debugging
146
-
147
-NOTE: Some of the debugging/profiling tools mentioned in the sections below are specific to Linux
148
-
149
-### Useful clamscan Flags
150
-
151
-The following are useful flags to include when debugging clamscan:
152
-
153
-- `--debug --verbose`: Print lots of helpful debug information
154
-
155
-- `--gen-json`: Print some additional debug information in a JSON format
156
-
157
-- `--statistics=pcre --statistics=bytecode`: Print execution statistics on any PCRE and bytecode rules that were evaluated
158
-
159
-- `--dev-performance`: Print per-file statistics regarding how long scanning took and the times spent in various scanning stages
160
-
161
-- `--detect-broken`: This will attempt to detect broken executable files.  If an executable is determined to be broken, some functionality might not get invoked for the sample, and this could be an indication of an issue parsing the PE header or file.  This causes those binary to generate an alert instead of just continuing on.  NOTE: This will be renamed to `--alert-broken` starting in ClamAV 0.101.
162
-
163
-- `--max-filesize=2000M --max-scansize=2000M --max-files=2000000 --max-recursion=2000000 --max-embeddedpe=2000M --max-htmlnormalize=2000000 --max-htmlnotags=2000000 --max-scriptnormalize=2000000 --max-ziptypercg=2000000 --max-partitions=2000000 --max-iconspe=2000000 --max-rechwp3=2000000 --pcre-match-limit=2000000 --pcre-recmatch-limit=2000000 --pcre-max-filesize=2000M`:
164
-
165
-  Effectively disables all file limits and maximums for scanning.  This is useful if you'd like to ensure that all files in a set get scanned, and would prefer clam to just run slowly or crash rather than skip a file because it encounters one of these thresholds
166
-
167
-The following are useful flags to include when debugging rules that you're
168
-writing:
169
-
170
-- `-d`: Allows you to specify a custom ClamAV rule file from the command line
171
-
172
-- `--bytecode-unsigned`: If you are testing custom bytecode rules, you'll need this flag so that `clamscan` actually runs the bytecode signature
173
-
174
-- `--all-match`: Allows multiple signatures to match on a file being scanned
175
-
176
-- `--leave-temps --tmpdir=/tmp`: By default, ClamAV will attempt to extract embedded files that it finds, normalize certain text files before looking for matches, and unpack packed executables that it has unpacking support for. These flags tell ClamAV to write these intermediate files out to the directory specified.  Usually when a file is written, it will mention the file name in the --debug output, so you can have some idea at what stage in the scanning process a tmp file was created.
177
-
178
-- `--dump-certs`: For signed PE files that match a rule, display information about the certificates stored within the binary.  Note - sigtool has this functionality as well and doesn't require a rule match to view the cert data
179
-
180
-### Using gdb
181
-
182
-Given that you might want to pass a lot of arguments to `gdb`, consider taking advantage of the `--args` parameter.  For example:
183
-
184
-```bash
185
-gdb --args ./installed/bin/clamscan -d /tmp/test.ldb -d /tmp/blacklist.crb -d --dumpcerts --debug --verbose --max-filesize=2000M --max-scansize=2000M --max-files=2000000 --max-recursion=2000000 --max-embeddedpe=2000M --max-iconspe=2000000 f8f101166fec5785b4e240e4b9e748fb6c14fdc3cd7815d74205fc59ce121515
186
-```
187
-
188
-When using ClamAV without libclamav statically linked, if you set breakpoints on libclamav functions by name, you'll need to make sure to indicate that the breakpoints should be resolved after libraries have been loaded.
189
-
190
-For other documentation about how to use `gdb`, check out the following resources:
191
-
192
-- [A Guide to gdb](http://www.cabrillo.edu/~shodges/cs19/progs/guide_to_gdb_1.1.pdf)
193
-- [gdb Quick Reference](http://users.ece.utexas.edu/~adnan/gdb-refcard.pdf)
194
-
195
-## Hunting for Memory Leaks
196
-You can easily hunt for memory leaks with valgrind.  Check out this guide to get started: [Valgrind Quick Start](http://valgrind.org/docs/manual/quick-start.html)
197
-
198
-If checking for leaks, be sure to run `clamscan` with samples that will hit as many of the unique code paths in the code you are testing.  An example invocation is as follows:
199
-
200
-```bash
201
-valgrind --leak-check=full ./installed/bin/clamscan -d /tmp/test.ldb --leave-temps --tempdir /tmp/test --debug --verbose /tmp/upx-samples/ > /tmp/upx-results-2.txt 2>&1
202
-```
203
-
204
-Alternatively, on Linux, you can use glibc's built-in leak checking functionality:
205
-
206
-```bash
207
-MALLOC_CHECK_=7 ./installed/bin/clamscan
208
-```
209
-
210
-See the [mallopt man page](http://manpages.ubuntu.com/manpages/trusty/man3/mallopt.3.html) for more details
211
-
212
-## Computing Code Coverage
213
-
214
-gcov/lcov can be used to produce a code coverage report indicating which lines of code were executed on a single run or by multiple runs of `clamscan`.  NOTE: for these metrics to be collected, ClamAV needs to have been configured with the `--enable-coverage` option.
215
-
216
-First, run the following to zero out all of the performance metrics:
217
-
218
-```bash
219
-lcov -z --directory . --output-file coverage.lcov.data
220
-```
221
-
222
-Next, run ClamAV through whatever test cases you have.  Then, run lcov again to collect the coverage data as follows:
223
-
224
-```bash
225
-lcov -c --directory . --output-file coverage.lcov.data
226
-```
227
-
228
-Finally, run the genhtml tool that ships with lcov to produce the code coverage report:
229
-
230
-```bash
231
-genhtml coverage.lcov.data --output-directory report
232
-```
233
-
234
-The report directory will have an `index.html` page which can be loaded into any web browser.
235
-
236
-For more information, visit the [lcov webpage](http://ltp.sourceforge.net/coverage/lcov.php)
237
-
238
-## Profiling - Flame Graphs
239
-
240
-[FlameGraph](https://github.com/brendangregg/FlameGraph) is a great tool for generating interactive flamegraphs based collected profiling data.  The github page has thorough documentation on how to use the tool, but an overview is presented below:
241
-
242
-First, install `perf`, which on Linux can be done via:
243
-
244
-```bash
245
-apt-get install linux-tools-common linux-tools-generic linux-tools-`uname -r`
246
-```
247
-
248
-Modify the system settings to allow `perf` record to be run by a standard user:
249
-
250
-```bash
251
-sudo su     # Run the following as root
252
-cat /proc/sys/kernel/perf_event_paranoid
253
-echo "1" > /proc/sys/kernel/perf_event_paranoid
254
-exit
255
-```
256
-
257
-Invoke `clamscan` via `perf record` as follows, and run `perf script` to collect the profiling data:
258
-
259
-```bash
260
-perf record -F 100 -g -- ./installed/bin/clamscan -d /tmp/test.ldb /tmp/2aa6b18d509090c60c3e4ecdd8aeb16e5f149807e3404c86892112710eab576d
261
-perf script > out.perf
262
-```
263
-
264
-The `-F` parameter indicates how many samples should be collected during program execution.  If your scan will take a long time to run, a lower value should be sufficient.  Otherwise, consider choosing a higher value (on Ubuntu 18.04, 7250 is the max frequency, but it can be increased via `/proc/sys/kernel/perf_event_max_sample_rate`.
265
-
266
-Check out the FlameGraph project and run the following commands to generate the flame graph:
267
-
268
-```bash
269
-perl stackcollapse-perf.pl ../clamav-devel/out.perf > /tmp/out.folded
270
-perl flamegraph.pl /tmp/out.folded > /tmp/test.svg
271
-```
272
-
273
-The SVG that is generated is interactive, but some viewers don't support this.
274
-Be sure to open it in a web browser like Chrome to be able to take full advantage of it.
275
-
276
-## Profiling - Callgrind
277
-
278
-Callgrind is a profiling tool included with `valgrind`.  This can be done by prepending `valgrind --tool=callgrind ` to the `clamscan` command.
279
-
280
-[kcachegrind](https://kcachegrind.github.io/html/Home.html) is a follow-on tool that will graphically present the profiling data and allow you to explore it visually, although if you don't already use KDE you'll have to install lots of extra packages to use it.
281
-
282
-## System Call Tracing / Fault Injection
283
-
284
-strace can be used to track the system calls that are performed and provide the number of calls / time spent in each system call.  This can be done by prepending `strace -c ` to a `clamscan` command.  Results will look something like this:
285
-
286
-```
287
-% time     seconds  usecs/call     calls    errors syscall
288
- 95.04    0.831430          13     62518           read
289
-  3.22    0.028172          14      2053           munmap
290
-  0.69    0.006005           3      2102           mmap
291
-  0.28    0.002420           7       344           pread64
292
-  0.16    0.001415           5       305         1 openat
293
-  0.13    0.001108           3       405           write
294
-  0.11    0.000932          23        40           mprotect
295
-  0.07    0.000632           2       310           close
296
-  0.07    0.000583           9        67        30 access
297
-  0.05    0.000395           1       444           lseek
298
-  0.04    0.000344           2       162           fstat
299
-  0.04    0.000338           1       253           brk
300
-  0.03    0.000262           1       422           fcntl
301
-  0.02    0.000218          16        14           futex
302
-  0.01    0.000119           1       212           getpid
303
-  0.01    0.000086          14         6           getdents
304
-  0.00    0.000043           7         6           dup
305
-  0.00    0.000040           1        31           unlink
306
-  0.00    0.000038          19         2           rt_sigaction
307
-  0.00    0.000037          19         2           rt_sigprocmask
308
-  0.00    0.000029           1        37           stat
309
-  0.00    0.000022          11         2           prlimit64
310
-  0.00    0.000021          21         1           sysinfo
311
-  0.00    0.000020           1        33           clock_gettime
312
-  0.00    0.000019          19         1           arch_prctl
313
-  0.00    0.000018          18         1           set_tid_address
314
-  0.00    0.000018          18         1           set_robust_list
315
-  0.00    0.000013           0        60           lstat
316
-  0.00    0.000011           0        65           madvise
317
-  0.00    0.000002           0        68           geteuid
318
-  0.00    0.000000           0         1           execve
319
-  0.00    0.000000           0         1           uname
320
-  0.00    0.000000           0         1           getcwd
321
-100.00    0.874790                 69970        31 total
322
-```
323
-
324
-`strace` can also be used for cool things like system call fault injection.  For instance, let's say you are curious whether the `read` bytecode API call is implemented in such a way that the underlying `read` system call could handle `EINTR` being returned (which can happen periodically).  To test this, write the following bytecode rule:
325
-
326
-```c
327
-VIRUSNAME_PREFIX("BC.Heuristic.Test.Read.Passed")
328
-VIRUSNAMES("")
329
-TARGET(0)
330
-
331
-SIGNATURES_DECL_BEGIN
332
-DECLARE_SIGNATURE(zeroes)
333
-SIGNATURES_DECL_END
334
-
335
-SIGNATURES_DEF_BEGIN
336
-DEFINE_SIGNATURE(zeroes, "0:0000")
337
-SIGNATURES_DEF_END
338
-
339
-bool logical_trigger()
340
-{
341
-    return matches(Signatures.zeroes);
342
-}
343
-
344
-#define READ_S(value, size) if (read(value, size) != size) return 0;
345
-
346
-int entrypoint(void)
347
-{
348
-    char buffer[65536];
349
-    int i;
350
-
351
-    for (i = 0; i < 256; i++)
352
-    {
353
-        debug(i);
354
-        debug("\n");
355
-        READ_S(buffer, sizeof(buffer));
356
-    }
357
-
358
-    foundVirus("");
359
-    return 0;
360
-}
361
-```
362
-
363
-Compiled the rule, and make a test file to match against it. Then run it under `strace` to determine what underlying read system call is being used for the bytecode `read` function:
364
-
365
-```bash
366
-clambc-compiler read_test.bc
367
-dd if=/dev/zero of=/tmp/zeroes bs=65535 count=256
368
-strace clamscan -d read_test.cbc --bytecode-unsigned /tmp/zeroes
369
-```
370
-
371
-It uses `pread64` under the hood, so the following command could be used for fault injection:
372
-
373
-```bash
374
-strace -e fault=pread64:error=EINTR:when=20+10 clamscan -d read_test.cbc --bytecode-unsigned /tmp/zeroes
375
-```
376
-
377
-This command tells `strace` to skip the first 20 `pread64` calls (these appear to be used by the loader, which didn't seem to handle `EINTR` correctly) but to inject `EINTR` for every 10th call afterward.  We can see the injection in action and that the system call is retried successfully:
378
-
379
-```
380
-pread64(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 65536, 15007744) = 65536
381
-pread64(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 65536, 15073280) = 65536
382
-pread64(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 65536, 15138816) = 65536
383
-pread64(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 65536, 15204352) = 65536
384
-pread64(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 65536, 15269888) = 65536
385
-pread64(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 65536, 15335424) = 65536
386
-pread64(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 65536, 15400960) = 65536
387
-pread64(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 65536, 15466496) = 65536
388
-pread64(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 65536, 15532032) = 65536
389
-pread64(3, 0x7f6a7ff43000, 65536, 15597568) = -1 EINTR (Interrupted system call) (INJECTED)
390
-pread64(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 65536, 15597568) = 65536
391
-```
392
-
393
-More documentation on using `strace` to perform system call fault injection, see [this presentation](https://archive.fosdem.org/2017/schedule/event/failing_strace/attachments/slides/1630/export/events/attachments/failing_strace/slides/1630/strace_fosdem2017_ta_slides.pdf) from FOSDEM 2017.
394 1
deleted file mode 100644
395 2
Binary files a/docs/UserManual/images/demon.png and /dev/null differ
396 3
deleted file mode 100644
... ...
@@ -1,448 +0,0 @@
1
-# LibClamAV
2
-
3
-Libclamav provides an easy and effective way to add a virus protection into your software. The library is thread-safe and transparently recognizes and scans within archives, mail files, MS Office document files, executables and other special formats.
4
-
5
-## License
6
-
7
-Libclamav is licensed under the GNU GPL v2 license. This means you are **not allowed** to link commercial, closed-source software against it. All software using libclamav must be GPL compliant.
8
-
9
-## Supported formats and features
10
-
11
-### Executables
12
-
13
-The library has a built-in support for 32- and 64-bit Portable Executable, ELF and Mach-O files. Additionally, it can handle PE files compressed or obfuscated with the following tools:
14
-
15
-- Aspack (2.12)
16
-- UPX (all versions)
17
-- FSG (1.3, 1.31, 1.33, 2.0)
18
-- Petite (2.x)
19
-- PeSpin (1.1)
20
-- NsPack
21
-- wwpack32 (1.20)
22
-- MEW
23
-- Upack
24
-- Y0da Cryptor (1.3)
25
-
26
-### Mail files
27
-
28
-Libclamav can handle almost every mail file format including TNEF (winmail.dat) attachments.
29
-
30
-### Archives and compressed files
31
-
32
-The following archive and compression formats are supported by internal handlers:
33
-
34
-- Zip (+ SFX)
35
-- RAR (+ SFX)
36
-- 7Zip
37
-- Tar
38
-- CPIO
39
-- Gzip
40
-- Bzip2
41
-- DMG
42
-- IMG
43
-- ISO 9660
44
-- PKG
45
-- HFS+ partition
46
-- HFSX partition
47
-- APM disk image
48
-- GPT disk image
49
-- MBR disk image
50
-- XAR
51
-- XZ
52
-- MS OLE2
53
-- MS Cabinet Files (+ SFX)
54
-- MS CHM (Compiled HTML)
55
-- MS SZDD compression format
56
-- BinHex
57
-- SIS (SymbianOS packages)
58
-- AutoIt
59
-- NSIS
60
-- InstallShield
61
-
62
-### Documents
63
-
64
-The most popular file formats are supported:
65
-
66
-- MS Office and MacOffice files
67
-- RTF
68
-- PDF
69
-- HTML
70
-
71
-In the case of Office, RTF and PDF files, libclamav will only extract the embedded objects and will not decode the text data itself. The text decoding and normalization is only performed for HTML files.
72
-
73
-### Data Loss Prevention
74
-
75
-Libclamav includes a DLP module which can detect the following credit card issuers: AMEX, VISA, MasterCard, Discover, Diner’s Club, and JCB and U.S. social security numbers inside text files.
76
-
77
-Future versions of Libclamav may include additional features to detect other credit cards and other forms of PII (Personally Identifiable Information) which may be transmitted without the benefit of being encrypted.
78
-
79
-### Others
80
-
81
-Libclamav can handle various obfuscators, encoders, files vulnerable to security risks such as:
82
-
83
-- JPEG (exploit detection)
84
-- RIFF (exploit detection)
85
-- uuencode
86
-- ScrEnc obfuscation
87
-- CryptFF
88
-
89
-## API
90
-
91
-### Header file
92
-
93
-Every program using libclamav must include the header file `clamav.h`:
94
-
95
-```c
96
-    #include <clamav.h>
97
-```
98
-
99
-### Initialization
100
-
101
-Before using libclamav, you should call `cl_init()` to initialize it. `CL_INIT_DEFAULT` is a macro that can be passed to `cl_init()` representing the default initialization settings. When it’s done, you’re ready to create a new scan engine by calling `cl_engine_new()`. To free resources allocated by the engine use `cl_engine_free()`. Function prototypes:
102
-
103
-```c
104
-    int cl_init(unsigned int options);
105
-    struct cl_engine *cl_engine_new(void);
106
-    int cl_engine_free(struct cl_engine *engine);
107
-```
108
-
109
-`cl_init()` and `cl_engine_free()` return `CL_SUCCESS` on success or another code on error. `cl_engine_new()` return a pointer or NULL if there’s not enough memory to allocate a new engine structure.
110
-
111
-### Database loading
112
-
113
-The following set of functions provides an interface for loading the virus database:
114
-
115
-```c
116
-    const char *cl_retdbdir(void);
117
-
118
-    int cl_load(const char *path, struct cl_engine *engine,
119
-            unsigned int *signo, unsigned int options);
120
-```
121
-
122
-`cl_retdbdir()` returns the default (hardcoded) path to the directory with ClamAV databases. `cl_load()` loads a single database file or all databases from a given directory (when `path` points to a directory). The second argument is used for passing in the pointer to the engine that should be previously allocated with `cl_engine_new()`. A number of loaded signatures will be **added** to `signo`. The last argument can pass the following flags:
123
-
124
-- **CL_DB_STDOPT**
125
-    This is an alias for a recommended set of scan options.
126
-- **CL_DB_PHISHING**
127
-    Load phishing signatures.
128
-- **CL_DB_PHISHING_URLS**
129
-    Initialize the phishing detection module and load .wdb and .pdb
130
-    files.
131
-- **CL_DB_PUA**
132
-    Load signatures for Potentially Unwanted Applications.
133
-- **CL_DB_OFFICIAL_ONLY**
134
-    Only load official signatures from digitally signed databases.
135
-- **CL_DB_BYTECODE**
136
-    Load bytecode.
137
-
138
-`cl_load()` returns `CL_SUCCESS` on success and another code on failure.
139
-
140
-```c
141
-        ...
142
-        struct cl_engine *engine;
143
-        unsigned int sigs = 0;
144
-        int ret;
145
-
146
-    if((ret = cl_init(CL_INIT_DEFAULT)) != CL_SUCCESS) {
147
-        printf("cl_init() error: %s\n", cl_strerror(ret));
148
-        return 1;
149
-    }
150
-
151
-    if(!(engine = cl_engine_new())) {
152
-        printf("Can't create new engine\n");
153
-        return 1;
154
-    }
155
-
156
-    ret = cl_load(cl_retdbdir(), engine, &sigs, CL_DB_STDOPT);
157
-```
158
-
159
-### Error handling
160
-
161
-Use `cl_strerror()` to convert error codes into human readable messages. The function returns a statically allocated string:
162
-
163
-```c
164
-    if(ret != CL_SUCCESS) {
165
-        printf("cl_load() error: %s\n", cl_strerror(ret));
166
-        cl_engine_free(engine);
167
-        return 1;
168
-    }
169
-```
170
-
171
-### Engine structure
172
-
173
-When all required databases are loaded you should prepare the detection engine by calling `cl_engine_compile()`. In case of failure you should still free the memory allocated to the engine with `cl_engine_free()`:
174
-
175
-```c
176
-    int cl_engine_compile(struct cl_engine *engine);
177
-```
178
-
179
-In our example:
180
-
181
-```c
182
-    if((ret = cl_engine_compile(engine)) != CL_SUCCESS) {
183
-        printf("cl_engine_compile() error: %s\n", cl_strerror(ret));
184
-        cl_engine_free(engine);
185
-        return 1;
186
-    }
187
-```
188
-
189
-### Limits
190
-
191
-When you create a new engine with `cl_engine_new()`, it will have all internal settings set to default values as recommended by the ClamAV authors. It’s possible to check and modify the values (numerical and strings) using the following set of functions:
192
-
193
-```c
194
-int cl_engine_set_num(struct cl_engine *engine,
195
-  enum cl_engine_field field, long long num);
196
-
197
-long long cl_engine_get_num(const struct cl_engine *engine,
198
-  enum cl_engine_field field, int *err);
199
-
200
-int cl_engine_set_str(struct cl_engine *engine,
201
-  enum cl_engine_field field, const char *str);
202
-
203
-const char *cl_engine_get_str(const struct cl_engine *engine,
204
-  enum cl_engine_field field, int *err);
205
-```
206
-
207
-Please don’t modify the default values unless you know what you’re doing. Refer to the ClamAV sources (clamscan, clamd) for examples.
208
-
209
-### Database checks
210
-
211
-It’s very important to keep the internal instance of the database up to date. You can watch database changes with the `cl_stat..()` family of functions.
212
-
213
-```c
214
-    int cl_statinidir(const char *dirname, struct cl_stat *dbstat);
215
-    int cl_statchkdir(const struct cl_stat *dbstat);
216
-    int cl_statfree(struct cl_stat *dbstat);
217
-```
218
-
219
-Initialization:
220
-
221
-```c
222
-        ...
223
-        struct cl_stat dbstat;
224
-
225
-    memset(&dbstat, 0, sizeof(struct cl_stat));
226
-    cl_statinidir(dbdir, &dbstat);
227
-```
228
-
229
-To check for a change you just need to call `cl_statchkdir` and check its return value (0 - no change, 1 - some change occurred). Remember to reset the `cl_stat` structure after reloading the database.
230
-
231
-```c
232
-    if(cl_statchkdir(&dbstat) == 1) {
233
-        reload_database...;
234
-        cl_statfree(&dbstat);
235
-        cl_statinidir(cl_retdbdir(), &dbstat);
236
-    }
237
-```
238
-
239
-Libclamav \(\ge0.96\) includes and additional call to check the number of signatures that can be loaded from a given directory:
240
-
241
-```c
242
-    int cl_countsigs(const char *path, unsigned int countoptions,
243
-        unsigned int *sigs);
244
-```
245
-
246
-The first argument points to the database directory, the second one specifies what signatures should be counted: `CL_COUNTSIGS_OFFICIAL` (official signatures), `CL_COUNTSIGS_UNOFFICIAL` (third party signatures), `CL_COUNTSIGS_ALL` (all signatures). The last argument points to the counter to which the number of detected signatures will be added (therefore the counter should be initially set to 0). The call returns `CL_SUCCESS` or an error code.
247
-
248
-### Data scan functions
249
-
250
-It’s possible to scan a file or descriptor using:
251
-
252
-```c
253
-    int cl_scanfile(
254
-        const char *filename,
255
-        const char **virname,
256
-        unsigned long int *scanned,
257
-        const struct cl_engine *engine,
258
-        struct cl_scan_options *options);
259
-
260
-    int cl_scandesc(
261
-        int desc,
262
-        const char *filename,
263
-        const char **virname,
264
-        unsigned long int *scanned,
265
-        const struct cl_engine *engine,
266
-        struct cl_scan_options *options);
267
-```
268
-
269
-Both functions will store a virus name under the pointer `virname`, the virus name is part of the engine structure and must not be released directly. If the third argument (`scanned`) is not NULL, the functions will increase its value with the size of scanned data (in `CL_COUNT_PRECISION` units). The last argument (`options`) requires a pointer to a data structure that specifies the scan options.  The data structure should be `memset()` Each variable in the structure is a bit-flag field.  The structure definition is:
270
-
271
-```c
272
-    struct cl_scan_options {
273
-        uint32_t general;
274
-        uint32_t parse;
275
-        uint32_t alert;
276
-        uint32_t heuristic_alert;
277
-        uint32_t mail;
278
-        uint32_t dev;
279
-    };
280
-```
281
-
282
-Supported flags for each of the fields are as follows:
283
-
284
-`general` - General scanning options.
285
-
286
-- **CL_SCAN_GENERAL_ALLMATCHES**
287
-    Scan in all-match mode
288
-- **CL_SCAN_GENERAL_COLLECT_METADATA**
289
-    Collect metadata (--gen-json)
290
-- **CL_SCAN_GENERAL_HEURISTICS**
291
-    Option to enable heuristic alerts.  Required for any of the heuristic alerting options to work.
292
-
293
-`parse` - Options to enable/disable specific parsing capabilities.  Generally you will want to enable all parsers.  The easiest way to do this is to set the parse flags to ~0.
294
-
295
-- **CL_SCAN_PARSE_ARCHIVE**
296
-    This flag enables transparent scanning of various archive formats.
297
-- **CL_SCAN_PARSE_ELF**
298
-    Enable support for ELF files.
299
-- **CL_SCAN_PARSE_PDF**
300
-    Enables scanning within PDF files.
301
-- **CL_SCAN_PARSE_SWF**
302
-    Enables scanning within SWF files, notably compressed SWF.
303
-- **CL_SCAN_PARSE_HWP**
304
-    Enables scanning of Hangul Word Processor (HWP) files.
305
-- **CL_SCAN_PARSE_XMLDOCS**
306
-    Enables scanning of XML-formatted documents (e.g. Word, Excel, Powerpoint, HWP).
307
-- **CL_SCAN_PARSE_MAIL**
308
-    Enable support for mail files.
309
-- **CL_SCAN_PARSE_OLE2**
310
-    Enables support for OLE2 containers (used by MS Office and .msi files).
311
-- **CL_SCAN_PARSE_HTML**
312
-    This flag enables HTML normalisation (including ScrEnc decryption).
313
-- **CL_SCAN_PARSE_PE**
314
-    This flag enables deep scanning of Portable Executable files and allows libclamav to unpack executables compressed with run-time unpackers.
315
-
316
-`heuristic` - Options to enable specific heuristic alerts
317
-
318
-- **CL_SCAN_GENERAL_HEURISTIC_PRECEDENCE**
319
-    Allow heuristic match to take precedence. When enabled, if a heuristic scan (such as phishingScan) detects a possible virus/phish it will stop scan immediately. Recommended, saves CPU scan-time. When *disabled*, virus/phish detected by heuristic scans will be reported only at the end of a scan. If an archive contains both a heuristically detected virus/phishing, and a real malware, the real malware will be reported.
320
-- **CL_SCAN_HEURISTIC_ENCRYPTED_ARCHIVE**
321
-    With this flag the library will mark encrypted archives as viruses (encrypted .zip, .7zip, .rar).
322
-- **CL_SCAN_HEURISTIC_ENCRYPTED_DOC**
323
-    With this flag the library will mark encrypted docuemnts as viruses (encrypted .pdf).
324
-- **CL_SCAN_HEURISTIC_BROKEN**
325
-    libclamav will try to detect broken executables and mark them as Broken.Executable.
326
-- **CL_SCAN_HEURISTIC_EXCEEDS_MAX**
327
-    Alert when the scan of any file exceeds maximums such as max filesize, max scansize, max recursion level.
328
-- **CL_SCAN_HEURISTIC_PHISHING_SSL_MISMATCH**
329
-    Heuristic for phishing module: alert on SSL mismatches in URLs.
330
-- **CL_SCAN_HEURISTIC_PHISHING_CLOAK**
331
-    Heuristic for phishing module: alert on cloaked URLs.
332
-- **CL_SCAN_HEURISTIC_MACROS**
333
-    OLE2 containers, which contain VBA macros will be marked infected (Heuristics.OLE2.ContainsMacros).
334
-- **CL_SCAN_HEURISTIC_PARTITION_INTXN**
335
-    alert if partition table size doesn't make sense
336
-- **CL_SCAN_HEURISTIC_STRUCTURED**
337
-    Enable the data loss prevention (DLP) module which scans for credit card and SSN numbers. i.e. alert when detecting personal information
338
-- **CL_SCAN_HEURISTIC_STRUCTURED_SSN_NORMAL**
339
-    Search for [and alert when detecting] SSNs formatted as xx-yy-zzzz.
340
-- **CL_SCAN_HEURISTIC_STRUCTURED_SSN_STRIPPED**
341
-    Search for [and alert when detecting] SSNs formatted as xxyyzzzz.
342
-
343
-`mail` - Options to enable specific mail parsing features
344
-
345
-- **CL_SCAN_MAIL_PARTIAL_MESSAGE**
346
-    Scan RFC1341 messages split over many emails. You will need to periodically clean up `$TemporaryDirectory/clamav-partial` directory.
347
-
348
-`dev` - Options designed for use by ClamAV developers
349
-
350
-- **CL_SCAN_DEV_COLLECT_SHA**
351
-    Enables hash output in sha-collect builds - for internal use only
352
-- **CL_SCAN_DEV_COLLECT_PERFORMANCE_INFO**
353
-    Collect performance timings
354
-
355
-All functions return `CL_CLEAN` when the file seems clean, `CL_VIRUS` when a virus is detected and another value on failure.
356
-
357
-```c
358
-        ...
359
-        const char *virname;
360
-
361
-    if((ret = cl_scanfile("/tmp/test.exe", &virname, NULL, engine,
362
-    &options)) == CL_VIRUS) {
363
-        printf("Virus detected: %s\n", virname);
364
-    } else {
365
-        printf("No virus detected.\n");
366
-        if(ret != CL_CLEAN)
367
-            printf("Error: %s\n", cl_strerror(ret));
368
-    }
369
-```
370
-
371
-### Memory
372
-
373
-Because the engine structure occupies a few megabytes of system memory, you should release it with `cl_engine_free()` if you no longer need to scan files.
374
-
375
-### Forking daemons
376
-
377
-If you’re using libclamav with a forking daemon you should call `srand()` inside a forked child before making any calls to the libclamav functions. This will avoid possible collisions with temporary filenames created by other processes of the daemon. This procedure is not required for multi-threaded daemons.
378
-
379
-### clamav-config
380
-
381
-Use `clamav-config` to check compilation information for libclamav.
382
-
383
-```bash
384
-    $ clamav-config --libs
385
-    -L/usr/local/lib -lz -lbz2 -lgmp -lpthread
386
-    $ clamav-config --cflags
387
-    -I/usr/local/include -g -O2
388
-```
389
-
390
-### Example
391
-
392
-You will find an example scanner application in the clamav source package (/example). Provided you have ClamAV already installed, execute the following to compile it:
393
-
394
-```bash
395
-    gcc -Wall ex1.c -o ex1 -lclamav
396
-```
397
-
398
-## CVD format
399
-
400
-CVD (ClamAV Virus Database) is a digitally signed tarball containing one or more databases. The header is a 512-bytes long string with colon separated fields:
401
-
402
-```ini
403
-ClamAV-VDB:build time:version:number of signatures:functionality
404
-level required:MD5 checksum:digital signature:builder name:build time (sec)
405
-```
406
-
407
-`sigtool --info` displays detailed information on CVD files:
408
-
409
-```bash
410
-$ sigtool -i daily.cvd
411
-File: daily.cvd
412
-Build time: 10 Mar 2008 10:45 +0000
413
-Version: 6191
414
-Signatures: 59084
415
-Functionality level: 26
416
-Builder: ccordes
417
-MD5: 6e6e29dae36b4b7315932c921e568330
418
-Digital signature: zz9irc9irupR3z7yX6J+OR6XdFPUat4HIM9ERn3kAcOWpcMFxq
419
-Fs4toG5WJsHda0Jj92IUusZ7wAgYjpai1Nr+jFfXHsJxv0dBkS5/XWMntj0T1ctNgqmiF
420
-+RLU6V0VeTl4Oej3Aya0cVpd9K4XXevEO2eTTvzWNCAq0ZzWNdjc
421
-Verification OK.
422
-```
423
-
424
-## Graphics
425
-
426
-The current ClamAV logo was created by Alicia Willet, Talos.
427
-
428
-## OpenAntiVirus
429
-
430
-Our database includes the virus database (about 7000 signatures) from OpenAntiVirus (<http://OpenAntiVirus.org>).
431
-
432
-1. Subscribers are not allowed to post to the mailing list
433
-
434
-2. For Windows instructions please see win32/README in the main source code directory.
435
-
436
-3. See section [3.7](#unit-testing) on how to run the unit tests
437
-
438
-4. if not available ClamAV will fall back to an interpreter
439
-
440
-5. Note that several versions of GCC have bugs when compiling LLVM, see <http://llvm.org/docs/GettingStarted.html#brokengcc> for a full list.
441
-
442
-6. The configure script in ClamAV automatically enables the unit tests, if it finds the check framework, however it doesn’t consider it a fatal error if unit tests cannot be enabled.
443
-
444
-7. To get more info on clamscan options run ’man clamscan’
445
-
446
-8. man 5 clamd.conf
447
-
448
-9. Remember to initialize the virus counter variable with 0.
... ...
@@ -1,7 +1,7 @@
1 1
 # Win32 ClamAV Build Instructions
2 2
 
3 3
 This document describes how to build ClamAV on Windows using Visual Studio.
4
-For information on how to use ClamAV, please refer to our [User Manual](../docs/UserManual.md).
4
+For information on how to use ClamAV, please refer to our [User Manual](https://www.clamav.net/documents).
5 5
 
6 6
 ## News
7 7