Skip to content

Commit 4f09f89

Browse files
Add Moodle detection rules for web server logs
1 parent 1aacbed commit 4f09f89

3 files changed

Lines changed: 120 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
title: Moodle Cron Endpoint Accessed From External Address
2+
id: eb36448d-2512-482d-ad99-9feab85ef500
3+
status: experimental
4+
description: |
5+
Detects requests to Moodle's web cron endpoint from an address outside RFC1918 space.
6+
Moodle documentation recommends restricting web cron to the local host or to a defined set of
7+
trusted addresses. Where it is left open, an unauthenticated attacker can repeatedly trigger the
8+
full scheduled task run, which is both a denial of service primitive and a way to force execution
9+
of tasks registered by an installed plugin.
10+
references:
11+
- https://docs.moodle.org/en/Cron
12+
- https://docs.moodle.org/en/Site_security_settings
13+
author: Sanket Taware (@sankettaware16)
14+
date: 2026-07-31
15+
tags:
16+
- attack.execution
17+
- attack.persistence
18+
- attack.privilege-escalation
19+
- attack.t1053
20+
logsource:
21+
category: webserver
22+
detection:
23+
selection:
24+
cs-uri-stem|endswith: '/admin/cron.php'
25+
filter_main_internal:
26+
c-ip|cidr:
27+
- '127.0.0.0/8'
28+
- '10.0.0.0/8'
29+
- '172.16.0.0/12'
30+
- '192.168.0.0/16'
31+
condition: selection and not 1 of filter_main_*
32+
falsepositives:
33+
- Sites that deliberately drive web cron from an external scheduler or uptime monitor
34+
- Reverse proxies and load balancers that do not preserve the original client address, which will make every request appear external
35+
level: high
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
title: Executable Or Script File Served From Moodle File Storage
2+
id: 98afeaf3-7305-42d9-8ea9-a9c968d903e7
3+
status: experimental
4+
description: |
5+
Detects successful downloads of executable or script file types through Moodle's file serving
6+
endpoints. Course files, assignment submissions and draft areas accept arbitrary uploads from any
7+
enrolled user, which makes a Moodle site an attractive and highly trusted distribution point for
8+
malware aimed at other members of the institution.
9+
references:
10+
- https://docs.moodle.org/dev/File_API
11+
- https://docs.moodle.org/en/Site_security_settings
12+
author: Sanket Taware (@sankettaware16)
13+
date: 2026-07-31
14+
tags:
15+
- attack.execution
16+
- attack.t1204.002
17+
logsource:
18+
category: webserver
19+
detection:
20+
selection_endpoint:
21+
cs-uri-stem|contains:
22+
- '/pluginfile.php'
23+
- '/draftfile.php'
24+
- '/tokenpluginfile.php'
25+
- '/webservice/pluginfile.php'
26+
selection_extension:
27+
cs-uri-stem|endswith:
28+
- '.bat'
29+
- '.chm'
30+
- '.cmd'
31+
- '.exe'
32+
- '.hta'
33+
- '.jar'
34+
- '.lnk'
35+
- '.msi'
36+
- '.ps1'
37+
- '.scr'
38+
- '.vbe'
39+
- '.vbs'
40+
- '.wsf'
41+
selection_status:
42+
sc-status: 200
43+
condition: all of selection_*
44+
falsepositives:
45+
- Programming, systems or security courses that distribute compiled binaries, JAR files or scripts as teaching material
46+
- Software packaged as a course resource by teaching staff
47+
- Assignment briefs that require students to submit compiled artefacts
48+
level: medium
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
title: PHP File Served From Moodle Upload Or Static Content Path
2+
id: 28b7d590-3fb1-4cca-b67b-c74ee2dc904d
3+
status: experimental
4+
description: |
5+
Detects a successful request for a .php file located under a Moodle directory that should only ever
6+
serve uploaded content or static assets. Moodle deliberately stores uploaded files outside the web
7+
root and serves them through pluginfile.php, so a PHP file answering with 200 from one of these
8+
paths means either the data directory has been exposed to the web server or a script has been
9+
written into the document root - both of which are consistent with a web shell.
10+
A 200 response for anything under the Moodle data directory is a serious misconfiguration in its own
11+
right and should be investigated even if the file is not PHP.
12+
references:
13+
- https://docs.moodle.org/en/Security_recommendations
14+
- https://docs.moodle.org/dev/File_API
15+
author: Sanket Taware (@sankettaware16)
16+
date: 2026-07-31
17+
tags:
18+
- attack.persistence
19+
- attack.t1505.003
20+
logsource:
21+
category: webserver
22+
detection:
23+
selection_extension:
24+
cs-uri-stem|endswith: '.php'
25+
selection_path:
26+
cs-uri-stem|contains:
27+
- '/moodledata/'
28+
- '/filedir/'
29+
- '/pix/'
30+
- '/userpix/'
31+
- '/repository/draftfiles/'
32+
selection_status:
33+
sc-status: 200
34+
condition: all of selection_*
35+
falsepositives:
36+
- A theme or plugin that ships a PHP file under a pix directory - verify against the plugin source before excluding
37+
level: high

0 commit comments

Comments
 (0)