code
stringlengths
12
2.05k
label
int64
0
1
programming_language
stringclasses
9 values
cwe_id
stringlengths
6
14
cwe_name
stringlengths
5
103
description
stringlengths
36
1.23k
url
stringlengths
36
48
label_name
stringclasses
2 values
public function getList($location, $features, $etag, $mediatypes) { $featuresArray = explode(';', $features); $mediaTypesArray = explode(';', $mediatypes); try { return $this->getFilesAndAlbums($location, $featuresArray, $etag, $mediaTypesArray); } catch (\Exception $exception) { return $this->jsonError($exception, $this->request, $this->logger); } }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
private function getGlobalState() { return array( Request::getTrustedProxies(), array( Request::HEADER_FORWARDED => Request::getTrustedHeaderName(Request::HEADER_FORWARDED), Request::HEADER_CLIENT_IP => Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP), Request::HEADER_CLIENT_HOST => Request::getTrustedHeaderName(Request::HEADER_CLIENT_HOST), Request::HEADER_CLIENT_PROTO => Request::getTrustedHeaderName(Request::HEADER_CLIENT_PROTO), Request::HEADER_CLIENT_PORT => Request::getTrustedHeaderName(Request::HEADER_CLIENT_PORT), ), ); }
1
PHP
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
public function update() { $project = $this->getProject(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); $values = $this->request->getValues(); list($valid, $errors) = $this->tagValidator->validateModification($values); if ($tag['project_id'] != $project['id']) { throw new AccessForbiddenException(); } if ($valid) { if ($this->tagModel->update($values['id'], $values['name'])) { $this->flash->success(t('Tag updated successfully.')); } else { $this->flash->failure(t('Unable to update this tag.')); } $this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id']))); } else { $this->edit($values, $errors); } }
0
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
private function encloseForCSV($field) { return '"' . cleanCSV($field) . '"'; }
0
PHP
CWE-1236
Improper Neutralization of Formula Elements in a CSV File
The software saves user-provided information into a Comma-Separated Value (CSV) file, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as a command when the file is opened by spreadsheet software.
https://cwe.mitre.org/data/definitions/1236.html
vulnerable
static function encrypt($string, $key) { $result = ''; for ($i=0; $i<strlen($string); $i++) { $char = substr($string, $i, 1); $keychar = substr($key, ($i % strlen($key))-1, 1); $char = chr(ord($char)+ord($keychar)); $result .= $char; } return base64_encode($result); }
0
PHP
CWE-798
Use of Hard-coded Credentials
The software contains hard-coded credentials, such as a password or cryptographic key, which it uses for its own inbound authentication, outbound communication to external components, or encryption of internal data.
https://cwe.mitre.org/data/definitions/798.html
vulnerable
public function api() { if (empty($this->params['apikey'])) { $_REQUEST['apikey'] = true; // set this to force an ajax reply $ar = new expAjaxReply(550, 'Permission Denied', 'You need an API key in order to access Exponent as a Service', null); $ar->send(); //FIXME this doesn't seem to work correctly in this scenario } else { $key = expUnserialize(base64_decode(urldecode($this->params['apikey']))); preg_match('/[^a-zA-Z_][^a-zA-Z0-9_]*/', $key, $matches); $key = $matches[0]; $cfg = new expConfig($key); $this->config = $cfg->config; if(empty($cfg->id)) { $ar = new expAjaxReply(550, 'Permission Denied', 'Incorrect API key or Exponent as a Service module configuration missing', null); $ar->send(); } else { if (!empty($this->params['get'])) { $this->handleRequest(); } else { $ar = new expAjaxReply(200, 'ok', 'Your API key is working, no data requested', null); $ar->send(); } } } }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public function setVerp($enabled = false) { $this->do_verp = $enabled; }
1
PHP
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
public function view() { $params = func_get_args(); $content = ''; $filename = urldecode(join('/', $params)); // Sanitize filename for securtiy // We don't allow backlinks if (strpos($filename, '..') !== false) { /* if (Plugin::isEnabled('statistics_api')) { $user = null; if (AuthUser::isLoggedIn()) $user = AuthUser::getUserName(); $ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : ($_SERVER['REMOTE_ADDR']); $event = array('event_type' => 'hack_attempt', // simple event type identifier 'description' => __('A possible hack attempt was detected.'), // translatable description 'ipaddress' => $ip, 'username' => $user); Observer::notify('stats_file_manager_hack_attempt', $event); } */ } $filename = str_replace('..', '', $filename); // Clean up nicely $filename = str_replace('//', '', $filename); // We don't allow leading slashes $filename = preg_replace('/^\//', '', $filename); // Check if file had URL_SUFFIX - if so, append it to filename $filename .= (isset($_GET['has_url_suffix']) && $_GET['has_url_suffix']==='1') ? URL_SUFFIX : ''; $file = FILES_DIR . '/' . $filename; if (!$this->_isImage($file) && file_exists($file)) { $content = file_get_contents($file); } $this->display('file_manager/views/view', array( 'csrf_token' => SecureToken::generateToken(BASE_URL.'plugin/file_manager/save/'.$filename), 'is_image' => $this->_isImage($file), 'filename' => $filename, 'content' => $content )); }
0
PHP
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
public function update_discount() { $id = empty($this->params['id']) ? null : $this->params['id']; $discount = new discounts($id); // find required shipping method if needed if ($this->params['required_shipping_calculator_id'] > 0) { $this->params['required_shipping_method'] = $this->params['required_shipping_methods'][$this->params['required_shipping_calculator_id']]; } else { $this->params['required_shipping_calculator_id'] = 0; } $discount->update($this->params); expHistory::back(); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
return preg_match ('/'.$pattern.'/', $page); }); }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public function session() { // Test if logged in, log in if not, log in. try { $this->assertElementPresent('css=ul#user-menu'); } catch (PHPUnit_Framework_AssertionFailedError $e) { /* If this isn't the first time we've logged in, we have a problem; * the user should have been logged in throughout the life of the * test case class. Append t */ if (!$this->firstLogin) array_push($this->verificationErrors, $e->toString()); $this->firstLogin = false; $this->login(); return 0; } try { $this->assertCorrectUser(); } catch (PHPUnit_Framework_AssertionFailedError $e) { /** * The browser is logged in but not as the correct user. */ $this->logout(); $this->login(); $this->firstLogin = false; return 0; } // Indicator of whether the session was already initialized properly return 1; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public function getValidUris() { return [ ['urn:path-rootless'], ['urn:path:with:colon'], ['urn:/path-absolute'], ['urn:/'], // only scheme with empty path ['urn:'], // only path ['/'], ['relative/'], ['0'], // same document reference [''], // network path without scheme ['//example.org'], ['//example.org/'], ['//example.org?q#h'], // only query ['?q'], ['?q=abc&foo=bar'], // only fragment ['#fragment'], // dot segments are not removed automatically ['./foo/../bar'], ]; }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
protected function getNewShopUrl(Request $request, Shop $newShop) { // Remove baseUrl from request url $url = $request->getRequestUri(); $requestShop = $this->get(ModelManager::class)->getRepository(Shop::class)->getActiveShopByRequestAsArray($request); if ($requestShop && str_starts_with($url, $requestShop['base_url'])) { $url = substr($url, \strlen($requestShop['base_url'])); } $baseUrl = $request->getBaseUrl(); if (str_starts_with($url, $baseUrl . '/')) { $url = substr($url, \strlen($baseUrl)); } $basePath = (string) $newShop->getBasePath(); if (str_starts_with($url, $basePath)) { $url = substr($url, \strlen($basePath)); } $host = $newShop->getHost(); $baseUrl = $newShop->getBaseUrl() ?: $request->getBasePath(); if ($request->isSecure()) { if ($newShop->getBaseUrl()) { $baseUrl = $newShop->getBaseUrl(); } else { $baseUrl = $request->getBaseUrl(); } } if (\is_string($host)) { $host = trim($host, '/'); } if (\is_string($baseUrl)) { $baseUrl = trim($baseUrl, '/'); } if (!empty($baseUrl)) { $baseUrl = '/' . $baseUrl; } $url = ltrim($url, '/'); if (!empty($url)) { $url = '/' . $url; } //build full redirect url to allow host switches return sprintf( '%s://%s%s%s', $request->getScheme(), $host, $baseUrl, $url ); }
1
PHP
CWE-601
URL Redirection to Untrusted Site ('Open Redirect')
A web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a Redirect. This simplifies phishing attacks.
https://cwe.mitre.org/data/definitions/601.html
safe
function manage () { expHistory::set('viewable', $this->params); $vendor = new vendor(); $vendors = $vendor->find('all'); if(!empty($this->params['vendor'])) { $purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']); } else { $purchase_orders = $this->purchase_order->find('all'); } assign_to_template(array( 'purchase_orders'=>$purchase_orders, 'vendors' => $vendors, 'vendor_id' => @$this->params['vendor'] )); }
1
PHP
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/74.html
safe
$this->addCodeDefinition($def); } }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
protected function _copy($source, $targetDir, $name) { $res = false; $target = $this->_joinPath($targetDir, $name); if ($this->tmp) { $local = $this->getTempFile(); if ($this->connect->get($source, $local) && $this->connect->put($target, $local, NET_SFTP_LOCAL_FILE)) { $res = true; } unlink($local); } else { //not memory efficient $res = $this->_filePutContents($target, $this->_getContents($source)); } return $res; }
0
PHP
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
vulnerable
unset($return[$key]); } } break; } return @array_change_key_case($return, CASE_UPPER); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public function options($hash) { $create = $createext = array(); if (isset($this->archivers['create']) && is_array($this->archivers['create'])) { foreach($this->archivers['create'] as $m => $v) { $create[] = $m; $createext[$m] = $v['ext']; } } return array( 'path' => $this->path($hash), 'url' => $this->URL, 'tmbUrl' => $this->tmbURL, 'disabled' => $this->disabled, 'separator' => $this->separator, 'copyOverwrite' => intval($this->options['copyOverwrite']), 'uploadOverwrite' => intval($this->options['uploadOverwrite']), 'uploadMaxSize' => intval($this->uploadMaxSize), 'dispInlineRegex' => $this->options['dispInlineRegex'], 'jpgQuality' => intval($this->options['jpgQuality']), 'archivers' => array( 'create' => $create, 'extract' => isset($this->archivers['extract']) && is_array($this->archivers['extract']) ? array_keys($this->archivers['extract']) : array(), 'createext' => $createext ), 'uiCmdMap' => (isset($this->options['uiCmdMap']) && is_array($this->options['uiCmdMap']))? $this->options['uiCmdMap'] : array(), 'syncChkAsTs' => intval($this->options['syncChkAsTs']), 'syncMinMs' => intval($this->options['syncMinMs']) ); }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public function AddBCC($address, $name = '') { return $this->AddAnAddress('bcc', $address, $name); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public function get_item( $request ) { $parent = get_post( $request['parent'] ); if ( ! $request['parent'] || ! $parent || $this->parent_post_type !== $parent->post_type ) { return new WP_Error( 'rest_post_invalid_parent', __( 'Invalid post parent ID.' ), array( 'status' => 404 ) ); } $revision = get_post( $request['id'] ); if ( ! $revision || 'revision' !== $revision->post_type ) { return new WP_Error( 'rest_post_invalid_id', __( 'Invalid revision ID.' ), array( 'status' => 404 ) ); } $response = $this->prepare_item_for_response( $revision, $request ); return rest_ensure_response( $response ); }
0
PHP
NVD-CWE-noinfo
null
null
null
vulnerable
public function __construct($strSystemid = "") { //Generating all the required objects. For this we use our cool cool carrier-object //take care of loading just the necessary objects $objCarrier = class_carrier::getInstance(); $this->objConfig = $objCarrier->getObjConfig(); $this->objSession = $objCarrier->getObjSession(); $this->objLang = $objCarrier->getObjLang(); $this->objTemplate = $objCarrier->getObjTemplate(); //Setting SystemID if($strSystemid == "") { $this->setSystemid(class_carrier::getInstance()->getParam("systemid")); } else { $this->setSystemid($strSystemid); } //And keep the action $this->setAction($this->getParam("action")); //in most cases, the list is the default action if no other action was passed if($this->getAction() == "") { $this->setAction("list"); } //try to load the current module-name and the moduleId by reflection $objReflection = new class_reflection($this); if(!isset($this->arrModule["modul"])) { $arrAnnotationValues = $objReflection->getAnnotationValuesFromClass(self::STR_MODULE_ANNOTATION); if(count($arrAnnotationValues) > 0) $this->setArrModuleEntry("modul", trim($arrAnnotationValues[0])); } if(!isset($this->arrModule["moduleId"])) { $arrAnnotationValues = $objReflection->getAnnotationValuesFromClass(self::STR_MODULEID_ANNOTATION); if(count($arrAnnotationValues) > 0) $this->setArrModuleEntry("moduleId", constant(trim($arrAnnotationValues[0]))); } $this->strLangBase = $this->getArrModule("modul"); }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
function mci_account_get_array_by_id( $p_user_id ) { $t_result = array(); $t_result['id'] = $p_user_id; if( user_exists( $p_user_id ) ) { $t_result['name'] = user_get_field( $p_user_id, 'username' ); $t_dummy = user_get_field( $p_user_id, 'realname' ); if( !empty( $t_dummy ) ) { $t_result['real_name'] = $t_dummy; } $t_dummy = user_get_field( $p_user_id, 'email' ); if( !empty( $t_dummy ) ) { $t_result['email'] = $t_dummy; } } return $t_result; }
0
PHP
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
public function confirm() { $project = $this->getProject(); $this->response->html($this->helper->layout->project('action/remove', array( 'action' => $this->actionModel->getById($this->request->getIntegerParam('action_id')), 'available_events' => $this->eventManager->getAll(), 'available_actions' => $this->actionManager->getAvailableActions(), 'project' => $project, 'title' => t('Remove an action') ))); }
0
PHP
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
public function activate_discount(){ if (isset($this->params['id'])) { $discount = new discounts($this->params['id']); $discount->update($this->params); //if ($discount->discountulator->hasConfig() && empty($discount->config)) { //flash('messages', $discount->discountulator->name().' requires configuration. Please do so now.'); //redirect_to(array('controller'=>'billing', 'action'=>'configure', 'id'=>$discount->id)); //} } expHistory::back(); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public function approve_toggle() { global $history; if (empty($this->params['id'])) return; /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login']; $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval']; $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification']; $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email']; $simplenote = new expSimpleNote($this->params['id']); $simplenote->approved = $simplenote->approved == 1 ? 0 : 1; $simplenote->save(); $lastUrl = makelink($history->history[$history->history['lasts']['type']][count($history->history[$history->history['lasts']['type']])-1]['params']); if (!empty($this->params['tab'])) { $lastUrl .= "#".$this->params['tab']; } redirect_to($lastUrl); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public static function createDefault() { $definition = HTMLPurifier_ConfigSchema::instance(); $config = new HTMLPurifier_Config($definition); return $config; }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
function kses($string, $allowed_html, $allowed_protocols = null) { $config = HTMLPurifier_Config::createDefault(); $allowed_elements = array(); $allowed_attributes = array(); foreach ($allowed_html as $element => $attributes) { $allowed_elements[$element] = true; foreach ($attributes as $attribute => $x) { $allowed_attributes["$element.$attribute"] = true; } } $config->set('HTML.AllowedElements', $allowed_elements); $config->set('HTML.AllowedAttributes', $allowed_attributes); $allowed_schemes = array(); if ($allowed_protocols !== null) { $config->set('URI.AllowedSchemes', $allowed_protocols); } $purifier = new HTMLPurifier($config); return $purifier->purify($string); }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public function clean() { $dataSourceConfig = ConnectionManager::getDataSource('default')->config; $dataSource = $dataSourceConfig['datasource']; if ($dataSource == 'Database/Mysql') { $sql = 'DELETE FROM bruteforces WHERE `expire` <= NOW();'; } elseif ($dataSource == 'Database/Postgres') { $sql = 'DELETE FROM bruteforces WHERE expire <= NOW();'; } $this->query($sql); }
0
PHP
NVD-CWE-noinfo
null
null
null
vulnerable
static protected function getFontsizeSelection() { $current_size = $GLOBALS['PMA_Config']->get('fontsize'); // for the case when there is no config file (this is supported) if (empty($current_size)) { if (isset($_COOKIE['pma_fontsize'])) { $current_size = $_COOKIE['pma_fontsize']; } else { $current_size = '82%'; } } $options = PMA_Config::getFontsizeOptions($current_size); $return = '<label for="select_fontsize">' . __('Font size') . ':</label>' . "\n" . '<select name="set_fontsize" id="select_fontsize"' . ' class="autosubmit">' . "\n"; foreach ($options as $option) { $return .= '<option value="' . $option . '"'; if ($option == $current_size) { $return .= ' selected="selected"'; } $return .= '>' . $option . '</option>' . "\n"; } $return .= '</select>'; return $return; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public static function run() { //print_r(self::$hooks[$var]); $hooks = self::$hooks; $num_args = func_num_args(); $args = func_get_args(); // print_r($args); // if ($num_args < 2) // trigger_error("Insufficient arguments", E_USER_ERROR); // Hook name should always be first argument $hook_name = array_shift($args); if (!isset($hooks[$hook_name])) { return; } // No plugins have registered this hook // print_r($args[0]); // $args = (is_array($args))?$args[0]: $args; if (is_array($hooks[$hook_name])) { $val = ''; foreach ($hooks[$hook_name] as $func) { if ($func != '') { // $args = call_user_func_array($func, $args); // $val .= $func((array) $args); } else { $val .= $args; } } return $val; } }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public function Archive() { // Update "main" ticket $upd_stmt = Database::prepare(' UPDATE `' . TABLE_PANEL_TICKETS . '` SET `archived` = "1" WHERE `id` = :tid' ); Database::pexecute($upd_stmt, array('tid' => $this->tid)); // Update "answers" to ticket $upd_stmt = Database::prepare(' UPDATE `' . TABLE_PANEL_TICKETS . '` SET `archived` = "1" WHERE `answerto` = :tid' ); Database::pexecute($upd_stmt, array('tid' => $this->tid)); return true; }
0
PHP
CWE-732
Incorrect Permission Assignment for Critical Resource
The product specifies permissions for a security-critical resource in a way that allows that resource to be read or modified by unintended actors.
https://cwe.mitre.org/data/definitions/732.html
vulnerable
$saveHandler = new SessionHandlerProxy(new \SessionHandler()); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public function executeQuery() { if ($this->query !== null) { $this->query ->offset($this->offset) ->limit($this->limit) ->orderBy($this->order, $this->direction); if ($this->formatter !== null) { return $this->formatter->withQuery($this->query)->format(); } else { return $this->query->findAll(); } } return array(); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
protected function itemLocked($hash) { if (!elFinder::$commonTempPath) { return false; } $lock = elFinder::$commonTempPath . DIRECTORY_SEPARATOR . $hash . '.lock'; if (file_exists($lock)) { if (filemtime($lock) + $this->itemLockExpire < time()) { unlink($lock); return false; } return true; } return false; }
0
PHP
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
vulnerable
function getResourceGroups($type='', $id='') { $return = array(); $query = "SELECT g.id AS id, " . "g.name AS name, " . "t.name AS type, " . "g.ownerusergroupid AS ownerid, " . "CONCAT(u.name, '@', a.name) AS owner " . "FROM resourcegroup g, " . "resourcetype t, " . "usergroup u, " . "affiliation a " . "WHERE g.resourcetypeid = t.id AND " . "g.ownerusergroupid = u.id AND " . "u.affiliationid = a.id "; if(! empty($type)) $query .= "AND t.name = '$type' "; if(! empty($id)) $query .= "AND g.id = $id "; $query .= "ORDER BY t.name, g.name"; $qh = doQuery($query, 281); while($row = mysql_fetch_assoc($qh)) { if(empty($type)) $return[$row["id"]]["name"] = $row["type"] . "/" . $row["name"]; else $return[$row["id"]]["name"] = $row["name"]; $return[$row["id"]]["ownerid"] = $row["ownerid"]; $return[$row["id"]]["owner"] = $row["owner"]; } return $return; }
1
PHP
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
function move_standalone() { expSession::clearAllUsersSessionCache('navigation'); assign_to_template(array( 'parent' => $this->params['parent'], )); }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public static function exist($cat) { $cat = Typo::int($cat); $sql = "SELECT `id` FROM `cat` WHERE `id` = '{$cat}' AND `type` = 'post'"; $q = Db::result($sql); // echo Db::$num_rows; if (Db::$num_rows > 0) { return true; } else { return false; } }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public function testResolveTranslation() { $translator = $this->prophesize(TranslatorInterface::class); $translator->getLocale()->willReturn('de'); $translator->setLocale('de')->shouldBeCalled(); $translator->trans('test-key')->willReturn('TEST'); $entity = $this->prophesize(RoutableInterface::class); $entity->getLocale()->willReturn('en'); $provider = new SymfonyExpressionTokenProvider($translator->reveal()); $this->assertEquals('TEST', $provider->provide($entity, 'translator.trans("test-key")')); }
0
PHP
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
vulnerable
public static function isExist($user, $except='') { if ($except != '') { $id = Typo::int($except); $where = "AND `userid` != '{$id}' "; } else { $where = ''; } $user = sprintf('%s', Typo::cleanX($user)); $sql = sprintf("SELECT `userid` FROM `user` WHERE `userid` = '%s' %s ", $user, $where); $usr = Db::result($sql); $n = Db::$num_rows; if ($n > 0) { return true; } else { return false; } }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
function db_case($array) { global $DatabaseType; $counter = 0; if ($DatabaseType == 'mysqli') { $array_count = count($array); $string = " CASE WHEN $array[0] ="; $counter++; $arr_count = count($array); for ($i = 1; $i < $arr_count; $i++) { $value = $array[$i]; if ($value == "''" && substr($string, -1) == '=') { $value = ' IS NULL'; $string = substr($string, 0, -1); } $string .= "$value"; if ($counter == ($array_count - 2) && $array_count % 2 == 0) $string .= " ELSE "; elseif ($counter == ($array_count - 1)) $string .= " END "; elseif ($counter % 2 == 0) $string .= " WHEN $array[0]="; elseif ($counter % 2 == 1) $string .= " THEN "; $counter++; } } return $string; }
0
PHP
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
vulnerable
public function showall() { expHistory::set('viewable', $this->params); $hv = new help_version(); //$current_version = $hv->find('first', 'is_current=1'); $ref_version = $hv->find('first', 'version=\''.$this->help_version.'\''); // pagination parameter..hard coded for now. $where = $this->aggregateWhereClause(); $where .= 'AND help_version_id='.(empty($ref_version->id)?'0':$ref_version->id);
1
PHP
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/74.html
safe
public function load_from_resultset($rs) { global $DB; $main = $rs[0]; $this->id = $main->id; $this->codename = $main->codename; $this->icon = $main->icon; $this->lid = $main->lid; $this->notes = $main->notes; $this->enabled = $main->enabled; /* $DB->query('SELECT function_id FROM nv_menu_items WHERE menu_id = '.$this->id.' ORDER BY position ASC'); $this->functions = $DB->result('function_id'); */ $this->functions = json_decode($main->functions); if(empty($this->functions)) $this->functions = array(); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
$category_query = "select id from ".prefix_table("nested_tree")." where title LIKE '".filter_var($array_category[0], FILTER_SANITIZE_STRING)."' AND parent_id = 0"; } else { rest_error('NO_CATEGORY'); } // Delete item $response = DB::delete(prefix_table("items"), "id_tree = (".$category_query.") and label LIKE '".filter_var($item, FILTER_SANITIZE_STRING)."'"); $json['type'] = 'item'; $json['item'] = $item; $json['category'] = $GLOBALS['request'][2]; if ($response) { $json['status'] = 'OK'; } else { $json['status'] = 'KO'; } } if ($json) { echo json_encode($json); } else { rest_error('EMPTY'); } } else { rest_error('METHOD'); } }
1
PHP
CWE-434
Unrestricted Upload of File with Dangerous Type
The software allows the attacker to upload or transfer files of dangerous types that can be automatically processed within the product's environment.
https://cwe.mitre.org/data/definitions/434.html
safe
public function checkIfAuthorised($user, $id) { if (!isset($user['id'])) { throw new MethodNotAllowedException('Invalid user.'); } $this->id = $id; if (!$this->exists()) { return false; } $thread = $this->find('first', array( 'conditions' => array('id' => $id), 'recursive' => -1 )); if (!empty($thread['Thread']['event_id'])) { $event = $this->Event->fetchEvent($user, array( 'eventid' => $thread['Thread']['event_id'], 'metadata' => true )); if (empty($event)) { return false; } $event = $event[0]; // update the distribution if it diverged from the event if ( $event['Event']['distribution'] != $thread['Thread']['distribution'] || $event['Event']['sharing_group_id'] != $thread['Thread']['sharing_group_id'] ) { $this->Behaviors->unload('SysLogLogable.SysLogLogable'); $thread['Thread']['distribution'] = $event['Event']['distribution']; $thread['Thread']['sharing_group_id'] = $event['Event']['sharing_group_id']; $this->save($thread); } return !empty($event); } if ($user['Role']['perm_site_admin']) { return true; } if ($thread['Thread']['org_id'] == $user['org_id'] || ($thread['Thread']['distribution'] > 0 && $thread['Thread']['distribution'] < 4)) { return true; } if ($thread['Thread']['distribution'] == 4 && $this->SharingGroup->checkIfAuthorised($user, $thread['Thread']['sharing_group_id'])) { return true; } return false; }
1
PHP
NVD-CWE-noinfo
null
null
null
safe
public function urlOrExistingFilepath($fields) { if ($this->isFeedLocal($this->data)) { if ($this->data['Feed']['source_format'] == 'misp') { if (!is_dir($this->data['Feed']['url'])) { return 'For MISP type local feeds, please specify the containing directory.'; } } else { if (!file_exists($this->data['Feed']['url'])) { return 'Invalid path or file not found. Make sure that the path points to an existing file that is readable and watch out for typos.'; } } } else { if (!filter_var($this->data['Feed']['url'], FILTER_VALIDATE_URL)) { return false; } } return true; }
0
PHP
CWE-502
Deserialization of Untrusted Data
The application deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
private function decryptContentEncryptionKey($private_key_or_secret) { $this->generateContentEncryptionKey(null); # NOTE: run this always not to make timing difference $fake_content_encryption_key = $this->content_encryption_key; switch ($this->header['alg']) { case 'RSA1_5': $rsa = $this->rsa($private_key_or_secret, RSA::ENCRYPTION_PKCS1); $this->content_encryption_key = $rsa->decrypt($this->jwe_encrypted_key); break; case 'RSA-OAEP': $rsa = $this->rsa($private_key_or_secret, RSA::ENCRYPTION_OAEP); $this->content_encryption_key = $rsa->decrypt($this->jwe_encrypted_key); break; case 'dir': $this->content_encryption_key = $private_key_or_secret; break; case 'A128KW': case 'A256KW': case 'ECDH-ES': case 'ECDH-ES+A128KW': case 'ECDH-ES+A256KW': throw new JOSE_Exception_UnexpectedAlgorithm('Algorithm not supported'); default: throw new JOSE_Exception_UnexpectedAlgorithm('Unknown algorithm'); } if (!$this->content_encryption_key) { # NOTE: # Not to disclose timing difference between CEK decryption error and others. # Mitigating Bleichenbacher Attack on PKCS#1 v1.5 # ref.) http://inaz2.hatenablog.com/entry/2016/01/26/222303 $this->content_encryption_key = $fake_content_encryption_key; } }
1
PHP
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
safe
public function Insert() { $ins_stmt = Database::prepare(" INSERT INTO `" . TABLE_PANEL_TICKETS . "` SET `customerid` = :customerid, `adminid` = :adminid, `category` = :category, `priority` = :priority, `subject` = :subject, `message` = :message, `dt` = :dt, `lastchange` = :lastchange, `ip` = :ip, `status` = :status, `lastreplier` = :lastreplier, `by` = :by, `answerto` = :answerto"); $ins_data = array( 'customerid' => $this->Get('customer'), 'adminid' => $this->Get('admin'), 'category' => $this->Get('category'), 'priority' => $this->Get('priority'), 'subject' => $this->Get('subject'), 'message' => $this->Get('message'), 'dt' => time(), 'lastchange' => time(), 'ip' => $this->Get('ip'), 'status' => $this->Get('status'), 'lastreplier' => $this->Get('lastreplier'), 'by' => $this->Get('by'), 'answerto' => $this->Get('answerto') ); Database::pexecute($ins_stmt, $ins_data); $this->tid = Database::lastInsertId(); return true; }
1
PHP
CWE-732
Incorrect Permission Assignment for Critical Resource
The product specifies permissions for a security-critical resource in a way that allows that resource to be read or modified by unintended actors.
https://cwe.mitre.org/data/definitions/732.html
safe
public function getServerExtList() { return $this->server_caps; }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public function show() { $task = $this->getTask(); $subtask = $this->getSubtask(); $this->response->html($this->template->render('subtask_converter/show', array( 'subtask' => $subtask, 'task' => $task, ))); }
0
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
public function save() { $project = $this->getProject(); $values = $this->request->getValues(); list($valid, $errors) = $this->categoryValidator->validateCreation($values); if ($valid) { if ($this->categoryModel->create($values) !== false) { $this->flash->success(t('Your category have been created successfully.')); $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])), true); return; } else { $errors = array('name' => array(t('Another category with the same name exists in this project'))); } } $this->create($values, $errors); }
0
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
public static function getHelpVersion($version_id) { global $db; return $db->selectValue('help_version', 'version', 'id="'.$version_id.'"'); }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
protected function _unlink($path) { $ret = @unlink($path); $ret && clearstatcache(); return $ret; }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public function actionGetItems($term){ X2LinkableBehavior::getItems ($term); }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public function manage() { expHistory::set('viewable', $this->params); $page = new expPaginator(array( 'model'=>'order_status', 'where'=>1, 'limit'=>10, 'order'=>'rank', 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->params['controller'], 'action'=>$this->params['action'], //'columns'=>array('Name'=>'title') )); assign_to_template(array( 'page'=>$page )); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
$masteroption->delete(); } // delete the mastergroup $db->delete('optiongroup', 'optiongroup_master_id='.$mastergroup->id); $mastergroup->delete(); expHistory::back(); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
protected function getComment() { $comment = $this->commentModel->getById($this->request->getIntegerParam('comment_id')); if (empty($comment)) { throw new PageNotFoundException(); } if (! $this->userSession->isAdmin() && $comment['user_id'] != $this->userSession->getId()) { throw new AccessForbiddenException(); } return $comment; }
0
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
public function addUser(){ $login_user = $this->checkLogin(); $this->checkAdmin(); $username = I("username"); $password = I("password"); $uid = I("uid"); $name = I("name"); if(!$username){ $this->sendError(10101,'用户名不允许为空'); return ; } if($uid){ if($password){ D("User")->updatePwd($uid, $password); } if($name){ D("User")->where(" uid = '$uid' ")->save(array("name"=>$name)); } $this->sendResult(array()); }else{ if (D("User")->isExist($username)) { $this->sendError(10101,L('username_exists')); return ; } $new_uid = D("User")->register($username,$password); if (!$new_uid) { $this->sendError(10101); }else{ if($name){ D("User")->where(" uid = '$new_uid' ")->save(array("name"=>$name)); } $this->sendResult($return); } } }
0
PHP
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
vulnerable
public function behaviors() { return array_merge(parent::behaviors(),array( 'X2LinkableBehavior'=>array( 'class'=>'X2LinkableBehavior', 'module'=>'marketing' ), 'ERememberFiltersBehavior' => array( 'class'=>'application.components.ERememberFiltersBehavior', 'defaults'=>array(), 'defaultStickOnClear'=>false ), 'tags' => array( 'class' => 'TagBehavior', 'disableTagScanning' => true, ), )); }
1
PHP
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
public function showall() { global $user, $sectionObj, $sections; expHistory::set('viewable', $this->params); $id = $sectionObj->id; $current = null; // all we need to do is determine the current section $navsections = $sections; if ($sectionObj->parent == -1) { $current = $sectionObj; } else { foreach ($navsections as $section) { if ($section->id == $id) { $current = $section; break; } } } assign_to_template(array( 'sections' => $navsections, 'current' => $current, 'canManage' => ((isset($user->is_acting_admin) && $user->is_acting_admin == 1) ? 1 : 0), )); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
foreach ($allusers as $uid) { $u = user::getUserById($uid); expPermissions::grant($u, 'manage', $sloc); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
static public function getPriorityText($_lng, $_priority = 0) { switch ($_priority) { case 1: return $_lng['ticket']['high']; break; case 2: return $_lng['ticket']['normal']; break; default: return $_lng['ticket']['low']; break; } }
1
PHP
CWE-732
Incorrect Permission Assignment for Critical Resource
The product specifies permissions for a security-critical resource in a way that allows that resource to be read or modified by unintended actors.
https://cwe.mitre.org/data/definitions/732.html
safe
protected function getComment() { $comment = $this->commentModel->getById($this->request->getIntegerParam('comment_id')); if (empty($comment)) { throw new PageNotFoundException(); } if (! $this->userSession->isAdmin() && $comment['user_id'] != $this->userSession->getId()) { throw new AccessForbiddenException(); } return $comment; }
0
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
protected function _dimensions($path, $mime) { clearstatcache(); return strpos($mime, 'image') === 0 && ($s = @getimagesize($path)) !== false ? $s[0].'x'.$s[1] : false; }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
private function _verify($public_key_or_secret, $expected_alg = null) { $segments = explode('.', $this->raw); $signature_base_string = implode('.', array($segments[0], $segments[1])); if (!$expected_alg) { $expected_alg = $this->header['alg']; $using_autodetected_alg = true; } switch ($expected_alg) { case 'HS256': case 'HS384': case 'HS512': if ($using_autodetected_alg) { throw new JOSE_Exception_UnexpectedAlgorithm( 'HMAC algs MUST be explicitly specified as $expected_alg' ); } $hmac_hash = hash_hmac($this->digest(), $signature_base_string, $public_key_or_secret, true); return hash_equals($this->signature, $hmac_hash); case 'RS256': case 'RS384': case 'RS512': return $this->rsa($public_key_or_secret, RSA::SIGNATURE_PKCS1)->verify($signature_base_string, $this->signature); case 'ES256': case 'ES384': case 'ES512': throw new JOSE_Exception_UnexpectedAlgorithm('Algorithm not supported'); case 'PS256': case 'PS384': case 'PS512': return $this->rsa($public_key_or_secret, RSA::SIGNATURE_PSS)->verify($signature_base_string, $this->signature); default: throw new JOSE_Exception_UnexpectedAlgorithm('Unknown algorithm'); } }
1
PHP
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
safe
public function handle($request, Closure $next) { if ($this->auth->guest()) { if ($request->ajax()) { return response('Unauthorized.', 401); } else { return redirect()->guest('login'); } } return $next($request); }
0
PHP
NVD-CWE-noinfo
null
null
null
vulnerable
public function create_directory() { if (!AuthUser::hasPermission('file_manager_mkdir')) { Flash::set('error', __('You do not have sufficient permissions to create a directory.')); redirect(get_url('plugin/file_manager/browse/')); } // CSRF checks if (isset($_POST['csrf_token'])) { $csrf_token = $_POST['csrf_token']; if (!SecureToken::validateToken($csrf_token, BASE_URL.'plugin/file_manager/create_directory')) { Flash::set('error', __('Invalid CSRF token found!')); redirect(get_url('plugin/file_manager/browse/')); } } else { Flash::set('error', __('No CSRF token found!')); redirect(get_url('plugin/file_manager/browse/')); } $data = $_POST['directory']; $path = str_replace('..', '', $data['path']); $dirname = str_replace('..', '', $data['name']); $dir = FILES_DIR . "/{$path}/{$dirname}"; if (mkdir($dir)) { $mode = Plugin::getSetting('dirmode', 'file_manager'); chmod($dir, octdec($mode)); } else { Flash::set('error', __('Directory :name has not been created!', array(':name' => $dirname))); } redirect(get_url('plugin/file_manager/browse/' . $path)); }
0
PHP
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
function update_option_master() { global $db; $id = empty($this->params['id']) ? null : $this->params['id']; $opt = new option_master($id); $oldtitle = $opt->title; $opt->update($this->params); // if the title of the master changed we should update the option groups that are already using it. if ($oldtitle != $opt->title) { }$db->sql('UPDATE '.$db->prefix.'option SET title="'.$opt->title.'" WHERE option_master_id='.$opt->id); expHistory::back(); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
function PMA_findExistingColNames($db, $cols, $allFields=false) { $cfgCentralColumns = PMA_centralColumnsGetParams(); if (empty($cfgCentralColumns)) { return array(); } $pmadb = $cfgCentralColumns['db']; $GLOBALS['dbi']->selectDb($pmadb, $GLOBALS['controllink']); $central_list_table = $cfgCentralColumns['table']; if ($allFields) { $query = 'SELECT * FROM ' . Util::backquote($central_list_table) . ' ' . 'WHERE db_name = \'' . $db . '\' AND col_name IN (' . $cols . ');'; $has_list = (array) $GLOBALS['dbi']->fetchResult( $query, null, null, $GLOBALS['controllink'] ); PMA_handleColumnExtra($has_list); } else { $query = 'SELECT col_name FROM ' . Util::backquote($central_list_table) . ' ' . 'WHERE db_name = \'' . $db . '\' AND col_name IN (' . $cols . ');'; $has_list = (array) $GLOBALS['dbi']->fetchResult( $query, null, null, $GLOBALS['controllink'] ); } return $has_list; }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
self::ajax($v); } else { if (in_array($k, $arr)) { self::incFront($k, $var); } else { self::error('404'); } } } }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public function manage_versions() { expHistory::set('manageable', $this->params); $hv = new help_version(); $current_version = $hv->find('first', 'is_current=1'); $sql = 'SELECT hv.*, COUNT(h.title) AS num_docs FROM '.DB_TABLE_PREFIX.'_help h '; $sql .= 'RIGHT JOIN '.DB_TABLE_PREFIX.'_help_version hv ON h.help_version_id=hv.id GROUP BY hv.version'; $page = new expPaginator(array( 'sql'=>$sql, 'limit'=>30, 'order' => (isset($this->params['order']) ? $this->params['order'] : 'version'), 'dir' => (isset($this->params['dir']) ? $this->params['dir'] : 'DESC'), 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->baseclassname, 'action'=>$this->params['action'], 'src'=>$this->loc->src, 'columns'=>array( gt('Version')=>'version', gt('Title')=>'title', gt('Current')=>'is_current', gt('# of Docs')=>'num_docs' ), )); assign_to_template(array( 'current_version'=>$current_version, 'page'=>$page )); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public function getSimilar($id) { $url = "http://api.themoviedb.org/3/movie/{$id}/similar?api_key=".$this->apikey; $similar = $this->curl($url); return $similar; }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public function copy() { return new HTMLPurifier_DefinitionCache_Decorator_Memory(); }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
$conditions[] = sprintf("\$this->has('%s')", $service); } if (!$conditions) { return ''; } return implode(' && ', $conditions); }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
function searchCategory() { return gt('Event'); }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
protected function _mkfile($path, $name) { if ($this->tmp) { $path = $this->_joinPath($path, $name); $local = $this->getTempFile(); $res = touch($local) && ftp_put($this->connect, $path, $local, FTP_ASCII); unlink($local); return $res ? $path : false; } return false; }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
private static function isNonStandardPort($scheme, $port) { return !isset(self::$schemes[$scheme]) || $port !== self::$schemes[$scheme]; }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public static function flag($vars) { switch (SMART_URL) { case true: $lang = '?lang='.$vars; if (isset($_GET['lang'])) { $uri = explode('?', $_SERVER['REQUEST_URI']); $uri = $uri[0]; } else { $uri = $_SERVER['REQUEST_URI']; } $url = $uri.$lang; break; default: // print_r($_GET); if (!empty($_GET)) { $val = ''; foreach ($_GET as $key => $value) { if ($key == 'lang') { $val .= '&lang='.$vars; } else { $val .= $key.'='.$value; } } } else { $val = 'lang='.$vars; } $lang = !isset($_GET['lang']) ? '&lang='.$vars : $val; $url = Site::$url.'/?'.$lang; break; } return $url; }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
protected function getAction(array $project) { $action = $this->actionModel->getById($this->request->getIntegerParam('action_id')); if (empty($action)) { throw new PageNotFoundException(); } if ($action['project_id'] != $project['id']) { throw new AccessForbiddenException(); } return $action; }
1
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
safe
public function testCheckHTTP() { if (! function_exists('curl_init')) { $this->markTestSkipped('Missing curl extension!'); } $this->assertTrue( $this->object->checkHTTP("http://www.phpmyadmin.net/test/data") ); $this->assertContains( "TEST DATA", $this->object->checkHTTP("http://www.phpmyadmin.net/test/data", true) ); $this->assertFalse( $this->object->checkHTTP("http://www.phpmyadmin.net/test/nothing") ); }
0
PHP
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
function _makeMpName($value) { if ($value != '') { $get_name = DBGet(DBQuery('SELECT TITLE FROM marking_periods WHERE marking_period_id=' . $value)); return $get_name[1]['TITLE']; } else return ''._customCoursePeriod.''; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function delete() { global $db; if (empty($this->params['id'])) return false; $product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']); $product = new $product_type($this->params['id'], true, false); //eDebug($product_type); //eDebug($product, true); //if (!empty($product->product_type_id)) { //$db->delete($product_type, 'id='.$product->product_id); //} $db->delete('option', 'product_id=' . $product->id . " AND optiongroup_id IN (SELECT id from " . $db->prefix . "optiongroup WHERE product_id=" . $product->id . ")"); $db->delete('optiongroup', 'product_id=' . $product->id); //die(); $db->delete('product_storeCategories', 'product_id=' . $product->id . ' AND product_type="' . $product_type . '"'); if ($product->product_type == "product") { if ($product->hasChildren()) { $this->deleteChildren(); } } $product->delete(); flash('message', gt('Product deleted successfully.')); expHistory::back(); }
1
PHP
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/74.html
safe
$that->assertSame('127.0.0.1', $request->server->get('REMOTE_ADDR')); $that->assertSame('10.0.0.2', $request->getClientIp()); $that->assertSame('Good', $request->headers->get('X-Forwarded-Host')); $that->assertSame('1234', $request->headers->get('X-Forwarded-Port')); $that->assertSame('https', $request->headers->get('X-Forwarded-Proto')); });
1
PHP
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
public function event() { $project = $this->getProject(); $values = $this->request->getValues(); if (empty($values['action_name']) || empty($values['project_id'])) { return $this->create(); } return $this->response->html($this->template->render('action_creation/event', array( 'values' => $values, 'project' => $project, 'available_actions' => $this->actionManager->getAvailableActions(), 'events' => $this->actionManager->getCompatibleEvents($values['action_name']), ))); }
0
PHP
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
public function update() { global $user; if (expSession::get('customer-signup')) expSession::set('customer-signup', false); if (isset($this->params['address_country_id'])) { $this->params['country'] = $this->params['address_country_id']; unset($this->params['address_country_id']); } if (isset($this->params['address_region_id'])) { $this->params['state'] = $this->params['address_region_id']; unset($this->params['address_region_id']); } if ($user->isLoggedIn()) { // check to see how many other addresses this user has already. $count = $this->address->find('count', 'user_id='.$user->id); // if this is first address save for this user we'll make this the default if ($count == 0) { $this->params['is_default'] = 1; $this->params['is_billing'] = 1; $this->params['is_shipping'] = 1; } // associate this address with the current user. $this->params['user_id'] = $user->id; // save the object $this->address->update($this->params); } else { //if (ecomconfig::getConfig('allow_anonymous_checkout')){ //user is not logged in, but allow anonymous checkout is enabled so we'll check //a few things that we don't check in the parent 'stuff and create a user account. $this->params['is_default'] = 1; $this->params['is_billing'] = 1; $this->params['is_shipping'] = 1; $this->address->update($this->params); } expHistory::back(); }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public function logout(){ $login_user = $this->checkLogin(); D("UserToken")->where(" uid = '$login_user[uid]' ")->save(array("token_expire"=>0)); session("login_user" , NULL); cookie('cookie_token',NULL); session(null); $this->sendResult(array()); }
0
PHP
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
vulnerable
public function getAsBBCode() { return $this->getValue(); }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
private function getMicroweberErrorBarHtml() { return ' <style> h2 { font-size:25px; font-weight: bold; } #mw-error-clear-cache-form-holder{ width:100%; background: #fff; border-top: 1px solid #d7d5e6; position: fixed; bottom: 5px; padding: 15px; z-index: 1000; } #mw-error-clear-cache-forms{ margin:10px; } .btn { border: 1px solid #4b476d; background: #342d59; color: #fff; padding: 5px 37px; } </style> <div id="mw-error-clear-cache-form-holder"> <div id="mw-error-clear-cache-forms"> <h2>OOPS! There is some error...</h2> <h3>Try to fix it by yourself using following buttons.</h3> <br /> <a href="' . api_url('mw_post_update') . '?redirect_to='.url_current().'" class="btn">Reload database</a> <a href="' . api_url('mw_reload_modules') . '?redirect_to='.url_current().'" class="btn">Reload modules</a> <a href="' . api_url('clearcache') . '?redirect_to='.url_current().'" class="btn">Clear cache</a> <a href="" class="btn">Refresh</a> </div> </div> '; }
1
PHP
NVD-CWE-noinfo
null
null
null
safe
public function contactInformationSave(Request $request) { $firstName = strip_tags($request->get('first_name')); $lastName = strip_tags($request->get('last_name')); $email = strip_tags($request->get('email')); $phone = strip_tags($request->get('phone')); session_append_array('checkout_v2', [ 'first_name'=> $firstName, 'last_name'=> $lastName, 'email'=> $email, 'phone'=> $phone ]); $validate = $this->_validateContactInformation($request->all()); if ($validate['valid'] == false) { session_set('errors', $validate['errors']); return redirect(route('checkout.contact_information')); } // Success return redirect(route('checkout.shipping_method')); }
1
PHP
CWE-94
Improper Control of Generation of Code ('Code Injection')
The software constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
safe
public function validate($string, $config, $context) { // no support for named mailboxes i.e. "Bob <[email protected]>" // that needs more percent encoding to be done if ($string == '') return false; $string = trim($string); $result = preg_match('/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i', $string); return $result ? $string : false; }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public function checkDefType($def) { if ($def->type !== $this->type) { trigger_error("Cannot use definition of type {$def->type} in cache for {$this->type}"); return false; } return true; }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
$tableBody[] = array(htmlentities($row['label']), $row['nb_visits'], $row['bounce_rate']); if ($count == 10) break; } $this->table($tableHead, $tableBody, null); }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
$doRegist = (strpos($cmd, '*') !== false); if (! $doRegist) { $_getcmd = create_function('$cmd', 'list($ret) = explode(\'.\', $cmd);return trim($ret);'); $doRegist = ($_reqCmd && in_array($_reqCmd, array_map($_getcmd, explode(' ', $cmd)))); } if ($doRegist) { // for backward compatibility if (! is_array($handlers)) { $handlers = array($handlers); } else { if (count($handlers) === 2 && is_object($handlers[0])) { $handlers = array($handlers); } } foreach($handlers as $handler) { if ($handler) { if (is_string($handler) && strpos($handler, '.')) { list($_domain, $_name, $_method) = array_pad(explode('.', $handler), 3, ''); if (strcasecmp($_domain, 'plugin') === 0) { if ($plugin = $this->getPluginInstance($_name, isset($opts['plugin'][$_name])? $opts['plugin'][$_name] : array()) and method_exists($plugin, $_method)) { $this->bind($cmd, array($plugin, $_method)); } } } else { $this->bind($cmd, $handler); } } } } } }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public function update() { global $user; if (expSession::get('customer-signup')) expSession::set('customer-signup', false); if (isset($this->params['address_country_id'])) { $this->params['country'] = $this->params['address_country_id']; unset($this->params['address_country_id']); } if (isset($this->params['address_region_id'])) { $this->params['state'] = $this->params['address_region_id']; unset($this->params['address_region_id']); } if ($user->isLoggedIn()) { // check to see how many other addresses this user has already. $count = $this->address->find('count', 'user_id='.$user->id); // if this is first address save for this user we'll make this the default if ($count == 0) { $this->params['is_default'] = 1; $this->params['is_billing'] = 1; $this->params['is_shipping'] = 1; } // associate this address with the current user. $this->params['user_id'] = $user->id; // save the object $this->address->update($this->params); } else { //if (ecomconfig::getConfig('allow_anonymous_checkout')){ //user is not logged in, but allow anonymous checkout is enabled so we'll check //a few things that we don't check in the parent 'stuff and create a user account. $this->params['is_default'] = 1; $this->params['is_billing'] = 1; $this->params['is_shipping'] = 1; $this->address->update($this->params); } expHistory::back(); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
protected function getComment() { $comment = $this->commentModel->getById($this->request->getIntegerParam('comment_id')); if (empty($comment)) { throw new PageNotFoundException(); } if (! $this->userSession->isAdmin() && $comment['user_id'] != $this->userSession->getId()) { throw new AccessForbiddenException(); } return $comment; }
0
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
public function redeemable($cart, $webuser) { global $website; global $DB; // 1/ coupon matches the current website $redeemable = true; if($this->website != $website->id) $redeemable = false; // 2/ coupon currency matches the current cart currency if($this->currency != $cart['currency']) $redeemable = false; // 3/ check dates $now = core_time(); if( !empty($this->date_begin) && $now < $this->date_begin) $redeemable = false; if( !empty($this->date_end) && $now > $this->date_end) $redeemable = false; // 4/ minimum spend // TODO: check currencies? if( !empty($this->minimum_spend) && $cart['subtotal'] < $this->minimum_spend ) $redeemable = false; // 5/ check webuser usage if( !empty($this->times_allowed_customer) ) { $times_used_by_customer = $DB->query_single( 'COUNT(*)', 'nv_orders', ' website = '.protect($website->id).' AND webuser = '.protect($webuser).' AND coupon = '.protect($this->id) ); if($times_used_by_customer > $this->times_allowed_customer) $redeemable = false; } // 6/ check global orders usage if( !empty($this->times_allowed_globally) ) { $times_used_globally = $DB->query_single( 'COUNT(*)', 'nv_orders', ' website = '.protect($website->id).' AND coupon = '.protect($this->id) ); if($times_used_globally > $this->times_allowed_globally) $redeemable = false; } return $redeemable; }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
function search_by_model() { global $db, $user; $sql = "select DISTINCT(p.id) as id, p.title, model from " . $db->prefix . "product as p WHERE "; if (!($user->isAdmin())) $sql .= '(p.active_type=0 OR p.active_type=1) AND '; //if first character of search is a -, then we do a wild card, else from beginning $this->params['query'] = expString::escape($this->params['query']); if ($this->params['query'][0] == '-') { $sql .= " p.model LIKE '%" . $this->params['query']; } else { $sql .= " p.model LIKE '" . $this->params['query']; } $sql .= "%' AND p.parent_id=0 GROUP BY p.id "; $sql .= "order by p.model ASC LIMIT 30"; $res = $db->selectObjectsBySql($sql); //eDebug($sql); $ar = new expAjaxReply(200, gt('Here\'s the items you wanted'), $res); $ar->send(); }
1
PHP
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
public function theme_switch() { if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change the theme.')); } expSettings::change('DISPLAY_THEME_REAL', $this->params['theme']); expSession::set('display_theme',$this->params['theme']); $sv = isset($this->params['sv'])?$this->params['sv']:''; if (strtolower($sv)=='default') { $sv = ''; } expSettings::change('THEME_STYLE_REAL',$sv); expSession::set('theme_style',$sv); expDatabase::install_dbtables(); // update tables to include any custom definitions in the new theme // $message = (MINIFY != 1) ? "Exponent is now minifying Javascript and CSS" : "Exponent is no longer minifying Javascript and CSS" ; // flash('message',$message); $message = gt("You have selected the")." '".$this->params['theme']."' ".gt("theme"); if ($sv != '') { $message .= ' '.gt('with').' '.$this->params['sv'].' '.gt('style variation'); } flash('message',$message); // expSession::un_set('framework'); expSession::set('force_less_compile', 1); // expTheme::removeSmartyCache(); expSession::clearAllUsersSessionCache(); expHistory::returnTo('manageable'); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public function testDoNotEncodeFormulas() { $this->assertSame(<<<'CSV' 0 =2+3 CSV , $this->encoder->encode(['=2+3'], 'csv')); $this->assertSame(<<<'CSV' 0 -2+3 CSV , $this->encoder->encode(['-2+3'], 'csv')); $this->assertSame(<<<'CSV' 0 +2+3 CSV , $this->encoder->encode(['+2+3'], 'csv')); $this->assertSame(<<<'CSV' 0 @MyDataColumn CSV , $this->encoder->encode(['@MyDataColumn'], 'csv')); $this->assertSame(<<<'CSV' 0 " tab" CSV , $this->encoder->encode(["\ttab"], 'csv')); $this->assertSame(<<<'CSV' 0 "=1+2"";=1+2" CSV , $this->encoder->encode(['=1+2";=1+2'], 'csv')); $this->assertSame(<<<'CSV' 0 "=1+2'"" ;,=1+2" CSV , $this->encoder->encode(['=1+2\'" ;,=1+2'], 'csv')); }
1
PHP
CWE-1236
Improper Neutralization of Formula Elements in a CSV File
The software saves user-provided information into a Comma-Separated Value (CSV) file, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as a command when the file is opened by spreadsheet software.
https://cwe.mitre.org/data/definitions/1236.html
safe
public function confirm(string $token) { try { $userId = $this->emailConfirmationService->checkTokenAndGetUserId($token); } catch (UserTokenNotFoundException $exception) { $this->showErrorNotification(trans('errors.email_confirmation_invalid')); return redirect('/register'); } catch (UserTokenExpiredException $exception) { $user = $this->userRepo->getById($exception->userId); $this->emailConfirmationService->sendConfirmation($user); $this->showErrorNotification(trans('errors.email_confirmation_expired')); return redirect('/register/confirm'); } $user = $this->userRepo->getById($userId); $user->email_confirmed = true; $user->save(); $this->emailConfirmationService->deleteByUser($user); $this->showSuccessNotification(trans('auth.email_confirm_success')); $this->loginService->login($user, auth()->getDefaultDriver()); return redirect('/'); }
0
PHP
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
vulnerable
static function dropdownConnect($itemtype, $fromtype, $myname, $entity_restrict = -1, $onlyglobal = 0, $used = []) { global $CFG_GLPI; $rand = mt_rand(); $field_id = Html::cleanId("dropdown_".$myname.$rand); $param = [ 'entity_restrict' => $entity_restrict, 'fromtype' => $fromtype, 'itemtype' => $itemtype, 'onlyglobal' => $onlyglobal, 'used' => $used, '_idor_token' => Session::getNewIDORToken($itemtype), ]; echo Html::jsAjaxDropdown($myname, $field_id, $CFG_GLPI['root_doc']."/ajax/getDropdownConnect.php", $param); return $rand; }
0
PHP
CWE-862
Missing Authorization
The software does not perform an authorization check when an actor attempts to access a resource or perform an action.
https://cwe.mitre.org/data/definitions/862.html
vulnerable