Issues (112)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

bbb_ajax.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
17
/**
18
 * Intermediator for handling ajax requests resulting on BigBlueButton actions.
19
 *
20
 * @package   mod_bigbluebuttonbn
21
 * @copyright 2010 onwards, Blindside Networks Inc
22
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 * @author    Jesus Federico  (jesus [at] blindsidenetworks [dt] com)
24
 */
25
26
define('READ_ONLY_SESSION', true);
27
define('AJAX_SCRIPT', true);
28
29
require(__DIR__.'/../../config.php');
30
require_once(__DIR__.'/locallib.php');
31
require_once(__DIR__.'/brokerlib.php');
32
33
global $PAGE, $USER, $CFG, $SESSION, $DB;
34
35
$params['action'] = optional_param('action', '', PARAM_TEXT);
36
$params['callback'] = optional_param('callback', '', PARAM_TEXT);
37
$params['id'] = optional_param('id', '', PARAM_TEXT);
38
$params['idx'] = optional_param('idx', '', PARAM_TEXT);
39
$params['bigbluebuttonbn'] = optional_param('bigbluebuttonbn', 0, PARAM_INT);
40
$params['signed_parameters'] = optional_param('signed_parameters', '', PARAM_TEXT);
41
$params['updatecache'] = optional_param('updatecache', 'false', PARAM_TEXT);
42
$params['meta'] = optional_param('meta', '', PARAM_TEXT);
43
44
require_login(null, true);
45
require_sesskey();
46
47
if (empty($params['action'])) {
48
    header('HTTP/1.0 400 Bad Request. Parameter ['.$params['action'].'] was not included');
49
    return;
50
}
51
52
$error = bigbluebuttonbn_broker_validate_parameters($params);
53
if (!empty($error)) {
54
    header('HTTP/1.0 400 Bad Request. '.$error);
55
    return;
56
}
57
58
if ($params['bigbluebuttonbn']) {
59
    $bbbbrokerinstance = bigbluebuttonbn_view_instance_bigbluebuttonbn($params['bigbluebuttonbn']);
60
    $cm = $bbbbrokerinstance['cm'];
61
    $bigbluebuttonbn = $bbbbrokerinstance['bigbluebuttonbn'];
62
    $context = context_module::instance($cm->id);
63
}
64
65
if (!isset($SESSION->bigbluebuttonbn_bbbsession) || is_null($SESSION->bigbluebuttonbn_bbbsession)) {
66
    header('HTTP/1.0 400 Bad Request. No session variable set');
67
    return;
68
}
69
$bbbsession = $SESSION->bigbluebuttonbn_bbbsession;
70
71
$userid = $USER->id;
72
if (!isloggedin() && $PAGE->course->id == SITEID) {
73
    $userid = guest_user()->id;
74
}
75
$hascourseaccess = ($PAGE->course->id == SITEID) || can_access_course($PAGE->course, $userid);
76
77
if (!$hascourseaccess) {
78
    header('HTTP/1.0 401 Unauthorized');
79
    return;
80
}
81
82
$type = null;
83
if (isset($bbbsession['bigbluebuttonbn']->type)) {
84
    $type = $bbbsession['bigbluebuttonbn']->type;
85
}
86
87
$typeprofiles = bigbluebuttonbn_get_instance_type_profiles();
88
$enabledfeatures = bigbluebuttonbn_get_enabled_features($typeprofiles, $type);
89
try {
90
    header('Content-Type: application/javascript; charset=utf-8');
91
    $a = strtolower($params['action']);
92
    if ($a == 'meeting_info') {
93
        $meetinginfo = bigbluebuttonbn_broker_meeting_info($bbbsession, $params, ($params['updatecache'] == 'true'));
94
        echo $meetinginfo;
95
        return;
96
    }
97
    if ($a == 'meeting_end') {
98
        $meetingend = bigbluebuttonbn_broker_meeting_end($bbbsession, $params);
99
        echo $meetingend;
100
        return;
101
    }
102
    if ($a == 'recording_play') {
103
        $recordingplay = bigbluebuttonbn_broker_recording_play($params);
104
        echo $recordingplay;
105
        return;
106
    }
107
    if ($a == 'recording_links') {
108
        $recordinglinks = bigbluebuttonbn_broker_recording_links($bbbsession, $params);
109
        echo $recordinglinks;
110
        return;
111
    }
112
    if ($a == 'recording_info') {
113
        $recordinginfo = bigbluebuttonbn_broker_recording_info($bbbsession, $params, $enabledfeatures['showroom']);
114
        echo $recordinginfo;
115
        return;
116
    }
117
    if ($a == 'recording_publish' || $a == 'recording_unpublish' ||
118
        $a == 'recording_delete' || $a == 'recording_edit' ||
119
        $a == 'recording_protect' || $a == 'recording_unprotect') {
120
        $recordingaction = bigbluebuttonbn_broker_recording_action($bbbsession, $params, $enabledfeatures['showroom']);
121
        echo $recordingaction;
122
        return;
123
    }
124
    if ($a == 'recording_import') {
125
        echo bigbluebuttonbn_broker_recording_import($bbbsession, $params);
126
        return;
127
    }
128
    if ($a == 'recording_list_table') {
129
        $PAGE->set_context(context_course::instance($PAGE->course->id));
130
        $recordingdata = bigbluebuttonbn_broker_get_recording_data($bbbsession, $params, $enabledfeatures);
131
        echo $recordingdata;
132
        return;
133
    }
134
    if ($a == 'completion_validate') {
135
        $completionvalidate = bigbluebuttonbn_broker_completion_validate($bigbluebuttonbn, $params);
0 ignored issues
show
Are you sure the assignment to $completionvalidate is correct as bigbluebuttonbn_broker_c...gbluebuttonbn, $params) (which targets bigbluebuttonbn_broker_completion_validate()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
136
        echo $completionvalidate;
137
        return;
138
    }
139
    header('HTTP/1.0 400 Bad request. The action '. $a . ' doesn\'t exist');
140
} catch (Exception $e) {
141
    header('HTTP/1.0 500 Internal Server Error. '.$e->getMessage());
142
}
143