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
$rst[$key] = self::parseAndTrim($st, $unescape); } return $rst; } $str = str_replace("<br>"," ",$str); $str = str_replace("</br>"," ",$str); $str = str_replace("<br/>"," ",$str); $str = str_replace("<br />"," ",$str); $str = str_replace("\r\n"," ",$str); $str = str_replace('"',"&quot;",$str); $str = str_replace("'","&#39;",$str); $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("¼","&#188;",$str); $str = str_replace("½","&#189;",$str); $str = str_replace("¾","&#190;",$str); $str = str_replace("™","&trade;", $str); $str = trim($str); if ($unescape) { $str = stripcslashes($str); } else { $str = addslashes($str); } 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
$dplArg = $this->wgRequest->getVal( $arg, '' ); if ( $dplArg == '' ) { $input = preg_replace( '/\{%' . $arg . ':(.*)%\}/U', '\1', $input ); $input = str_replace( '{%' . $arg . '%}', '', $input ); } else { $input = preg_replace( '/\{%' . $arg . ':.*%\}/U ', $dplArg, $input ); $input = str_replace( '{%' . $arg . '%}', $dplArg, $input ); } } return $input; }
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 addElementToContentSet($element, $type) { if (!isset($this->content_sets[$type])) $this->content_sets[$type] = ''; else $this->content_sets[$type] .= ' | '; $this->content_sets[$type] .= $element; }
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
$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
public function fetchRow($sql) { // retrieve row $query_id = $this->query($sql); $record = mysql_fetch_row($this->query_id); $this->freeResult($query_id); return $record; }#-#fetchRow()
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
private function mail_passthru($to, $subject, $body, $header, $params) { if ( ini_get('safe_mode') || !($this->UseSendmailOptions) ) { $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($subject)), $body, $header); } else { $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($subject)), $body, $header, $params); } return $rt; }
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 usesOption() { return $this->useOption; }
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
foreach ($data['alertred'] as $alert) { # code... echo "<li>$alert</li>\n"; }
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 check_file_dir_name($label) { if (empty($label) || preg_match('/[^A-Za-z0-9_.-]/', $label)) die(xlt("ERROR: The following variable contains invalid characters").": ". attr($label)); }
0
PHP
CWE-116
Improper Encoding or Escaping of Output
The software prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. As a result, the intended structure of the message is not preserved.
https://cwe.mitre.org/data/definitions/116.html
vulnerable
foreach($fields as $field) { if(substr($key, 0, strlen($field.'-'))==$field.'-') { $this->dictionary[substr($key, strlen($field.'-'))][$field] = $value; } }
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 editor($mode = 'light'){ $editor = Options::v('use_editor'); if($editor == 'on'){ $GLOBALS['editor'] = true; }else{ $GLOBALS['editor'] = false; } if ($mode == 'light') { $GLOBALS['editor_mode'] = 'light'; }else{ $GLOBALS['editor_mode'] = 'full'; } //return $editor; }
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 confirm() { $project = $this->getProject(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); $this->response->html($this->template->render('project_tag/remove', array( 'tag' => $tag, '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
function XMLRPCaddImageToGroup($name, $imageid) { if($groupid = getResourceGroupID("image/$name")) { $groups = getUserResources(array("imageAdmin"), array("manageGroup"), 1); if(! array_key_exists($groupid, $groups['image'])) { return array('status' => 'error', 'errorcode' => 46, 'errormsg' => 'Unable to access image group'); } $resources = getUserResources(array("imageAdmin"), array("manageGroup")); if(! array_key_exists($imageid, $resources['image'])) { return array('status' => 'error', 'errorcode' => 47, 'errormsg' => 'Unable to access image'); } $allimages = getImages(0, $imageid); $query = "INSERT IGNORE INTO resourcegroupmembers " . "(resourceid, " . "resourcegroupid) " . "VALUES " . "({$allimages[$imageid]['resourceid']}, " . "$groupid)"; doQuery($query); return array('status' => 'success'); } else { return array('status' => 'error', 'errorcode' => 83, 'errormsg' => 'invalid resource group name'); } }
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 update_optiongroup_master() { global $db; $id = empty($this->params['id']) ? null : $this->params['id']; $og = new optiongroup_master($id); $oldtitle = $og->title; $og->update($this->params); // if the title of the master changed we should update the option groups that are already using it. if ($oldtitle != $og->title) { $db->sql('UPDATE '.$db->prefix.'optiongroup SET title="'.$og->title.'" WHERE title="'.$oldtitle.'"'); } 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[$index] = strip_tags($value); if($return[$index] == 'zero') $return[$index] = '0'; } } elseif($type == ARG_MULTISTRING) { foreach($return as $index => $value) { $return[$index] = strip_tags($value); } } else $return = strip_tags($return); if(! empty($return) && $type == ARG_NUMERIC) { if(! is_numeric($return)) { return preg_replace('([^\d])', '', $return); } } elseif(! empty($return) && $type == ARG_STRING) { if(! is_string($return)) $return = $defaultvalue; } elseif(! empty($return) && $type == ARG_MULTINUMERIC) { foreach($return as $index => $value) { if(! is_numeric($value)) { $return[$index] = preg_replace('([^\d])', '', $value); } } return $return; } elseif(! empty($return) && $type == ARG_MULTISTRING) { foreach($return as $index => $value) { if(! is_string($value)) $return[$index] = $defaultvalue; elseif($addslashes) $return[$index] = addslashes($value); } return $return; } if(is_string($return)) { if(strlen($return) == 0) $return = $defaultvalue; elseif($addslashes) $return = addslashes($return); } return $return; }
0
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
vulnerable
static function convertXMLFeedSafeChar($str) { $str = str_replace("<br>","",$str); $str = str_replace("</br>","",$str); $str = str_replace("<br/>","",$str); $str = str_replace("<br />","",$str); $str = str_replace("&quot;",'"',$str); $str = str_replace("&#39;","'",$str); $str = str_replace("&rsquo;","'",$str); $str = str_replace("&lsquo;","'",$str); $str = str_replace("&#174;","",$str); $str = str_replace("�","-", $str); $str = str_replace("�","-", $str); $str = str_replace("�", '"', $str); $str = str_replace("&rdquo;",'"', $str); $str = str_replace("�", '"', $str); $str = str_replace("&ldquo;",'"', $str); $str = str_replace("\r\n"," ",$str); $str = str_replace("�"," 1/4",$str); $str = str_replace("&#188;"," 1/4", $str); $str = str_replace("�"," 1/2",$str); $str = str_replace("&#189;"," 1/2",$str); $str = str_replace("�"," 3/4",$str); $str = str_replace("&#190;"," 3/4",$str); $str = str_replace("�", "(TM)", $str); $str = str_replace("&trade;","(TM)", $str); $str = str_replace("&reg;","(R)", $str); $str = str_replace("�","(R)",$str); $str = str_replace("&","&amp;",$str); $str = str_replace(">","&gt;",$str); return trim($str); }
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_optiongroup_master() { expHistory::set('editable', $this->params); $id = isset($this->params['id']) ? $this->params['id'] : null; $record = new optiongroup_master($id); assign_to_template(array( 'record'=>$record )); }
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 canImportData() { 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
function __construct($data) { $this->data = $data; }
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 injectProof($string) { $quotes = substr_count("'", $string); if ($quotes % 2 != 0) $string = $this->escapeString($string); $dquotes = substr_count('"', $string); if ($dquotes % 2 != 0) $string = $this->escapeString($string); return $string; }
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 settings_save() { AuthUser::load(); if (!AuthUser::isLoggedIn()) { redirect(get_url('login')); } else if (!AuthUser::hasPermission('admin_edit')) { Flash::set('error', __('You do not have permission to access the requested page!')); redirect(get_url()); } if (!isset($_POST['settings'])) { Flash::set('error', 'File Manager - ' . __('form was not posted.')); redirect(get_url('plugin/file_manager/settings')); } else { $settings = $_POST['settings']; if ($settings['umask'] == 0) $settings['umask'] = 0; elseif (!preg_match('/^0?[0-7]{3}$/', $settings['umask'])) $settings['umask'] = 0; if (strlen($settings['umask']) === 3) $settings['umask'] = '0' . $settings['umask']; elseif (strlen($settings['umask']) !== 4 && $settings['umask'] != 0) $settings['umask'] = 0; if (!preg_match('/^0?[0-7]{3}$/', $settings['dirmode'])) $settings['dirmode'] = '0755'; if (strlen($settings['dirmode']) === 3) $settings['dirmode'] = '0' . $settings['dirmode']; if (!preg_match('/^0?[0-7]{3}$/', $settings['filemode'])) $settings['filemode'] = '0755'; if (strlen($settings['filemode']) === 3) $settings['filemode'] = '0' . $settings['filemode']; } if (Plugin::setAllSettings($settings, 'file_manager')) Flash::setNow('success', 'File Manager - ' . __('plugin settings saved.')); else Flash::setNow('error', 'File Manager - ' . __('plugin settings not saved!')); $this->display('file_manager/views/settings', array('settings' => $settings)); }
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 saveconfig() { global $db; if (empty($this->params['id'])) return false; $calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']); $calc = new $calcname($this->params['id']); $conf = serialize($calc->parseConfig($this->params)); $calc->update(array('config'=>$conf)); 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
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; } }
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 columnUpdate($table, $col, $val, $where=1) { $res = @mysqli_query($this->connection, "UPDATE `" . $this->prefix . "$table` SET `$col`='" . $val . "' WHERE $where"); /*if ($res == null) return array(); $objects = array(); for ($i = 0; $i < mysqli_num_rows($res); $i++) $objects[] = mysqli_fetch_object($res);*/ //return $objects; }
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 = ['form' => tep_draw_form('languages', 'languages.php', 'page=' . $_GET['page'] . '&lID=' . $lInfo->languages_id . '&action=save')];
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 setModel(Model $model) { $this->model = $model; $this->extensions = $this->model->getAllowedExtensions(); $this->from($this->model->getObjectTypeDirName()); return $this; }
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 update() { global $DB; $ok = $DB->execute(' UPDATE nv_menus SET codename = :codename, icon = :icon, lid = :lid, notes = :notes, functions = :functions, enabled = :enabled WHERE id = :id', array( 'id' => $this->id, 'codename' => value_or_default($this->codename, ""), 'icon' => value_or_default($this->icon, ""), 'lid' => value_or_default($this->lid, 0), 'notes' => value_or_default($this->notes, ""), 'functions' => json_encode($this->functions), 'enabled' => value_or_default($this->enabled, 0) ) ); if(!$ok) throw new Exception($DB->get_last_error()); return true; }
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 getZipFile() { $path = $_SESSION['__path']; unset($_SESSION['__path']); $filename = basename($path); if (is_file($path)) { // Send the file for download! header("Expires: 0"); header("Cache-Control: must-revalidate"); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=$filename"); header("Content-Description: File Transfer"); @readfile($path); // Delete the temporary file unlink($path); } }
1
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
safe
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['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 static function scrap($param) { if ($param != '') { foreach ($param as $k => $v) { if (is_array($v)) { foreach ($v as $k2 => $v2) { $data[$k2] = $v2; } }else{ $data = ''; } } } else { $data = ''; } return $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
$debug_info .= sprintf("%s%s\r\n", str_pad($header_name . ': ', 20), w3_escape_comment($header_value)); } }
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
function phpAds_clearSession() { $GLOBALS['session'] = array( '__authentic__' => true, ); }
1
PHP
CWE-384
Session Fixation
Authenticating a user, or otherwise establishing a new user session, without invalidating any existing session identifier gives an attacker the opportunity to steal authenticated sessions.
https://cwe.mitre.org/data/definitions/384.html
safe
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-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 validate($string, $config, $context) { // regular pre-processing $string = $this->parseCDATA($string); if ($string === '') return false; // assumes URI doesn't have spaces in it $bits = explode(' ', strtolower($string)); // bits to process $caught = array(); $caught['type'] = false; $caught['position'] = false; $caught['image'] = false; $i = 0; // number of catches $none = false; foreach ($bits as $bit) { if ($i >= 3) return; // optimization bit if ($bit === '') continue; foreach ($caught as $key => $status) { if ($status !== false) continue; $r = $this->info['list-style-' . $key]->validate($bit, $config, $context); if ($r === false) continue; if ($r === 'none') { if ($none) continue; else $none = true; if ($key == 'image') continue; } $caught[$key] = $r; $i++; break; } } if (!$i) return false; $ret = array(); // construct type if ($caught['type']) $ret[] = $caught['type']; // construct image if ($caught['image']) $ret[] = $caught['image']; // construct position if ($caught['position']) $ret[] = $caught['position']; if (empty($ret)) return false; return implode(' ', $ret); }
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 activate_address() { global $db, $user; $object = new stdClass(); $object->id = $this->params['id']; $db->setUniqueFlag($object, 'addresses', $this->params['is_what'], "user_id=" . $user->id); flash("message", gt("Successfully updated address.")); 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
$value = str_replace($originalName, $cleanedName, $value); } unset($value); } $result = hash_equals(GeneralUtility::hmac(serialize($fieldChangeFunctions)), $this->parameters['fieldChangeFuncHash']); } return $result; }
0
PHP
CWE-327
Use of a Broken or Risky Cryptographic Algorithm
The use of a broken or risky cryptographic algorithm is an unnecessary risk that may result in the exposure of sensitive information.
https://cwe.mitre.org/data/definitions/327.html
vulnerable
protected function _move($source, $targetDir, $name) { $target = $this->_joinPath($targetDir, $name); return $this->connect->rename($source, $target) ? $target : false; }
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
protected function parseChunkedRequest(Request $request) { $totalChunkCount = $request->get('dztotalchunkcount'); $index = $request->get('dzchunkindex'); $last = ((int) $index + 1) === (int) $totalChunkCount; $uuid = $request->get('dzuuid'); /** * @var UploadedFile */ $file = $request->files->get('file')->getClientOriginalName(); $orig = $file; return [$last, $uuid, $index, $orig]; }
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 sendAsync(RequestInterface $request, array $options = []) { // Merge the base URI into the request URI if needed. $options = $this->prepareDefaults($options); return $this->transfer( $request->withUri($this->buildUri($request->getUri(), $options), $request->hasHeader('Host')), $options ); }
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
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['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
protected function emailExistsInDB($email) { /* Build sql query*/ $sql = 'SELECT * FROM '.$this->usersTable; $sql .= ' WHERE email = "'.$email.'";'; /* Execute query */ $results = $this->wiki->loadAll($sql); return $results; // If the password does not already exist in DB, $result is an empty table => 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 update_item_permissions_check( $request ) { $term = $this->get_term( $request['id'] ); if ( is_wp_error( $term ) ) { return $term; } if ( ! current_user_can( 'edit_term', $term->term_id ) ) { return new WP_Error( 'rest_cannot_update', __( 'Sorry, you are not allowed to edit this term.' ), array( 'status' => rest_authorization_required_code() ) ); } return true; }
1
PHP
NVD-CWE-noinfo
null
null
null
safe
protected function parse() { parent::parse(); // grab the error-type from the parameters $errorType = $this->getParameter('type'); // set correct headers switch($errorType) { case 'module-not-allowed': case 'action-not-allowed': SpoonHTTP::setHeadersByCode(403); break; case 'not-found': SpoonHTTP::setHeadersByCode(404); break; } // querystring provided? if($this->getParameter('querystring') !== null) { // split into file and parameters $chunks = explode('?', $this->getParameter('querystring')); // get extension $extension = SpoonFile::getExtension($chunks[0]); // if the file has an extension it is a non-existing-file if($extension != '' && $extension != $chunks[0]) { // set correct headers SpoonHTTP::setHeadersByCode(404); // give a nice error, so we can detect which file is missing echo 'Requested file (' . implode('?', $chunks) . ') not found.'; // stop script execution exit; } } // assign the correct message into the template $this->tpl->assign('message', BL::err(SpoonFilter::toCamelCase($errorType, '-'))); }
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 fetchRow($sql) { // retrieve row $query_id = $this->query($sql); $record = mysql_fetch_row($this->query_id); $this->freeResult($query_id); return $record; }#-#fetchArray()
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"; }
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
protected function getSwimlane(array $project) { $swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id')); if (empty($swimlane)) { throw new PageNotFoundException(); } if ($swimlane['project_id'] != $project['id']) { throw new AccessForbiddenException(); } return $swimlane; }
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 finalize() { $this->finalized = true; $this->parser = 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
public function load_lines() { global $DB; $DB->query(' SELECT * FROM nv_orders_lines WHERE `order` = '.protect($this->id).' ORDER BY position ASC' ); $this->lines = $DB->result(); }
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 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 handleElement(&$token) { if (!$token instanceof HTMLPurifier_Token_Start) return; $next = false; for ($i = $this->inputIndex + 1, $c = count($this->inputTokens); $i < $c; $i++) { $next = $this->inputTokens[$i]; if ($next instanceof HTMLPurifier_Token_Text) { if ($next->is_whitespace) continue; if ($this->removeNbsp && !isset($this->removeNbspExceptions[$token->name])) { $plain = str_replace("\xC2\xA0", "", $next->data); $isWsOrNbsp = $plain === '' || ctype_space($plain); if ($isWsOrNbsp) continue; } } break; } if (!$next || ($next instanceof HTMLPurifier_Token_End && $next->name == $token->name)) { if (isset($this->_exclude[$token->name])) return; $this->attrValidator->validateToken($token, $this->config, $this->context); $token->armor['ValidateAttributes'] = true; if (isset($token->attr['id']) || isset($token->attr['name'])) return; $token = $i - $this->inputIndex + 1; for ($b = $this->inputIndex - 1; $b > 0; $b--) { $prev = $this->inputTokens[$b]; if ($prev instanceof HTMLPurifier_Token_Text && $prev->is_whitespace) continue; break; } // This is safe because we removed the token that triggered this. $this->rewind($b - 1); return; } }
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 setClientFilename($clientFilename) { if (false === $this->isStringOrNull($clientFilename)) { throw new InvalidArgumentException( 'Upload file client filename must be a string or null' ); } $this->clientFilename = $clientFilename; }
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 searchNew() { global $db, $user; $this->params['query'] = expString::escape($this->params['query']); //$this->params['query'] = str_ireplace('-','\-',$this->params['query']); $sql = "select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid, "; $sql .= "match (p.title,p.model,p.body) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) as relevance, "; $sql .= "CASE when p.model like '" . $this->params['query'] . "%' then 1 else 0 END as modelmatch, "; $sql .= "CASE when p.title like '%" . $this->params['query'] . "%' then 1 else 0 END as titlematch "; $sql .= "from " . $db->prefix . "product as p INNER JOIN " . $db->prefix . "content_expFiles as cef ON p.id=cef.content_id AND cef.content_type IN ('product','eventregistration','donation','giftcard') AND cef.subtype='mainimage' INNER JOIN " . $db->prefix . "expFiles as f ON cef.expFiles_id = f.id WHERE "; if (!$user->isAdmin()) $sql .= '(p.active_type=0 OR p.active_type=1) AND '; $sql .= " match (p.title,p.model,p.body) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) AND p.parent_id=0 "; $sql .= " HAVING relevance > 0 "; //$sql .= "GROUP BY p.id "; $sql .= "order by modelmatch,titlematch,relevance desc LIMIT 10"; eDebug($sql); $res = $db->selectObjectsBySql($sql); eDebug($res, true); $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 pluginDetails() { return [ 'name' => 'Debugbar', 'description' => 'Debugbar integration for OctoberCMS.', 'author' => 'RainLab', 'icon' => 'icon-cog', 'homepage' => 'https://github.com/rainlab/debugbar-plugin' ]; }
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
function db_properties($table) { global $DatabaseType, $DatabaseUsername; switch ($DatabaseType) { case 'mysqli': $result = DBQuery("SHOW COLUMNS FROM $table"); while ($row = db_fetch_row($result)) { $properties[strtoupper($row['FIELD'])]['TYPE'] = strtoupper($row['TYPE'], strpos($row['TYPE'], '(')); if (!$pos = strpos($row['TYPE'], ',')) $pos = strpos($row['TYPE'], ')'); else $properties[strtoupper($row['FIELD'])]['SCALE'] = substr($row['TYPE'], $pos + 1); $properties[strtoupper($row['FIELD'])]['SIZE'] = substr($row['TYPE'], strpos($row['TYPE'], '(') + 1, $pos); if ($row['NULL'] != '') $properties[strtoupper($row['FIELD'])]['NULL'] = "Y"; else $properties[strtoupper($row['FIELD'])]['NULL'] = "N"; } break; } return $properties; }
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 check_referer(){ global $_pages, $_base_href, $msg; if(isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] !='' && $_SERVER['HTTP_REFERER'] != $_SERVER['PHP_SELF']){ $referer_script = preg_replace('#'.$_base_href.'#', '', $_SERVER['HTTP_REFERER']); if( !in_array($_pages[$referer_script], $_pages)){ $msg->addError('ACCESS_DENIED'); require(AT_INCLUDE_PATH.'header.inc.php'); require(AT_INCLUDE_PATH.'footer.inc.php'); exit; } } }
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
function selectObjectsBySql($sql) { $res = @mysqli_query($this->connection, $sql); if ($res == null) return array(); $objects = array(); for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) $objects[] = mysqli_fetch_object($res); return $objects; }
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 getCustomDefinitionService() { return $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition(); }
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 parseAndTrimImport($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('""', '"', $str); //do this no matter what...in case someone added a quote in a non HTML field if (!$isHTML) { //if HTML, then leave the single quotes alone, otheriwse replace w/ special Char $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
$contentType = str_replace('data:', '', $cur); } } } else {
0
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
vulnerable
public static function parseAndTrimImport($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('""', '"', $str); //do this no matter what...in case someone added a quote in a non HTML field if (!$isHTML) { //if HTML, then leave the single quotes alone, otheriwse replace w/ special Char $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; }
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 incFront($vars, $param = '') { // print_r($param); // echo $vars; $file = GX_PATH.'/inc/lib/Control/Frontend/'.$vars.'.control.php'; if (file_exists($file)) { # code... include $file; } else { // echo "error"; self::error('404'); } }
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 paginated_list($offset, $limit, $order_by_field, $order_by_ascdesc) { global $DB; global $website; $DB->queryLimit( '*', 'nv_block_groups', 'website = '.protect($website->id), $order_by_field.' '.$order_by_ascdesc, $offset, $limit ); $rs = $DB->result(); $total = $DB->foundRows(); return array($rs, $total); }
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 getNewComputer() { $computer = getItemByTypeName('Computer', '_test_pc01'); $fields = $computer->fields; unset($fields['id']); unset($fields['date_creation']); unset($fields['date_mod']); $fields['name'] = $this->getUniqueString(); $this->integer((int)$computer->add($fields))->isGreaterThan(0); return $computer; }
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 delete_selected() { $item = $this->event->find('first', 'id=' . $this->params['id']); if ($item && $item->is_recurring == 1) { $event_remaining = false; $eventdates = $item->eventdate[0]->find('all', 'event_id=' . $item->id); foreach ($eventdates as $ed) { if (array_key_exists($ed->id, $this->params['dates'])) { $ed->delete(); } else { $event_remaining = true; } } if (!$event_remaining) { $item->delete(); // model will also ensure we delete all event dates } expHistory::back(); } else { notfoundController::handle_not_found(); } }
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
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
private static function title_case_lower($s) { return self::mb_convert_case($s[0], MB_CASE_LOWER, '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
function nvweb_content_comments_count($object_id = NULL, $object_type = "item") { global $DB; global $website; global $current; $element = $current['object']; if($current['type']=='structure' && $object_type == "item") $element = $element->elements(0); // item = structure->elements(first) if(empty($object_id)) $object_id = $element->id; $DB->query('SELECT COUNT(*) as total FROM nv_comments WHERE website = '.protect($website->id).' AND object_type = "'.$object_type.'" AND object_id = '.protect($object_id).' AND status = 0' ); $out = $DB->result('total'); return $out[0]; }
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 generate_location_json( ) { /* TODO: Try to track modification? if ( !empty( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) { $http_time = strtotime( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ); $mod_time = strtotime( $post->post_modified_gmt . ' GMT' ); if ($mod_time <= $http_time) { return status_header(304); // Not modified } } status_header(200); header( 'Last-Modified: ' . mysql2date( 'D, d M Y H:i:s', $post->post_modified_gmt, false ) . ' GMT' ); header( 'Content-type: text/xml; charset='.get_settings('blog_charset'), true); header( 'Cache-control: max-age=300, must-revalidate', true); header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + 300 ) . " GMT" ); header( 'Pragma:' ); */ status_header(200); header('Content-type: application/json; charset='.get_option('blog_charset'), true); header('Cache-Control: no-cache;', true); header('Expires: -1;', true); $json = GeoMashup::get_locations_json($_REQUEST); if ( isset( $_REQUEST['callback'] ) ) $json = $_REQUEST['callback'] . '(' . $json . ')'; echo $json; }
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 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 confirm() { $project = $this->getProject(); $action = $this->getAction($project); $this->response->html($this->helper->layout->project('action/remove', array( 'action' => $action, 'available_events' => $this->eventManager->getAll(), 'available_actions' => $this->actionManager->getAvailableActions(), 'project' => $project, 'title' => t('Remove an 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 test_valid_comment_0_content() { $result = $this->myxmlrpcserver->wp_newComment( array( 1, 'administrator', 'administrator', self::$post->ID, array( 'content' => '0', ), ) ); $this->assertNotIXRError( $result ); }
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
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 getAsText() { if ($this->codeDefinition) { return $this->codeDefinition->asText($this); } else { $s = ""; foreach ($this->getChildren() as $child) $s .= $child->getAsText(); return $s; } }
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
[$result, $message] = $rule($remoteFile); if ($result !== true) { Helpers::record_warnings(E_USER_WARNING, "Error loading $remoteFile: $message", __FILE__, __LINE__); } } list($remoteFileContent, $http_response_header) = @Helpers::getFileContent($remoteFile, $context); if ($remoteFileContent === null) { return false; } $localTempFile = @tempnam($this->options->get("tempDir"), "dompdf-font-"); file_put_contents($localTempFile, $remoteFileContent); $font = Font::load($localTempFile); if (!$font) { unlink($localTempFile); return false; } $font->parse(); $font->saveAdobeFontMetrics("$localFilePath.ufm"); $font->close(); unlink($localTempFile); if ( !file_exists("$localFilePath.ufm") ) { return false; } $fontExtension = ".ttf"; switch ($font->getFontType()) { case "TrueType": default: $fontExtension = ".ttf"; break; } // Save the changes file_put_contents($localFilePath.$fontExtension, $remoteFileContent); if ( !file_exists($localFilePath.$fontExtension) ) { unlink("$localFilePath.ufm"); return false; } $this->setFontFamily($fontname, $entry); return true; }
1
PHP
CWE-73
External Control of File Name or Path
The software allows user input to control or influence paths or file names that are used in filesystem operations.
https://cwe.mitre.org/data/definitions/73.html
safe
function manage_vendors () { expHistory::set('viewable', $this->params); $vendor = new vendor(); $vendors = $vendor->find('all'); assign_to_template(array( 'vendors'=>$vendors )); }
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 routePostProvider() { return [ ['/api/articles/', 1, 'articles', 'post', false], ['/api/v1/articles/', 1, 'articles', 'post', false], ['/api/v2/articles/', 2, 'articles', 'post', false], ['/api/articles/5', 1, 'articles', 'post', 5], ['/api/v1/articles/5', 1, 'articles', 'post', 5], ['/api/v2/articles/5', 2, 'articles', 'post', 5], ]; }
0
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
vulnerable
function update() { parent::update(); expSession::clearAllUsersSessionCache('navigation'); }
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 getDeleteItemLink($icmsObj, $onlyUrl=false, $withimage=true, $userSide=false) { if ($this->handler->_moduleName != 'system') { $admin_side = $userSide ? '' : 'admin/'; $ret = $this->handler->_moduleUrl . $admin_side . $this->handler->_page . "?op=del&amp;" . $this->handler->keyName . "=" . $icmsObj->getVar($this->handler->keyName); } else { /** * @todo: to be implemented... */ //$admin_side = $userSide ? '' : 'admin/'; $admin_side = ''; $ret = $this->handler->_moduleUrl . $admin_side . 'admin.php?fct=' . $this->handler->_itemname . "&amp;op=del&amp;" . $this->handler->keyName . "=" . $icmsObj->getVar($this->handler->keyName); } if ($onlyUrl) { return $ret; } elseif ($withimage) { return "<a href='" . $ret . "'> <img src='" . ICMS_IMAGES_SET_URL . "/actions/editdelete.png' style='vertical-align: middle;' alt='" . _CO_ICMS_DELETE . "' title='" . _CO_ICMS_DELETE . "'/></a>"; } return "<a href='" . $ret . "'>" . $icmsObj->getVar($this->handler->identifierName) . "</a>"; }
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 getDefaultScheme($config, $context) { return HTMLPurifier_URISchemeRegistry::instance()->getScheme($this->defaultScheme, $config, $context); }
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 dropdown($vars) { return Categories::dropdown($vars); }
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 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-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 get_session($vars) { }
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
setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); }
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 getFixesForLevel($level) { if ($level == $this->levels[0]) { return array(); } $activated_levels = array(); for ($i = 1, $c = count($this->levels); $i < $c; $i++) { $activated_levels[] = $this->levels[$i]; if ($this->levels[$i] == $level) break; } if ($i == $c) { trigger_error( 'Tidy level ' . htmlspecialchars($level) . ' not recognized', E_USER_WARNING ); return array(); } $ret = array(); foreach ($activated_levels as $level) { foreach ($this->fixesForLevel[$level] as $fix) { $ret[$fix] = true; } } return $ret; }
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 exist($vars) { if (file_exists(GX_THEME.THEME.'/'.$vars.'.php')) { 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
static public function deleteCategory($_id = 0) { if ($_id != 0) { $result_stmt = Database::prepare(" SELECT COUNT(`id`) as `numtickets` FROM `" . TABLE_PANEL_TICKETS . "` WHERE `category` = :cat" ); $result = Database::pexecute_first($result_stmt, array('cat' => $_id)); if ($result['numtickets'] == "0") { $del_stmt = Database::prepare(" DELETE FROM `" . TABLE_PANEL_TICKET_CATS . "` WHERE `id` = :id" ); Database::pexecute($del_stmt, array('id' => $_id)); return true; } else { return false; } } 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
private function addInlineReference($id, Definition $definition, $targetId, $forConstructor) { list($callCount, $behavior) = $this->serviceCalls[$targetId]; while ($this->container->hasAlias($targetId)) { $targetId = (string) $this->container->getAlias($targetId); } if ($id === $targetId) { return $this->addInlineService($id, $definition, $definition); } if ('service_container' === $targetId || isset($this->referenceVariables[$targetId])) { return ''; } $hasSelfRef = isset($this->circularReferences[$id][$targetId]); $forConstructor = $forConstructor && !isset($this->definitionVariables[$definition]); $code = $hasSelfRef && !$forConstructor ? $this->addInlineService($id, $definition, $definition) : ''; if (isset($this->referenceVariables[$targetId]) || (2 > $callCount && (!$hasSelfRef || !$forConstructor))) { return $code; } $name = $this->getNextVariableName(); $this->referenceVariables[$targetId] = new Variable($name); $reference = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE >= $behavior ? new Reference($targetId, $behavior) : null; $code .= sprintf(" \$%s = %s;\n", $name, $this->getServiceCall($targetId, $reference)); if (!$hasSelfRef || !$forConstructor) { return $code; } $code .= sprintf(<<<'EOTXT' if (isset($this->%s[%s])) { return $this->%1$s[%2$s]; } EOTXT , 'services', $this->doExport($id) ); return $code; }
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 testMatchingTags() { $tokenizer = new JBBCode\Tokenizer('[url]http://jbbcode.com[/url]'); $this->assertEquals('[', $tokenizer->next()); $this->assertEquals('url', $tokenizer->next()); $this->assertEquals(']', $tokenizer->next()); $this->assertEquals('http://jbbcode.com', $tokenizer->next()); $this->assertEquals('[', $tokenizer->next()); $this->assertEquals('/url', $tokenizer->next()); $this->assertEquals(']', $tokenizer->next()); $this->assertFalse($tokenizer->hasNext()); }
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 _fopen($path, $mode='rb') { $fp = $this->tmbPath ? @fopen($this->getTempFile($path), 'w+') : @tmpfile(); if ($fp) { if (($res = $this->query('SELECT content FROM '.$this->tbf.' WHERE id="'.$path.'"')) && ($r = $res->fetch_assoc())) { fwrite($fp, $r['content']); rewind($fp); return $fp; } else { $this->_fclose($fp, $path); } } 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
$result = $this->__handleLinks($string, $trigger); if (!$result) return 'Malformed syntax.'; } return $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
protected function _move($source, $targetDir, $name) { $target = $this->_joinPath($targetDir, $name); $ret = @rename($source, $target) ? $target : false; $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 create(Request $request) { /** @var User $user */ $user = auth()->user(); if (!$this->userRepository->hasRole($user, 'owner')) { $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))])); return redirect(route('currencies.index')); } $subTitleIcon = 'fa-plus'; $subTitle = (string) trans('firefly.create_currency'); // put previous url in session if not redirect from store (not "create another"). if (true !== session('currencies.create.fromStore')) { $this->rememberPreviousUri('currencies.create.uri'); } $request->session()->forget('currencies.create.fromStore'); Log::channel('audit')->info('Create new currency.'); return prefixView('currencies.create', compact('subTitleIcon', 'subTitle')); }
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 sendHeaders() { // headers have already been sent by the developer if (headers_sent()) { return $this; } if (!$this->headers->has('Date')) { $this->setDate(\DateTime::createFromFormat('U', time())); } // headers foreach ($this->headers->allPreserveCase() as $name => $values) { foreach ($values as $value) { header($name.': '.$value, false, $this->statusCode); } } // status header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode); // cookies foreach ($this->headers->getCookies() as $cookie) { if ($cookie->isRaw()) { setrawcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); } else { setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); } } return $this; }
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 setSectionSeparators( ?array $separators ) { $this->sectionSeparators = (array)$separators ?? []; }
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 getTimeout() { return $this->Timeout; }
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 manage() { global $db, $router, $user; expHistory::set('manageable', $router->params); assign_to_template(array( 'canManageStandalones' => self::canManageStandalones(), 'sasections' => $db->selectObjects('section', 'parent=-1'), 'user' => $user, // 'canManagePagesets' => $user->isAdmin(), // 'templates' => $db->selectObjects('section_template', 'parent=0'), )); }
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 loadAdsenseJs() { echo '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>'; }
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 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
header("Location: ".$this->makeLink(array('section'=>intval($_REQUEST['section']))),TRUE,301);
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(); $subtask = $this->getSubtask(); $this->response->html($this->template->render('subtask/remove', 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