| 1 |
## Overview |
| 2 |
|
| 3 |
This aims to provide many different types of ClamAV rules for the given `test.exe` x86 Windows executable binary in order to test ClamAV's ability to report multiple signature matches (`-z` or `--allmatch` in `clamscan`). |
| 4 |
|
| 5 |
- `src` - contains the code necessary to rebuild the `test.exe` program. |
| 6 |
- `alert-sigs` are a combination of signatures generated by this tool, and those that were manually created. |
| 7 |
- As the name implies, these signatures are expected to alert on the `text.exe` program. |
| 8 |
- Some of these signatures depend on signatures in `weak-sigs`. |
| 9 |
- `weak-sigs` are a combination of signatures generated by this tool, and those that were manually created. |
| 10 |
- As the name implies, these signatures support the `alert-sigs`, but do not alert on their own. |
| 11 |
|
| 12 |
The tools necessary to (re)generate those sigs that were generated are not included here. |
| 13 |
|
| 14 |
## Requirements |
| 15 |
|
| 16 |
- `python3` |
| 17 |
- `mingw-w64` |
| 18 |
- Just `sudo apt install mingw-w64` on ubuntu 20.04 |
| 19 |
- `osslsigncode` |
| 20 |
- The ubuntu package is dated, but it's pretty easy to install from https://github.com/mtrojnar/osslsigncode |
| 21 |
- Follow the directions for those prereqs. |
| 22 |
- Note: you can use these `cmake` commands: |
| 23 |
```bash |
| 24 |
mkdir build && cd build |
| 25 |
cmake .. && cmake --build . |
| 26 |
sudo cmake --install . --prefix /usr/local/bin |
| 27 |
``` |
| 28 |
|
| 29 |
## Steps to regenerate the `test.exe` program |
| 30 |
|
| 31 |
1. Build the binary with: `./build.py` |
| 32 |
|
| 33 |
2. Generate the signatures. First run: |
| 34 |
```sh |
| 35 |
mkdir gen |
| 36 |
``` |
| 37 |
Then run: |
| 38 |
```sh |
| 39 |
python generate.py build/test.exe |
| 40 |
``` |
| 41 |
|
| 42 |
## Testing: |
| 43 |
- Example invocation: |
| 44 |
``` |
| 45 |
$ clamscan -z -d gen/ -d manual/ build/test.exe --bytecode-unsigned --no-summary | sort -n |
| 46 |
test.exe: Test.GenSig.HSB_01of06_MD5_FIXED.UNOFFICIAL FOUND |
| 47 |
test.exe: Test.GenSig.MSB_01of90_MD5_FIXED_dottext.UNOFFICIAL FOUND |
| 48 |
test.exe: Test.GenSig.MSB_02of90_SHA1_FIXED_dottext.UNOFFICIAL FOUND |
| 49 |
test.exe: Test.GenSig.MSB_03of90_SHA256_FIXED_dottext.UNOFFICIAL FOUND |
| 50 |
test.exe: Test.GenSig.MSB_04of90_MD5_STAR_dottext.UNOFFICIAL FOUND |
| 51 |
test.exe: Test.GenSig.MSB_05of90_SHA1_STAR_dottext.UNOFFICIAL FOUND |
| 52 |
test.exe: Test.GenSig.MSB_06of90_SHA256_STAR_dottext.UNOFFICIAL FOUND |
| 53 |
test.exe: Test.GenSig.NDB_01of08_legalcopyright.UNOFFICIAL FOUND |
| 54 |
test.exe: Test.GenSig.NDB_02of08_internalname.UNOFFICIAL FOUND |
| 55 |
test.exe: Test.GenSig.NDB_03of08_fileversion.UNOFFICIAL FOUND |
| 56 |
test.exe: Test.GenSig.NDB_04of08_companyname.UNOFFICIAL FOUND |
| 57 |
test.exe: Test.GenSig.NDB_05of08_productname.UNOFFICIAL FOUND |
| 58 |
test.exe: Test.GenSig.NDB_06of08_productversion.UNOFFICIAL FOUND |
| 59 |
test.exe: Test.GenSig.NDB_07of08_filedescription.UNOFFICIAL FOUND |
| 60 |
test.exe: Test.GenSig.NDB_08of08_originalfilename.UNOFFICIAL FOUND |
| 61 |
test.exe: Test.Sig.LDB_01of16_PE_1.UNOFFICIAL FOUND |
| 62 |
test.exe: Test.Sig.LDB_02of16_PE_2.UNOFFICIAL FOUND |
| 63 |
test.exe: Test.Sig.LDB_03of16_ANY_1.UNOFFICIAL FOUND |
| 64 |
test.exe: Test.Sig.LDB_04of16_ANY_2.UNOFFICIAL FOUND |
| 65 |
test.exe: Test.Sig.LDB_05of16_PE_EP_1.UNOFFICIAL FOUND |
| 66 |
test.exe: Test.Sig.LDB_06of16_PE_EP_2.UNOFFICIAL FOUND |
| 67 |
test.exe: Test.Sig.LDB_07of16_PE_SE1_1.UNOFFICIAL FOUND |
| 68 |
test.exe: Test.Sig.LDB_09of16_PE_S1_1.UNOFFICIAL FOUND |
| 69 |
test.exe: Test.Sig.LDB_10of16_PE_S1_2.UNOFFICIAL FOUND |
| 70 |
test.exe: Test.Sig.LDB_11of16_PE_PCRE_1.UNOFFICIAL FOUND |
| 71 |
test.exe: Test.Sig.LDB_12of16_PE_PCRE_2.UNOFFICIAL FOUND |
| 72 |
test.exe: Test.Sig.LDB_13of16_ANY_PCRE_1.UNOFFICIAL FOUND |
| 73 |
test.exe: Test.Sig.LDB_14of16_ANY_PCRE_2.UNOFFICIAL FOUND |
| 74 |
test.exe: Test.Sig.LDB_15of16_PE_ICON_1.UNOFFICIAL FOUND |
| 75 |
test.exe: Test.Sig.LDB_16of16_PE_ICON_2.UNOFFICIAL FOUND |
| 76 |
test.exe: Test.Sig.NDB_01of10_PE_1.UNOFFICIAL FOUND |
| 77 |
test.exe: Test.Sig.NDB_02of10_PE_2.UNOFFICIAL FOUND |
| 78 |
test.exe: Test.Sig.NDB_03of10_ANY_1.UNOFFICIAL FOUND |
| 79 |
test.exe: Test.Sig.NDB_04of10_ANY_2.UNOFFICIAL FOUND |
| 80 |
test.exe: Test.Sig.NDB_05of10_PE_EP_1.UNOFFICIAL FOUND |
| 81 |
test.exe: Test.Sig.NDB_06of10_PE_EP_2.UNOFFICIAL FOUND |
| 82 |
test.exe: Test.Sig.NDB_07of10_PE_SE2_1.UNOFFICIAL FOUND |
| 83 |
test.exe: Test.Sig.NDB_09of10_PE_S1_1.UNOFFICIAL FOUND |
| 84 |
test.exe: Test.Sig.NDB_10of10_PE_S1_2.UNOFFICIAL FOUND |
| 85 |
test.exe: YARA.Test_Sig_YARA_1of1_strings.UNOFFICIAL FOUND |
| 86 |
``` |
| 87 |
|
| 88 |
## Steps to generate the .ico file: |
| 89 |
``` |
| 90 |
head -c 245760 /dev/urandom | convert -depth 8 -size 320x256 RGB:- test.png |
| 91 |
convert -background transparent test.png -define icon:auto-resize=16,32,48,64,256 test.ico |
| 92 |
``` |