94 Commits

Author SHA1 Message Date
Felipe Zimmerle
94fd570e31 Fix parser segfault on parser while parsing downloaded content
The error message was using a null pointer which was leading ModSecurity
to segfault
2014-11-21 03:52:03 -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
9b836b652a Initial support to load rules from a remote server
New directive `SecRemoteRules' was added. It allows the user to load a
set of rules from a given HTTP server.
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
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
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
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
80185e2a90 Bugfix: Missing ipv6 support check
The Function "ip_tree_from_file" was making a reference for
IPV6_TREE whitout checkingx if it was supported or not.
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
Felipe Zimmerle
28d4f9fce1 iis: Checks Win version before declare inet_pton
Checking for `!(NTDDI_VERSION >= NTDDI_VISTA)` to decide whenever or not
to declare the inet_pton function.
2014-03-31 16:22:10 -07:00
Felipe Zimmerle
bd0980f63d Reverts commit: a4202146b8d26b6615bbab986383fe0afae60d77
Testing inet_pton with the help of Steffen. Acording to Steffen we can use
!(NTDDI_VERSION >= NTDDI_VISTA) to identify that the specific Windows version
has this function defined or not, if so we can use the Windows version.
Reverting this commit to avoid to overwrite the Windows' function. And
see the original error that happened before this commit.
2014-03-31 16:22:10 -07:00
Felipe Zimmerle
d93ce9ceee Adds REQUEST_FULL and REQUEST_FULL_LENGTH variables
This variable is a combination from REQUEST_LINE, REQUEST_HEADERS and
REQUEST_BODY (if any). Expects for \n\n in between each of those values.
2014-03-31 07:14:55 -07:00
Greg Chow
5b0c933cf3 Fixes UTF8 to Unicode conversion bug in 4-byte encodings 2014-03-31 07:14:55 -07:00
Felipe \\\"Zimmerle\\\" Costa
a4202146b8 iis: Fix inet_pton build problem
There is a function named inet_pton on windows API, with different
signature. This patch just override the windows function and point
the inet_pton to our implementation.
2013-11-07 17:15:52 -02:00
Breno Silva
a6fd09b691 Fix null byte convertion into utf8toUnicode 2013-07-04 03:34:10 -07:00
Breno Silva
aa18ec7f45 Updated copyright dates 2013-04-19 03:20:46 -04:00
Greg Wroblewski
c53e743c86 IIS version improvements 2013-01-18 11:39:05 -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
ce3cf00a2c Fixed byte conversion issue during logging under zlinux 2012-10-31 17:05:41 -04:00
brenosilva
eeb331ca46 Added utf8toUnicode tfn - fix typo 2012-08-24 17:04:52 +00:00
brenosilva
781a506bc9 Added utf8toUnicode tfn 2012-08-24 17:02:13 +00:00
brenosilva
7385b120a7 Fixed check if ip_strv is NULL 2012-08-16 12:52:38 +00:00
brenosilva
8cec8c7e6d Make internal m_strcasestr default 2012-08-15 16:08:02 +00:00
brenosilva
592ec392d1 Remove ctl:ruleUpdateTarget* and add ctl:ruleRemovetarget* 2012-08-02 18:04:53 +00:00
brenosilva
543a7db8a7 Check for strcasestr 2012-07-27 01:10:33 +00:00
brenosilva
81b74ba633 Fix code for windows 2012-06-16 19:33:22 +00:00
brenosilva
de56a8bcf4 Add inet_pton for windows 2012-06-15 20:45:54 +00:00
brenosilva
780db20398 Add inet_pton for windows 2012-06-15 20:44:10 +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
8642120748 Code cleanups 2012-01-02 20:21:29 +00:00
brenosilva
5b82006fee Code cleanup 2012-01-02 20:09:49 +00:00
brenosilva
3090edd850 sqlHexDecode fully hex decode 2011-10-26 22:31:23 +00:00
brenosilva
2a585fba82 Check for X in uppercase into sqlHexDecode 2011-10-21 12:57:41 +00:00
brenosilva
162f219f1d MODSEC-273 2011-10-20 18:22:21 +00:00
brenosilva
150bc418dd Fix issue in sqlHexDecode 2011-10-18 01:44:39 +00:00
brenosilva
a4f0957b0c Revert hexDecode and add new sqlHexDecode 2011-10-10 16:24:07 +00:00
brenosilva
0ae09036b4 MODSEC-255 2011-07-27 13:19:43 +00:00
brenosilva
06dd5907b6 Build and code fixes 2011-06-14 15:01:17 +00:00
brenosilva
f595919107 Implement unicode map 2011-06-02 19:11:04 +00:00
brenosilva
6d7781754b Fix MODSEC-247 2011-05-24 14:54:45 +00:00
brenosilva
6b7edc4d47 Fixes, code cleanups, improvements 2011-04-27 15:58:22 +00:00
ivanr
352514f7d8 Fix comment to reflext the base64DecodeExt change 2011-04-25 19:19:21 +00:00
brenosilva
c1d3fd6363 Applied patches from Diego 2011-04-20 19:14:49 +00:00
brenosilva
d68731a38b APR-Ipmatch operator 2011-04-16 21:25:30 +00:00
brenosilva
a9557a66cd Add more char to escape in log_escape_re 2011-04-07 13:41:30 +00:00
brenosilva
0d32c17c30 Memory pool fixes and code cleanup 2011-04-03 03:57:02 +00:00
brenosilva
6031e7fdae Improvements, bug fixes and cleanup from Tom Donavan 2011-04-02 23:10:16 +00:00
brenosilva
2ff42243fa Add escape option to rsub and rbl improvements 2011-03-31 17:15:37 +00:00