224 Commits

Author SHA1 Message Date
Marc Stern
e5bbd89399 re-added some NULL check at run-time, with an error message on stderr 2024-08-14 13:53:52 +02:00
Marc Stern
8dd5d5f46b re_operators.c: removed invalid check (done correctly on line 1067)
copy_rules(): only one return code => void
2024-08-07 09:42:40 +02:00
Marc Stern
7c379c8d59 Fixed assert() usage:
- added some missing
 - removed some invalid
 - removed some that were not relevant in the context of the current function, when done in a called function
2024-07-31 11:17:36 +02:00
Ervin Hegedus
3f4c02fdb3
Merge pull request #3154 from marcstern/v2/pcre
Use PCRE_STUDY_EXTRA_NEEDED flag
2024-05-31 00:14:07 +02:00
Marc Stern
84ad094ff6 Use PCRE_STUDY_EXTRA_NEEDED flag 2024-05-28 16:19:29 +02:00
Marc Stern
4a992b5a16 Replace a memset to 0 by a single assignment and fixing the 0 byte missing at the end when MSC_LARGE_STREAM_INPUT is not defined 2024-05-28 15:41:38 +02:00
Marc Stern
c7c7881c22 space 2024-05-16 16:56:46 +02:00
Marc Stern
d45c4baa83 spaces 2024-05-16 16:55:31 +02:00
Marc Stern
ca7b4b49bf Merge branch 'v2/master' of https://github.com/marcstern/ModSecurity into v2/master 2024-05-16 16:51:48 +02:00
Marc Stern
649aea7288
Merge branch 'v2/master' into v2/mst/nullcheck2 2024-04-04 16:08:59 +02:00
Marc Stern
c5a6d6b3a5 Revert to OWASP 2024-02-20 14:09:14 +01:00
Marc Stern
91da5872c1 Many null pointer checks 2024-02-20 13:15:52 +01:00
Ervin Hegedus
2812553a45 Revert "Update re_operators.c"
This reverts commit 9c0d05f73470b3e6acb1078d8b59a837b363731a.
2024-02-08 00:10:25 +01:00
Ervin Hegedus
6dafdb2b97 Revert "remove useless memset"
This reverts commit 3dc5ff5f6532a9222bc9607f5f2dd34b28ca6fe4.
2024-02-08 00:07:20 +01:00
Ervin Hegedus
892033237f Revert "Update re_operators.c"
This reverts commit 931f8b6ed455fa91d5eead31a34c6320e3cfc1ca.
2024-02-08 00:05:00 +01:00
Ervin Hegedus
a2c4813814 Revert "Fixed variable definition scope (compile error)"
This reverts commit 0cd8b15c5a780951714e83f9dc907f93562df268.
2024-02-08 00:00:25 +01:00
Ervin Hegedus
ac332cc79d
Revert "'jit' variable not initialized when WITH_PCRE2 is defined" 2024-02-07 23:10:22 +01:00
Marc Stern
07f4076f46 Check for NULL pointers 2024-02-07 12:04:50 +01:00
Marc Stern
e406bcadcd Fixed compilation issue (variable scope definition) 2024-02-06 09:54:07 +01:00
Marc Stern
0cd8b15c5a Fixed variable definition scope (compile error) 2024-02-05 10:36:04 +01:00
Marc Stern
26d2b0d069
Merge pull request #2954 from marcstern/v2/mst/optim2
remove useless memset
2024-02-01 11:08:09 +01:00
Marc Stern
1d9ad64a56 if WITH_PCRE2 id defined, jit was not initialized 2023-09-25 16:15:19 +02:00
Marc Stern
077d1bd0b7 if WITH_PCRE2 id defined, jit was not initialized 2023-09-25 16:00:17 +02:00
Marc Stern
931f8b6ed4
Update re_operators.c 2023-08-21 09:39:42 +02:00
Marc Stern
9c0d05f734
Update re_operators.c 2023-08-21 09:33:27 +02:00
Marc Stern
3dc5ff5f65 remove useless memset 2023-08-11 16:44:18 +02:00
Martin Vierula
2105ed0639 Do not escape special chars in regex pattern with macro 2023-07-27 06:21:45 -07:00
Martin Vierula
a17cbc8f5e
Support for JIT option for PCRE2 2022-12-07 07:47:42 -08:00
Martin Vierula
8fc0b519b7
Support for PCRE2 2022-11-08 08:06:39 -08:00
Martin Vierula
d9df7f529e
Limit rsub null termination to where necessary 2022-09-06 05:29:38 -07:00
John Lightsey
039b35029c
Fix other usage of the global pool for request temporaries in re_operators.c 2021-01-14 14:23:39 -03:00
John Lightsey
e419b50fe7
Store temporaries in the request pool for regexes compiled per-request.
The code for testing regexes with embedded Apache variables
(rule->re_precomp == 1) during request processing was utilizing the global
engine pool for the storage of temporary values. This approach is not
threadsafe, retains the temporary variables longer than they are usable,
and causes corruption of the global pool's "cleanups" linked-lists when
Apache is configured with a threaded MPM.
2021-01-14 14:23:39 -03:00
Felipe Zimmerle
176276a931
Fix the order of error_msg validation
Reported by @marcstern at #2128
2019-07-10 14:52:46 -03:00
Victor Hora
aab128f810 Code cosmetics: checks if actionset is not null before use it 2018-09-22 20:21:23 -04:00
Felipe Zimmerle
739048749e
Fix utf-8 character encoding conversion
Reported on: #1794
2018-09-04 21:02:09 -03:00
Felipe Zimmerle
6406e2108d
Makes `large stream optimization' optional 2017-10-06 16:43:45 +00:00
Allan Boll
6ce7f4d689
Remove the unneeded null termination for the stream_input_data 2017-10-05 17:20:41 +00:00
Allan Boll
afae690655
Preallocate memory when SecStreamInBodyInspection is on. 20x speed improvement for 10mb upload. Also simplified modsecurity_request_body_to_stream. 2017-10-05 17:20:40 +00:00
Victor Hora
9b90d86f75
Add capture action to @detectXSS operator 2017-10-05 03:24:23 +00:00
Robert Paprocki
96a1f55e16
Read fuzzy hash databases on init
Instead of reading the fuzzy db on every invocation, read and store
the db contents during initialization and store the contents in memory.
The only significant behavior change here is that a change in db contents
now (obviously) requires a daemon restart, as no API is provided to
flush the list of ssdeep chunks.
2017-04-06 13:20:24 -03:00
Robert Paprocki
fd49ca7138
Don't leak an fd on fuzzy hash initialization
Since we're re-opening this file with every invocation, let's
close our sanity check fd.
2017-04-06 13:20:24 -03:00
Felipe Zimmerle
b1e4954a86 Closes a file handle that was left opened on fuzzy hash
Fuzzy hash implementation was lefting a file handle behind whenever the results
matched.
2014-12-12 04:34:21 -08:00
Felipe Zimmerle
069122194e Reducing the amount of compilation warnings 2014-12-11 12:42:58 -08:00
Felipe Zimmerle
fa77c93589 Fix typo on fuzzy hash match message
Replaced "Socore" with Score.
2014-12-11 12:42:58 -08:00
Felipe Zimmerle
dc81e4f852 Informs problems and successfully loaded external resources during reload
Resources load mechanism as the SecRemoteRuels were not showing information
about the loaded rules while Apache was reloaded. This patch add such
information to reload in the same way that it was showing on restart.
2014-12-11 12:42:58 -08:00
Felipe Zimmerle
ce4cf24f6e Refactoring external resources download warn messages
Holding the message to be displayed when Apache is ready to write on the
error_log instead of the default output. Regression tests were added.
2014-12-11 12:42:49 -08:00
Felipe Zimmerle
d4a055e78e Checks HTTP code after performing a resource download
As reported by Walter Hop on our dev- mailing list, remote resource download
was not validating the HTTP code, parsing errors pages as resources. This
commit fix  this issue, from now one HTTP error codes will be verified and
treated as errors. Operators are now dealing well with empty values that may
be produced in consequence of a download error.
2014-12-11 12:39:31 -08:00
Felipe Zimmerle
23823bb2c3 Makes Curl no longer a mandatory depedency for ModSecurity core
As reported by Rainer Jung, Curl may not be mandatory to build
	ModSecurity core. This patch make it optional by:
	- Concentrate all downloads using curl on msc_remote_rules.c
	- Split Curl build definitions checks into: WITH_CURL, WITH_REMOTE_RULES
	and WITH_CRYPTO.
	  - WITH_CURL: Contains Culr headers and binaries during the build time.
	  - WITH_REMOTE_RULES: Currently enabled if Curl is present.
	  - WITH_CRYPTO: Set if apr tool was compiled with crypto support.
	- Renames msc_remote_grab_content to msc_remote_download_content
2014-12-03 08:28:59 -08:00
Felipe Zimmerle
9fe72b72de Improves the CA validation
On IIS CA validation was not working as libcurl on windows does not look for a
certificate store, unless it is specified. The resource downloads are now
respecting the SecRemoteRulesFailAction.
2014-11-17 19:32:32 -08:00
Felipe Zimmerle
b5398abaf2 Forces downloads using https-only for resources or rules
This commit makes ModSecurity to refuse to download or install rules
(SecRemoteRules) from sites that are not running HTTPS with a valid and
trusted certificate.
2014-11-14 11:53:40 -08:00