-
Bug
-
Resolution: Fixed
-
Blocker
-
3.8
-
MOODLE_38_STABLE
-
MOODLE_38_STABLE
-
-
H5P Sprint Relase 3.8
The H5P filter recently introduced allows an attacker to execute JavaScript, and embed content that does not meet the allowed sources requirements.
Pre-requisites
- H5P filter enabled
- Default allowed sources
Demonstration
The following URLs are examples of vulnerabilities, include those URLs anywhere where the filter is applied.
https://perdu%2Ecom#h5p.com/content/1
|
|
https://mydomain-h5p.com/content/1
|
|
https://mydomainh5p.com/content/1
|
|
https://"onload="alert(1)"h5p.com/content/1"
|
Explanation
The default allowed sources contain the following:
https://*.h5p.com/content/[id]
|
A regular expression is constructed from the allowed sources replacing the * character with the regex [\.]+. It also does not escape the . (periods) that are part of the allowed sources.
With that we can:
- Use the URL code %2E to hide . (periods) which allows us to completely replace the domain of the URL (first exploit)
- Buy our own domain that ends in h5p.com as the preceding . (period) is not escaped, and can be any character (2nd and 3rd exploits)
- Inject HTML through the domain so long as it does not include a period (4th exploit)
You should consider having a bug bounty