VYPR
High severity7.4NVD Advisory· Published Feb 22, 2016· Updated May 6, 2026

CVE-2015-3272

CVE-2015-3272

Description

Open redirect vulnerability in the clean_param function in lib/moodlelib.php in Moodle through 2.6.11, 2.7.x before 2.7.9, 2.8.x before 2.8.7, and 2.9.x before 2.9.1 allows remote attackers to redirect users to arbitrary web sites and conduct phishing attacks via vectors involving an HTTP Referer header that has a substring match with a local URL.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
moodle/moodlePackagist
>= 2.7.0, < 2.7.92.7.9
moodle/moodlePackagist
>= 2.8.0, < 2.8.72.8.7
moodle/moodlePackagist
>= 2.9.0, < 2.9.12.9.1

Affected products

28
  • Moodle/Moodle28 versions
    cpe:2.3:a:moodle:moodle:2.6.0:*:*:*:*:*:*:*+ 27 more
    • cpe:2.3:a:moodle:moodle:2.6.0:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.6.1:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.6.10:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.6.2:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.6.3:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.6.4:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.6.5:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.6.6:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.6.7:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.6.8:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.6.9:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.7.0:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.7.1:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.7.2:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.7.3:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.7.4:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.7.5:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.7.6:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.7.7:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.7.8:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.8.0:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.8.1:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.8.2:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.8.3:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.8.4:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.8.5:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.8.6:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.9.0:*:*:*:*:*:*:*

Patches

4
9580c08e9e4e

MDL-50688 lib: fix local url validation bug

https://github.com/moodle/moodlePetr SkodaJun 14, 2015via ghsa
1 file changed · +7 3
  • lib/moodlelib.php+7 3 modified
    @@ -1036,11 +1036,15 @@ function clean_param($param, $type) {
                     // Simulate the HTTPS version of the site.
                     $httpswwwroot = str_replace('http://', 'https://', $CFG->wwwroot);
     
    -                if (preg_match(':^/:', $param)) {
    +                if ($param === $CFG->wwwroot) {
    +                    // Exact match;
    +                } else if (!empty($CFG->loginhttps) && $param === $httpswwwroot) {
    +                    // Exact match;
    +                } else if (preg_match(':^/:', $param)) {
                         // Root-relative, ok!
    -                } else if (preg_match('/^' . preg_quote($CFG->wwwroot, '/') . '/i', $param)) {
    +                } else if (preg_match('/^' . preg_quote($CFG->wwwroot . '/', '/') . '/i', $param)) {
                         // Absolute, and matches our wwwroot.
    -                } else if (!empty($CFG->loginhttps) && preg_match('/^' . preg_quote($httpswwwroot, '/') . '/i', $param)) {
    +                } else if (!empty($CFG->loginhttps) && preg_match('/^' . preg_quote($httpswwwroot . '/', '/') . '/i', $param)) {
                         // Absolute, and matches our httpswwwroot.
                     } else {
                         // Relative - let's make sure there are no tricks.
    
5c1f41f0583e

MDL-50688 lib: fix local url validation bug

https://github.com/moodle/moodlePetr SkodaJun 14, 2015via ghsa
1 file changed · +7 3
  • lib/moodlelib.php+7 3 modified
    @@ -1033,11 +1033,15 @@ function clean_param($param, $type) {
                     // Simulate the HTTPS version of the site.
                     $httpswwwroot = str_replace('http://', 'https://', $CFG->wwwroot);
     
    -                if (preg_match(':^/:', $param)) {
    +                if ($param === $CFG->wwwroot) {
    +                    // Exact match;
    +                } else if (!empty($CFG->loginhttps) && $param === $httpswwwroot) {
    +                    // Exact match;
    +                } else if (preg_match(':^/:', $param)) {
                         // Root-relative, ok!
    -                } else if (preg_match('/^' . preg_quote($CFG->wwwroot, '/') . '/i', $param)) {
    +                } else if (preg_match('/^' . preg_quote($CFG->wwwroot . '/', '/') . '/i', $param)) {
                         // Absolute, and matches our wwwroot.
    -                } else if (!empty($CFG->loginhttps) && preg_match('/^' . preg_quote($httpswwwroot, '/') . '/i', $param)) {
    +                } else if (!empty($CFG->loginhttps) && preg_match('/^' . preg_quote($httpswwwroot . '/', '/') . '/i', $param)) {
                         // Absolute, and matches our httpswwwroot.
                     } else {
                         // Relative - let's make sure there are no tricks.
    
5673aae91407

MDL-50688 lib: fix local url validation bug

https://github.com/moodle/moodlePetr SkodaJun 14, 2015via ghsa
1 file changed · +7 3
  • lib/moodlelib.php+7 3 modified
    @@ -1033,11 +1033,15 @@ function clean_param($param, $type) {
                     // Simulate the HTTPS version of the site.
                     $httpswwwroot = str_replace('http://', 'https://', $CFG->wwwroot);
     
    -                if (preg_match(':^/:', $param)) {
    +                if ($param === $CFG->wwwroot) {
    +                    // Exact match;
    +                } else if (!empty($CFG->loginhttps) && $param === $httpswwwroot) {
    +                    // Exact match;
    +                } else if (preg_match(':^/:', $param)) {
                         // Root-relative, ok!
    -                } else if (preg_match('/^' . preg_quote($CFG->wwwroot, '/') . '/i', $param)) {
    +                } else if (preg_match('/^' . preg_quote($CFG->wwwroot . '/', '/') . '/i', $param)) {
                         // Absolute, and matches our wwwroot.
    -                } else if (!empty($CFG->loginhttps) && preg_match('/^' . preg_quote($httpswwwroot, '/') . '/i', $param)) {
    +                } else if (!empty($CFG->loginhttps) && preg_match('/^' . preg_quote($httpswwwroot . '/', '/') . '/i', $param)) {
                         // Absolute, and matches our httpswwwroot.
                     } else {
                         // Relative - let's make sure there are no tricks.
    
980bd08bdc01

MDL-50688 lib: fix local url validation bug

https://github.com/moodle/moodlePetr SkodaJun 14, 2015via ghsa
1 file changed · +7 3
  • lib/moodlelib.php+7 3 modified
    @@ -1036,11 +1036,15 @@ function clean_param($param, $type) {
                     // Simulate the HTTPS version of the site.
                     $httpswwwroot = str_replace('http://', 'https://', $CFG->wwwroot);
     
    -                if (preg_match(':^/:', $param)) {
    +                if ($param === $CFG->wwwroot) {
    +                    // Exact match;
    +                } else if (!empty($CFG->loginhttps) && $param === $httpswwwroot) {
    +                    // Exact match;
    +                } else if (preg_match(':^/:', $param)) {
                         // Root-relative, ok!
    -                } else if (preg_match('/^' . preg_quote($CFG->wwwroot, '/') . '/i', $param)) {
    +                } else if (preg_match('/^' . preg_quote($CFG->wwwroot . '/', '/') . '/i', $param)) {
                         // Absolute, and matches our wwwroot.
    -                } else if (!empty($CFG->loginhttps) && preg_match('/^' . preg_quote($httpswwwroot, '/') . '/i', $param)) {
    +                } else if (!empty($CFG->loginhttps) && preg_match('/^' . preg_quote($httpswwwroot . '/', '/') . '/i', $param)) {
                         // Absolute, and matches our httpswwwroot.
                     } else {
                         // Relative - let's make sure there are no tricks.
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

10

News mentions

0

No linked articles in our index yet.