179 Commits

Author SHA1 Message Date
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
Felipe Zimmerle
899ee0c365 Adds support to load remote resources to pmFromFile and ipMatchFromFile
Initially those directives were only able to load content from a
local file. This commit extends this functionality allowing the user to
provide an HTTP URI that can be downloaded and loaded by ModSecurity.
Initially the download is associated with a server restart. For next
versions we expect to load such resources as it become outdated (Without
need to resetart the server).
2014-11-14 11:53:40 -08:00
Felipe Zimmerle
de1c028d12 Declares msre_var *rvar at the beggining of the function
Necessary to fix the build on Win8 VS 2011
2014-11-14 11:53:39 -08:00
Felipe Zimmerle
a45fe95ed5 FuzzyHash: if disable giving an run time error instead of config
FuzzyHash operator is optional and only installed if the headers for libfuzzy
was found in the system. Otherwise, the FuzzyHash operator is disable during
the compilation. After this commit, if some rules tries to use it, ModSecurity
will produce an runtime error not a config time error, allowing the web server
to procede normal with its operations.
2014-11-14 11:53:39 -08:00
Felipe Zimmerle
96865a92d3 Adds fuzzyHash operator
The fuzzyHash operator can be used to match files. In conjuntcion
with FILES_TMP_CONTENT collection it can scan uploaded files and
try to match it with a pre caculated list of know malicious content,
more details on how it works can be found on ssdeep website:
http://ssdeep.sourceforge.net/
2014-11-14 11:53:39 -08:00
Felipe Zimmerle
046b553736 Fix ipMatch entry on ErrorLog and DebugLog
ipMatch message on error log was not correct, it was missing the matched
ip address. This commit adds the correct matched ip address.
(See issue #738)
2014-06-12 15:49:19 -07:00
Felipe Zimmerle
5d92e448ae Fixes subnets representations using slash notation
The ipv4 representation was only accepting slash notation with masks
represented in 2 digits. In the ipv6 implementation several fixies were made:
The maximum value to a bitmask was 64 which is not the reality, as ipv6 can
handle 128 bits. The second change was also to enable mask representation with
more and less than 2 digits. A more general fix was added to allow the unit
tests to work even if a invalid ip/range was informed during the creation of
the "tree", now it is checking if the tree is NULL while performing the
execution of the operator. Initial problem was reported at the issue: #706.
2014-06-11 09:31:53 -07:00
Felipe Zimmerle
385a2828e8 Code cosmetics: Reduces the amounts of warning.
Removes the warnings by adding missing headers and removed unused variables.
2014-03-31 16:22:11 -07:00
Felipe Zimmerle
1e63e49db4 Uses %zu to print size_t instead of %d.
This will help to reduce the amount of warnings during the compilation
See #631 for further information.
2014-03-31 16:22:11 -07:00
Felipe Zimmerle
66939d059b Adds initial support to @detectXSS
Libinject was recently updated to support XSS detection. This commit adds
initial support to it.
2014-03-31 16:22:11 -07:00
Felipe Zimmerle
0037a0732a Using RadixTree instead of list to storage IPs
Used by the operator @ipMatch and variants, this structure storage all the IPs
addresses for later comparison. Last version was using RadixTree only if the
set of IPs was specified from files. IPs specified as parameters, was using
a chained list. Chained lists may affect the performance, since lookups in
worst case will be O(n). RadixTrees could provide better results depending
on the amount of elements and its contents.
2014-03-31 16:22:10 -07:00
Felipe Zimmerle
b9fdc4fe3b Adds support to suspicious and whitelist to Read and Write limits
The operators @ipMatch, @ipMatchF and @ipMatchFromFile were
added to the functions: SecReadStateLimit and SecReadStateLimit,
by using them it is possible to declare a suspicious list. When
a suspicious list is given, the {Read|Write}StateLimit will be
applied just to the IPs that belongs to that restricted list.
Note that the negative of those operators (e.g. !@ipMatch) can be
used to place a whitelist. The {Read|Write}StateLimit
restrictions will not be applied to those in the whitelist.
This current version the Sec{Read|Write}StateLimit can be used
varios times to add elements to both lists, however, the
last informed limit will be applied for the entire group. This
feature is experimental, and suggestions on how to improve it
are very welcome. For further discussion use the issue: #353.
2014-03-31 16:22:10 -07:00
Nick Galbreath
74ec784005 libinjection sync 2013-12-18 04:19:02 +00:00
Breno Silva
0fc4142a31 Change strncpy to memcpy 2013-07-05 02:45:05 -07:00
Breno Silva
4064e74cca Fixed: Libjection 3.0.0 compilation errors 2013-06-19 11:05:59 -07:00
Nick Galbreath
c07b9a5362 libinjection v3.0.0pre21 take 2 2013-06-23 13:58:22 +09:00
Breno Silva
f003243d9c Merge pull request #106 from client9/remotes/trunk
libinjection 2.0.0
2013-05-27 06:08:03 -07:00
Nick Galbreath
3a3fda25f7 libinjection 2.0.0 2013-05-17 23:41:45 +09:00
Breno Silva
fed38c8107 Fixed: return msgs at detectSQLi 2013-05-08 16:22:47 -04:00
Breno Silva
db964c4223 Fixed: return msgs at detectSQLi 2013-05-08 05:57:06 -04:00
Breno Silva
aa18ec7f45 Updated copyright dates 2013-04-19 03:20:46 -04:00
Breno Silva
417d7daf20 Added Libjection 2013-04-18 22:51:07 -04:00
Breno Silva
3bd497946e Fixed: possible memory leak in rsub 2013-04-04 12:29:33 -04:00
Breno Silva
406d482009 Fix issue in ipmatchf 2013-01-21 00:43:53 -04:00
Breno Silva
3f6c14de59 Fixed msc_test crash using pcre jit in some platforms 2013-01-02 17:30:48 -04:00
Hideaki Hayashi
c98da92cf7 fixed bugs in cpf_verify 2012-12-07 16:59:26 -08:00
Breno Silva
fc45a3fe3b Fixed compilation issue under Windows when APR ipv6 is disabled 2012-12-01 08:21:04 -04:00
Breno Silva
c4e9dbaed7 added APR_HAVE_ARPA_INET_H pre-compile macro 2012-11-28 09:02:54 -04:00
Hideaki Hayashi
7beb244df3 fix for issues in ssn_verify such as infinite loop. 2012-11-12 16:56:09 -08:00
Hideaki Hayashi
9e6dddff8e handle invalid escape sequence passed to strmatch operator 2012-11-07 16:15:56 -08:00
Breno Silva
53d422e9de Change names of HMAC feature to HASH 2012-10-30 18:02:22 -04:00
brenosilva
781a506bc9 Added utf8toUnicode tfn 2012-08-24 17:02:13 +00:00
brenosilva
8d5131a186 Fixed some dereferenced pointers 2012-08-16 18:26:20 +00:00
brenosilva
221aba605f Fixed some dereferenced 2012-08-16 18:12:46 +00:00
brenosilva
fc8edbb462 Fixed check if s->name & value is NULL 2012-08-16 13:10:20 +00:00
brenosilva
3bb931e188 Fix warnings 2012-06-17 13:32:07 +00:00
brenosilva
81b74ba633 Fix code for windows 2012-06-16 19:33:22 +00:00
brenosilva
d88a24da1f fix rsub input parsing and add maturity, ver and accuracy actions 2012-06-04 15:29:51 +00:00
brenosilva
14156d831b Add ipmatchFromfile 2012-06-01 20:26:51 +00:00
brenosilva
866cb6d6b4 Update trunk for 2.7 2012-05-10 23:18:39 +00:00
brenosilva
f92f8219d4 fix stream vars memory leak 2011-12-05 17:01:51 +00:00
brenosilva
9cbc44eea8 Fix PCRE jit issue when not enable jit in configure 2011-10-24 11:52:12 +00:00
brenosilva
3cb5edde27 Add extra debug info for pcre jit 2011-10-22 19:00:26 +00:00
brenosilva
b0e9468d6e MODSEC-249 2011-08-31 16:53:11 +00:00
brenosilva
5cacf63b3e MODSEC-142 2011-07-22 13:22:30 +00:00
brenosilva
78880129b5 Fix urbl whitelist msg 2011-07-19 18:25:05 +00:00