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
} elseif (!empty($this->params['src'])) { if ($this->params['src'] == $loc->src) { $this->config = $config->config; break; } } }
0
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
vulnerable
$db->updateObject($value, 'section'); } $db->updateObject($moveSec, 'section'); //handle re-ranking of previous parent $oldSiblings = $db->selectObjects("section", "parent=" . $oldParent . " AND rank>" . $oldRank . " ORDER BY rank"); $rerank = 1; foreach ($oldSiblings as $value) { if ($value->id != $moveSec->id) { $value->rank = $rerank; $db->updateObject($value, 'section'); $rerank++; } } if ($oldParent != $moveSec->parent) { //we need to re-rank the children of the parent that the moving section has just left $childOfLastMove = $db->selectObjects("section", "parent=" . $oldParent . " ORDER BY rank"); for ($i = 0, $iMax = count($childOfLastMove); $i < $iMax; $i++) { $childOfLastMove[$i]->rank = $i; $db->updateObject($childOfLastMove[$i], 'section'); } } } } self::checkForSectionalAdmins($move); expSession::clearAllUsersSessionCache('navigation'); }
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 manage() { expHistory::set('viewable', $this->params); // $category = new storeCategory(); // $categories = $category->getFullTree(); // // // foreach($categories as $i=>$val){ // // if (!empty($this->values) && in_array($val->id,$this->values)) { // // $this->tags[$i]->value = true; // // } else { // // $this->tags[$i]->value = false; // // } // // $this->tags[$i]->draggable = $this->draggable; // // $this->tags[$i]->checkable = $this->checkable; // // } // // $obj = json_encode($categories); }
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 downloadfile() { if (empty($this->params['fileid'])) { flash('error', gt('There was an error while trying to download your file. No File Specified.')); expHistory::back(); } $fd = new filedownload(intval($this->params['fileid'])); if (empty($this->params['filenum'])) $this->params['filenum'] = 0; if (empty($fd->expFile['downloadable'][$this->params['filenum']]->id)) { flash('error', gt('There was an error while trying to download your file. The file you were looking for could not be found.')); expHistory::back(); } $fd->downloads++; $fd->save(); // this will set the id to the id of the actual file..makes the download go right. $this->params['id'] = $fd->expFile['downloadable'][$this->params['filenum']]->id; parent::downloadfile(); }
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_version() { // get the current version $hv = new help_version(); $current_version = $hv->find('first', 'is_current=1'); // check to see if the we have a new current version and unset the old current version. if (!empty($this->params['is_current'])) { // $db->sql('UPDATE '.DB_TABLE_PREFIX.'_help_version set is_current=0'); help_version::clearHelpVersion(); } expSession::un_set('help-version'); // save the version $id = empty($this->params['id']) ? null : $this->params['id']; $version = new help_version(); // if we don't have a current version yet so we will force this one to be it if (empty($current_version->id)) $this->params['is_current'] = 1; $version->update($this->params); // if this is a new version we need to copy over docs if (empty($id)) { self::copydocs($current_version->id, $version->id); } // let's update the search index to reflect the current help version searchController::spider(); flash('message', gt('Saved help version').' '.$version->version); 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
static function displayname() { return "Events"; }
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 title($id) { $sql = sprintf("SELECT `title` FROM `posts` WHERE `id` = '%d'", $id); try { $r = Db::result($sql); if (isset($r['error'])) { $title['error'] = $r['error']; //echo $title['error']; } else { $title = $r[0]->title; } } catch (Exception $e) { $title = $e->getMessage(); } return $title; }
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 update() { parent::update(); expSession::clearAllUsersSessionCache('navigation'); }
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 configure() { $this->config['defaultbanner'] = array(); if (!empty($this->config['defaultbanner_id'])) { $this->config['defaultbanner'][] = new expFile($this->config['defaultbanner_id']); } parent::configure(); $banners = $this->banner->find('all', null, 'companies_id'); assign_to_template(array( 'banners'=>$banners, 'title'=>static::displayname() )); }
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 remove() { $this->checkCSRFParam(); $project = $this->getProject(); $action = $this->actionModel->getById($this->request->getIntegerParam('action_id')); if (! empty($action) && $this->actionModel->remove($action['id'])) { $this->flash->success(t('Action removed successfully.')); } else { $this->flash->failure(t('Unable to remove this action.')); } $this->response->redirect($this->helper->url->to('ActionController', 'index', array('project_id' => $project['id']))); }
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 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); }
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 referenceFixtures() { return array( 'campaign' => array ('Campaign', '.CampaignMailingBehaviorTest'), 'lists' => 'X2List', 'credentials' => 'Credentials', 'users' => 'User', 'profile' => array('Profile','.marketing'), 'actions' => 'Actions' ); }
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 edit_order_item() { $oi = new orderitem($this->params['id'], true, true); if (empty($oi->id)) { flash('error', gt('Order item doesn\'t exist.')); expHistory::back(); } $oi->user_input_fields = expUnserialize($oi->user_input_fields); $params['options'] = $oi->opts; $params['user_input_fields'] = $oi->user_input_fields; $oi->product = new product($oi->product->id, true, true); if ($oi->product->parent_id != 0) { $parProd = new product($oi->product->parent_id); //$oi->product->optiongroup = $parProd->optiongroup; $oi->product = $parProd; } //FIXME we don't use selectedOpts? // $oi->selectedOpts = array(); // if (!empty($oi->opts)) { // foreach ($oi->opts as $opt) { // $option = new option($opt[0]); // $og = new optiongroup($option->optiongroup_id); // if (!isset($oi->selectedOpts[$og->id]) || !is_array($oi->selectedOpts[$og->id])) // $oi->selectedOpts[$og->id] = array($option->id); // else // array_push($oi->selectedOpts[$og->id], $option->id); // } // } //eDebug($oi->selectedOpts); assign_to_template(array( 'oi' => $oi, 'params' => $params )); }
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 action_edge_mode_enable() { w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/activation.php'); $config_path = w3_get_wp_config_path(); $config_data = @file_get_contents($config_path); if ($config_data === false) return; $new_config_data = $this->wp_config_evaluation_mode_remove_from_content($config_data); $new_config_data = preg_replace( '~<\?(php)?~', "\\0\r\n" . $this->wp_config_evaluation_mode(), $new_config_data, 1); if ($new_config_data != $config_data) { try { w3_wp_write_to_file($config_path, $new_config_data); } catch (FilesystemOperationException $ex) { throw new Exception('Configuration file not writable. Please edit file <strong>' . $config_path . '</strong> and add the next lines: '. $this->wp_config_evaluation_mode()); } try { $this->_config_admin->set('notes.edge_mode', false); $this->_config_admin->save(); } catch (Exception $ex) {} } w3_admin_redirect(array('w3tc_note' => 'enabled_edge')); }
1
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
safe
static function displayname() { return gt("e-Commerce Category Manager"); }
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 shouldRun(DateTime $date) { global $timedate; $runDate = clone $date; $this->handleTimeZone($runDate); $cron = Cron\CronExpression::factory($this->schedule); if (empty($this->last_run) && $cron->isDue($runDate)) { return true; } $lastRun = $this->last_run ? $timedate->fromDb($this->last_run) : $timedate->fromDb($this->date_entered); $this->handleTimeZone($lastRun); $next = $cron->getNextRunDate($lastRun); return $next <= $runDate; }
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 _basename($path) { return basename($path); }
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 moveVotes() { $sql = "SELECT * FROM package_proposal_votes WHERE pkg_prop_id = {$this->proposal}"; $res = $this->mdb2->query($sql); if (MDB2::isError($res)) { throw new RuntimeException("DB error occurred: {$res->getDebugInfo()}"); } if ($res->numRows() == 0) { return; // nothing to do } $insert = "INSERT INTO package_proposal_comments ("; $insert .= "user_handle, pkg_prop_id, timestamp, comment"; $insert .= ") VALUES(%s, {$this->proposal}, %d, %s)"; $delete = "DELETE FROM package_proposal_votes WHERE"; $delete .= " pkg_prop_id = {$this->proposal}"; $delete .= " AND user_handle = %s"; while ($row = $res->fetchRow(MDB2_FETCHMODE_OBJECT)) { $comment = "Original vote: {$row->value}\n"; $comment .= "Conditional vote: " . (($row->is_conditional != 0)?'yes':'no') . "\n"; $comment .= "Comment on vote: " . $row->comment . "\n"; $comment .= "Reviewed: " . implode(", ", unserialize($row->reviews)); $sql = sprintf( $insert, $this->mdb2->quote($row->user_handle), $row->timestamp, $this->mdb2->quote($comment) ); $this->queryChange($sql); $sql = sprintf( $delete, $this->mdb2->quote($row->user_handle) ); $this->queryChange($sql); }
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
public function update($key, $qty) { if ((int)$qty && ((int)$qty > 0)) { $this->session->data['cart'][$key] = (int)$qty; } else { $this->remove($key); } $this->data = array(); }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
public function search_external() { // global $db, $user; global $db; $sql = "select DISTINCT(a.id) as id, a.source as source, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email "; $sql .= "from " . $db->prefix . "external_addresses as a "; //R JOIN " . //$db->prefix . "billingmethods as bm ON bm.addresses_id=a.id "; $sql .= " WHERE match (a.firstname,a.lastname,a.email,a.organization) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) "; $sql .= "order by match (a.firstname,a.lastname,a.email,a.organization) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) ASC LIMIT 12"; $res = $db->selectObjectsBySql($sql); foreach ($res as $key=>$record) { $res[$key]->title = $record->firstname . ' ' . $record->lastname; } //eDebug($sql); $ar = new expAjaxReply(200, gt('Here\'s the items you wanted'), $res); $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 validateEmail ($option, $optRule) { if (isset ($option['value'])) { try { EmailDeliveryBehavior::addressHeaderToArray ($option['value']); } catch (CException $e) { return array (false, $e->getMessage ()); } } return array (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
private function checkAuthenticationTag() { if ($this->authentication_tag === $this->calculateAuthenticationTag()) { return true; } else { throw new JOSE_Exception_UnexpectedAlgorithm('Invalid authentication tag'); } }
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
protected function edebug($str, $level = 0) { if ($level > $this->do_debug) { return; } //Avoid clash with built-in function names if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) { call_user_func($this->Debugoutput, $str, $this->do_debug); return; } switch ($this->Debugoutput) { case 'error_log': //Don't output, just log error_log($str); break; case 'html': //Cleans up output a bit for a better looking, HTML-safe output echo htmlentities( preg_replace('/[\r\n]+/', '', $str), ENT_QUOTES, 'UTF-8' ) . "<br>\n"; break; case 'echo': default: //Normalize line breaks $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str); echo gmdate('Y-m-d H:i:s') . "\t" . str_replace( "\n", "\n \t ", trim($str) )."\n"; } }
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 confirm() { $project = $this->getProject(); $this->response->html($this->helper->layout->project('column/remove', array( 'column' => $this->columnModel->getById($this->request->getIntegerParam('column_id')), 'project' => $project, ))); }
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 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(); }
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
$q->close(); } self::$num_rows = $n; return $r; }
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
static function convertUTF($string) { return $string = str_replace('?', '', htmlspecialchars($string, ENT_IGNORE, 'UTF-8')); }
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 get_item( $request ) { $parent = $this->get_parent( $request['parent'] ); if ( is_wp_error( $parent ) ) { return $parent; } $revision = $this->get_revision( $request['id'] ); if ( is_wp_error( $revision ) ) { return $revision; } $response = $this->prepare_item_for_response( $revision, $request ); return rest_ensure_response( $response ); }
1
PHP
NVD-CWE-noinfo
null
null
null
safe
private function checkAuthenticationTag() { if (hash_equals($this->authentication_tag, $this->calculateAuthenticationTag())) { return true; } else { throw new JOSE_Exception_UnexpectedAlgorithm('Invalid authentication tag'); } }
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 isAllowedFilename($filename){ $allow_array = array( '.jpg','.jpeg','.png','.bmp','.gif','.ico','.webp', '.mp3','.wav','.m4a','.ogg','.webma','.mp4','.flv', '.mov','.webmv','.m3u8a','.flac','.mkv', '.zip','.tar','.gz','.tgz','.ipa','.apk','.rar','.iso','.bz2','.epub', '.pdf','.ofd','.swf','.epub','.xps', '.doc','.docx','.odt','.rtf','.docm','.dotm','.dot','.dotx','.wps','.wpt', '.ppt','.pptx','.xls','.xlsx','.txt','.md','.psd','.csv', '.cer','.ppt','.pub','.properties','.json','.css', ) ; $ext = strtolower(substr($filename,strripos($filename,'.')) ); //获取文件扩展名(转为小写后) if(in_array( $ext , $allow_array ) ){ return true ; } return false; }
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 testCanConstructWithProtocolVersion() { $r = new Response(200, [], null, '1000'); $this->assertSame('1000', $r->getProtocolVersion()); }
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 confirm() { $task = $this->getTask(); $comment = $this->getComment(); $this->response->html($this->template->render('comment/remove', array( 'comment' => $comment, 'task' => $task, 'title' => t('Remove a 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 assertNotNull() { if ($this->contents === null) $this->error('must not be null'); return $this; }
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 init_args() { $_REQUEST=strings_stripSlashes($_REQUEST); $args = new stdClass(); $args->req_spec_id = isset($_REQUEST['req_spec_id']) ? $_REQUEST['req_spec_id'] : 0; $args->doCompare = isset($_REQUEST['doCompare']) ? true : false; $args->left_item_id = isset($_REQUEST['left_item_id']) ? intval($_REQUEST['left_item_id']) : -1; $args->right_item_id = isset($_REQUEST['right_item_id']) ? intval($_REQUEST['right_item_id']) : -1; $args->tproject_id = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0; $args->useDaisyDiff = (isset($_REQUEST['diff_method']) && ($_REQUEST['diff_method'] == 'htmlCompare')) ? 1 : 0; $diffEngineCfg = config_get("diffEngine"); $args->context = null; if( !isset($_REQUEST['context_show_all'])) { $args->context = (isset($_REQUEST['context']) && is_numeric($_REQUEST['context'])) ? $_REQUEST['context'] : $diffEngineCfg->context; } return $args; }
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() { $sql = 'SELECT id, name as value FROM x2_accounts WHERE name LIKE :qterm ORDER BY name ASC'; $command = Yii::app()->db->createCommand($sql); $qterm = $_GET['term'] . '%'; $command->bindParam(":qterm", $qterm, PDO::PARAM_STR); $result = $command->queryAll(); echo CJSON::encode($result); exit; }
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
private function getCategory() { $category = $this->categoryModel->getById($this->request->getIntegerParam('category_id')); if (empty($category)) { throw new PageNotFoundException(); } return $category; }
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 client_send($data) { $this->edebug("CLIENT -> SERVER: $data", self::DEBUG_CLIENT); return fwrite($this->smtp_conn, $data); }
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 selectBillingOptions() { }
0
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
vulnerable
static function isSearchable() { return true; }
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 execute(&$params){ $model = new Actions; $model->type = 'note'; $model->complete = 'Yes'; $model->associationId = $params['model']->id; $model->associationType = $params['model']->module; $model->actionDescription = $this->parseOption('comment', $params); $model->assignedTo = $this->parseOption('assignedTo', $params); $model->completedBy = $this->parseOption('assignedTo', $params); if(empty($model->assignedTo) && $params['model']->hasAttribute('assignedTo')){ $model->assignedTo = $params['model']->assignedTo; $model->completedBy = $params['model']->assignedTo; } if($params['model']->hasAttribute('visibility')) $model->visibility = $params['model']->visibility; $model->createDate = time(); $model->completeDate = time(); if($model->save()){ return array( true, Yii::t('studio', 'View created action: ').$model->getLink()); }else{ $errors = $model->getErrors (); return array(false, array_shift($errors)); } }
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 testAlwaysReturnsBody() { $r = new Response(); $this->assertInstanceOf('Psr\Http\Message\StreamInterface', $r->getBody()); }
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 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
foreach ($indexesOld as $index) { if (\in_array('name', $index->getColumns()) || \in_array('mail', $index->getColumns())) { $this->indexesOld[] = $index; $this->addSql('DROP INDEX ' . $index->getName() . ' ON ' . $users); } }
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 add($def, $config) { if (!$this->checkDefType($def)) return; $file = $this->generateFilePath($config); if (file_exists($file)) return false; if (!$this->_prepareDir($config)) return false; return $this->_write($file, serialize($def), $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
protected function getStatusCode($exception) { if ($exception instanceof HttpExceptionInterface) { $code = $exception->getStatusCode(); } elseif ($exception instanceof AjaxException) { $code = 406; } else { $code = 500; } return $code; }
0
PHP
CWE-532
Insertion of Sensitive Information into Log File
Information written to log files can be of a sensitive nature and give valuable guidance to an attacker or expose sensitive user information.
https://cwe.mitre.org/data/definitions/532.html
vulnerable
$value = (int)$_POST[$key]; } else { $value = strtotime($_POST[$key]); } $icmsObj->setVar($key, $value); break; case XOBJ_DTYPE_URL: if (isset($_POST[$key])) { $icmsObj->setVar($key, filter_var($_POST[$key], FILTER_SANITIZE_URL)); } break; case XOBJ_DTYPE_ARRAY: if (is_array($_POST[$key])) { $icmsObj->setVar($key, serialize($_POST[$key])); } break; default: $icmsObj->setVar($key, $_POST[$key]); break; } } }
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
$items['id'] = getUserGroupID($esc_name, $affilid); } } # owner if($custom && array_key_exists('owner', $items)) { if(! validateUserid($items['owner'])) { return array('status' => 'error', 'errorcode' => 20, 'errormsg' => 'submitted owner is invalid'); } } # managingGroup if($custom && array_key_exists('managingGroup', $items)) { $parts = explode('@', $items['managingGroup']); if(count($parts) != 2) { return array('status' => 'error', 'errorcode' => 24, 'errormsg' => 'submitted managingGroup is invalid'); } $mgaffilid = getAffiliationID($parts[1]); if(is_null($mgaffilid) || ! checkForGroupName($parts[0], 'user', '', $mgaffilid)) { return array('status' => 'error', 'errorcode' => 25, 'errormsg' => 'submitted managingGroup does not exist'); } $items['managingGroupID'] = getUserGroupID($parts[0], $mgaffilid); $items['managingGroupName'] = $parts[0]; $items['managingGroupAffilid'] = $mgaffilid; } $items['status'] = 'success'; return $items; }
1
PHP
CWE-264
Permissions, Privileges, and Access Controls
Weaknesses in this category are related to the management of permissions, privileges, and other security features that are used to perform access control.
https://cwe.mitre.org/data/definitions/264.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) { if (! is_array($handlers) || 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); } } } } } }
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
$contents[] = ['class' => 'text-center', 'text' => tep_draw_bootstrap_button(IMAGE_SAVE, 'fas fa-save', null, 'primary', null, 'btn-success xxx text-white mr-2') . tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-times', tep_href_link('countries.php', 'page=' . $_GET['page']), null, null, 'btn-light')];
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
$navs[$i]->link = expCore::makeLink(array('section' => $navs[$i]->id), '', $navs[$i]->sef_name); if (!$view) { // unset($navs[$i]); //FIXME this breaks jstree if we remove a parent and not the child $attr = new stdClass(); $attr->class = 'hidden'; // bs3 class to hide elements $navs[$i]->li_attr = $attr; } }
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 customerHasTickets($_cid = 0) { if ($_cid != 0) { $result_stmt = Database::prepare(" SELECT `id` FROM `" . TABLE_PANEL_TICKETS . "` WHERE `customerid` = :cid" ); Database::pexecute($result_stmt, array('cid' => $_cid)); $tickets = array(); while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { $tickets[] = $row['id']; } return $tickets; } return false; }
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
$cols .= '\'' . Util::sqlAddSlashes($col_select) . '\','; } $cols = trim($cols, ','); $has_list = PMA_findExistingColNames($db, $cols); foreach ($field_select as $column) { if (!in_array($column, $has_list)) { $colNotExist[] = "'" . $column . "'"; } } } if (!empty($colNotExist)) { $colNotExist = implode(",", array_unique($colNotExist)); $message = Message::notice( sprintf( __( 'Couldn\'t remove Column(s) %1$s ' . 'as they don\'t exist in central columns list!' ), htmlspecialchars($colNotExist) ) ); } $GLOBALS['dbi']->selectDb($pmadb, $GLOBALS['controllink']); $query = 'DELETE FROM ' . Util::backquote($central_list_table) . ' ' . 'WHERE db_name = \'' . $db . '\' AND col_name IN (' . $cols . ');'; if (!$GLOBALS['dbi']->tryQuery($query, $GLOBALS['controllink'])) { $message = Message::error(__('Could not remove columns!')); $message->addMessage('<br />' . htmlspecialchars($cols) . '<br />'); $message->addMessage( Message::rawError( $GLOBALS['dbi']->getError($GLOBALS['controllink']) ) ); } return $message; }
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 copy() { return new HTMLPurifier_DefinitionCache_Decorator(); }
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
$params = ['name' => 'value'];
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 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-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 getQuerySelect() { return "a.id AS `" . $this->name . "`"; }
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 configure() { $this->config['defaultbanner'] = array(); if (!empty($this->config['defaultbanner_id'])) { $this->config['defaultbanner'][] = new expFile($this->config['defaultbanner_id']); } parent::configure(); $banners = $this->banner->find('all', null, 'companies_id'); assign_to_template(array( 'banners'=>$banners, 'title'=>static::displayname() )); }
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 __construct () { }
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
$definition->addMethodCall('addAllowedUrls', [$additionalUrlsKey, $additionalUrlsArr]); } } }
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 static function lib($var) { $file = GX_LIB.$var.'.class.php'; if (file_exists($file)) { include($file); } }
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 removeOptionValidator() { $this->optionValidator = null; return $this; }
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 editTitle() { global $user; $file = new expFile($this->params['id']); if ($user->id==$file->poster || $user->isAdmin()) { $file->title = $this->params['newValue']; $file->save(); $ar = new expAjaxReply(200, gt('Your title was updated successfully'), $file); } else { $ar = new expAjaxReply(300, gt("You didn't create this file, so you can't edit it.")); } $ar->send(); }
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 sendHttpHeaders() { $https = $GLOBALS['PMA_Config']->isHttps(); $mapTilesUrls = ' *.tile.openstreetmap.org *.tile.opencyclemap.org'; /** * Sends http headers */ $GLOBALS['now'] = gmdate('D, d M Y H:i:s') . ' GMT'; if (! defined('TESTSUITE')) { /* Prevent against ClickJacking by disabling framing */ if (! $GLOBALS['cfg']['AllowThirdPartyFraming']) { header( 'X-Frame-Options: DENY' ); } header( "X-Content-Security-Policy: default-src 'self' " . $GLOBALS['cfg']['CSPAllow'] . ';' . "options inline-script eval-script;" . "img-src 'self' data: " . $GLOBALS['cfg']['CSPAllow'] . ($https ? "" : $mapTilesUrls) . ";" ); if (PMA_USR_BROWSER_AGENT == 'SAFARI' && PMA_USR_BROWSER_VER < '6.0.0' ) { header( "X-WebKit-CSP: allow 'self' " . $GLOBALS['cfg']['CSPAllow'] . ';' . "options inline-script eval-script;" . "img-src 'self' data: " . $GLOBALS['cfg']['CSPAllow'] . ($https ? "" : $mapTilesUrls) . ";" ); } else {
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
$text = wfMessage( 'intersection_noincludecats', $args )->text(); } } if ( empty( $text ) ) { $text = wfMessage( 'dpl_log_' . $errorMessageId, $args )->text(); } $this->buffer[] = '<p>Extension:DynamicPageList (DPL), version ' . DPL_VERSION . ': ' . $text . '</p>'; } return false; }
0
PHP
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
vulnerable
public function getQuerySelect() { return ''; }
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 saveConfig() { if (!empty($this->params['aggregate']) || !empty($this->params['pull_rss'])) { if ($this->params['order'] == 'rank ASC') { expValidator::failAndReturnToForm(gt('User defined ranking is not allowed when aggregating or pull RSS data feeds.'), $this->params); } } parent::saveConfig(); }
0
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
vulnerable
$form .= "<option value='".$advertiser['clientid']."'>".htmlspecialchars(MAX_buildName($advertiser['clientid'], $advertiser['clientname']))."</option>"; } $form .= "</select><input type='image' class='submit' src='" . OX::assetPath() . "/images/".$GLOBALS['phpAds_TextDirection']."/go_blue.gif'></form>"; addPageFormTool($GLOBALS['strMoveTo'], 'iconTrackerMove', $form); //delete $deleteConfirm = phpAds_DelConfirm($GLOBALS['strConfirmDeleteTracker']); addPageLinkTool($GLOBALS["strDelete"], MAX::constructUrl(MAX_URL_ADMIN, "tracker-delete.php?token=".urlencode($token)."&clientid=".$advertiserId."&trackerid=".$trackerId."&returnurl=advertiser-trackers.php"), "iconDelete", null, $deleteConfirm); addPageShortcut($GLOBALS['strBackToTrackers'], MAX::constructUrl(MAX_URL_ADMIN, "advertiser-trackers.php?clientid=$advertiserId"), "iconBack"); }
1
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
safe
public static function start() { $url = Site::$url; $site_id = !defined('SITE_ID') ? 'Installation' : SITE_ID; session_name('GeniXCMS-'.$site_id); session_start(); $uri = parse_url($url); // print_r($uri); //unset($_SESSION); if (!isset($_SESSION['gxsess']) || $_SESSION['gxsess'] == '') { $_SESSION['gxsess'] = array( 'key' => self::sesKey(), 'time' => date('Y-m-d H:i:s'), 'val' => array(), ); } session_regenerate_id(); $path = isset($uri['path'])? $uri['path']: ''; setcookie(session_name(), session_id(), time() + 3600, $path); $GLOBALS['start_time'] = microtime(true); }
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 function sendXML($items_id, $itemtype) { if (call_user_func([$itemtype, 'canView'])) { $xml = file_get_contents(GLPI_PLUGIN_DOC_DIR."/fusioninventory/xml/".$items_id); echo $xml; } else { Html::displayRightError(); } }
0
PHP
CWE-19
Data Processing Errors
Weaknesses in this category are typically found in functionality that processes data. Data processing is the manipulation of input to retrieve or save information.
https://cwe.mitre.org/data/definitions/19.html
vulnerable
private function generateTempFileData() { return [ 'name' => md5(mt_rand()), 'tmp_name' => tempnam(sys_get_temp_dir(), ''), 'type' => 'image/jpeg', 'size' => mt_rand(1000, 10000), 'error' => '0', ]; }
0
PHP
CWE-330
Use of Insufficiently Random Values
The software uses insufficiently random numbers or values in a security context that depends on unpredictable numbers.
https://cwe.mitre.org/data/definitions/330.html
vulnerable
public static function BBCode2Html($text) { $text = trim($text); $text = self::parseEmoji($text); // Smileys to find... $in = array( ); // And replace them by... $out = array( ); $in[] = '[/*]'; $in[] = '[*]'; $out[] = '</li>'; $out[] = '<li>'; $text = str_replace($in, $out, $text); // BBCode to find... $in = array( '/\[b\](.*?)\[\/b\]/ms', '/\[i\](.*?)\[\/i\]/ms', '/\[u\](.*?)\[\/u\]/ms', '/\[mark\](.*?)\[\/mark\]/ms', '/\[s\](.*?)\[\/s\]/ms', '/\[list\=(.*?)\](.*?)\[\/list\]/ms', '/\[list\](.*?)\[\/list\]/ms', '/\[\*\]\s?(.*?)\n/ms', '/\[fs(.*?)\](.*?)\[\/fs(.*?)\]/ms', '/\[color\=(.*?)\](.*?)\[\/color\]/ms' ); // And replace them by... $out = array( '\1', '\1', '\1', '\1', '\1', '\2', '\1', '\1', '\2', '\2' ); $text = preg_replace($in, $out, $text); // Prepare quote's $text = str_replace("\r\n","\n",$text); // paragraphs $text = str_replace("\r", "", $text); return $text; }
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
$evs = $this->event->find('all', "id=" . $edate->event_id . $featuresql); foreach ($evs as $key=>$event) { if ($condense) { $eventid = $event->id; $multiday_event = array_filter($events, create_function('$event', 'global $eventid; return $event->id === $eventid;')); if (!empty($multiday_event)) { unset($evs[$key]); continue; } } $evs[$key]->eventstart += $edate->date; $evs[$key]->eventend += $edate->date; $evs[$key]->date_id = $edate->id; if (!empty($event->expCat)) { $catcolor = empty($event->expCat[0]->color) ? null : trim($event->expCat[0]->color); // if (substr($catcolor,0,1)=='#') $catcolor = '" style="color:'.$catcolor.';'; $evs[$key]->color = $catcolor; } } if (count($events) < 500) { // magic number to not crash loop? $events = array_merge($events, $evs); } else { // $evs[$key]->title = gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!'); // $events = array_merge($events, $evs); flash('notice',gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!')); break; // keep from breaking system by too much data } }
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 dropdown($vars) { if(is_array($vars)){ //print_r($vars); $name = $vars['name']; $where = "WHERE "; if(isset($vars['parent'])) { $where .= " `parent` = '{$vars['parent']}' "; }else{ $where .= "1 "; } $order_by = "ORDER BY "; if(isset($vars['order_by'])) { $order_by .= " {$vars['order_by']} "; }else{ $order_by .= " `name` "; } if (isset($vars['sort'])) { $sort = " {$vars['sort']}"; }else{ $sort = " ASC"; } } $cat = Db::result("SELECT * FROM `cat` {$where} {$order_by} {$sort}"); //print_r($cat); $drop = "<select name=\"{$name}\" class=\"form-control\"><option></option>"; if(Db::$num_rows > 0 ){ foreach ($cat as $c) { # code... if($c->parent == null || $c->parent == '0' ){ if(isset($vars['selected']) && $c->id == $vars['selected']) $sel = "SELECTED"; else $sel = ""; $drop .= "<option value=\"{$c->id}\" $sel style=\"padding-left: 10px;\">{$c->name}</option>"; foreach ($cat as $c2) { # code... if($c2->parent == $c->id){ if(isset($vars['selected']) && $c2->id == $vars['selected']) $sel = "SELECTED"; else $sel = ""; $drop .= "<option value=\"{$c2->id}\" $sel style=\"padding-left: 10px;\">&nbsp;&nbsp;&nbsp;{$c2->name}</option>"; } } } } } $drop .= "</select>"; return $drop; }
1
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
safe
public static function create() { self::ridOld(); $length = "80"; $token = ""; $codeAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; $codeAlphabet.= "abcdefghijklmnopqrstuvwxyz"; $codeAlphabet.= "0123456789"; $codeAlphabet.= SECURITY; for($i=0;$i<$length;$i++){ $token .= $codeAlphabet[Typo::crypto_rand_secure(0,strlen($codeAlphabet))]; } $url = $_SERVER['REQUEST_URI']; $url = htmlspecialchars($url, ENT_QUOTES, 'UTF-8'); $ip = $_SERVER['REMOTE_ADDR']; $time = time(); define('TOKEN', $token); define('TOKEN_URL', $url); define('TOKEN_IP', $ip); define('TOKEN_TIME', $time); $json = self::json(); Options::update('tokens',$json); return $token; }
1
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
safe
public function testCreateRelationshipMeta() { // test $GLOBALS['log']->reset(); SugarBean::createRelationshipMeta(null, null, null, array(), null); self::assertCount(1, $GLOBALS['log']->calls['fatal']); // test $GLOBALS['log']->reset(); SugarBean::createRelationshipMeta(null, null, null, array(), 'Contacts'); self::assertCount(1, $GLOBALS['log']->calls['fatal']); // test $GLOBALS['log']->reset(); SugarBean::createRelationshipMeta(null, null, null, array(), 'Contacts', true); self::assertCount(1, $GLOBALS['log']->calls['fatal']); // test $GLOBALS['log']->reset(); SugarBean::createRelationshipMeta('User', null, null, array(), 'Contacts'); self::assertCount(8, $GLOBALS['log']->calls['fatal']); // test $GLOBALS['log']->reset(); SugarBean::createRelationshipMeta('User', $this->db, null, array(), 'Contacts'); self::assertNotTrue(isset($GLOBALS['log']->calls['fatal'])); // test $GLOBALS['log']->reset(); SugarBean::createRelationshipMeta('Nonexists1', $this->db, null, array(), 'Nonexists2'); self::assertCount(1, $GLOBALS['log']->calls['debug']); // test $GLOBALS['log']->reset(); SugarBean::createRelationshipMeta('User', null, null, array(), 'Contacts'); self::assertCount(8, $GLOBALS['log']->calls['fatal']); }
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
elseif ($permission === $mergedPermission && $mergedPermissions[$permission] === 1) { $matched = true; break; }
0
PHP
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
public function __construct($host, $user, $password) { $this->host = $host; list($workgroup, $user) = $this->splitUser($user); $this->user = $user; $this->workgroup = $workgroup; $this->password = $password; }
1
PHP
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
foreach ($page as $pageperm) { if (!empty($pageperm['manage'])) return true; }
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 remove() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->remove($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane removed successfully.')); } else { $this->flash->failure(t('Unable to remove this swimlane.')); } $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); }
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 addDecorator($decorator) { if (is_string($decorator)) { $class = "HTMLPurifier_DefinitionCache_Decorator_$decorator"; $decorator = new $class; } $this->decorators[$decorator->name] = $decorator; }
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 XMLRPCremoveUserGroupPriv($name, $affiliation, $nodeid, $permissions) { require_once(".ht-inc/privileges.php"); global $user; if(! is_numeric($nodeid)) { return array('status' => 'error', 'errorcode' => 78, 'errormsg' => 'Invalid nodeid specified'); } if(! checkUserHasPriv("userGrant", $user['id'], $nodeid)) { return array('status' => 'error', 'errorcode' => 65, 'errormsg' => 'Unable to remove user group privileges on this node'); } $validate = array('name' => $name, 'affiliation' => $affiliation); $rc = validateAPIgroupInput($validate, 1); if($rc['status'] == 'error') return $rc; $groupid = $rc['id']; #$name = "$name@$affiliation"; $perms = explode(':', $permissions); $usertypes = getTypes('users'); array_push($usertypes["users"], "block"); array_push($usertypes["users"], "cascade"); $diff = array_diff($perms, $usertypes['users']); if(count($diff)) { return array('status' => 'error', 'errorcode' => 66, 'errormsg' => 'Invalid or missing permissions list supplied'); } $cnp = getNodeCascadePrivileges($nodeid, "usergroups"); $np = getNodePrivileges($nodeid, "usergroups"); if(array_key_exists($name, $cnp['usergroups']) && (! array_key_exists($name, $np['usergroups']) || ! in_array('block', $np['usergroups'][$name]))) { $intersect = array_intersect($cnp['usergroups'][$name]['privs'], $perms); if(count($intersect)) { return array('status' => 'error', 'errorcode' => 80, 'errormsg' => 'Unable to modify privileges cascaded to this node'); } } $diff = array_diff($np['usergroups'][$name]['privs'], $perms); if(count($diff) == 1 && in_array("cascade", $diff)) array_push($perms, "cascade"); updateUserOrGroupPrivs($groupid, $nodeid, array(), $perms, "group"); return array('status' => 'success'); }
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 testValidation () { $contact = $this->contacts ('testAnyone'); $tag = new Tags (); $tag->setAttributes (array ( 'itemId' => $contact->id, 'type' => get_class ($contact), 'itemName' => $contact->name, 'tag' => 'test', 'taggedBy' => 'testuser', )); $this->assertSaves ($tag); // ensure that normalization was performed upon validation $this->assertEquals (Tags::normalizeTag ('test'), $tag->tag); // ensure that tag must be unique $tag = new Tags (); $tag->setAttributes (array ( 'itemId' => $contact->id, 'type' => get_class ($contact), 'itemName' => $contact->name, 'tag' => 'test', 'taggedBy' => 'testuser', )); $tag->validate (); $this->assertTrue ($tag->hasErrors ('tag')); // ensure that tag must be unique $tag = new Tags (); $tag->setAttributes (array ( 'itemId' => $contact->id, 'type' => get_class ($contact), 'itemName' => $contact->name, 'tag' => '#test', 'taggedBy' => 'testuser', )); $tag->validate (); $this->assertTrue ($tag->hasErrors ('tag')); // ensure that tag must be unique $tag = new Tags (); $tag->setAttributes (array ( 'itemId' => $contact->id, 'type' => get_class ($contact), 'itemName' => $contact->name, 'tag' => '#test,', 'taggedBy' => 'testuser', )); $tag->validate (); $this->assertTrue ($tag->hasErrors ('tag')); }
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 confirm() { $task = $this->getTask(); $comment = $this->getComment(); $this->response->html($this->template->render('comment/remove', array( 'comment' => $comment, 'task' => $task, 'title' => t('Remove a 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
$child->accept($this); } }
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 gc($force = false) { if ($force || mt_rand(0, 1000000) < $this->gcProbability) { $this->db->createCommand() ->delete($this->cacheTable, '[[expire]] > 0 AND [[expire]] < ' . time()) ->execute(); } }
0
PHP
CWE-330
Use of Insufficiently Random Values
The software uses insufficiently random numbers or values in a security context that depends on unpredictable numbers.
https://cwe.mitre.org/data/definitions/330.html
vulnerable
public static function flagLib() { return '<link href="'.Site::$url.'/assets/css/flag-icon.min.css" rel="stylesheet">'; }
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 addPrefix($prefix) { $this->prefixes[] = $prefix; }
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 edit_order_item() { $oi = new orderitem($this->params['id'], true, true); if (empty($oi->id)) { flash('error', gt('Order item doesn\'t exist.')); expHistory::back(); } $oi->user_input_fields = expUnserialize($oi->user_input_fields); $params['options'] = $oi->opts; $params['user_input_fields'] = $oi->user_input_fields; $oi->product = new product($oi->product->id, true, true); if ($oi->product->parent_id != 0) { $parProd = new product($oi->product->parent_id); //$oi->product->optiongroup = $parProd->optiongroup; $oi->product = $parProd; } //FIXME we don't use selectedOpts? // $oi->selectedOpts = array(); // if (!empty($oi->opts)) { // foreach ($oi->opts as $opt) { // $option = new option($opt[0]); // $og = new optiongroup($option->optiongroup_id); // if (!isset($oi->selectedOpts[$og->id]) || !is_array($oi->selectedOpts[$og->id])) // $oi->selectedOpts[$og->id] = array($option->id); // else // array_push($oi->selectedOpts[$og->id], $option->id); // } // } //eDebug($oi->selectedOpts); assign_to_template(array( 'oi' => $oi, 'params' => $params )); }
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 edit() { global $template; parent::edit(); $allforms = array(); $allforms[""] = gt('Disallow Feedback'); // calculate which event date is the one being edited $event_key = 0; foreach ($template->tpl->tpl_vars['record']->value->eventdate as $key=>$d) { if ($d->id == $this->params['date_id']) $event_key = $key; } assign_to_template(array( 'allforms' => array_merge($allforms, expTemplate::buildNameList("forms", "event/email", "tpl", "[!_]*")), 'checked_date' => !empty($this->params['date_id']) ? $this->params['date_id'] : null, 'event_key' => $event_key, )); }
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 approve_submit() { global $history; if (empty($this->params['id'])) { flash('error', gt('No ID supplied for comment to approve')); $lastUrl = expHistory::getLast('editable'); } /* 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']); //FIXME here is where we might sanitize the note before approving it $simplenote->body = $this->params['body']; $simplenote->approved = $this->params['approved']; $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); }
0
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
vulnerable
public static function createFromGlobals() { // With the php's bug #66606, the php's built-in web server // stores the Content-Type and Content-Length header values in // HTTP_CONTENT_TYPE and HTTP_CONTENT_LENGTH fields. $server = $_SERVER; if ('cli-server' === PHP_SAPI) { if (array_key_exists('HTTP_CONTENT_LENGTH', $_SERVER)) { $server['CONTENT_LENGTH'] = $_SERVER['HTTP_CONTENT_LENGTH']; } if (array_key_exists('HTTP_CONTENT_TYPE', $_SERVER)) { $server['CONTENT_TYPE'] = $_SERVER['HTTP_CONTENT_TYPE']; } } $request = self::createRequestFromFactory($_GET, $_POST, array(), $_COOKIE, $_FILES, $server); if (0 === strpos($request->headers->get('CONTENT_TYPE'), 'application/x-www-form-urlencoded') && in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), array('PUT', 'DELETE', 'PATCH')) ) { parse_str($request->getContent(), $data); $request->request = new ParameterBag($data); } return $request; }
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 confirm() { $project = $this->getProject(); $this->response->html($this->helper->layout->project('column/remove', array( 'column' => $this->columnModel->getById($this->request->getIntegerParam('column_id')), 'project' => $project, ))); }
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
echo '<LANGUAGE>' . htmlentities($value_arr['LANGUAGE']) . '</LANGUAGE>'; foreach ($value_arr['ENROLLMENT_INFO'] as $eid => $ed) { echo '<ENROLLMENT_INFO_' . htmlentities($eid) . '>'; echo '<SCHOOL_ID>' . htmlentities($ed['SCHOOL_ID']) . '</SCHOOL_ID>'; echo '<CALENDAR>' . htmlentities($ed['CALENDAR']) . '</CALENDAR>'; echo '<GRADE>' . htmlentities($ed['GRADE']) . '</GRADE>'; echo '<SECTION>' . htmlentities($ed['SECTION']) . '</SECTION>'; echo '<START_DATE>' . htmlentities($ed['START_DATE']) . '</START_DATE>'; echo '<DROP_DATE>' . htmlentities($ed['DROP_DATE']) . '</DROP_DATE>'; echo '<ENROLLMENT_CODE>' . htmlentities($ed['ENROLLMENT_CODE']) . '</ENROLLMENT_CODE>'; echo '<DROP_CODE>' . htmlentities($ed['DROP_CODE']) . '</DROP_CODE>'; echo '</ENROLLMENT_INFO_' . htmlentities($eid) . '>'; } echo '</STUDENT>'; } echo '</SCHOOL>'; }
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 parseAndTrim($str, $isHTML = false) { //�Death from above�? � //echo "1<br>"; eDebug($str); // global $db; $str = str_replace("�", "&rsquo;", $str); $str = str_replace("�", "&lsquo;", $str); $str = str_replace("�", "&#174;", $str); $str = str_replace("�", "-", $str); $str = str_replace("�", "&#151;", $str); $str = str_replace("�", "&rdquo;", $str); $str = str_replace("�", "&ldquo;", $str); $str = str_replace("\r\n", " ", $str); //$str = str_replace(",","\,",$str); $str = str_replace('\"', "&quot;", $str); $str = str_replace('"', "&quot;", $str); $str = str_replace("�", "&#188;", $str); $str = str_replace("�", "&#189;", $str); $str = str_replace("�", "&#190;", $str); //$str = htmlspecialchars($str); //$str = utf8_encode($str); // if (DB_ENGINE=='mysqli') { // $str = @mysqli_real_escape_string($db->connection,trim(str_replace("�", "&trade;", $str))); // } elseif(DB_ENGINE=='mysql') { // $str = @mysql_real_escape_string(trim(str_replace("�", "&trade;", $str)),$db->connection); // } else { // $str = trim(str_replace("�", "&trade;", $str)); // } $str = @expString::escape(trim(str_replace("�", "&trade;", $str))); //echo "2<br>"; eDebug($str,die); return $str; }
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 edit_section() { global $db, $user; $parent = new section($this->params['parent']); if (empty($parent->id)) $parent->id = 0; assign_to_template(array( 'haveStandalone' => ($db->countObjects('section', 'parent=-1') && $parent->id >= 0), 'parent' => $parent, 'isAdministrator' => $user->isAdmin(), )); }
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 testGetClientIpsWithConflictingHeadersProvider() { // $httpForwarded $httpXForwardedFor return array( array('for=87.65.43.21', '192.0.2.60'), array('for=87.65.43.21, for=192.0.2.60', '192.0.2.60'), array('for=192.0.2.60', '192.0.2.60,87.65.43.21'), array('for="::face", for=192.0.2.60', '192.0.2.60,192.0.2.43'), array('for=87.65.43.21, for=192.0.2.60', '192.0.2.60,87.65.43.21'), ); }
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 XMLRPCaddUserGroup($name, $affiliation, $owner, $managingGroup, $initialMaxTime, $totalMaxTime, $maxExtendTime, $custom=1) { global $user; if(! in_array('groupAdmin', $user['privileges'])) { return array('status' => 'error', 'errorcode' => 16, 'errormsg' => 'access denied for managing groups'); } $validate = array('name' => $name, 'affiliation' => $affiliation, 'owner' => $owner, 'managingGroup' => $managingGroup, 'initialMaxTime' => $initialMaxTime, 'totalMaxTime' => $totalMaxTime, 'maxExtendTime' => $maxExtendTime, 'custom' => $custom); $rc = validateAPIgroupInput($validate, 0); if($rc['status'] == 'error') return $rc; if($custom != 0 && $custom != 1) $custom = 1; if(! $custom) $rc['managingGroupID'] = NULL; $data = array('type' => 'user', 'owner' => $owner, 'name' => $name, 'affiliationid' => $rc['affiliationid'], 'editgroupid' => $rc['managingGroupID'], 'initialmax' => $initialMaxTime, 'totalmax' => $totalMaxTime, 'maxextend' => $maxExtendTime, 'overlap' => 0, 'custom' => $custom); if(! addGroup($data)) { return array('status' => 'error', 'errorcode' => 26, 'errormsg' => 'failure while adding group to database'); } return array('status' => 'success'); }
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
list($h, $m) = explode('.', $row['RunAt']); $main .= '<div style="' . $extra_css . '" class="phoromatic_overview_box">'; $main .= '<h1><a href="?schedules/' . $row['ScheduleID'] . '">' . $row['Title'] . '</a></h1>'; if(!empty($systems_for_schedule)) { if($row['RunAt'] > date('H.i')) { $run_in_future = true; $main .= '<h3>Runs In ' . pts_strings::format_time((($h * 60) + $m) - ((date('H') * 60) + date('i')), 'MINUTES') . '</h3>'; } else { $run_in_future = false; $main .= '<h3>Triggered ' . pts_strings::format_time(max(1, (date('H') * 60) + date('i') - (($h * 60) + $m)), 'MINUTES') . ' Ago</h3>'; } } foreach($systems_for_schedule as $system_id) { $pprid = self::result_match($row['ScheduleID'], $system_id, date('Y-m-d')); if($pprid) $main .= '<a href="?result/' . $pprid . '">'; $main .= phoromatic_server::system_id_to_name($system_id); if($pprid) $main .= '</a>'; else if(!$run_in_future) { $sys_info = self::system_info($system_id); $last_comm_diff = time() - strtotime($sys_info['LastCommunication']); $main .= ' <sup><a href="?systems/' . $system_id . '">'; if($last_comm_diff > 3600) { $main .= '<strong>Last Communication: ' . pts_strings::format_time($last_comm_diff, 'SECONDS', true, 60) . ' Ago</strong>'; } else { $main .= $sys_info['CurrentTask']; } $main .= '</a></sup>'; } $main .= '<br />'; } $main .= '</div>'; } $main .= '</div>'; $main .= '</div>'; echo '<div id="pts_phoromatic_main_area">' . $main . '</div>'; //echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in()); echo phoromatic_webui_footer(); }
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
$result = $search->getSearchResults($item->query, false, true); if(empty($result) && !in_array($item->query, $badSearchArr)) { $badSearchArr[] = $item->query; $badSearch[$ctr2]['query'] = $item->query; $badSearch[$ctr2]['count'] = $db->countObjects("search_queries", "query='{$item->query}'"); $ctr2++; } } //Check if the user choose from the dropdown if(!empty($user_default)) { if($user_default == $anonymous) { $u_id = 0; } else { $u_id = $user_default; } $where .= "user_id = {$u_id}"; } //Get all the search query records $records = $db->selectObjects('search_queries', $where); for ($i = 0, $iMax = count($records); $i < $iMax; $i++) { if(!empty($records[$i]->user_id)) { $u = user::getUserById($records[$i]->user_id); $records[$i]->user = $u->firstname . ' ' . $u->lastname; } } $page = new expPaginator(array( 'records' => $records, 'where'=>1, 'model'=>'search_queries', 'limit'=>(isset($this->config['limit']) && $this->config['limit'] != '') ? 10 : $this->config['limit'], 'order'=>empty($this->config['order']) ? 'timestamp' : $this->config['order'], 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->baseclassname, 'action'=>$this->params['action'], 'columns'=>array( 'ID'=>'id', gt('Query')=>'query', gt('Timestamp')=>'timestamp', gt('User')=>'user_id', ), )); $uname['id'] = implode($uname['id'],','); $uname['name'] = implode($uname['name'],','); assign_to_template(array( 'page'=>$page, 'users'=>$uname, 'user_default' => $user_default, 'badSearch' => $badSearch )); }
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
static function isSearchable() { return true; }
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