diff options
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/source/config.rst | 24 | ||||
| -rw-r--r-- | doc/source/faq.rst | 72 |
2 files changed, 51 insertions, 45 deletions
diff --git a/doc/source/config.rst b/doc/source/config.rst index 525885f..64d3591 100644 --- a/doc/source/config.rst +++ b/doc/source/config.rst | |||
| @@ -11,15 +11,15 @@ Configuration | |||
| 11 | read the present documentation about how to configure them, | 11 | read the present documentation about how to configure them, |
| 12 | evaluate your threat model and write your configuration file accordingly. | 12 | evaluate your threat model and write your configuration file accordingly. |
| 13 | 13 | ||
| 14 | Since PHP *ini-like* configuration model isn't flexible enough, | 14 | Since PHP *ini-like* configuration model isn't flexible enough for our |
| 15 | Snuffleupagus is using its own format in the file specified by | 15 | usecases, Snuffleupagus is using its own format in the file specified by |
| 16 | the directive ``sp.configuration_file`` **in** your ``php.ini`` file, | 16 | the directive ``sp.configuration_file`` **in** your ``php.ini`` file, |
| 17 | like ``sp.configuration_file=/etc/php/conf.d/snuffleupagus.rules``. | 17 | like ``sp.configuration_file=/etc/php/conf.d/snuffleupagus.rules``. |
| 18 | 18 | ||
| 19 | You can use the ``,`` separator to include multiple configuration files: | 19 | You can use the ``,`` separator to include multiple configuration files: |
| 20 | ``sp.configuration_file=/etc/php/conf.d/snuffleupagus.rules,/etc/php/conf.d/sp_wordpress.rules``. | 20 | ``sp.configuration_file=/etc/php/conf.d/snuffleupagus.rules,/etc/php/conf.d/sp_wordpress.rules``. |
| 21 | 21 | ||
| 22 | We're also also supporting `glob <https://en.wikipedia.org/wiki/Glob_%28programming%29>`__, | 22 | It also supports `glob <https://en.wikipedia.org/wiki/Glob_%28programming%29>`__, |
| 23 | so you can write something like: | 23 | so you can write something like: |
| 24 | ``sp.configuration_file=/etc/php/conf.d/*.rules,/etc/php/conf.d/extra/test.rules``. | 24 | ``sp.configuration_file=/etc/php/conf.d/*.rules,/etc/php/conf.d/extra/test.rules``. |
| 25 | 25 | ||
| @@ -32,9 +32,9 @@ To sum up, you should put this in your ``php.ini``: | |||
| 32 | 32 | ||
| 33 | And the **snuffleupagus rules** into the ``.rules`` files. | 33 | And the **snuffleupagus rules** into the ``.rules`` files. |
| 34 | 34 | ||
| 35 | Since our configuration format is a bit more complex than php's one, | 35 | Since the configuration format is a bit more complex than php's one, |
| 36 | we have a ``sp.allow_broken_configuration`` parameter (``false`` by default), | 36 | their is a ``sp.allow_broken_configuration`` parameter (``false`` by default), |
| 37 | that you can set to ``true`` if you want PHP to carry on if your Snuffleupagus' | 37 | that can be set to ``true`` if you want PHP to carry on if your Snuffleupagus' |
| 38 | configuration contains syntax errors. You'll still get a big scary message in | 38 | configuration contains syntax errors. You'll still get a big scary message in |
| 39 | your logs of course. We do **not** recommend to use it of course, but sometimes | 39 | your logs of course. We do **not** recommend to use it of course, but sometimes |
| 40 | it might be useful to be able to "debug in production" without breaking your | 40 | it might be useful to be able to "debug in production" without breaking your |
| @@ -45,23 +45,23 @@ Configuration file format | |||
| 45 | 45 | ||
| 46 | Options are chainable by using dots (``.``). | 46 | Options are chainable by using dots (``.``). |
| 47 | 47 | ||
| 48 | Some options have a string parameter, that **must** be quoted with double quotes, e.g. ``"string"``. | 48 | String parameters **must** be quoted with double quotes, e.g. ``"string"``. |
| 49 | 49 | ||
| 50 | Comments are prefixed either with ``#``, or ``;``. | 50 | Comments are prefixed either with ``#``, or ``;``. |
| 51 | 51 | ||
| 52 | Some rules apply in a specific ``function`` (context) on a specific ``variable`` | 52 | Some rules apply to a specific ``function`` (context) on a specific ``variable`` |
| 53 | (data), like ``disable_function``. Others can only be enabled/disabled, like | 53 | (data), like ``disable_function``. Others can only be enabled/disabled, like |
| 54 | ``harden_random``. | 54 | ``harden_random``. |
| 55 | 55 | ||
| 56 | Most of the features can be used in ``simulation`` mode by appending the | 56 | Most of the features can be used in ``simulation`` mode by appending the |
| 57 | ``.simulation()`` or ``.sim()`` option to them (eg. ``sp.readonly_exec.simulation().enable();``) to see | 57 | ``.simulation()`` or ``.sim()`` option to them (eg. ``sp.readonly_exec.simulation().enable();``) to see |
| 58 | whether or not they could break your website. The simulation mode won't block the request, | 58 | whether or not they could break your website. The simulation mode won't block the request, |
| 59 | but will write a warning in the log. | 59 | and will only log a warning. |
| 60 | 60 | ||
| 61 | The rules are evaluated in the order that they are written, the **first** one | 61 | The rules are evaluated in the order that they are written, the **first** one |
| 62 | to match will terminate the evaluation (except for rules in simulation mode). | 62 | to match will terminate the evaluation, except of course for rules in simulation mode. |
| 63 | 63 | ||
| 64 | Rules can be split into lines and contain whitespace for easier readability and maintenance: (This feature is available since version 0.8.0.) | 64 | Since Snuffleupagus 0.8.0, rules can be split into lines and contain whitespace for easier readability and maintenance: |
| 65 | 65 | ||
| 66 | :: | 66 | :: |
| 67 | 67 | ||
| @@ -70,8 +70,6 @@ Rules can be split into lines and contain whitespace for easier readability and | |||
| 70 | .alias("newline in mail() To:") | 70 | .alias("newline in mail() To:") |
| 71 | .drop(); | 71 | .drop(); |
| 72 | 72 | ||
| 73 | The terminating ``;`` is optional for now, but it should be used for future compatibility. | ||
| 74 | |||
| 75 | Rules, including comments, needs to be written in ASCII, other encodings aren't | 73 | Rules, including comments, needs to be written in ASCII, other encodings aren't |
| 76 | supported and might cause syntax errors and related issues like making | 74 | supported and might cause syntax errors and related issues like making |
| 77 | all rules after non-ASCII symbols not considered for execution and silently discarded. | 75 | all rules after non-ASCII symbols not considered for execution and silently discarded. |
diff --git a/doc/source/faq.rst b/doc/source/faq.rst index 0485f21..df2cdb5 100644 --- a/doc/source/faq.rst +++ b/doc/source/faq.rst | |||
| @@ -54,18 +54,18 @@ Why not Suhosin? | |||
| 54 | 54 | ||
| 55 | We're huge fans of `Suhosin <https://suhosin.org>`_, unfortunately: | 55 | We're huge fans of `Suhosin <https://suhosin.org>`_, unfortunately: |
| 56 | 56 | ||
| 57 | - it doesn't work very well on PHP7 | 57 | - It doesn't work very well on PHP7+. |
| 58 | - it has some oudated features and misses new ones | 58 | - It has some outdated features and misses modern ones. |
| 59 | - it doesn't cope very well with our various industrialization needs | 59 | - It doesn't cope very well with some industrialization needs. |
| 60 | - it has some shortcomings by design | 60 | - It has some shortcomings by design. |
| 61 | 61 | ||
| 62 | We're using the `disable_function <https://secure.php.net/manual/en/ini.core.php#ini.disable-functions>`_ | 62 | For example,the `disable_function <https://secure.php.net/manual/en/ini.core.php#ini.disable-functions>`_ |
| 63 | directive, but unfortunately, it doesn't provide enough usable granularity (guess how many CMSs are using | 63 | directive doesn't provide enough usable granularity: guess how many CMSs are using |
| 64 | the `system <https://secure.php.net/manual/en/function.system.php#refsect1-function.system-notes>`_ | 64 | the `system <https://secure.php.net/manual/en/function.system.php#refsect1-function.system-notes>`_ |
| 65 | function to perform various mandatory maintenance tasks). | 65 | function to perform various mandatory maintenance tasks. |
| 66 | 66 | ||
| 67 | This is why we decided to write our own hardening module, in the spirit of Suhosin, | 67 | This is why we decided to write our own hardening module, in the spirit of Suhosin, |
| 68 | with virtual-patching support, as well as other cool new features. | 68 | with virtual-patching support, as well as other fancy new features. |
| 69 | 69 | ||
| 70 | 70 | ||
| 71 | What license is Snuffleupagus released under and why? | 71 | What license is Snuffleupagus released under and why? |
| @@ -75,11 +75,11 @@ Snuffleupagus is licensed under the `LGPL <https://www.gnu.org/copyleft/lesser.h | |||
| 75 | was developed by the fine people from `NBS System <https://nbs-system.com/>`__, | 75 | was developed by the fine people from `NBS System <https://nbs-system.com/>`__, |
| 76 | and is maintained by Julien (jvoisin) Voisin. | 76 | and is maintained by Julien (jvoisin) Voisin. |
| 77 | 77 | ||
| 78 | We chose the LGPL because we don't care that much how you're using Snuffleupagus, | 78 | The LGPL was chosen because we don't care that much how you're using Snuffleupagus, |
| 79 | but we'd like to force people to make their improvements/contributions | 79 | but we'd like to have improvements/contributions made available for everyone to |
| 80 | available to everyone. | 80 | benefit from. |
| 81 | 81 | ||
| 82 | The complete license text is shipped with the sources and can be found under ``LICENSE``. | 82 | The complete license text is shipped with the sources and can be found in the ``LICENSE`` file. |
| 83 | 83 | ||
| 84 | For compatibility with older PHP versions, some original PHP source code was copied or ported back to older versions. | 84 | For compatibility with older PHP versions, some original PHP source code was copied or ported back to older versions. |
| 85 | This source code resides in ``src/sp_php_compat.c`` and ``src/sp_php_compat.h`` and retains its original license | 85 | This source code resides in ``src/sp_php_compat.c`` and ``src/sp_php_compat.h`` and retains its original license |
| @@ -89,12 +89,11 @@ This source code resides in ``src/sp_php_compat.c`` and ``src/sp_php_compat.h`` | |||
| 89 | What is the different between Snuffleupagus and a (WAF) like ModSecurity? | 89 | What is the different between Snuffleupagus and a (WAF) like ModSecurity? |
| 90 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | 90 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
| 91 | 91 | ||
| 92 | `ModSecurity <https://modsecurity.org/>`__ and other `Web Application | 92 | `ModSecurity <https://modsecurity.org/>`__ and other `Web Application Firewalls |
| 93 | Firewalls (WAF) <https://en.wikipedia.org/wiki/Web_application_firewall>`__ are | 93 | (WAF) <https://en.wikipedia.org/wiki/Web_application_firewall>`__ are working |
| 94 | working by inspecting the http traffic. Snuffleupagus being a PHP module, is | 94 | by inspecting the http traffic. Snuffleupagus being a PHP module, operates |
| 95 | operating directly inside your website's code, with a lesser overhead, as well | 95 | directly inside the website's code, with a smaller overhead, as well as a |
| 96 | as a better understanding of what is currently happening inside your | 96 | better comprehension of what is currently happening there. |
| 97 | application. | ||
| 98 | 97 | ||
| 99 | 98 | ||
| 100 | Should I use Snuffleupagus? | 99 | Should I use Snuffleupagus? |
| @@ -103,18 +102,19 @@ Should I use Snuffleupagus? | |||
| 103 | Yes. | 102 | Yes. |
| 104 | 103 | ||
| 105 | Even if you're not using the virtual-patching capabilities, Snuffleupagus comes | 104 | Even if you're not using the virtual-patching capabilities, Snuffleupagus comes |
| 106 | with various passive features that won't break your website while killing numerous vulnerabilities. | 105 | with various passive features that won't break your website while killing |
| 106 | numerous vulnerability classes. | ||
| 107 | 107 | ||
| 108 | Please keep in mind that you are not only protecting yourself and your users/customers, | 108 | Please keep in mind that you are not only protecting yourself and your users/customers, |
| 109 | but also other people on the internet that might be attacked by your server if | 109 | but also other people on the internet that might be attacked by your server |
| 110 | it becomes compromised. | 110 | should it become compromised. |
| 111 | 111 | ||
| 112 | How mature is this project? | 112 | How mature is this project? |
| 113 | """"""""""""""""""""""""""" | 113 | """"""""""""""""""""""""""" |
| 114 | 114 | ||
| 115 | This project has been floating around since early 2016 and we did the first commit | 115 | This project has been floating around since early 2016 and the first commit |
| 116 | the 28:sup:`th` of December of the same year. It's currently stable, | 116 | is from the 28th of December of the same year. It's currently stable, |
| 117 | and is usable and used in production. | 117 | and is usable and used in production at various scales. |
| 118 | 118 | ||
| 119 | Are you saying that PHP isn't secure? | 119 | Are you saying that PHP isn't secure? |
| 120 | """"""""""""""""""""""""""""""""""""" | 120 | """"""""""""""""""""""""""""""""""""" |
| @@ -137,8 +137,8 @@ all your security issues, but we believe that it might definitely help. | |||
| 137 | Sounds great, but is it working? | 137 | Sounds great, but is it working? |
| 138 | """""""""""""""""""""""""""""""" | 138 | """""""""""""""""""""""""""""""" |
| 139 | 139 | ||
| 140 | We've been using it in production since a couple of years, and it thwarted | 140 | It has been used in production since its inception, and thwarted |
| 141 | numerous known and unknown attacks. If you want some evidences, one of the | 141 | numerous known and unknown attacks. Should you want some evidences, one of the |
| 142 | developer published in June 2019 a `blogpost | 142 | developer published in June 2019 a `blogpost |
| 143 | <https://dustri.org/b/snuffleupagus-versus-recent-high-profile-vulnerabilities.html>`__ | 143 | <https://dustri.org/b/snuffleupagus-versus-recent-high-profile-vulnerabilities.html>`__ |
| 144 | showcasing how efficient Snuffleupagus was versus *major* web | 144 | showcasing how efficient Snuffleupagus was versus *major* web |
| @@ -147,13 +147,13 @@ vulnerabilities from 2018/2019. | |||
| 147 | 147 | ||
| 148 | Why should I send you bugs, security issues and patches? | 148 | Why should I send you bugs, security issues and patches? |
| 149 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""" | 149 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""" |
| 150 | |||
| 150 | Snuffleupagus is an open-source security software, by reporting (or fixing) | 151 | Snuffleupagus is an open-source security software, by reporting (or fixing) |
| 151 | bugs, or implementing new features, you are helping others to protect themselves. | 152 | bugs, or implementing new features, you are helping others to protect themselves. |
| 152 | 153 | ||
| 153 | We're also firm believers in the *Beerbounty* system: | 154 | We're also firm believers in the *Beerbounty* system: we are happy to offer you |
| 154 | we are happy to offer you beers when/if we ever meet if you helped the project in | 155 | beers when/if we ever meet if you helped the project in any way. If you don't |
| 155 | any way. If you don't like beer, we're sure that we'll find something else, | 156 | like beer, we're sure that we'll find something else, don't worry. |
| 156 | don't worry. | ||
| 157 | 157 | ||
| 158 | 158 | ||
| 159 | Installation and configuration | 159 | Installation and configuration |
| @@ -161,6 +161,7 @@ Installation and configuration | |||
| 161 | 161 | ||
| 162 | Can snuffleupagus break my application? | 162 | Can snuffleupagus break my application? |
| 163 | """"""""""""""""""""""""""""""""""""""" | 163 | """"""""""""""""""""""""""""""""""""""" |
| 164 | |||
| 164 | Yes. | 165 | Yes. |
| 165 | 166 | ||
| 166 | Some options won't break anything, like :ref:`harden-rand <harden-rand-feature>`, | 167 | Some options won't break anything, like :ref:`harden-rand <harden-rand-feature>`, |
| @@ -170,7 +171,7 @@ rules might pretty well break your website. | |||
| 170 | It's up to you to configure Snuffleupagus accordingly to your needs. | 171 | It's up to you to configure Snuffleupagus accordingly to your needs. |
| 171 | 172 | ||
| 172 | You can also enable the ``simulation`` mode on features that you're not sure about, | 173 | You can also enable the ``simulation`` mode on features that you're not sure about, |
| 173 | to see what snuffleupagus would do to your application, before activating them for good. | 174 | to see what Snuffleupagus would do to your application, before activating them for good. |
| 174 | 175 | ||
| 175 | How can I find out the problem when my application breaks? | 176 | How can I find out the problem when my application breaks? |
| 176 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""" | 177 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
| @@ -180,17 +181,20 @@ By checking the logs; Snuffleupagus systematically prefix them with ``[snuffleup | |||
| 180 | 181 | ||
| 181 | Does Snuffleupagus run on Windows? | 182 | Does Snuffleupagus run on Windows? |
| 182 | """""""""""""""""""""""""""""""""" | 183 | """""""""""""""""""""""""""""""""" |
| 184 | |||
| 183 | No idea, feel free to `try <https://github.com/jvoisin/snuffleupagus/issues/2>`_. | 185 | No idea, feel free to `try <https://github.com/jvoisin/snuffleupagus/issues/2>`_. |
| 184 | 186 | ||
| 185 | 187 | ||
| 186 | Does Snuggleupagus run on `HHVM <http://hhvm.com/>`_? | 188 | Does Snuggleupagus run on `HHVM <http://hhvm.com/>`_? |
| 187 | """"""""""""""""""""""""""""""""""""""""""""""""""""" | 189 | """"""""""""""""""""""""""""""""""""""""""""""""""""" |
| 190 | |||
| 188 | No it doesn't, since `HHVM's API <https://github.com/facebook/hhvm/wiki/Extension-API>`_ | 191 | No it doesn't, since `HHVM's API <https://github.com/facebook/hhvm/wiki/Extension-API>`_ |
| 189 | is really different from PHP7's one. We're not currently planning to rewrite | 192 | is really different from PHP7's one. We're not currently planning to rewrite |
| 190 | Snuffleupagus to support it. | 193 | Snuffleupagus to support it. |
| 191 | 194 | ||
| 192 | Will Snuffleupagus run on my old PHP 5? | 195 | Will Snuffleupagus run on my old PHP 5? |
| 193 | """"""""""""""""""""""""""""""""""""""" | 196 | """"""""""""""""""""""""""""""""""""""" |
| 197 | |||
| 194 | No. | 198 | No. |
| 195 | 199 | ||
| 196 | Since PHP5 `is deprecated since the end of 2018 <http://php.net/supported-versions.php>`_, | 200 | Since PHP5 `is deprecated since the end of 2018 <http://php.net/supported-versions.php>`_, |
| @@ -202,6 +206,7 @@ Help and support | |||
| 202 | 206 | ||
| 203 | I found a security issue | 207 | I found a security issue |
| 204 | """""""""""""""""""""""" | 208 | """""""""""""""""""""""" |
| 209 | |||
| 205 | If you believe you have found a security issue affecting Snuffleupagus, | 210 | If you believe you have found a security issue affecting Snuffleupagus, |
| 206 | then we would be more than happy to hear from you! | 211 | then we would be more than happy to hear from you! |
| 207 | 212 | ||
| @@ -219,17 +224,19 @@ you find a security issue. | |||
| 219 | 224 | ||
| 220 | I found a bug. How can I report it? | 225 | I found a bug. How can I report it? |
| 221 | """"""""""""""""""""""""""""""""""" | 226 | """"""""""""""""""""""""""""""""""" |
| 227 | |||
| 222 | We do have an issue tracker on `Github <https://github.com/jvoisin/snuffleupagus/issues>`_. | 228 | We do have an issue tracker on `Github <https://github.com/jvoisin/snuffleupagus/issues>`_. |
| 223 | Please make sure to include as much information as possible when reporting your issue, | 229 | Please make sure to include as much information as possible when reporting your issue, |
| 224 | such as your operating system, your version of PHP, your version of Snuffleupagus, | 230 | such as your operating system, your version of PHP, your version of Snuffleupagus, |
| 225 | your logs, the problematic PHP code, the request, a brief description, … long story short, | 231 | your logs, the problematic PHP code, the request, a brief description, … long story short, |
| 226 | give us everything that you can. | 232 | give us everything you have. |
| 227 | 233 | ||
| 228 | If you're feeling extra-nice, you can try to :ref:`debug it yourself <debug>`, | 234 | If you're feeling extra-nice, you can try to :ref:`debug it yourself <debug>`, |
| 229 | it's not that hard. | 235 | it's not that hard. |
| 230 | 236 | ||
| 231 | Where can I find even more help? | 237 | Where can I find even more help? |
| 232 | """""""""""""""""""""""""""""""" | 238 | """""""""""""""""""""""""""""""" |
| 239 | |||
| 233 | The :doc:`configuration page <config>` might be what you're looking for. | 240 | The :doc:`configuration page <config>` might be what you're looking for. |
| 234 | If you're adventurous, you can also check the `issue tracker <https://github.com/jvoisin/snuffleupagus/issues/?q=is%3Aissue>`_ | 241 | If you're adventurous, you can also check the `issue tracker <https://github.com/jvoisin/snuffleupagus/issues/?q=is%3Aissue>`_ |
| 235 | (make sure to check the `closed issues <https://github.com/jvoisin/snuffleupagus/issues?q=is%3Aissue+is%3Aclosed>`_ too). | 242 | (make sure to check the `closed issues <https://github.com/jvoisin/snuffleupagus/issues?q=is%3Aissue+is%3Aclosed>`_ too). |
| @@ -240,6 +247,7 @@ Unimplemented mitigations and abandoned ideas | |||
| 240 | 247 | ||
| 241 | Constant time comparisons | 248 | Constant time comparisons |
| 242 | """"""""""""""""""""""""" | 249 | """"""""""""""""""""""""" |
| 250 | |||
| 243 | We didn't manage to perform time-based side-channel attacks on strings | 251 | We didn't manage to perform time-based side-channel attacks on strings |
| 244 | against real world PHP application, and the results that we gathered on | 252 | against real world PHP application, and the results that we gathered on |
| 245 | tailored test cases weren't concluding: for simplicity's sake, we chose | 253 | tailored test cases weren't concluding: for simplicity's sake, we chose |
