Skip to content

Commit

Permalink
Detect Joomla CVE-2023-23752
Browse files Browse the repository at this point in the history
1. Detect CVE-2023-23752 exploit attempts (Joomla injection).

MISC:
2. Increase points subtracted for researchers from 1 to 2.
3. Edit androx regex pattern to match a longer signature.
4. Some misc comments
  • Loading branch information
mepley1 committed Jan 5, 2025
1 parent 1e1f5d1 commit 2fa220a
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions project/auto_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,9 @@ def is_mirai_dvr(request):
return False

def is_mirai_netgear(request):
""" Mirai attempting to exploit old Netgear DGN interface command injection vuln. """
""" Attempts to exploit old Netgear DGN interface command injection vuln.
Commonly exploited by Mirai/variants. """
# TODO: Refactor this to use regex, this is too sloppy.
path = request.path
MIRAI_NETGEAR_PATH = '/setup.cgi'
MIRAI_NETGEAR_SIGNATURES = [
Expand Down Expand Up @@ -436,9 +438,10 @@ def is_androx(request):
Almost always preceded by a request like `GET /.env`, which will probably get reported before this POST request does.
Return True if 0x[] or 0x01[] etc found in form data keys. """

'''ANDROX_SIGS = [
'''
ANDROX_SIGS = [
# Just a few examples I've seen. Leaving this here for reference.
#'androxgh0st', 'legion', 'ridho', 'janc0xsec', 'CREX' #some values I've seen so far
#'androxgh0st', 'legion', 'ridho', 'janc0xsec', 'CREX', '0x0day' #some values I've seen so far
# Keys:
'0x[]',
'0x%5B%5D', #Depending on how I decode it.
Expand All @@ -448,8 +451,8 @@ def is_androx(request):

if request.method == 'POST' and request.content_type == 'application/x-www-form-urlencoded':
form_data_keys = [item for item in request.form.keys()]
# Match for "0x" followed by 0-8 (arbitrary, could be more but I've only seen up to 4) of any char, then brackets "[]". Example "0x[]" or "0x01[]"
ANDROX_SIG_REGEX = r'^0x.{0,8}\[\]$'
# Match for "0x" followed by 0-16 (arbitrary, could be more but I've only seen up to about 5) of any char, then brackets "[]". Example "0x[]" or "0x01[]"
ANDROX_SIG_REGEX = r'^0x.{0,16}\[\]$'
regex = re.compile(ANDROX_SIG_REGEX, re.IGNORECASE)
return any(regex.search(_) for _ in form_data_keys)
return False
Expand Down Expand Up @@ -548,6 +551,19 @@ def is_tbk_auth_bypass(request):
else:
return False

def is_joomla_injection(request) -> bool:
""" CVE-2023-23752 - Joomla injection. """
EXPLOIT_PATH = '/api/index.php/v1/config/application'
if request.path.lower() == EXPLOIT_PATH.lower():
# Make pattern mostly optional, so probes for the path alone will match as well.
EXPLOIT_PATTERN = r'^(public=true(&page%5Boffset%5D=.*&page%5Blimit%5D=.*)?)?$'
regex = re.compile(EXPLOIT_PATTERN, re.IGNORECASE)
# Really only need to check path, but might as well check query too.
if regex.search(request.query_string.decode(errors='replace')):
return True
else:
return False

# more generic rules

def is_post_request(request):
Expand Down Expand Up @@ -807,8 +823,8 @@ def check_all_rules():
(is_nmap_http_scan, 'Nmap HTTP scan', ['21']),
(is_nmap_vuln_probe, 'Nmap probe', ['21']),
(is_mirai_dvr, 'HiSense DVR exploit, likely Mirai', ['23','21']),
(is_mirai_netgear, 'Netgear command injection exploit, likely Mirai', ['23','21']),
(is_mirai_jaws, 'Jaws webserver command injection, likely Mirai', ['23', '21']),
(is_mirai_netgear, 'Netgear command injection exploit', ['23','21']),
(is_mirai_jaws, 'Jaws webserver command injection', ['23', '21']),
(is_mirai_ua, 'User-agent associated with Mirai', ['23','19']),
(is_androx, 'AndroxGh0st/variant', ['21']),
(is_cobalt_strike_scan, 'Cobalt Strike path', ['21']),
Expand All @@ -819,7 +835,8 @@ def check_all_rules():
(is_tpl_exploit, 'CVE-2023-1389', ['15','21','23']),
(is_zyxel_rci, 'Zyxel CVE-2022-30525', ['15','21','23']),
(is_dlink_backdoor, 'D-Link CVE-2024-3272/CVE-2024-3273', ['15','21','23']),
(is_tbk_auth_bypass, 'CVE-2018-9995', ['21','23']),
(is_tbk_auth_bypass, 'CVE-2018-9995 TBK DVR auth bypass', ['21','23']),
(is_joomla_injection, 'Joomla CVE-2023-23752', ['21','16']),
(is_post_request, 'Suspicious POST request', ['21']),
(no_host_header, 'No Host header', ['21']),
(is_misc_get_probe, 'GET with unexpected args', ['21']),
Expand Down Expand Up @@ -848,7 +865,7 @@ def check_all_rules():
# Lower the score for known benign researchers/scanners
if is_research(request):
if rules_matched > 0:
rules_matched -= 1
rules_matched -= 2

# If any rules matched, report to AbuseIPDB.
if rules_matched > 0:
Expand Down

0 comments on commit 2fa220a

Please sign in to comment.