Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More test fixing #40

Merged
merged 3 commits into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crash_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def get_matchers(
re.compile("__GARLIC_CALL__ srand\\(\\) __ENDGARLIC__", flags),
re.compile("function '.{0,30}GARLIC.{0,30}' not found", flags),
re.compile("SQL syntax.{0,2048}GARLIC", flags),
re.compile(":/bin", flags),
re.compile("<GARLIC", flags),
# Forgot quotes that allow xss?
re.compile("\\s[A-Za-z_0-9-]+\\s*=\\s*[^\\s\"']*GARLIC GARLIC", flags),
Expand Down
2 changes: 2 additions & 0 deletions docker_image/strip_php_array_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
with open(file, "r", encoding="utf-8", errors="ignore") as f:
data = f.read()
with open(file, "w") as f:
for i in range(10):
data = re.sub(r"(function[^(]*\([^)]*)\? *array (\$[^)]*\))", r"\1\2", data, re.MULTILINE)
for i in range(10):
data = re.sub(r"(function[^(]*\([^)]*)array (\$[^)]*\))", r"\1\2", data, re.MULTILINE)
f.write(data)
4 changes: 4 additions & 0 deletions test/test_crash_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ def test_weridly_escaped_payloads_are_detected(self):
output = run_in_container_and_get_output(["php", "-r", "echo 'GARLIC\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\"';"])
self.assertAnyMatcherWouldDetect(output)

def test_phpinfo_or_env_is_detected(self):
output = run_in_container_and_get_output(["php", "-r", "phpinfo();"])
self.assertAnyMatcherWouldDetect(output)

def test_libxml_crashes_are_detected(self):
output = run_in_container_and_get_output(["php", "-r", 'simplexml_load_string("BAD XML");'])
self.assertAnyMatcherWouldDetect(output)
Expand Down
Loading