Skip to content

Commit

Permalink
Detecting phpinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
kazet committed Aug 31, 2024
1 parent a260fb5 commit 141d027
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
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
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

0 comments on commit 141d027

Please sign in to comment.