code
stringlengths
12
2.05k
label
int64
0
1
programming_language
stringclasses
9 values
cwe_id
stringlengths
6
14
cwe_name
stringlengths
5
103
description
stringlengths
36
1.23k
url
stringlengths
36
48
label_name
stringclasses
2 values
public function isBlacklisted($ip, $username) { // first remove old expired rows $this->clean(); // count $params = array( 'conditions' => array( 'Bruteforce.ip' => $ip, 'LOWER(Bruteforce.username)' => trim(strtolower($username))) ); $count = $this->find('count', $params); $amount = Configure::check('SecureAuth.amount') ? Configure::read('SecureAuth.amount') : 5; if ($count >= $amount) { return true; } else { return false; } }
1
PHP
CWE-367
Time-of-check Time-of-use (TOCTOU) Race Condition
The software checks the state of a resource before using that resource, but the resource's state can change between the check and the use in a way that invalidates the results of the check. This can cause the software to perform invalid actions when the resource is in an unexpected state.
https://cwe.mitre.org/data/definitions/367.html
safe
public function search() { // global $db, $user; global $db; $sql = "select DISTINCT(a.id) as id, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email "; $sql .= "from " . $db->prefix . "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 offset($offset) { $this->ar_offset = $offset; return $this; }
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 insert($vars) { if(is_array($vars)) { $ins = array( 'table' => 'options', 'name' => $vars['name'], 'value' => $vars['value'] ); $opt = Db::insert($ins); }else{ Control::error('unknown','Format not Found, please in array'); } return $opt; }
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-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 go($input, $path, $allowed='', $uniq=false, $size='', $width = '', $height = ''){ $filename = Typo::cleanX($_FILES[$input]['name']); $filename = str_replace(' ', '_', $filename); if(isset($_FILES[$input]) && $_FILES[$input]['error'] == 0){ if($uniq == true){ $uniqfile = sha1(microtime().$filename); }else{ $uniqfile = ''; } $extension = pathinfo($_FILES[$input]['name'], PATHINFO_EXTENSION); $filetmp = $_FILES[$input]['tmp_name']; $filepath = GX_PATH.$path.$uniqfile.$filename; if(!in_array(strtolower($extension), $allowed)){ $result['error'] = 'File not allowed'; }else{ if(move_uploaded_file( $filetmp, $filepath) ){ $result['filesize'] = filesize($filepath); $result['filename'] = $uniqfile.$filename; $result['path'] = $path.$uniqfile.$filename; $result['filepath'] = $filepath; $result['fileurl'] = Options::get('siteurl').$path.$uniqfile.$filename; }else{ $result['error'] = 'Cannot upload to directory, please check if directory is exist or You had permission to write it.'; } } }else{ //$result['error'] = $_FILES[$input]['error']; $result['error'] = ''; } return $result; }
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 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-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 cat($vars) { switch (SMART_URL) { case true: # code... $inFold = (Options::v('permalink_use_index_php') == "on")? "/index.php":""; $url = Site::$url.$inFold."/category/".$vars."/".Typo::slugify(Categories::name($vars)); break; default: # code... $url = Site::$url."/?cat={$vars}"; break; } return $url; }
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 beforeAction($action) { // Bypass when not installed for installer if (empty(Yii::$app->params['installed']) && Yii::$app->controller->module != null && Yii::$app->controller->module->id == 'installer') { return true; } $this->handleDeprecatedSettings(); $this->controllerAccess = $this->getControllerAccess($this->rules); if (!$this->controllerAccess->run()) { if (isset($this->controllerAccess->codeCallback) && method_exists($this, $this->controllerAccess->codeCallback)) { // Call a specific function for current action filter, // may be used to filter a logged in user for some restriction e.g. "must change password" call_user_func([$this, $this->controllerAccess->codeCallback]); } else if ($this->controllerAccess->code == 401) { $this->loginRequired(); } else { $this->forbidden(); } return false; } return parent::beforeAction($action); }
1
PHP
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
safe
public function testActionsPages () { $this->visitPages ($this->getPages ('^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
} elseif (!empty($this->params['src'])) { if ($this->params['src'] == $loc->src) { $this->config = $config->config; break; } } }
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); }
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 function buildControl() { $control = new colorcontrol(); if (!empty($this->params['value'])) $control->value = $this->params['value']; if ($this->params['value'][0] != '#') $this->params['value'] = '#' . $this->params['value']; $control->default = $this->params['value']; if (!empty($this->params['hide'])) $control->hide = $this->params['hide']; if (isset($this->params['flip'])) $control->flip = $this->params['flip']; $this->params['name'] = !empty($this->params['name']) ? $this->params['name'] : ''; $control->name = $this->params['name']; $this->params['id'] = !empty($this->params['id']) ? $this->params['id'] : ''; $control->id = isset($this->params['id']) && $this->params['id'] != "" ? $this->params['id'] : ""; //echo $control->id; if (empty($control->id)) $control->id = $this->params['name']; if (empty($control->name)) $control->name = $this->params['id']; // attempt to translate the label if (!empty($this->params['label'])) { $this->params['label'] = gt($this->params['label']); } else { $this->params['label'] = null; } echo $control->toHTML($this->params['label'], $this->params['name']); // $ar = new expAjaxReply(200, gt('The control was created'), json_encode(array('data'=>$code))); // $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 static function secure() { if (!isset($_SESSION['gxsess']['val']['loggedin']) && !isset($_SESSION['gxsess']['val']['username'])) { header('location: login.php'); } else { 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 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 ac_sigleid($name, $id) { global $cms_db, $sess; $sess->gc( true ); $ret = true; if( $id >= 1 ) { $ret = false; $cquery = sprintf("select count(*) from %s where user_id='%s' and name='%s'", $cms_db['sessions'], $id, $name); $squery = sprintf("select sid from %s where user_id='%s' and name='%s'", $cms_db['sessions'], $id, addslashes($name)); $this->db->query($squery); if ( $this->db->affected_rows() == 0 && $this->db->query($cquery) && $this->db->next_record() && $this->db->f(0) == 0 ) { // nothing found here $ret = true; } } 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
function csrf_get_tokens() { $has_cookies = !empty($_COOKIE); // $ip implements a composite key, which is sent if the user hasn't sent // any cookies. It may or may not be used, depending on whether or not // the cookies "stick" $secret = csrf_get_secret(); if (!$has_cookies && $secret) { // :TODO: Harden this against proxy-spoofing attacks $ip = ';ip:' . csrf_hash($_SERVER['IP_ADDRESS']); } else { $ip = ''; } csrf_start(); // These are "strong" algorithms that don't require per se a secret if (session_id()) { return 'sid:' . csrf_hash(session_id()) . $ip; } if ($GLOBALS['csrf']['cookie']) { $val = csrf_generate_secret(); setcookie($GLOBALS['csrf']['cookie'], $val); return 'cookie:' . csrf_hash($val) . $ip; } if ($GLOBALS['csrf']['key']) { return 'key:' . csrf_hash($GLOBALS['csrf']['key']) . $ip; } // These further algorithms require a server-side secret if (!$secret) { return 'invalid'; } if ($GLOBALS['csrf']['user'] !== false) { return 'user:' . csrf_hash($GLOBALS['csrf']['user']); } if ($GLOBALS['csrf']['allow-ip']) { return ltrim($ip, ';'); } return 'invalid'; }
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 static function restoreX2WebUser () { if (isset (self::$_oldUserComponent)) { Yii::app()->setComponent ('user', self::$_oldUserComponent); } else { throw new CException ('X2WebUser component could not be restored'); } }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
protected function assertCsvExported ($csv) { $exportPath = implode(DIRECTORY_SEPARATOR, array( Yii::app()->basePath, 'data', 'records_export.csv' )); $csvFile = implode(DIRECTORY_SEPARATOR, array( Yii::app()->basePath, 'tests', 'data', 'csvs', $csv.".csv" )); $this->assertFileExists ($exportPath); $expectedLength = count(file($csvFile)); $exportedLength = count(file($exportPath)); $this->assertEquals ($expectedLength, $exportedLength); // TODO achieve consistency in fields //$this->assertFileEquals ($csvFile, $exportPath); }
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
$dt = date('Y-m-d', strtotime($match)); $sql = par_rep("/'$match'/", "'$dt'", $sql); } } if (substr($sql, 0, 6) == "BEGIN;") { $array = explode(";", $sql); foreach ($array as $value) { if ($value != "") { $user_agent = explode('/', $_SERVER['HTTP_USER_AGENT']); if ($user_agent[0] == 'Mozilla') { $result = $connection->query($value); } if (!$result) { $user_agent = explode('/', $_SERVER['HTTP_USER_AGENT']); if ($user_agent[0] == 'Mozilla') { $connection->query("ROLLBACK"); die(db_show_error($sql, _dbExecuteFailed, mysqli_error($connection))); } } } } } else { $user_agent = explode('/', $_SERVER['HTTP_USER_AGENT']); if ($user_agent[0] == 'Mozilla') { $result = $connection->query($sql) or die(db_show_error($sql, _dbExecuteFailed, mysqli_error($connection))); } } break; }
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 create() { $length = "80"; $token = ""; $codeAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; $codeAlphabet.= "abcdefghijklmnopqrstuvwxyz"; $codeAlphabet.= "0123456789"; // $codeAlphabet.= "!@#$%^&*()[]\/{}|:\<>"; //$codeAlphabet.= SECURITY_KEY; 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; }
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 transform($attr, $config, $context) { if (!isset($attr[$this->name])) return $attr; $length = $this->confiscateAttr($attr, $this->name); if(ctype_digit($length)) $length .= 'px'; $this->prependCSS($attr, $this->cssName . ":$length;"); return $attr; }
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 getFontSize() { $fs = $GLOBALS['PMA_Config']->get('fontsize'); if (!is_null($fs)) { return $fs; } if (isset($_COOKIE['pma_fontsize'])) { return htmlspecialchars($_COOKIE['pma_fontsize']); } return '82%'; }
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 setTagName($tagName) { $this->tagName = $tagName; }
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 editAlt() { global $user; $file = new expFile($this->params['id']); if ($user->id==$file->poster || $user->isAdmin()) { $file->alt = $this->params['newValue']; $file->save(); $ar = new expAjaxReply(200, gt('Your alt was updated successfully'), $file); } else { $ar = new expAjaxReply(300, gt("You didn't create this file, so you can't edit it.")); } $ar->send(); echo json_encode($file); //FIXME we exit before hitting this }
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
$src = substr($ref->source, strlen($prefix)) . $section->id; if (call_user_func(array($ref->module, 'hasContent'))) { $oloc = expCore::makeLocation($ref->module, $ref->source); $nloc = expCore::makeLocation($ref->module, $src); if ($ref->module != "container") { call_user_func(array($ref->module, 'copyContent'), $oloc, $nloc); } else { call_user_func(array($ref->module, 'copyContent'), $oloc, $nloc, $section->id); } } }
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-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
$sloc = expCore::makeLocation('navigation', null, $section->id); // remove any manage permissions for this page and it's children // $db->delete('userpermission', "module='navigationController' AND internal=".$section->id); // $db->delete('grouppermission', "module='navigationController' AND internal=".$section->id); foreach ($allusers as $uid) { $u = user::getUserById($uid); expPermissions::grant($u, 'manage', $sloc); } foreach ($allgroups as $gid) { $g = group::getGroupById($gid); expPermissions::grantGroup($g, 'manage', $sloc); } } }
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
unset($cache); $cache = $new_cache; } $this->caches[$method][$type] = $cache; return $this->caches[$method][$type]; }
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 get_items_permissions_check( $request ) { $parent = $this->get_parent( $request['parent'] ); if ( is_wp_error( $parent ) ) { return $parent; } $parent_post_type_obj = get_post_type_object( $parent->post_type ); if ( ! current_user_can( $parent_post_type_obj->cap->edit_post, $parent->ID ) ) { return new WP_Error( 'rest_cannot_read', __( 'Sorry, you are not allowed to view revisions of this post.' ), array( 'status' => rest_authorization_required_code() ) ); } return true; }
1
PHP
NVD-CWE-noinfo
null
null
null
safe
public function getDisplayName ($plural=true, $ofModule=true) { return Yii::t('contacts', '{contact} Lists|{contact} List', array( (int) $plural, '{contact}' => Modules::displayName(false, 'Contacts'), )); }
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 form_confirm_buttons($action_url, $cancel_url) { global $config; ?> <tr> <td align='right'> <input type='button' onClick='cactiReturnTo("<?php print htmlspecialchars($config['url_path'] . $cancel_url);?>")' value='<?php print __esc('Cancel');?>'> <input type='button' onClick='cactiReturnTo("<?php print htmlspecialchars($config['url_path'] . $action_url . '&confirm=true');?>")' value='<?php print __esc('Delete');?>'> </td> </tr> <?php }
0
PHP
NVD-CWE-noinfo
null
null
null
vulnerable
public function __construct($scheme, $userinfo, $host, $port, $path, $query, $fragment) { $this->scheme = is_null($scheme) || ctype_lower($scheme) ? $scheme : strtolower($scheme); $this->userinfo = $userinfo; $this->host = $host; $this->port = is_null($port) ? $port : (int) $port; $this->path = $path; $this->query = $query; $this->fragment = $fragment; }
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 setRssValues($rss) { $this->set('rsstitle', \App\Purifier::purifyByType((string) $rss->title, 'Text')); $this->set('url', $rss->link); }
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 val ($vars) { $val = $_SESSION['gxsess']['val']; foreach ($val as $k => $v) { # code... switch ($k) { case $vars: return $v; break; default: //echo "no value"; break; } } }
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
} elseif (!empty($this->params['src'])) { if ($this->params['src'] == $loc->src) { $this->config = $config->config; break; } } }
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
$count += $db->dropTable($basename); } flash('message', gt('Deleted').' '.$count.' '.gt('unused tables').'.'); expHistory::back(); }
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
function reparent_standalone() { $standalone = $this->section->find($this->params['page']); if ($standalone) { $standalone->parent = $this->params['parent']; $standalone->update(); expSession::clearAllUsersSessionCache('navigation'); expHistory::back(); } else { notfoundController::handle_not_found(); } }
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 XMLRPCgetUserGroups($groupType=0, $affiliationid=0) { global $user; $groupType = processInputData($groupType, ARG_NUMERIC, 0, 0); $affiliationid = processInputData($affiliationid, ARG_NUMERIC, 0, 0); $groups = getUserGroups($groupType, $affiliationid); // Filter out any groups to which the user does not have access. $usergroups = array(); foreach($groups as $id => $group) { if($group['ownerid'] == $user['id'] || (array_key_exists("editgroupid", $group) && array_key_exists($group['editgroupid'], $user["groups"])) || (array_key_exists($id, $user["groups"]))) { array_push($usergroups, $group); } } return array("status" => "success", "groups" => $usergroups); }
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
public function behaviors() { return array_merge(parent::behaviors(),array( 'X2LinkableBehavior'=>array( 'class'=>'X2LinkableBehavior', 'module'=>'marketing' ), 'ERememberFiltersBehavior' => array( 'class'=>'application.components.ERememberFiltersBehavior', 'defaults'=>array(), 'defaultStickOnClear'=>false ) )); }
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
<div class='graphWrapper' style='width:100%;' id='wrapper_<?php print $graph['local_graph_id']?>' graph_width='<?php print $graph['width'];?>' graph_height='<?php print $graph['height'];?>' title_font_size='<?php print ((read_user_setting('custom_fonts') == 'on') ? read_user_setting('title_size') : read_config_option('title_size'));?>'></div> <?php print (read_user_setting('show_graph_title') == 'on' ? "<span class='center'>" . html_escape($graph['title_cache']) . '</span>' : '');?> </td> <td id='dd<?php print $graph['local_graph_id'];?>' class='noprint graphDrillDown'> <?php graph_drilldown_icons($graph['local_graph_id']);?> </td> </tr> </table> <div> </td> <?php $i++; if (($i % $columns) == 0) { $i = 0; print "</tr>\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
public function __construct() { $this->parser = new HTMLPurifier_VarParser(); }
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 getLastReply() { return $this->last_reply; }
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
$newret = recyclebin::restoreFromRecycleBin($iLoc, $page_id); if (!empty($newret)) $ret .= $newret . '<br>'; if ($iLoc->mod == 'container') { $ret .= scan_container($container->internal, $page_id); } } 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
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
function edit_externalalias() { $section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params); if ($section->parent == -1) { notfoundController::handle_not_found(); exit; } // doesn't work for standalone pages if (empty($section->id)) { $section->public = 1; if (!isset($section->parent)) { // This is another precaution. The parent attribute // should ALWAYS be set by the caller. //FJD - if that's the case, then we should die. notfoundController::handle_not_authorized(); exit; //$section->parent = 0; } } assign_to_template(array( 'section' => $section, 'glyphs' => self::get_glyphs(), )); }
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 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
$masteroption->delete(); } // delete the mastergroup $db->delete('optiongroup', 'optiongroup_master_id='.$mastergroup->id); $mastergroup->delete(); 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
function insertObject($object, $table) { //if ($table=="text") eDebug($object,true); $sql = "INSERT INTO `" . $this->prefix . "$table` ("; $values = ") VALUES ("; foreach (get_object_vars($object) as $var => $val) { //We do not want to save any fields that start with an '_' if ($var{0} != '_') { $sql .= "`$var`,"; if ($values != ") VALUES (") { $values .= ","; } $values .= "'" . $this->escapeString($val) . "'"; } } $sql = substr($sql, 0, -1) . substr($values, 0) . ")"; //if($table=='text')eDebug($sql,true); if (@mysqli_query($this->connection, $sql) != false) { $id = mysqli_insert_id($this->connection); return $id; } else return 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 filterValue($value, $regex, $stripTags = true, array $allowedHtmlTags = [], array $allowedAttributes = []) { if (empty($value)) { return $value; } if ($stripTags) { $value = strip_tags($value); } if (preg_match($regex, $value)) { return null; } $antiXss = new AntiXSS(); $antiXss->removeEvilAttributes($allowedHtmlTags); $antiXss->removeEvilHtmlTags($allowedAttributes); $value = $antiXss->xss_clean($value); return \str_replace(['&lt;', '&gt;'], ['<', '>'], $value); }
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 ($days as $event) { if (empty($event->eventdate->date) || ($viewrange == 'upcoming' && $event->eventdate->date < time())) break; if (empty($event->eventstart)) $event->eventstart = $event->eventdate->date; $extitem[] = $event; }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
$masteroption->delete(); } // delete the mastergroup $db->delete('optiongroup', 'optiongroup_master_id='.$mastergroup->id); $mastergroup->delete(); expHistory::back(); }
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
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 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(); }
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 session() { // Test if logged in, log in if not, log in. try { $this->assertElementPresent('css=ul#user-menu'); } catch (PHPUnit_Framework_AssertionFailedError $e) { /* If this isn't the first time we've logged in, we have a problem; * the user should have been logged in throughout the life of the * test case class. Append t */ if (!$this->firstLogin) array_push($this->verificationErrors, $e->toString()); $this->firstLogin = false; $this->login(); return 0; } try { $this->assertCorrectUser(); } catch (PHPUnit_Framework_AssertionFailedError $e) { // The browser is logged in but not as the correct user. $this->logout(); $this->login(); $this->firstLogin = false; return 0; } // Indicator of whether the session was already initialized properly return 1; }
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 elements_count() { global $DB; global $webuser; $permission = (!empty($_SESSION['APP_USER#'.APP_UNIQUE])? 1 : 0); // public access / webuser based / webuser groups based $access = 2; if(!empty($current['webuser'])) { $access = 1; if(!empty($webuser->groups)) { $access_groups = array(); foreach($webuser->groups as $wg) { if(empty($wg)) continue; $access_groups[] = 'groups LIKE "%g'.$wg.'%"'; } if(!empty($access_groups)) $access_extra = ' OR (access = 3 AND ('.implode(' OR ', $access_groups).'))'; } } $out = $DB->query_single( 'COUNT(id)', 'nv_items', ' category = '.protect($this->id).' AND website = '.protect($this->website).' AND permission <= '.$permission.' AND (date_published = 0 OR date_published < '.core_time().') AND (date_unpublish = 0 OR date_unpublish > '.core_time().') AND (access = 0 OR access = '.$access.$access_extra.') '); return $out; }
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 routeDeleteProvider() { return [ ['/api/articles/', 1, 'articles', 'batchDelete', false, 200], ['/api/v1/articles/', 1, 'articles', 'batchDelete', false, 200], ['/api/v2/articles/', 2, 'articles', 'batchDelete', false, 200], ['/api/articles/5', 1, 'articles', 'delete', 5, 200], ['/api/v1/articles/5', 1, 'articles', 'delete', 5, 200], ['/api/v2/articles/5', 2, 'articles', 'delete', 5, 200], ]; }
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
foreach ($allusers as $uid) { $u = user::getUserById($uid); expPermissions::grant($u, 'manage', $sloc); }
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
private function setModule($value) { $modules = (array) FrontendModel::getModules(); if(!in_array((string) $value, $modules)) { // when debug is on throw an exception if(SPOON_DEBUG) throw new FrontendException('Invalid file.'); // when debug is of show a descent message else exit(SPOON_DEBUG_MESSAGE); } $this->module = (string) $value; }
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
public function setFrom($address, $name = '', $auto = true) { $address = trim($address); $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim if (!$this->validateAddress($address)) { $this->setError($this->lang('invalid_address') . ': ' . $address); $this->edebug($this->lang('invalid_address') . ': ' . $address); if ($this->exceptions) { throw new phpmailerException($this->lang('invalid_address') . ': ' . $address); } return false; } $this->From = $address; $this->FromName = $name; if ($auto) { if (empty($this->Sender)) { $this->Sender = $address; } } return true; }
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
$text = preg_replace($exp, '', $text); } // Primary expression to filter out tags $exp = '/(?:^|\s)(#(?:\w+|\w[-\w]+\w))(?:$|\s)/u'; $matches = array(); preg_match_all($exp, $text, $matches); return $matches[1]; }
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
protected function shouldRedirect(Request $request, Shop $shop) { return //for example: template preview, direct shop selection via url ( $request->isGet() && $request->getQuery('__shop') !== null && (int) $request->getQuery('__shop') !== (int) $shop->getId() ) //for example: shop language switch || ( $request->isPost() && $request->getPost('__shop') !== null && $request->getPost('__redirect') !== null ) ; }
1
PHP
CWE-601
URL Redirection to Untrusted Site ('Open Redirect')
A web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a Redirect. This simplifies phishing attacks.
https://cwe.mitre.org/data/definitions/601.html
safe
public function verify($name) { return $this->sendCommand('VRFY', "VRFY $name", array(250, 251)); }
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 remind() { /*if (!check_captcha()) { $this->templatemanager->notify_next(__("You have entered wrong security code."), "error", __("Error!")); redirect("administration/auth/forgot"); die; }//*/ $email = trim($this->input->post("email", true)); $u = User::factory()->get_by_email($email); if (!$u->exists()) { $this->templatemanager->notify_next(__("User with that e-mail does not exists!"), "error", __("Error")); redirect("administration/auth/forgot"); } $u->key = random_string('unique'); $u->save(); Log::write('requested password change', LogSeverity::Notice, $u->id); //set variables for template $vars = array( 'name'=>$u->name ,'email'=>$u->email ,'website_title'=>Setting::value('website_title', CS_PRODUCT_NAME) ,'reset_link'=>site_url('administration/auth/resetpass/'.$u->id.'/'.$u->key) ,'site_url'=>site_url() ); //get email template $template = file_get_contents(APPPATH . "templates/forgot_password.html"); $template = __($template, null, 'email'); $template .= "<br />\n<br />\n<br />\n" . __(file_get_contents(APPPATH . "templates/signature.html"), null, 'email'); $template = parse_template($template, $vars); //send email $this->email->to("$email"); $this->email->subject(__("%s password reset", Setting::value('website_title', CS_PRODUCT_NAME), 'email')); $this->email->message($template); $this->email->set_alt_message(strip_tags($template)); $from = Setting::value("default_email", false); if (empty($from)) $from = "noreply@".get_domain_name(true); $this->email->from($from); $sent = $this->email->send(); if ($sent) $this->templatemanager->notify_next(__("Please check your e-mail for further information."), "notice", __("Notice")); else $this->templatemanager->notify_next(__("Activation e-mail could not be sent!"), "error", __("Error")); redirect("administration/auth/login"); }
0
PHP
CWE-640
Weak Password Recovery Mechanism for Forgotten Password
The software contains a mechanism for users to recover or change their passwords without knowing the original password, but the mechanism is weak.
https://cwe.mitre.org/data/definitions/640.html
vulnerable
public function __construct($non_negative = false) { $this->non_negative = $non_negative; }
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
static function is_username($username, &$error='') { if (strlen($username)<2) $error = __('Username must have at least two (2) characters'); elseif (!preg_match('/^[\p{L}\d._-]+$/u', $username)) $error = __('Username contains invalid characters'); return $error == ''; }
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 _getEntityString($entityIds) { $entity = ''; if (!empty($entityIds)) { $entityArr = array(); foreach ($entityIds as $entityId => $entityValue) { $entityArr[] = "$entityId=$entityValue"; } $entity = implode('&',$entityArr) . '&'; } return $entity; }
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 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($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(); }
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 testIdException() { session_start(); $this->proxy->setId('foo'); }
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 generated(){ $end_time = microtime(TRUE); $time_taken = $end_time - $GLOBALS['start_time']; $time_taken = round($time_taken,5); echo '<center><small>Page generated in '.$time_taken.' seconds.</small></center>'; }
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 saveLdapConfig(){ $login_user = $this->checkLogin(); $this->checkAdmin(); $ldap_open = intval(I("ldap_open")) ; $ldap_form = I("ldap_form") ; if ($ldap_open) { if (!$ldap_form['user_field']) { $ldap_form['user_field'] = 'cn'; } if( !extension_loaded( 'ldap' ) ) { $this->sendError(10011,"你尚未安装php-ldap扩展。如果是普通PHP环境,请手动安装之。如果是使用之前官方docker镜像,则需要重新安装镜像。方法是:备份 /showdoc_data 整个目录,然后全新安装showdoc,接着用备份覆盖/showdoc_data 。然后递归赋予777可写权限。"); return ; } $ldap_conn = ldap_connect($ldap_form['host'], $ldap_form['port']);//建立与 LDAP 服务器的连接 if (!$ldap_conn) { $this->sendError(10011,"Can't connect to LDAP server"); return ; } ldap_set_option($ldap_conn, LDAP_OPT_PROTOCOL_VERSION, $ldap_form['version']); $rs=ldap_bind($ldap_conn, $ldap_form['bind_dn'], $ldap_form['bind_password']);//与服务器绑定 用户登录验证 成功返回1 if (!$rs) { $this->sendError(10011,"Can't bind to LDAP server"); return ; } $result = ldap_search($ldap_conn,$ldap_form['base_dn'],"(cn=*)"); $data = ldap_get_entries($ldap_conn, $result); for ($i=0; $i<$data["count"]; $i++) { $ldap_user = $data[$i][$ldap_form['user_field']][0] ; if (!$ldap_user) { continue ; } //如果该用户不在数据库里,则帮助其注册 if(!D("User")->isExist($ldap_user)){ D("User")->register($ldap_user,$ldap_user.time()); } } D("Options")->set("ldap_form" , json_encode( $ldap_form)) ; } D("Options")->set("ldap_open" ,$ldap_open) ; $this->sendResult(array()); }
0
PHP
CWE-338
Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG)
The product uses a Pseudo-Random Number Generator (PRNG) in a security context, but the PRNG's algorithm is not cryptographically strong.
https://cwe.mitre.org/data/definitions/338.html
vulnerable
public function myaddressbook() { global $user; // check if the user is logged in. expQueue::flashIfNotLoggedIn('message',gt('You must be logged in to manage your address book.')); if (!$user->isAdmin() && $this->params['user_id'] != $user->id) { unset($this->params['user_id']); } expHistory::set('viewable', $this->params); $userid = (empty($this->params['user_id'])) ? $user->id : $this->params['user_id']; assign_to_template(array( 'addresses'=>$this->address->find('all', 'user_id='.$userid) )); }
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
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 testUnclosedTags() { $code = '[b]bold'; $codeOutput = '[b]bold[/b]'; $this->assertBBCodeOutput($code, $codeOutput); }
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 remove() { $this->checkCSRFParam(); $project = $this->getProject(); $filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id')); $this->checkPermission($project, $filter); if ($this->customFilterModel->remove($filter['id'])) { $this->flash->success(t('Custom filter removed successfully.')); } else { $this->flash->failure(t('Unable to remove this custom filter.')); } $this->response->redirect($this->helper->url->to('CustomFilterController', '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
protected function nonSpecialEntityCallback($matches) { // replaces all but big five $entity = $matches[0]; $is_num = (@$matches[0][1] === '#'); if ($is_num) { $is_hex = (@$entity[2] === 'x'); $code = $is_hex ? hexdec($matches[1]) : (int) $matches[2]; // abort for special characters if (isset($this->_special_dec2str[$code])) return $entity; return HTMLPurifier_Encoder::unichr($code); } else { if (isset($this->_special_ent2dec[$matches[3]])) return $entity; if (!$this->_entity_lookup) { $this->_entity_lookup = HTMLPurifier_EntityLookup::instance(); } if (isset($this->_entity_lookup->table[$matches[3]])) { return $this->_entity_lookup->table[$matches[3]]; } else { return $entity; } } }
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 update() { global $user; if (expSession::get('customer-signup')) expSession::set('customer-signup', false); if (isset($this->params['address_country_id'])) { $this->params['country'] = $this->params['address_country_id']; unset($this->params['address_country_id']); } if (isset($this->params['address_region_id'])) { $this->params['state'] = $this->params['address_region_id']; unset($this->params['address_region_id']); } if ($user->isLoggedIn()) { // check to see how many other addresses this user has already. $count = $this->address->find('count', 'user_id='.$user->id); // if this is first address save for this user we'll make this the default if ($count == 0) { $this->params['is_default'] = 1; $this->params['is_billing'] = 1; $this->params['is_shipping'] = 1; } // associate this address with the current user. $this->params['user_id'] = $user->id; // save the object $this->address->update($this->params); } else { //if (ecomconfig::getConfig('allow_anonymous_checkout')){ //user is not logged in, but allow anonymous checkout is enabled so we'll check //a few things that we don't check in the parent 'stuff and create a user account. $this->params['is_default'] = 1; $this->params['is_billing'] = 1; $this->params['is_shipping'] = 1; $this->address->update($this->params); } expHistory::back(); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
$dt = date('Y-m-d', strtotime($match)); $sql = par_rep("/'$match'/", "'$dt'", $sql); } } if (substr($sql, 0, 6) == "BEGIN;") { $array = explode(";", $sql); foreach ($array as $value) { if ($value != "") { $result = $connection->query($value); if (!$result) { $connection->query("ROLLBACK"); die(db_show_error($sql, _dbExecuteFailed, mysql_error())); } } } } else { $result = $connection->query($sql) or die(db_show_error($sql, _dbExecuteFailed, mysql_error())); } break; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function draw_vdef_preview($vdef_id) { ?> <tr class='even'> <td style='padding:4px'> <pre>vdef=<?php print html_escape(get_vdef($vdef_id, true));?></pre> </td> </tr> <?php }
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 providesExceptionData() { $notFoundEnvMessage = 'An error occurred. Request ID: 1234'; $notFoundEnvException = new NotFoundEnvException($notFoundEnvMessage); $notFoundEnvStatus = Http::STATUS_NOT_FOUND; $notFoundServiceMessage = 'An error occurred. Request ID: 1234'; $notFoundServiceException = new NotFoundServiceException($notFoundServiceMessage); $notFoundServiceStatus = Http::STATUS_NOT_FOUND; $forbiddenServiceMessage = 'Forbidden in service'; $forbiddenServiceException = new ForbiddenServiceException($forbiddenServiceMessage); $forbiddenServiceStatus = Http::STATUS_FORBIDDEN; $errorServiceMessage = 'An error occurred. Request ID: 1234'; $errorServiceException = new InternalServerErrorServiceException($errorServiceMessage); $errorServiceStatus = Http::STATUS_INTERNAL_SERVER_ERROR; $coreServiceMessage = 'An error occurred. Request ID: 1234'; $coreServiceException = new \Exception($coreServiceMessage); $coreServiceStatus = Http::STATUS_INTERNAL_SERVER_ERROR; return [ [$notFoundEnvException, $notFoundEnvMessage, $notFoundEnvStatus], [$notFoundServiceException, $notFoundServiceMessage, $notFoundServiceStatus], [$forbiddenServiceException, $forbiddenServiceMessage, $forbiddenServiceStatus], [$errorServiceException, $errorServiceMessage, $errorServiceStatus], [$coreServiceException, $coreServiceMessage, $coreServiceStatus] ]; }
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 showUnpublished() { expHistory::set('viewable', $this->params); // setup the where clause for looking up records. $where = parent::aggregateWhereClause(); $where = "((unpublish != 0 AND unpublish < ".time().") OR (publish > ".time().")) AND ".$where; if (isset($this->config['only_featured'])) $where .= ' AND is_featured=1'; $page = new expPaginator(array( 'model'=>'news', 'where'=>$where, 'limit'=>25, 'order'=>'unpublish', 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->baseclassname, 'action'=>$this->params['action'], 'src'=>$this->loc->src, 'columns'=>array( gt('Title')=>'title', gt('Published On')=>'publish', gt('Status')=>'unpublish' ), )); assign_to_template(array( 'page'=>$page )); }
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 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(); }
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 db_start() { global $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType; switch ($DatabaseType) { case 'mysqli': $connection = new mysqli($DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort); break; } // Error code for both. if ($connection === false) { switch ($DatabaseType) { case 'mysqli': $errormessage = mysqli_error($connection); break; } db_show_error("", "" . _couldNotConnectToDatabase . ": $DatabaseServer", $errormessage); } return $connection; }
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 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 static function validateRegex($path, $values) { $result = array($path => ''); if (empty($values[$path])) { return $result; } static::testPHPErrorMsg(); $matches = array(); // in libraries/ListDatabase.php _checkHideDatabase(), // a '/' is used as the delimiter for hide_db preg_match('/' . Util::requestString($values[$path]) . '/', '', $matches); static::testPHPErrorMsg(false); if (isset($php_errormsg)) { $error = preg_replace('/^preg_match\(\): /', '', $php_errormsg); return array($path => $error); } return $result; }
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 getViewFileParams () { if (!isset ($this->_viewFileParams)) { $this->_viewFileParams = array_merge ( parent::getViewFileParams (), array ( 'chartType' => $this->chartType, 'chartSettingsDataProvider' => self::getChartSettingsProvider ( $this->chartType), 'eventTypes' => array ('all'=>Yii::t('app', 'All Events')) + Events::$eventLabels, 'socialSubtypes' => json_decode ( Dropdowns::model()->findByPk(113)->options,true), 'visibilityFilters' => array ( '1'=>'Public', '0'=>'Private', ), 'suppressChartSettings' => false, 'chartType' => 'usersChart', 'widgetUID' => $this->widgetUID, 'metricTypes' => User::getUserOptions (), ) ); } return $this->_viewFileParams; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function XMLRPCgetUserGroups($groupType=0, $affiliationid=0) { global $user; $groups = getUserGroups($groupType, $affiliationid); // Filter out any groups to which the user does not have access. $usergroups = array(); foreach($groups as $id => $group){ if($group['ownerid'] == $user['id'] || (array_key_exists("editgroupid", $group) && array_key_exists($group['editgroupid'], $user["groups"])) || (array_key_exists($id, $user["groups"]))){ array_push($usergroups, $group); } } return array( "status" => "success", "groups" => $usergroups); }
0
PHP
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
function checkHTTP($link, $get_body = false) { if (! function_exists('curl_init')) { return null; } $ch = curl_init($link); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ch, CURLOPT_USERAGENT, 'phpMyAdmin/' . PMA_VERSION); curl_setopt($ch, CURLOPT_TIMEOUT, 5); if (! defined('TESTSUITE')) { session_write_close(); } $data = @curl_exec($ch); if (! defined('TESTSUITE')) { ini_set('session.use_only_cookies', '0'); ini_set('session.use_cookies', '0'); ini_set('session.use_trans_sid', '0'); ini_set('session.cache_limiter', 'nocache'); session_start(); } if ($data === false) { return null; } $httpOk = 'HTTP/1.1 200 OK'; $httpNotFound = 'HTTP/1.1 404 Not Found'; if (substr($data, 0, strlen($httpOk)) === $httpOk) { return $get_body ? /*overload*/mb_substr( $data, /*overload*/mb_strpos($data, "\r\n\r\n") + 4 ) : true; } $httpNOK = substr( $data, 0, strlen($httpNotFound) ); if ($httpNOK === $httpNotFound) { return false; } return null; }
0
PHP
CWE-310
Cryptographic Issues
Weaknesses in this category are related to the design and implementation of data confidentiality and integrity. Frequently these deal with the use of encoding techniques, encryption libraries, and hashing algorithms. The weaknesses in this category could lead to a degradation of the quality data if they are not addressed.
https://cwe.mitre.org/data/definitions/310.html
vulnerable
function db_seq_nextval($seqname) { global $DatabaseType; if ($DatabaseType == 'mysqli') $seq = "fn_" . strtolower($seqname) . "()"; return $seq; }
0
PHP
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
vulnerable
public static function opt($var) { $opt = self::$opt; if (key_exists($var,$opt)) { if ($var == 'mdo_adsense') { return self::isAdsense($opt[$var]); } else { return urldecode(self::$opt[$var]); } } }
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 testNoAuthorityWithInvalidPath() { $input = 'urn://example:animal:ferret:nose'; $uri = new Uri($input); }
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 PHPMailerAutoload($classname) { //Can't use __DIR__ as it's only in PHP 5.3+ $filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php'; if (is_readable($filename)) { require $filename; } }
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 edit_internalalias() { $section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params); if ($section->parent == -1) { notfoundController::handle_not_found(); exit; } // doesn't work for standalone pages if (empty($section->id)) { $section->public = 1; if (!isset($section->parent)) { // This is another precaution. The parent attribute // should ALWAYS be set by the caller. //FJD - if that's the case, then we should die. notfoundController::handle_not_authorized(); exit; //$section->parent = 0; } } assign_to_template(array( 'section' => $section, 'glyphs' => self::get_glyphs(), )); }
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 isAllowedFilename($filename){ $allow_array = array( '.jpg','.jpeg','.png','.bmp','.gif','.ico','.webp', '.mp3','.wav','.mp4', '.mov','.webmv','.flac','.mkv', '.zip','.tar','.gz','.tgz','.ipa','.apk','.rar','.iso', '.pdf','.ofd','.swf','.epub','.xps', '.doc','.docx','.wps', '.ppt','.pptx','.xls','.xlsx','.txt','.psd','.csv', '.cer','.ppt','.pub','.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
function addDiscountToCart() { // global $user, $order; global $order; //lookup discount to see if it's real and valid, and not already in our cart //this will change once we allow more than one coupon code $discount = new discounts(); $discount = $discount->getCouponByName($this->params['coupon_code']); if (empty($discount)) { flash('error', gt("This discount code you entered does not exist.")); //redirect_to(array('controller'=>'cart', 'action'=>'checkout')); expHistory::back(); } //check to see if it's in our cart already if ($this->isDiscountInCart($discount->id)) { flash('error', gt("This discount code is already in your cart.")); //redirect_to(array('controller'=>'cart', 'action'=>'checkout')); expHistory::back(); } //this should really be reworked, as it shoudn't redirect directly and not return $validateDiscountMessage = $discount->validateDiscount(); if ($validateDiscountMessage == "") { //if all good, add to cart, otherwise it will have redirected $od = new order_discounts(); $od->orders_id = $order->id; $od->discounts_id = $discount->id; $od->coupon_code = $discount->coupon_code; $od->title = $discount->title; $od->body = $discount->body; $od->save(); // set this to just the discount applied via this coupon?? if so, when though? $od->discount_total = ??; flash('message', gt("The discount code has been applied to your cart.")); } else { flash('error', $validateDiscountMessage); } //redirect_to(array('controller'=>'cart', 'action'=>'checkout')); expHistory::back(); }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public static function initializeNavigation() { $sections = section::levelTemplate(0, 0); return $sections; }
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 AddAddress($address, $name = '') { return $this->AddAnAddress('to', $address, $name); }
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 static function _date2timestamp( $datetime, $wtz=null ) { if( !isset( $datetime['hour'] )) $datetime['hour'] = 0; if( !isset( $datetime['min'] )) $datetime['min'] = 0; if( !isset( $datetime['sec'] )) $datetime['sec'] = 0; if( empty( $wtz ) && ( !isset( $datetime['tz'] ) || empty( $datetime['tz'] ))) return mktime( $datetime['hour'], $datetime['min'], $datetime['sec'], $datetime['month'], $datetime['day'], $datetime['year'] ); $output = $offset = 0; if( empty( $wtz )) { if( iCalUtilityFunctions::_isOffset( $datetime['tz'] )) { $offset = iCalUtilityFunctions::_tz2offset( $datetime['tz'] ) * -1; $wtz = 'UTC'; } else $wtz = $datetime['tz']; } if(( 'Z' == $wtz ) || ( 'GMT' == strtoupper( $wtz ))) $wtz = 'UTC'; try { $strdate = sprintf( '%04d-%02d-%02d %02d:%02d:%02d', $datetime['year'], $datetime['month'], $datetime['day'], $datetime['hour'], $datetime['min'], $datetime['sec'] ); $d = new DateTime( $strdate, new DateTimeZone( $wtz )); if( 0 != $offset ) // adjust for offset $d->modify( $offset.' seconds' ); $output = $d->format( 'U' ); unset( $d ); } catch( Exception $e ) { $output = mktime( $datetime['hour'], $datetime['min'], $datetime['sec'], $datetime['month'], $datetime['day'], $datetime['year'] ); } return $output; }
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() { $this->manager = new HTMLPurifier_HTMLModuleManager(); }
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
$rndString = function ($len = 10) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $randomString = ''; for ($i = 0; $i < $len; $i++) { $randomString .= $characters[rand(0, strlen($characters) - 1)]; } return $randomString; };
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