diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 29 |
1 files changed, 23 insertions, 6 deletions
| @@ -60,22 +60,28 @@ PMF tries as much as possible to use semantic patterns, to detect things like | |||
| 60 | and then passed to some dangerous function like `system`". | 60 | and then passed to some dangerous function like `system`". |
| 61 | 61 | ||
| 62 | ## Installation | 62 | ## Installation |
| 63 | |||
| 64 | ### From source | ||
| 65 | |||
| 63 | - Install Go (using your package manager, or [manually](https://go.dev/doc/install)) | 66 | - Install Go (using your package manager, or [manually](https://go.dev/doc/install)) |
| 64 | - Install libyara >= 4.2 (using your package manager, or [from source](https://yara.readthedocs.io/en/stable/gettingstarted.html)) | 67 | - Install libyara >= 4.2 (using your package manager, or [from source](https://yara.readthedocs.io/en/stable/gettingstarted.html)) |
| 65 | - Download php-malware-finder: `git clone https://github.com/jvoisin/php-malware-finder.git` | 68 | - Download php-malware-finder: `git clone https://github.com/jvoisin/php-malware-finder.git` |
| 66 | - Build php-malware-finder: `cd php-malware-finder && make` | 69 | - Build php-malware-finder: `cd php-malware-finder && make` |
| 67 | 70 | ||
| 71 | or replace the last 2 steps with `go install github.com/jvoisin/php-malware-finder`, | ||
| 72 | which will directly compile and install PMF in your `${GOROOT}/bin` folder. | ||
| 73 | |||
| 68 | ## How to use it? | 74 | ## How to use it? |
| 69 | 75 | ||
| 70 | ``` | 76 | ``` |
| 71 | $ ./phpmalwarefinder -h | 77 | $ ./php-malware-finder -h |
| 72 | Usage: | 78 | Usage: |
| 73 | phpmalwarefinder [OPTIONS] [Target] | 79 | php-malware-finder [OPTIONS] [Target] |
| 74 | 80 | ||
| 75 | Application Options: | 81 | Application Options: |
| 76 | -r, --rules-dir= Rules location (default: /etc/phpmalwarefinder or .) | 82 | -r, --rules-dir= Alternative rules location (default: embedded rules) |
| 77 | -a, --show-all Display all matched rules | 83 | -a, --show-all Display all matched rules |
| 78 | -f, --fast Enable YARA's fast mode' | 84 | -f, --fast Enable YARA's fast mode |
| 79 | -R, --rate-limit= Max. filesystem ops per second, 0 for no limit (default: 0) | 85 | -R, --rate-limit= Max. filesystem ops per second, 0 for no limit (default: 0) |
| 80 | -v, --verbose Verbose mode | 86 | -v, --verbose Verbose mode |
| 81 | -w, --workers= Number of workers to spawn for scanning (default: 32) | 87 | -w, --workers= Number of workers to spawn for scanning (default: 32) |
| @@ -84,6 +90,7 @@ Application Options: | |||
| 84 | -i, --exclude-imgs Do not scan image files | 90 | -i, --exclude-imgs Do not scan image files |
| 85 | -x, --exclude-ext= Additional file extensions to exclude | 91 | -x, --exclude-ext= Additional file extensions to exclude |
| 86 | -u, --update Update rules | 92 | -u, --update Update rules |
| 93 | -V, --version Show version number and exit | ||
| 87 | 94 | ||
| 88 | Help Options: | 95 | Help Options: |
| 89 | -h, --help Show this help message | 96 | -h, --help Show this help message |
| @@ -92,7 +99,7 @@ Help Options: | |||
| 92 | Or if you prefer to use `yara`: | 99 | Or if you prefer to use `yara`: |
| 93 | 100 | ||
| 94 | ``` | 101 | ``` |
| 95 | $ yara -r ./php.yar /var/www | 102 | $ yara -r ./data/php.yar /var/www |
| 96 | ``` | 103 | ``` |
| 97 | 104 | ||
| 98 | Please keep in mind that you should use at least YARA 3.4 because we're using | 105 | Please keep in mind that you should use at least YARA 3.4 because we're using |
| @@ -103,6 +110,16 @@ have support for hashes. | |||
| 103 | 110 | ||
| 104 | Oh, and by the way, you can run the *comprehensive* testsuite with `make tests`. | 111 | Oh, and by the way, you can run the *comprehensive* testsuite with `make tests`. |
| 105 | 112 | ||
| 113 | ### Docker | ||
| 114 | |||
| 115 | If you want to avoid having to install Go and libyara, you can also use our | ||
| 116 | docker image and simply mount the folder you want to scan to the container's | ||
| 117 | `/data` directory: | ||
| 118 | |||
| 119 | ``` | ||
| 120 | $ docker run --rm -v /folder/to/scan:/data ghcr.io/jvoisin/php-malware-finder | ||
| 121 | ``` | ||
| 122 | |||
| 106 | ## Whitelisting | 123 | ## Whitelisting |
| 107 | 124 | ||
| 108 | Check the [whitelist.yar](https://github.com/jvoisin/php-malware-finder/blob/master/php-malware-finder/whitelist.yar) file. | 125 | Check the [whitelist.yar](https://github.com/jvoisin/php-malware-finder/blob/master/php-malware-finder/whitelist.yar) file. |
| @@ -115,7 +132,7 @@ Because: | |||
| 115 | - It doesn't use [a single rule per sample]( | 132 | - It doesn't use [a single rule per sample]( |
| 116 | https://github.com/Neo23x0/signature-base/blob/e264d66a8ea3be93db8482ab3d639a2ed3e9c949/yara/thor-webshells.yar | 133 | https://github.com/Neo23x0/signature-base/blob/e264d66a8ea3be93db8482ab3d639a2ed3e9c949/yara/thor-webshells.yar |
| 117 | ), since it only cares about finding malicious patterns, not specific webshells | 134 | ), since it only cares about finding malicious patterns, not specific webshells |
| 118 | - It has a [complete testsuite](https://travis-ci.org/jvoisin/php-malware-finder), to avoid regressions | 135 | - It has a [complete testsuite](https://github.com/jvoisin/php-malware-finder/actions), to avoid regressions |
| 119 | - Its whitelist system doesn't rely on filenames | 136 | - Its whitelist system doesn't rely on filenames |
| 120 | - It doesn't rely on (slow) [entropy computation]( https://en.wikipedia.org/wiki/Entropy_(information_theory) ) | 137 | - It doesn't rely on (slow) [entropy computation]( https://en.wikipedia.org/wiki/Entropy_(information_theory) ) |
| 121 | - It uses a ghetto-style static analysis, instead of relying on file hashes | 138 | - It uses a ghetto-style static analysis, instead of relying on file hashes |
