Skip to content

Commit

Permalink
chore: tests for CVE-2023-32712 added
Browse files Browse the repository at this point in the history
  • Loading branch information
hsekowski-splunk committed Aug 17, 2023
1 parent 0febf07 commit 9c80a27
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions tests/integration/test_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
import context
from _search import search


def test_CVE_2023_32712():
# CVE-2023-32712
session_key = context.get_session_key()

msg_prefix = "ASCII Table in one string: "
search_results = search(
session_key, f"search index=_internal \"{msg_prefix}\""
)
time.sleep(30)
search_results = search(session_key, f'search index=_internal "{msg_prefix}"')
assert len(search_results) >= 1
_raw_event = search_results[0]["_raw"]

Expand All @@ -38,19 +38,26 @@ def test_CVE_2023_32712():
assert "\t\n" in _raw_event
assert r"\x0b\x0c" in _raw_event
# assert "\r" in _raw_event
assert r"\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" in _raw_event
assert " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~" in _raw_event
assert (
r"\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
in _raw_event
)
assert (
" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
in _raw_event
)
assert r"\x7f" in _raw_event

# test for white characters as they shouldn't be represented in fixed Splunk instance
def gen_ascii_chars_range(start: int=0, stop: int=128) -> str:
def gen_ascii_chars_range(start: int = 0, stop: int = 128) -> str:
chars_str = ""
for i in range(start, stop):
chars_str += chr(i)
return chars_str
ascii_chars_range_00_09 = gen_ascii_chars_range(start=0,stop=9)
ascii_chars_range_0b_0d = gen_ascii_chars_range(start=11,stop=13)
ascii_chars_range_0e_20 = gen_ascii_chars_range(start=14,stop=32)

ascii_chars_range_00_09 = gen_ascii_chars_range(start=0, stop=9)
ascii_chars_range_0b_0d = gen_ascii_chars_range(start=11, stop=13)
ascii_chars_range_0e_20 = gen_ascii_chars_range(start=14, stop=32)
assert ascii_chars_range_00_09 not in _raw_event
assert ascii_chars_range_0b_0d not in _raw_event
assert ascii_chars_range_0e_20 not in _raw_event

0 comments on commit 9c80a27

Please sign in to comment.