VYPR
Moderate severityNVD Advisory· Published May 25, 2013· Updated Apr 29, 2026

CVE-2013-2081

CVE-2013-2081

Description

Moodle hub registration form always sends site information (users, courses, etc.) to remote hubs even when administrators have configured 'don't send' settings, due to hardcoded default values in the form.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

Moodle hub registration form always sends site information (users, courses, etc.) to remote hubs even when administrators have configured 'don't send' settings, due to hardcoded default values in the form.

Vulnerability

In Moodle hub registration, the definition() method of the hub registration form hardcoded the default value of checkboxes for sending site information to true [3][4]. This meant that even if an administrator had previously set a "don't send" flag for certain data (e.g., user count, course count), the checkboxes remained enabled by default, forcing the site to send that information during hub registration. The bug affects Moodle versions through 2.1.10, 2.2.x before 2.2.10, 2.3.x before 2.3.7, and 2.4.x before 2.4.4 [1].

Exploitation

An attacker controls a malicious Moodle hub and invites a vulnerable Moodle site to register. When the site administrator visits the registration page, the form's checkboxes for site statistics (users, courses, role assignments, posts, etc.) are all pre-checked, regardless of the administrator's prior "don't send" preferences. Unless the administrator manually unchecks every box, the form submission sends the sensitive data to the attacker's hub. No authentication above the site administrator role is required, but the administrator must interact with the registration form.

Impact

An attacker operating a malicious hub can obtain detailed site statistics such as number of users, courses, posts, questions, and other configuration data. This information disclosure can aid in profiling the site for further attacks. The scope is limited to the data sent in the registration form; no code execution or data modification is achieved.

Mitigation

The fix, tracked as MDL-37822, changes setDefault('courses', true) to setDefault('courses', $coursesnumber != -1) and similarly for all other checkboxes [3][4]. This ensures that the checkbox reflects the stored "don't send" configuration. The fix was released in Moodle 2.2.10, 2.3.7, 2.4.4, and 2.5.0. Sites that cannot upgrade should carefully review hub registration forms and manually uncheck any fields they do not wish to send.

AI Insight generated on May 23, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
moodle/moodlePackagist
< 2.2.102.2.10
moodle/moodlePackagist
>= 2.3.0, < 2.3.72.3.7
moodle/moodlePackagist
>= 2.4.0, < 2.4.42.4.4

Affected products

33
  • Moodle/Moodle32 versions
    cpe:2.3:a:moodle:moodle:2.1.0:*:*:*:*:*:*:*+ 31 more
    • cpe:2.3:a:moodle:moodle:2.1.0:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.1.1:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.1.10:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.1.2:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.1.3:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.1.4:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.1.5:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.1.6:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.1.7:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.1.8:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.1.9:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.2.0:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.2.1:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.2.2:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.2.3:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.2.4:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.2.5:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.2.6:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.2.7:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.2.8:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.2.9:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.3.0:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.3.1:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.3.2:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.3.3:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.3.4:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.3.5:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.3.6:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.4.0:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.4.1:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.4.2:*:*:*:*:*:*:*
    • cpe:2.3:a:moodle:moodle:2.4.3:*:*:*:*:*:*:*
  • ghsa-coords
    Range: < 2.2.10

Patches

10
669dee58048b

MDL-37822 Moodle send site information to a hub even though it's unchecked

https://github.com/moodle/moodleJerome MouneyracMay 7, 2013via ghsa
2 files changed · +41 13
  • admin/registration/forms.php+14 12 modified
    @@ -244,9 +244,11 @@ public function definition() {
             $postsnumber = get_config('hub', 'site_postsnumber_' . $cleanhuburl);
             $questionsnumber = get_config('hub', 'site_questionsnumber_' . $cleanhuburl);
             $resourcesnumber = get_config('hub', 'site_resourcesnumber_' . $cleanhuburl);
    -        $badges = get_config('hub', 'site_badges_' . $cleanhuburl);
    -        $issuedbadges = get_config('hub', 'site_issuedbadges_' . $cleanhuburl);
    +        $badgesnumber = get_config('hub', 'site_badges_' . $cleanhuburl);
    +        $issuedbadgesnumber = get_config('hub', 'site_issuedbadges_' . $cleanhuburl);
             $mediancoursesize = get_config('hub', 'site_mediancoursesize_' . $cleanhuburl);
    +        $participantnumberaveragecfg = get_config('hub', 'site_participantnumberaverage_' . $cleanhuburl);
    +        $modulenumberaveragecfg = get_config('hub', 'site_modulenumberaverage_' . $cleanhuburl);
     
             //hidden parameters
             $mform->addElement('hidden', 'huburl', $huburl);
    @@ -387,53 +389,53 @@ public function definition() {
             if (HUB_MOODLEORGHUBURL != $huburl) {
                 $mform->addElement('checkbox', 'courses', get_string('sendfollowinginfo', 'hub'),
                         " " . get_string('coursesnumber', 'hub', $coursecount));
    -            $mform->setDefault('courses', 1);
    +            $mform->setDefault('courses', $coursesnumber != -1);
                 $mform->setType('courses', PARAM_INT);
                 $mform->addHelpButton('courses', 'sendfollowinginfo', 'hub');
     
                 $mform->addElement('checkbox', 'users', '',
                         " " . get_string('usersnumber', 'hub', $usercount));
    -            $mform->setDefault('users', 1);
    +            $mform->setDefault('users', $usersnumber != -1);
                 $mform->setType('users', PARAM_INT);
     
                 $mform->addElement('checkbox', 'roleassignments', '',
                         " " . get_string('roleassignmentsnumber', 'hub', $roleassigncount));
    -            $mform->setDefault('roleassignments', 1);
    +            $mform->setDefault('roleassignments', $roleassignmentsnumber != -1);
                 $mform->setType('roleassignments', PARAM_INT);
     
                 $mform->addElement('checkbox', 'posts', '',
                         " " . get_string('postsnumber', 'hub', $postcount));
    -            $mform->setDefault('posts', 1);
    +            $mform->setDefault('posts', $postsnumber != -1);
                 $mform->setType('posts', PARAM_INT);
     
                 $mform->addElement('checkbox', 'questions', '',
                         " " . get_string('questionsnumber', 'hub', $questioncount));
    -            $mform->setDefault('questions', 1);
    +            $mform->setDefault('questions', $questionsnumber != -1);
                 $mform->setType('questions', PARAM_INT);
     
                 $mform->addElement('checkbox', 'resources', '',
                         " " . get_string('resourcesnumber', 'hub', $resourcecount));
    -            $mform->setDefault('resources', 1);
    +            $mform->setDefault('resources', $resourcesnumber != -1);
                 $mform->setType('resources', PARAM_INT);
     
                 $mform->addElement('checkbox', 'badges', '',
                         " " . get_string('badgesnumber', 'hub', $badges));
    -            $mform->setDefault('badges', 1);
    +            $mform->setDefault('badges', $badgesnumber != -1);
                 $mform->setType('resources', PARAM_INT);
     
                 $mform->addElement('checkbox', 'issuedbadges', '',
                         " " . get_string('issuedbadgesnumber', 'hub', $issuedbadges));
    -            $mform->setDefault('issuedbadges', 1);
    +            $mform->setDefault('issuedbadges', $issuedbadgesnumber != -1);
                 $mform->setType('resources', PARAM_INT);
     
                 $mform->addElement('checkbox', 'participantnumberaverage', '',
                         " " . get_string('participantnumberaverage', 'hub', $participantnumberaverage));
    -            $mform->setDefault('participantnumberaverage', 1);
    +            $mform->setDefault('participantnumberaverage', $participantnumberaveragecfg != -1);
                 $mform->setType('participantnumberaverage', PARAM_FLOAT);
     
                 $mform->addElement('checkbox', 'modulenumberaverage', '',
                         " " . get_string('modulenumberaverage', 'hub', $modulenumberaverage));
    -            $mform->setDefault('modulenumberaverage', 1);
    +            $mform->setDefault('modulenumberaverage', $modulenumberaveragecfg != -1);
                 $mform->setType('modulenumberaverage', PARAM_FLOAT);
             } else {
                 $mform->addElement('static', 'courseslabel', get_string('sendfollowinginfo', 'hub'),
    
  • admin/registration/register.php+27 1 modified
    @@ -62,7 +62,18 @@
     $fromform = $siteregistrationform->get_data();
     
     if (!empty($fromform) and confirm_sesskey()) {
    -    //save the settings
    +
    +    // Set to -1 all optional data marked as "don't send" by the admin.
    +    // The function get_site_info() will not calculate the optional data if config is set to -1.
    +    $inputnames = array('courses', 'users', 'roleassignments', 'posts', 'questions', 'resources',
    +        'badges', 'issuedbadges', 'modulenumberaverage', 'participantnumberaverage');
    +    foreach ($inputnames as $inputname) {
    +        if (empty($fromform->{$inputname})) {
    +            $fromform->{$inputname} = -1;
    +        }
    +    }
    +
    +    // Save the settings.
         $cleanhuburl = clean_param($huburl, PARAM_ALPHANUMEXT);
         set_config('site_name_' . $cleanhuburl, $fromform->name, 'hub');
         set_config('site_description_' . $cleanhuburl, $fromform->description, 'hub');
    @@ -115,6 +126,21 @@
     if (!empty($fromform) and empty($update) and confirm_sesskey()) {
     
         if (!empty($fromform) and confirm_sesskey()) { // if the register button has been clicked
    +
    +        // Retrieve the optional info (specially course number, user number, module number average...).
    +        $siteinfo = $registrationmanager->get_site_info($huburl);
    +        $fromform->courses = $siteinfo['courses'];
    +        $fromform->users = $siteinfo['users'];
    +        $fromform->enrolments = $siteinfo['enrolments'];
    +        $fromform->posts = $siteinfo['posts'];
    +        $fromform->questions = $siteinfo['questions'];
    +        $fromform->resources = $siteinfo['resources'];
    +        $fromform->badges = $siteinfo['badges'];
    +        $fromform->issuedbadges = $siteinfo['issuedbadges'];
    +        $fromform->modulenumberaverage = $siteinfo['modulenumberaverage'];
    +        $fromform->participantnumberaverage = $siteinfo['participantnumberaverage'];
    +        $fromform->street = $siteinfo['street'];
    +
             $params = (array) $fromform; //we are using the form input as the redirection parameters (token, url and name)
     
             $unconfirmedhub = $registrationmanager->get_unconfirmedhub($huburl);
    
a811e8ac56e4

MDL-37822 fix checkboxes that were always set to on by default

https://github.com/moodle/moodleJerome MouneyracMar 19, 2013via ghsa
1 file changed · +10 8
  • admin/registration/forms.php+10 8 modified
    @@ -243,6 +243,8 @@ public function definition() {
             $questionsnumber = get_config('hub', 'site_questionsnumber_' . $cleanhuburl);
             $resourcesnumber = get_config('hub', 'site_resourcesnumber_' . $cleanhuburl);
             $mediancoursesize = get_config('hub', 'site_mediancoursesize_' . $cleanhuburl);
    +        $participantnumberaveragecfg = get_config('hub', 'site_participantnumberaverage_' . $cleanhuburl);
    +        $modulenumberaveragecfg = get_config('hub', 'site_modulenumberaverage_' . $cleanhuburl);
     
             //hidden parameters
             $mform->addElement('hidden', 'huburl', $huburl);
    @@ -374,36 +376,36 @@ public function definition() {
             if (HUB_MOODLEORGHUBURL != $huburl) {
                 $mform->addElement('checkbox', 'courses', get_string('sendfollowinginfo', 'hub'),
                         " " . get_string('coursesnumber', 'hub', $coursecount));
    -            $mform->setDefault('courses', true);
    +            $mform->setDefault('courses', $coursesnumber != -1);
                 $mform->addHelpButton('courses', 'sendfollowinginfo', 'hub');
     
                 $mform->addElement('checkbox', 'users', '',
                         " " . get_string('usersnumber', 'hub', $usercount));
    -            $mform->setDefault('users', true);
    +            $mform->setDefault('users', $usersnumber != -1);
     
                 $mform->addElement('checkbox', 'roleassignments', '',
                         " " . get_string('roleassignmentsnumber', 'hub', $roleassigncount));
    -            $mform->setDefault('roleassignments', true);
    +            $mform->setDefault('roleassignments', $roleassignmentsnumber != -1);
     
                 $mform->addElement('checkbox', 'posts', '',
                         " " . get_string('postsnumber', 'hub', $postcount));
    -            $mform->setDefault('posts', true);
    +            $mform->setDefault('posts', $postsnumber != -1);
     
                 $mform->addElement('checkbox', 'questions', '',
                         " " . get_string('questionsnumber', 'hub', $questioncount));
    -            $mform->setDefault('questions', true);
    +            $mform->setDefault('questions', $questionsnumber != -1);
     
                 $mform->addElement('checkbox', 'resources', '',
                         " " . get_string('resourcesnumber', 'hub', $resourcecount));
    -            $mform->setDefault('resources', true);
    +            $mform->setDefault('resources', $resourcesnumber != -1);
     
                 $mform->addElement('checkbox', 'participantnumberaverage', '',
                         " " . get_string('participantnumberaverage', 'hub', $participantnumberaverage));
    -            $mform->setDefault('participantnumberaverage', true);
    +            $mform->setDefault('participantnumberaverage', $participantnumberaveragecfg != -1);
     
                 $mform->addElement('checkbox', 'modulenumberaverage', '',
                         " " . get_string('modulenumberaverage', 'hub', $modulenumberaverage));
    -            $mform->setDefault('modulenumberaverage', true);
    +            $mform->setDefault('modulenumberaverage', $modulenumberaveragecfg != -1);
             } else {
                 $mform->addElement('static', 'courseslabel', get_string('sendfollowinginfo', 'hub'),
                         " " . get_string('coursesnumber', 'hub', $coursecount));
    
be6281e2cbc2

MDL-37822 fix checkboxes that were always set to on by default

https://github.com/moodle/moodleJerome MouneyracMar 19, 2013via ghsa
1 file changed · +10 8
  • admin/registration/forms.php+10 8 modified
    @@ -244,6 +244,8 @@ public function definition() {
             $questionsnumber = get_config('hub', 'site_questionsnumber_' . $cleanhuburl);
             $resourcesnumber = get_config('hub', 'site_resourcesnumber_' . $cleanhuburl);
             $mediancoursesize = get_config('hub', 'site_mediancoursesize_' . $cleanhuburl);
    +        $participantnumberaveragecfg = get_config('hub', 'site_participantnumberaverage_' . $cleanhuburl);
    +        $modulenumberaveragecfg = get_config('hub', 'site_modulenumberaverage_' . $cleanhuburl);
     
             //hidden parameters
             $mform->addElement('hidden', 'huburl', $huburl);
    @@ -376,36 +378,36 @@ public function definition() {
             if (HUB_MOODLEORGHUBURL != $huburl) {
                 $mform->addElement('checkbox', 'courses', get_string('sendfollowinginfo', 'hub'),
                         " " . get_string('coursesnumber', 'hub', $coursecount));
    -            $mform->setDefault('courses', true);
    +            $mform->setDefault('courses', $coursesnumber != -1);
                 $mform->addHelpButton('courses', 'sendfollowinginfo', 'hub');
     
                 $mform->addElement('checkbox', 'users', '',
                         " " . get_string('usersnumber', 'hub', $usercount));
    -            $mform->setDefault('users', true);
    +            $mform->setDefault('users', $usersnumber != -1);
     
                 $mform->addElement('checkbox', 'roleassignments', '',
                         " " . get_string('roleassignmentsnumber', 'hub', $roleassigncount));
    -            $mform->setDefault('roleassignments', true);
    +            $mform->setDefault('roleassignments', $roleassignmentsnumber != -1);
     
                 $mform->addElement('checkbox', 'posts', '',
                         " " . get_string('postsnumber', 'hub', $postcount));
    -            $mform->setDefault('posts', true);
    +            $mform->setDefault('posts', $postsnumber != -1);
     
                 $mform->addElement('checkbox', 'questions', '',
                         " " . get_string('questionsnumber', 'hub', $questioncount));
    -            $mform->setDefault('questions', true);
    +            $mform->setDefault('questions', $questionsnumber != -1);
     
                 $mform->addElement('checkbox', 'resources', '',
                         " " . get_string('resourcesnumber', 'hub', $resourcecount));
    -            $mform->setDefault('resources', true);
    +            $mform->setDefault('resources', $resourcesnumber != -1);
     
                 $mform->addElement('checkbox', 'participantnumberaverage', '',
                         " " . get_string('participantnumberaverage', 'hub', $participantnumberaverage));
    -            $mform->setDefault('participantnumberaverage', true);
    +            $mform->setDefault('participantnumberaverage', $participantnumberaveragecfg != -1);
     
                 $mform->addElement('checkbox', 'modulenumberaverage', '',
                         " " . get_string('modulenumberaverage', 'hub', $modulenumberaverage));
    -            $mform->setDefault('modulenumberaverage', true);
    +            $mform->setDefault('modulenumberaverage', $modulenumberaveragecfg != -1);
             } else {
                 $mform->addElement('static', 'courseslabel', get_string('sendfollowinginfo', 'hub'),
                         " " . get_string('coursesnumber', 'hub', $coursecount));
    
1d79b726d762

MDL-37822 fix checkboxes that were always set to on by default

https://github.com/moodle/moodleJerome MouneyracMar 19, 2013via ghsa
1 file changed · +10 8
  • admin/registration/forms.php+10 8 modified
    @@ -244,6 +244,8 @@ public function definition() {
             $questionsnumber = get_config('hub', 'site_questionsnumber_' . $cleanhuburl);
             $resourcesnumber = get_config('hub', 'site_resourcesnumber_' . $cleanhuburl);
             $mediancoursesize = get_config('hub', 'site_mediancoursesize_' . $cleanhuburl);
    +        $participantnumberaveragecfg = get_config('hub', 'site_participantnumberaverage_' . $cleanhuburl);
    +        $modulenumberaveragecfg = get_config('hub', 'site_modulenumberaverage_' . $cleanhuburl);
     
             //hidden parameters
             $mform->addElement('hidden', 'huburl', $huburl);
    @@ -376,36 +378,36 @@ public function definition() {
             if (HUB_MOODLEORGHUBURL != $huburl) {
                 $mform->addElement('checkbox', 'courses', get_string('sendfollowinginfo', 'hub'),
                         " " . get_string('coursesnumber', 'hub', $coursecount));
    -            $mform->setDefault('courses', true);
    +            $mform->setDefault('courses', $coursesnumber != -1);
                 $mform->addHelpButton('courses', 'sendfollowinginfo', 'hub');
     
                 $mform->addElement('checkbox', 'users', '',
                         " " . get_string('usersnumber', 'hub', $usercount));
    -            $mform->setDefault('users', true);
    +            $mform->setDefault('users', $usersnumber != -1);
     
                 $mform->addElement('checkbox', 'roleassignments', '',
                         " " . get_string('roleassignmentsnumber', 'hub', $roleassigncount));
    -            $mform->setDefault('roleassignments', true);
    +            $mform->setDefault('roleassignments', $roleassignmentsnumber != -1);
     
                 $mform->addElement('checkbox', 'posts', '',
                         " " . get_string('postsnumber', 'hub', $postcount));
    -            $mform->setDefault('posts', true);
    +            $mform->setDefault('posts', $postsnumber != -1);
     
                 $mform->addElement('checkbox', 'questions', '',
                         " " . get_string('questionsnumber', 'hub', $questioncount));
    -            $mform->setDefault('questions', true);
    +            $mform->setDefault('questions', $questionsnumber != -1);
     
                 $mform->addElement('checkbox', 'resources', '',
                         " " . get_string('resourcesnumber', 'hub', $resourcecount));
    -            $mform->setDefault('resources', true);
    +            $mform->setDefault('resources', $resourcesnumber != -1);
     
                 $mform->addElement('checkbox', 'participantnumberaverage', '',
                         " " . get_string('participantnumberaverage', 'hub', $participantnumberaverage));
    -            $mform->setDefault('participantnumberaverage', true);
    +            $mform->setDefault('participantnumberaverage', $participantnumberaveragecfg != -1);
     
                 $mform->addElement('checkbox', 'modulenumberaverage', '',
                         " " . get_string('modulenumberaverage', 'hub', $modulenumberaverage));
    -            $mform->setDefault('modulenumberaverage', true);
    +            $mform->setDefault('modulenumberaverage', $modulenumberaveragecfg != -1);
             } else {
                 $mform->addElement('static', 'courseslabel', get_string('sendfollowinginfo', 'hub'),
                         " " . get_string('coursesnumber', 'hub', $coursecount));
    
fd469033fa2c

MDL-37822 move the default code above the set_config to not make the code less confusing

https://github.com/moodle/moodleJerome MouneyracMar 18, 2013via ghsa
1 file changed · +12 11
  • admin/registration/register.php+12 11 modified
    @@ -62,7 +62,18 @@
     $fromform = $siteregistrationform->get_data();
     
     if (!empty($fromform) and confirm_sesskey()) {
    -    //save the settings
    +
    +    // Set to -1 all optional data marked as "don't send" by the admin.
    +    // The function get_site_info() will not calculate the optional data if config is set to -1.
    +    $inputnames = array('courses', 'users', 'roleassignments', 'posts', 'questions', 'resources',
    +        'modulenumberaverage', 'participantnumberaverage');
    +    foreach ($inputnames as $inputname) {
    +        if (empty($fromform->{$inputname})) {
    +            $fromform->{$inputname} = -1;
    +        }
    +    }
    +
    +    // Save the settings.
         $cleanhuburl = clean_param($huburl, PARAM_ALPHANUMEXT);
         set_config('site_name_' . $cleanhuburl, $fromform->name, 'hub');
         set_config('site_description_' . $cleanhuburl, $fromform->description, 'hub');
    @@ -78,16 +89,6 @@
         set_config('site_geolocation_' . $cleanhuburl, $fromform->geolocation, 'hub');
         set_config('site_contactable_' . $cleanhuburl, $fromform->contactable, 'hub');
         set_config('site_emailalert_' . $cleanhuburl, $fromform->emailalert, 'hub');
    -
    -    // Set to -1 all optional data marked as "don't send" by the admin.
    -    // The function get_site_info() will not calculate the optional data if config is set to -1.
    -    $inputnames = array('courses', 'users', 'roleassignments', 'posts', 'questions', 'resources',
    -        'modulenumberaverage', 'participantnumberaverage');
    -    foreach ($inputnames as $inputname) {
    -        if (empty($fromform->{$inputname})) {
    -            $fromform->{$inputname} = -1;
    -        }
    -    }
         set_config('site_coursesnumber_' . $cleanhuburl, $fromform->courses, 'hub');
         set_config('site_usersnumber_' . $cleanhuburl, $fromform->users, 'hub');
         set_config('site_roleassignmentsnumber_' . $cleanhuburl, $fromform->roleassignments, 'hub');
    
1fc34e37fdc5

MDL-37822 move the default code above the set_config to not make the code less confusing

https://github.com/moodle/moodleJerome MouneyracMar 18, 2013via ghsa
1 file changed · +12 11
  • admin/registration/register.php+12 11 modified
    @@ -62,7 +62,18 @@
     $fromform = $siteregistrationform->get_data();
     
     if (!empty($fromform) and confirm_sesskey()) {
    -    //save the settings
    +
    +    // Set to -1 all optional data marked as "don't send" by the admin.
    +    // The function get_site_info() will not calculate the optional data if config is set to -1.
    +    $inputnames = array('courses', 'users', 'roleassignments', 'posts', 'questions', 'resources',
    +        'modulenumberaverage', 'participantnumberaverage');
    +    foreach ($inputnames as $inputname) {
    +        if (empty($fromform->{$inputname})) {
    +            $fromform->{$inputname} = -1;
    +        }
    +    }
    +
    +    // Save the settings.
         $cleanhuburl = clean_param($huburl, PARAM_ALPHANUMEXT);
         set_config('site_name_' . $cleanhuburl, $fromform->name, 'hub');
         set_config('site_description_' . $cleanhuburl, $fromform->description, 'hub');
    @@ -78,16 +89,6 @@
         set_config('site_geolocation_' . $cleanhuburl, $fromform->geolocation, 'hub');
         set_config('site_contactable_' . $cleanhuburl, $fromform->contactable, 'hub');
         set_config('site_emailalert_' . $cleanhuburl, $fromform->emailalert, 'hub');
    -
    -    // Set to -1 all optional data marked as "don't send" by the admin.
    -    // The function get_site_info() will not calculate the optional data if config is set to -1.
    -    $inputnames = array('courses', 'users', 'roleassignments', 'posts', 'questions', 'resources',
    -        'modulenumberaverage', 'participantnumberaverage');
    -    foreach ($inputnames as $inputname) {
    -        if (empty($fromform->{$inputname})) {
    -            $fromform->{$inputname} = -1;
    -        }
    -    }
         set_config('site_coursesnumber_' . $cleanhuburl, $fromform->courses, 'hub');
         set_config('site_usersnumber_' . $cleanhuburl, $fromform->users, 'hub');
         set_config('site_roleassignmentsnumber_' . $cleanhuburl, $fromform->roleassignments, 'hub');
    
4d65904bc132

MDL-37822 move the default code above the set_config to not make the code less confusing

https://github.com/moodle/moodleJerome MouneyracMar 18, 2013via ghsa
1 file changed · +12 11
  • admin/registration/register.php+12 11 modified
    @@ -60,7 +60,18 @@
     $fromform = $siteregistrationform->get_data();
     
     if (!empty($fromform) and confirm_sesskey()) {
    -    //save the settings
    +
    +    // Set to -1 all optional data marked as "don't send" by the admin.
    +    // The function get_site_info() will not calculate the optional data if config is set to -1.
    +    $inputnames = array('courses', 'users', 'roleassignments', 'posts', 'questions', 'resources',
    +        'modulenumberaverage', 'participantnumberaverage');
    +    foreach ($inputnames as $inputname) {
    +        if (empty($fromform->{$inputname})) {
    +            $fromform->{$inputname} = -1;
    +        }
    +    }
    +
    +    // Save the settings.
         $cleanhuburl = clean_param($huburl, PARAM_ALPHANUMEXT);
         set_config('site_name_' . $cleanhuburl, $fromform->name, 'hub');
         set_config('site_description_' . $cleanhuburl, $fromform->description, 'hub');
    @@ -76,16 +87,6 @@
         set_config('site_geolocation_' . $cleanhuburl, $fromform->geolocation, 'hub');
         set_config('site_contactable_' . $cleanhuburl, $fromform->contactable, 'hub');
         set_config('site_emailalert_' . $cleanhuburl, $fromform->emailalert, 'hub');
    -
    -    // Set to -1 all optional data marked as "don't send" by the admin.
    -    // The function get_site_info() will not calculate the optional data if config is set to -1.
    -    $inputnames = array('courses', 'users', 'roleassignments', 'posts', 'questions', 'resources',
    -        'modulenumberaverage', 'participantnumberaverage');
    -    foreach ($inputnames as $inputname) {
    -        if (empty($fromform->{$inputname})) {
    -            $fromform->{$inputname} = -1;
    -        }
    -    }
         set_config('site_coursesnumber_' . $cleanhuburl, $fromform->courses, 'hub');
         set_config('site_usersnumber_' . $cleanhuburl, $fromform->users, 'hub');
         set_config('site_roleassignmentsnumber_' . $cleanhuburl, $fromform->roleassignments, 'hub');
    
667eaec4d267

MDL-37822 Moodle send site information to a hub even though it's unchecked

https://github.com/moodle/moodleJerome MouneyracFeb 7, 2013via ghsa
1 file changed · +23 0
  • admin/registration/register.php+23 0 modified
    @@ -78,6 +78,16 @@
         set_config('site_geolocation_' . $cleanhuburl, $fromform->geolocation, 'hub');
         set_config('site_contactable_' . $cleanhuburl, $fromform->contactable, 'hub');
         set_config('site_emailalert_' . $cleanhuburl, $fromform->emailalert, 'hub');
    +
    +    // Set to -1 all optional data marked as "don't send" by the admin.
    +    // The function get_site_info() will not calculate the optional data if config is set to -1.
    +    $inputnames = array('courses', 'users', 'roleassignments', 'posts', 'questions', 'resources',
    +        'modulenumberaverage', 'participantnumberaverage');
    +    foreach ($inputnames as $inputname) {
    +        if (empty($fromform->{$inputname})) {
    +            $fromform->{$inputname} = -1;
    +        }
    +    }
         set_config('site_coursesnumber_' . $cleanhuburl, $fromform->courses, 'hub');
         set_config('site_usersnumber_' . $cleanhuburl, $fromform->users, 'hub');
         set_config('site_roleassignmentsnumber_' . $cleanhuburl, $fromform->roleassignments, 'hub');
    @@ -113,6 +123,19 @@
     if (!empty($fromform) and empty($update) and confirm_sesskey()) {
     
         if (!empty($fromform) and confirm_sesskey()) { // if the register button has been clicked
    +
    +        // Retrieve the optional info (specially course number, user number, module number average...).
    +        $siteinfo = $registrationmanager->get_site_info($huburl);
    +        $fromform->courses = $siteinfo['courses'];
    +        $fromform->users = $siteinfo['users'];
    +        $fromform->enrolments = $siteinfo['enrolments'];
    +        $fromform->posts = $siteinfo['posts'];
    +        $fromform->questions = $siteinfo['questions'];
    +        $fromform->resources = $siteinfo['resources'];
    +        $fromform->modulenumberaverage = $siteinfo['modulenumberaverage'];
    +        $fromform->participantnumberaverage = $siteinfo['participantnumberaverage'];
    +        $fromform->street = $siteinfo['street'];
    +
             $params = (array) $fromform; //we are using the form input as the redirection parameters (token, url and name)
     
             $unconfirmedhub = $registrationmanager->get_unconfirmedhub($huburl);
    
54a3ce69e9ca

MDL-37822 Moodle send site information to a hub even though it's unchecked

https://github.com/moodle/moodleJerome MouneyracFeb 7, 2013via ghsa
1 file changed · +23 0
  • admin/registration/register.php+23 0 modified
    @@ -78,6 +78,16 @@
         set_config('site_geolocation_' . $cleanhuburl, $fromform->geolocation, 'hub');
         set_config('site_contactable_' . $cleanhuburl, $fromform->contactable, 'hub');
         set_config('site_emailalert_' . $cleanhuburl, $fromform->emailalert, 'hub');
    +
    +    // Set to -1 all optional data marked as "don't send" by the admin.
    +    // The function get_site_info() will not calculate the optional data if config is set to -1.
    +    $inputnames = array('courses', 'users', 'roleassignments', 'posts', 'questions', 'resources',
    +        'modulenumberaverage', 'participantnumberaverage');
    +    foreach ($inputnames as $inputname) {
    +        if (empty($fromform->{$inputname})) {
    +            $fromform->{$inputname} = -1;
    +        }
    +    }
         set_config('site_coursesnumber_' . $cleanhuburl, $fromform->courses, 'hub');
         set_config('site_usersnumber_' . $cleanhuburl, $fromform->users, 'hub');
         set_config('site_roleassignmentsnumber_' . $cleanhuburl, $fromform->roleassignments, 'hub');
    @@ -113,6 +123,19 @@
     if (!empty($fromform) and empty($update) and confirm_sesskey()) {
     
         if (!empty($fromform) and confirm_sesskey()) { // if the register button has been clicked
    +
    +        // Retrieve the optional info (specially course number, user number, module number average...).
    +        $siteinfo = $registrationmanager->get_site_info($huburl);
    +        $fromform->courses = $siteinfo['courses'];
    +        $fromform->users = $siteinfo['users'];
    +        $fromform->enrolments = $siteinfo['enrolments'];
    +        $fromform->posts = $siteinfo['posts'];
    +        $fromform->questions = $siteinfo['questions'];
    +        $fromform->resources = $siteinfo['resources'];
    +        $fromform->modulenumberaverage = $siteinfo['modulenumberaverage'];
    +        $fromform->participantnumberaverage = $siteinfo['participantnumberaverage'];
    +        $fromform->street = $siteinfo['street'];
    +
             $params = (array) $fromform; //we are using the form input as the redirection parameters (token, url and name)
     
             $unconfirmedhub = $registrationmanager->get_unconfirmedhub($huburl);
    
60c468bcb3b6

MDL-37822 Moodle send site information to a hub even though it's unchecked

https://github.com/moodle/moodleJerome MouneyracFeb 7, 2013via ghsa
1 file changed · +23 0
  • admin/registration/register.php+23 0 modified
    @@ -76,6 +76,16 @@
         set_config('site_geolocation_' . $cleanhuburl, $fromform->geolocation, 'hub');
         set_config('site_contactable_' . $cleanhuburl, $fromform->contactable, 'hub');
         set_config('site_emailalert_' . $cleanhuburl, $fromform->emailalert, 'hub');
    +
    +    // Set to -1 all optional data marked as "don't send" by the admin.
    +    // The function get_site_info() will not calculate the optional data if config is set to -1.
    +    $inputnames = array('courses', 'users', 'roleassignments', 'posts', 'questions', 'resources',
    +        'modulenumberaverage', 'participantnumberaverage');
    +    foreach ($inputnames as $inputname) {
    +        if (empty($fromform->{$inputname})) {
    +            $fromform->{$inputname} = -1;
    +        }
    +    }
         set_config('site_coursesnumber_' . $cleanhuburl, $fromform->courses, 'hub');
         set_config('site_usersnumber_' . $cleanhuburl, $fromform->users, 'hub');
         set_config('site_roleassignmentsnumber_' . $cleanhuburl, $fromform->roleassignments, 'hub');
    @@ -111,6 +121,19 @@
     if (!empty($fromform) and empty($update) and confirm_sesskey()) {
     
         if (!empty($fromform) and confirm_sesskey()) { // if the register button has been clicked
    +
    +        // Retrieve the optional info (specially course number, user number, module number average...).
    +        $siteinfo = $registrationmanager->get_site_info($huburl);
    +        $fromform->courses = $siteinfo['courses'];
    +        $fromform->users = $siteinfo['users'];
    +        $fromform->enrolments = $siteinfo['enrolments'];
    +        $fromform->posts = $siteinfo['posts'];
    +        $fromform->questions = $siteinfo['questions'];
    +        $fromform->resources = $siteinfo['resources'];
    +        $fromform->modulenumberaverage = $siteinfo['modulenumberaverage'];
    +        $fromform->participantnumberaverage = $siteinfo['participantnumberaverage'];
    +        $fromform->street = $siteinfo['street'];
    +
             $params = (array) $fromform; //we are using the form input as the redirection parameters (token, url and name)
     
             $unconfirmedhub = $registrationmanager->get_unconfirmedhub($huburl);
    

Vulnerability mechanics

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

References

17

News mentions

0

No linked articles in our index yet.