Thierry Fournier
4a3e9734ef
fix/minor: Error encoding hexa decimal
...
String is defined as an array of char. The char can be negative. The
cast "reinterpret_cast" from char to int keep the negative side, so
the "unsigned char" number 0x91 is negative as "char". When it is
"reinterpret_cast" as integer, it becomes 0xffffff91, so the hexadecimal
display is broken:
[155493246391.747672] [/absolute?what=badarg2] [9] T (0) t:hexEncode: "ffffff91ffffffecffffffe6334bffffffebffffff87ffffff9affffff824a06ffffffc33b4cffff (14 characters omitted)"
This patch fix this behavior using classic cast without reinterpret_cast:
[155493251286.221115] [/absolute?what=badarg2] [9] T (0) t:hexEncode: "91ece6334beb879a824a06c33b4cb4240e4c6f56"
2019-05-27 17:06:51 -03:00
Julien Leproust
1acd87a803
Limit log variables to 200 characters
...
To avoid generating too long log lines which end up truncated (like in
nginx's error log), and missing important bits.
2019-05-27 17:04:32 -03:00
Felipe Zimmerle
61c11251b6
parser: Fix filename
2019-04-23 13:17:23 -03:00
Felipe Zimmerle
0669c2e64d
parser: new bison version
2019-04-22 10:46:27 -03:00
Felipe Zimmerle
4e76c6adf0
Renames namespace Variables to variables
2019-03-06 15:53:20 -03:00
Felipe Zimmerle
b9ed150224
Fix namespace utilization on seclang-parser.yy
2019-03-06 15:12:44 -03:00
Ervin Hegedus
ccd90c51c5
Increment OVECCOUNT value for bigger regex's
2019-02-12 10:08:47 -03:00
Ervin Hegedus
a6e6bc2b5f
Allow empty anchored variable to use
2019-02-12 09:31:19 -03:00
Ervin Hegedus
17d79ed7ba
Fixed data collecting in multipart parsing
2019-02-12 09:16:07 -03:00
Ervin Hegedus
4b3e6328e3
Fixed validateByteRange parsing method
2019-02-12 09:10:36 -03:00
Felipe Zimmerle
2dff768262
Removes a memory leak on the JSON parser
2019-02-11 10:17:02 -03:00
WGH
37cf60b8d2
Fix use of deleted Regex copy constructor in LMDB code
...
Bug introduced in ad28de4f. Fixes #2008 .
2019-01-28 16:20:02 -03:00
Felipe Zimmerle
dc78c0e180
Fix: Extra whitespace in some configuration directives causing error
...
Issue #2006
2019-01-21 14:44:31 -03:00
Felipe Zimmerle
df3c3f62b7
Cosmetics: coding style
2019-01-18 11:02:22 -03:00
WGH
ad28de4f14
Refactor regex code
...
This commit fixes quite a few odd things in regex code:
* Lack of encapsulation.
* Non-method functions for matching without retrieving all groups.
* Regex class being copyable without proper copy-constructor (potential UAF
and double free due to pointer members m_pc and m_pce).
* Redundant SMatch::m_length, which always equals to match.size() anyway.
* Weird SMatch::size_ member which is initialized only by one of the three matching
functions, and equals to the return value of that function anyways.
* Several places in code having std::string value instead of reference.
2019-01-18 10:34:01 -03:00
Andrei Belov
ae02076340
Fixed buffer overflow in Utils::Md5::hexdigest()
...
Found via failed test (auditlog.json) on Alpine Linux 3.8.2.
2019-01-14 16:29:07 -03:00
Felipe Zimmerle
78b7fa4e2c
Adds missing drop.h
2018-12-26 11:05:54 -03:00
Felipe Zimmerle
d00ea5111d
Adds initial support to drop action
2018-12-24 16:35:41 -03:00
Ervin Hegedus
77854ed1b5
Fix inet addr handling on 64 bit big endian systems
2018-12-10 15:03:09 -03:00
Felipe Zimmerle
407b6c0f4b
Fix setenv action to strdup key=variable
2018-11-29 15:18:15 -03:00
Felipe Zimmerle
d2b14de268
Allow 0 length JSON requests
...
As discussed at: #1822
2018-11-29 10:39:46 -03:00
Fred Nicolson
3d2030426c
Replaced log locking using mutex with fcntl lock
...
When reloading Nginx, there is a race condition which is visible under high
load. As the logging mutex is shared between multiple workers, when a worker
is sent a stop signal during a reload, and the log mutex is held, write()
will never return, which means that the mutex will never unlock. As other
workers share this mutex, they will deadlock.
fcntl does not suffer from this issue.
2018-11-27 10:09:29 -03:00
Wenfeng Liu
3b3004d24d
Correct the usage of modsecurity::Phases::NUMBER_OF_PHASES
2018-11-27 09:23:00 -03:00
Felipe Zimmerle
ce3abf2626
Adds support to multiple ranges in ctl:ruleRemoveById
...
Issue #1956
2018-11-26 20:48:18 -03:00
Felipe Zimmerle
e712d30c56
Fix setvar to understand Rule variable in collections
...
Issue #1961
2018-11-26 19:49:44 -03:00
Victor Hora
b638e523af
Make the boundary check less strict as per RFC2046
2018-11-20 22:17:22 -03:00
Victor Hora
ecad8c6c7e
Fix buffer size for utf8toUnicode transformation
2018-11-16 14:58:40 -05:00
Felipe Zimmerle
9d80983e55
Fix on top of #1943 + adding test cases
2018-11-01 16:11:39 -03:00
supplient
39f4a5d7d2
Fix double macros bug
...
Macro run strangely if I input double macros like "%{ARGS_COMBINED_SIZE}%{ARGS_COMBINED_SIZE}".
2018-11-01 15:56:54 -03:00
Felipe Zimmerle
18cdffdbca
Encapsulates int[N] in a class to avoid compilation issues
...
Depending on the compiler, there may be a compilation issue with the
usage of std::unique_ptr<int[]>. Therefore encapsulating it inside a
regular class.
2018-11-01 11:50:15 -03:00
Victor Hora
e3b9f7c913
Fix SecUnicodeMapFile support
...
Makes SecUnicodeMapFile read the file and adjust transformation to use the
right variable.
2018-10-31 22:57:39 -03:00
Felipe Zimmerle
e1e8a01ed2
Override the default status code if not suitable to redirect action
...
Issue #1850
2018-10-30 18:20:23 -03:00
Felipe Zimmerle
bfe917b6b1
parser: Fix the support for CRLF configuration files
2018-10-30 17:16:44 -03:00
Felipe Zimmerle
3f0ea90970
Test case skeleton for #1941
2018-10-29 11:14:31 -03:00
Felipe Zimmerle
91daeee9f6
Only calling server log if the message is not disruptive
...
The disruptive message is already part of the interception object
2018-10-25 18:04:27 -03:00
Felipe Zimmerle
448897d297
Marking message as disruptive before generate log msg
2018-10-25 18:04:07 -03:00
Felipe Zimmerle
973c1f1028
Fix rule line number
...
Issue #1844
2018-10-24 21:02:35 -03:00
Felipe Zimmerle
fa5f3784f2
Using shared_ptr instead of unique_ptr on rules exceptions
2018-10-23 17:03:18 -03:00
Felipe Zimmerle
ef7f65db90
Changes debuglogs schema to avoid unecessary str allocation
2018-10-23 17:00:16 -03:00
Felipe Zimmerle
23e0d35d2d
Fix the SecUnicodeMapFile and SecUnicodeCodePage
2018-10-23 17:00:11 -03:00
Felipe Zimmerle
69cd61439d
Changes the timing to save the rule message
2018-10-23 16:58:42 -03:00
Victor Hora
8088d6af71
Fix crash in msc_rules_add_file() when using disruptive action in child rule inside of chain
2018-10-23 16:39:21 -03:00
Wenfeng Liu
ec1112c648
Fix memory leak in AuditLog::init()
2018-10-23 16:39:15 -03:00
Felipe Zimmerle
8bda7c0a45
Fix RULE lookup in chained rules.
2018-10-23 16:37:54 -03:00
Felipe Zimmerle
120108fd33
Adds support for /32 in @ipMatch cidr notation.
...
/32 is the representation of the ip itself. Not sure if it is needed,
but there is a complaint for that: #849
2018-10-23 16:37:53 -03:00
Felipe Zimmerle
a5a40a71a9
Makes matchedvars inline
2018-10-23 16:37:49 -03:00
Felipe Zimmerle
b58018e778
Fix multimatch behavior to match what we have on v2
2018-10-23 16:37:42 -03:00
Felipe Zimmerle
dba73f5367
Using values after transformation at MATCHED_VARS
2018-10-23 16:26:11 -03:00
Felipe Zimmerle
85ecd190d9
Adds full support to UpdateActionById.
...
Issue #1800
2018-10-23 16:26:11 -03:00
Felipe Zimmerle
3e8e28da48
Refactoring on the RULE variable
2018-10-23 16:26:11 -03:00