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 testSettingCookie() { $_SERVER['REQUEST_METHOD'] = 'GET'; $controller = $this->getMock('Cake\Controller\Controller', ['redirect']); $controller->request = new Request(['webroot' => '/dir/']); $controller->response = new Response(); $event = new Event('Controller.startup', $controller); $this->component->startup($event); $cookie = $controller->response->cookie('csrfToken'); $this->assertNotEmpty($cookie, 'Should set a token.'); $this->assertRegExp('/^[a-f0-9]+$/', $cookie['value'], 'Should look like a hash.'); $this->assertEquals(0, $cookie['expire'], 'session duration.'); $this->assertEquals('/dir/', $cookie['path'], 'session path.'); $this->assertEquals($cookie['value'], $controller->request->params['_csrfToken']); }
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 __construct() { }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public function validate($input) { return (bool) preg_match('/^[A-z0-9\-#., ()%]+$/', $input); }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
function edit() { if (empty($this->params['content_id'])) { flash('message',gt('An error occurred: No content id set.')); expHistory::back(); } /* The global constants can be overridden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet // $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login']; // $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval']; // $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification']; // $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email']; $id = empty($this->params['id']) ? null : $this->params['id']; $comment = new expComment($id); //FIXME here is where we might sanitize the comment before displaying/editing it assign_to_template(array( 'content_id'=>$this->params['content_id'], 'content_type'=>$this->params['content_type'], 'comment'=>$comment )); }
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 init_args() { $args = new stdClass(); $_REQUEST = strings_stripSlashes($_REQUEST); $args->build_id = isset($_REQUEST['build_id']) ? $_REQUEST['build_id'] : 0; $args->confirmed = isset($_REQUEST['confirmed']) && $_REQUEST['confirmed'] == 'yes' ? true : false; $args->user_id = $_SESSION['userID']; $args->testproject_id = $_SESSION['testprojectID']; $args->testproject_name = $_SESSION['testprojectName']; $args->refreshTree = isset($_SESSION['setting_refresh_tree_on_action']) ? $_SESSION['setting_refresh_tree_on_action'] : false; return $args; }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public function toString() { // reconstruct authority $authority = null; // there is a rendering difference between a null authority // (http:foo-bar) and an empty string authority // (http:///foo-bar). if (!is_null($this->host)) { $authority = ''; if(!is_null($this->userinfo)) $authority .= $this->userinfo . '@'; $authority .= $this->host; if(!is_null($this->port)) $authority .= ':' . $this->port; } // Reconstruct the result // One might wonder about parsing quirks from browsers after // this reconstruction. Unfortunately, parsing behavior depends // on what *scheme* was employed (file:///foo is handled *very* // differently than http:///foo), so unfortunately we have to // defer to the schemes to do the right thing. $result = ''; if (!is_null($this->scheme)) $result .= $this->scheme . ':'; if (!is_null($authority)) $result .= '//' . $authority; $result .= $this->path; if (!is_null($this->query)) $result .= '?' . $this->query; if (!is_null($this->fragment)) $result .= '#' . $this->fragment; return $result; }
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 parseAndTrimExport($str, $isHTML = false) { //�Death from above�? � //echo "1<br>"; eDebug($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("\r\n", " ", $str); $str = str_replace("\t", " ", $str); $str = str_replace(",", "\,", $str); $str = str_replace("�", "&#188;", $str); $str = str_replace("�", "&#189;", $str); $str = str_replace("�", "&#190;", $str); if (!$isHTML) { $str = str_replace('\"', "&quot;", $str); $str = str_replace('"', "&quot;", $str); } else { $str = str_replace('"', '""', $str); } //$str = htmlspecialchars($str); //$str = utf8_encode($str); $str = 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 function load($id) { try { $select = $this->zdb->select(self::TABLE, 't'); $select->where(self::PK . ' = ' . $id); $select->join( array('a' => PREFIX_DB . Adherent::TABLE), 't.' . Adherent::PK . '=a.' . Adherent::PK, array() ); //restrict query on current member id if he's not admin nor staff member if (!$this->login->isAdmin() && !$this->login->isStaff() && !$this->login->isGroupManager()) { if (!$this->login->isLogged()) { Analog::log( 'Non-logged-in users cannot load transaction id `' . $id, Analog::ERROR ); return false; } $select->where ->nest() ->equalTo('a.' . Adherent::PK, $this->login->id) ->or ->equalTo('a.parent_id', $this->login->id) ->unnest() ->and ->equalTo('t.' . self::PK, $id) ; } else { $select->where->equalTo(self::PK, $id); } $results = $this->zdb->execute($select); $result = $results->current(); if ($result) { $this->loadFromRS($result); return true; } else { Analog::log( 'Transaction id `' . $id . '` does not exists', Analog::WARNING ); return false; } } catch (Throwable $e) { Analog::log( 'Cannot load transaction form id `' . $id . '` | ' . $e->getMessage(), Analog::WARNING ); throw $e; } }
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 subscriptions() { global $db; expHistory::set('manageable', $this->params); // make sure we have what we need. if (empty($this->params['key'])) expQueue::flashAndFlow('error', gt('The security key for account was not supplied.')); if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The subscriber id for account was not supplied.')); // verify the id/key pair $sub = new subscribers($this->params['id']); if (empty($sub->id)) expQueue::flashAndFlow('error', gt('We could not find any subscriptions matching the ID and Key you provided.')); // get this users subscriptions $subscriptions = $db->selectColumn('expeAlerts_subscribers', 'expeAlerts_id', 'subscribers_id='.$sub->id); // get a list of all available E-Alerts $ealerts = new expeAlerts(); assign_to_template(array( 'subscriber'=>$sub, 'subscriptions'=>$subscriptions, 'ealerts'=>$ealerts->find('all') )); }
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 testDoesNotAddPortWhenNoPort() { $this->assertEquals('bar', new Uri('//bar')); $this->assertEquals('bar', (new Uri('//bar'))->getHost()); }
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 getLinkTypes () { return Yii::app()->db->createCommand (" SELECT distinct(modelName) FROM x2_fields WHERE fieldName='nameId' ORDER by modelName ASC ")->queryColumn (); }
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 ($fields as $field => $title) { if($i==0 && $j==0){ echo '<div class="row">'; }elseif($i==0 && $j>0){ echo '</div><div class="row">'; } echo '<div class="col-md-6"><label class="checkbox-inline"><INPUT type=checkbox onclick="addHTML(\'<LI>' . $title . '</LI>\',\'names_div\',false);addHTML(\'<INPUT type=hidden name=fields[' . $field . '] value=Y>\',\'fields_div\',false);addHTML(\'\',\'names_div_none\',true);this.disabled=true">' . $title . '<label></div>'; /*if ($i % 2 == 0) echo '</TR><TR>';*/ $i++; if($i==2){ $i = 0; } $j++; }
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
$is_child = ($nesting == 0); // direct if ($token instanceof HTMLPurifier_Token_Start) { $nesting++; } elseif ($token instanceof HTMLPurifier_Token_End) { $nesting--; } if ($is_child) { $list_of_children .= $token->name . ','; } } // add leading comma to deal with stray comma declarations $list_of_children = ',' . rtrim($list_of_children, ','); $okay = preg_match( '/^,?'.$this->_pcre_regex.'$/', $list_of_children ); return (bool) $okay; }
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 OA_runMPE() { $objResponse = new xajaxResponse(); $objResponse->addAssign("run-mpe", "innerHTML", "<img src='run-mpe.ph?token=".urlencode(phpAds_SessionGetToken())."' />"); return $objResponse; }
1
PHP
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
safe
public function permissions_all() { //set the permissions array $perms = array(); foreach ($this->permissions as $perm => $name) { if (!in_array($perm, $this->remove_permissions)) $perms[$perm] = $name; } $perms = array_merge($perms, $this->m_permissions, $this->add_permissions, $this->manage_permissions); return $perms; }
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
function wp_kses_bad_protocol_once( $string, $allowed_protocols, $count = 1 ) { $string = preg_replace( '/(&#0*58(?![;0-9])|&#x0*3a(?![;a-f0-9]))/i', '$1;', $string ); $string2 = preg_split( '/:|&#0*58;|&#x0*3a;/i', $string, 2 ); if ( isset( $string2[1] ) && ! preg_match( '%/\?%', $string2[0] ) ) { $string = trim( $string2[1] ); $protocol = wp_kses_bad_protocol_once2( $string2[0], $allowed_protocols ); if ( 'feed:' == $protocol ) { if ( $count > 2 ) { return ''; } $string = wp_kses_bad_protocol_once( $string, $allowed_protocols, ++$count ); if ( empty( $string ) ) { return $string; } } $string = $protocol . $string; } 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
static function authenticate() { if (isset($_REQUEST['backend_login'])) { $user = DB_DataObject::factory('users'); $user->active = true; $user->name = $_REQUEST['username']; $user->find(true); // Don't look whether that user exists, so we give less timing information // Instead, rely only on having a matching password $proffered_password = $_REQUEST['password']; if (in_array( $user->password, self::password_hashes($proffered_password, $user->password_salt) )) { // Regenerate the session ID, unless it's an IE we're talking to which would use the old session ID to load the frame contents // Remove this guard once we no longer use frames if(!preg_match('/(?i)msie /', $_SERVER['HTTP_USER_AGENT'])) { session_regenerate_id(); } $user->login(); return $user; } else { Log::warn("Failed login for user name '".$_REQUEST['username']."' from " . $_SERVER['REMOTE_ADDR'].' user-agent '.$_SERVER['HTTP_USER_AGENT']); return -1; } } return false; }
0
PHP
CWE-522
Insufficiently Protected Credentials
The product transmits or stores authentication credentials, but it uses an insecure method that is susceptible to unauthorized interception and/or retrieval.
https://cwe.mitre.org/data/definitions/522.html
vulnerable
$p = $vars['paging'] - (ceil($maxpage / 2) - 1); $limit = $curr + ceil($maxpage / 2) - 1; // echo "more maxpage"; } else { $p = $vars['paging'] - (ceil($maxpage / 2) - 1); $limit = $curr + floor($maxpage / 2); } for ($i = $p; $i <= $limit /*ceil($total/$vars['max'])+1*/; ++$i) { # code... if ($smart == true) { $url = $vars['url'].'/paging/'.$i; } else { $url = $vars['url'].'&paging='.$i; } if ($vars['paging'] == $i) { $sel = 'class="active"'; } else { $sel = ''; } $r .= "<li {$sel}><a href=\"{$url}\">$i</a></li>"; } $r .= '</ul>'; } elseif (isset($vars['type']) && $vars['type'] == 'pager') { // PAGER
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 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) { $site = Typo::slugify(Options::v('sitename')); $uniqfile = $site.'-'.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(file_exists($filepath)) { // @chmod($filepath,0755); //Change the file permissions if allowed // @unlink($filepath); //remove the file // } if (move_uploaded_file( $filetmp, $filepath ) ) { $result['filesize'] = filesize($filepath); $result['filename'] = $uniqfile.$filename; $result['path'] = $path.$uniqfile.$filename; $result['filepath'] = $filepath; $result['fileurl'] = Site::$url.$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; }
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 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 }
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 load($id) { global $zdb; try { $select = $zdb->select(self::TABLE); $select->limit(1)->where(self::PK . ' = ' . $id); $results = $zdb->execute($select); $res = $results->current(); $this->id = $id; $this->short = $res->short_label; $this->long = $res->long_label; } catch (Throwable $e) { Analog::log( 'An error occurred loading title #' . $id . "Message:\n" . $e->getMessage(), Analog::ERROR ); throw $e; } }
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 isFrozen() { @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); 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 approve() { expHistory::set('editable', $this->params); /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login']; $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval']; $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification']; $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email']; if (empty($this->params['id'])) { flash('error', gt('No ID supplied for note to approve')); $lastUrl = expHistory::getLast('editable'); } $simplenote = new expSimpleNote($this->params['id']); assign_to_template(array( 'simplenote'=>$simplenote, 'require_login'=>$require_login, 'require_approval'=>$require_approval, 'require_notification'=>$require_notification, 'notification_email'=>$notification_email, 'tab'=>$this->params['tab'] )); }
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
return $fa->nameGlyph($icons, 'icon-'); } } else { return array(); } }
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 ($allgroups as $gid) { $g = group::getGroupById($gid); expPermissions::grantGroup($g, 'manage', $sloc); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public function approve_toggle() { if (empty($this->params['id'])) return; /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet // $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login']; // $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval']; // $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification']; // $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email']; $comment = new expComment($this->params['id']); $comment->approved = $comment->approved == 1 ? 0 : 1; if ($comment->approved) { $this->sendApprovalNotification($comment,$this->params); } $comment->save(); 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 upload() { // upload the file, but don't save the record yet... if ($this->params['resize'] != 'false') { $maxwidth = $this->params['max_width']; } else { $maxwidth = null; } $file = expFile::fileUpload('Filedata',false,false,null,null,$maxwidth); // since most likely this function will only get hit via flash in YUI Uploader // and since Flash can't pass cookies, we lose the knowledge of our $user // so we're passing the user's ID in as $_POST data. We then instantiate a new $user, // and then assign $user->id to $file->poster so we have an audit trail for the upload if (is_object($file)) { $resized = !empty($file->resized) ? true : false; $user = new user($this->params['usrid']); $file->poster = $user->id; $file->posted = $file->last_accessed = time(); $file->save(); if (!empty($this->params['cat'])) { $expcat = new expCat($this->params['cat']); $params['expCat'][0] = $expcat->id; $file->update($params); } // a echo so YUI Uploader is notified of the function's completion if ($resized) { echo gt('File resized and then saved'); } else { echo gt('File saved'); } } else { echo gt('File was NOT uploaded!'); // flash('error',gt('File was not uploaded!')); } }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public function get_item( $request ) { $id = (int) $request['id']; $post = get_post( $id ); if ( empty( $id ) || empty( $post->ID ) || $this->post_type !== $post->post_type ) { return new WP_Error( 'rest_post_invalid_id', __( 'Invalid post ID.' ), array( 'status' => 404 ) ); } $data = $this->prepare_item_for_response( $post, $request ); $response = rest_ensure_response( $data ); if ( is_post_type_viewable( get_post_type_object( $post->post_type ) ) ) { $response->link_header( 'alternate', get_permalink( $id ), array( 'type' => 'text/html' ) ); } return $response; }
0
PHP
NVD-CWE-noinfo
null
null
null
vulnerable
public function uploadImage() { $filesCheck = array_filter($_FILES); if (!empty($filesCheck) && $this->approvedFileExtension($_FILES['file']['name'], 'image') && strpos($_FILES['file']['type'], 'image/') !== false) { ini_set('upload_max_filesize', '10M'); ini_set('post_max_size', '10M'); $tempFile = $_FILES['file']['tmp_name']; $targetPath = $this->root . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'userTabs' . DIRECTORY_SEPARATOR; $this->makeDir($targetPath); $targetFile = $targetPath . $_FILES['file']['name']; $this->setAPIResponse(null, pathinfo($_FILES['file']['name'], PATHINFO_BASENAME) . ' has been uploaded', null); return move_uploaded_file($tempFile, $targetFile); } }
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 function delete_item_permissions_check( $request ) { if ( ! $this->check_is_taxonomy_allowed( $this->taxonomy ) ) { return false; } $term = get_term( (int) $request['id'], $this->taxonomy ); if ( ! $term ) { return new WP_Error( 'rest_term_invalid', __( 'Term does not exist.' ), array( 'status' => 404 ) ); } if ( ! current_user_can( 'delete_term', $term->term_id ) ) { return new WP_Error( 'rest_cannot_delete', __( 'Sorry, you are not allowed to delete this term.' ), array( 'status' => rest_authorization_required_code() ) ); } return true; }
0
PHP
NVD-CWE-noinfo
null
null
null
vulnerable
function edit_section() { global $db, $user; $parent = new section($this->params['parent']); if (empty($parent->id)) $parent->id = 0; assign_to_template(array( 'haveStandalone' => ($db->countObjects('section', 'parent=-1') && $parent->id >= 0), 'parent' => $parent, 'isAdministrator' => $user->isAdmin(), )); }
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 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
$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-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 configureDefaults(array $config) { $defaults = [ 'allow_redirects' => RedirectMiddleware::$defaultSettings, 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false ]; // Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set if ($proxy = getenv('HTTP_PROXY')) { $defaults['proxy']['http'] = $proxy; } if ($proxy = getenv('HTTPS_PROXY')) { $defaults['proxy']['https'] = $proxy; } if ($noProxy = getenv('NO_PROXY')) { $cleanedNoProxy = str_replace(' ', '', $noProxy); $defaults['proxy']['no'] = explode(',', $cleanedNoProxy); } $this->config = $config + $defaults; if (!empty($config['cookies']) && $config['cookies'] === true) { $this->config['cookies'] = new CookieJar(); } // Add the default user-agent header. if (!isset($this->config['headers'])) { $this->config['headers'] = ['User-Agent' => default_user_agent()]; } else { // Add the User-Agent header if one was not already set. foreach (array_keys($this->config['headers']) as $name) { if (strtolower($name) === 'user-agent') { return; } } $this->config['headers']['User-Agent'] = default_user_agent(); } }
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_order_item() { $oi = new orderitem($this->params['id'], true, true); if (empty($oi->id)) { flash('error', gt('Order item doesn\'t exist.')); expHistory::back(); } $oi->user_input_fields = expUnserialize($oi->user_input_fields); $params['options'] = $oi->opts; $params['user_input_fields'] = $oi->user_input_fields; $oi->product = new product($oi->product->id, true, true); if ($oi->product->parent_id != 0) { $parProd = new product($oi->product->parent_id); //$oi->product->optiongroup = $parProd->optiongroup; $oi->product = $parProd; } //FIXME we don't use selectedOpts? // $oi->selectedOpts = array(); // if (!empty($oi->opts)) { // foreach ($oi->opts as $opt) { // $option = new option($opt[0]); // $og = new optiongroup($option->optiongroup_id); // if (!isset($oi->selectedOpts[$og->id]) || !is_array($oi->selectedOpts[$og->id])) // $oi->selectedOpts[$og->id] = array($option->id); // else // array_push($oi->selectedOpts[$og->id], $option->id); // } // } //eDebug($oi->selectedOpts); assign_to_template(array( 'oi' => $oi, 'params' => $params )); }
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 _makeChooseCheckbox($value, $title) { global $THIS_RET; // return '<INPUT type=checkbox name=st_arr[] value=' . $value . ' checked>'; return "<input name=unused[$THIS_RET[STUDENT_ID]] value=" . $THIS_RET[STUDENT_ID] . " type='checkbox' id=$THIS_RET[STUDENT_ID] onClick='setHiddenCheckboxStudents(\"st_arr[]\",this,$THIS_RET[STUDENT_ID]);' />"; }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public function before_content( $content ) { global $post; $post_id = $post->ID; // show on single sell media pages if ( is_singular( 'sell_media_item' ) || sell_media_attachment( $post_id ) || sell_media_is_search() ) { // bail if it's password protected item if ( post_password_required( $post ) || ( isset( $post->post_parent ) && post_password_required( $post->post_parent ) ) ) { return $content; } $has_multiple_attachments = sell_media_has_multiple_attachments( $post_id ); $wrap = ( ! $has_multiple_attachments || 'attachment' === get_post_type( $post_id ) ) ? true : false; $new_content = ''; // only wrap content if a single image/media is being viewed if ( $wrap ) { $new_content .= '<div class="sell-media-content">'; } $new_content .= sell_media_breadcrumbs(); $new_content .= sell_media_get_media(); $new_content .= $content; // only wrap content if a single image/media is being viewed if ( $wrap ) { $new_content .= '</div>'; } $content = $new_content; // set the post views, used for popular query sell_media_set_post_views( $post_id ); } return apply_filters( 'sell_media_content', $content ); }
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
static function description() { return gt("This module is for managing categories in your store."); }
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 pending() { // global $db; // make sure we have what we need. if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('Your subscriber ID was not supplied.')); // find the subscriber and their pending subscriptions $ealerts = expeAlerts::getPendingBySubscriber($this->params['id']); $subscriber = new subscribers($this->params['id']); // render the template assign_to_template(array( 'subscriber'=>$subscriber, 'ealerts'=>$ealerts )); }
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 _chmod($path, $mode) { $modeOct = is_string($mode) ? octdec($mode) : octdec(sprintf("%04o",$mode)); return ftp_chmod($this->connect, $modeOct, $path); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
function PMA_secureSession() { // prevent session fixation and XSS // (better to use session_status() if available) if ((PMA_PHP_INT_VERSION >= 50400 && session_status() === PHP_SESSION_ACTIVE) || (PMA_PHP_INT_VERSION < 50400 && session_id() !== '') ) { session_regenerate_id(true); } $_SESSION[' PMA_token '] = bin2hex(phpseclib\Crypt\Random::string(16)); }
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 get_item( $request ) { $user = $this->get_user( $request['id'] ); if ( is_wp_error( $user ) ) { return $user; } $user = $this->prepare_item_for_response( $user, $request ); $response = rest_ensure_response( $user ); return $response; }
1
PHP
NVD-CWE-noinfo
null
null
null
safe
protected function getProjectTag(array $project) { $tag = $this->tagModel->getById($this->request->getIntegerParam('tag_id')); if (empty($tag)) { throw new PageNotFoundException(); } if ($tag['project_id'] != $project['id']) { throw new AccessForbiddenException(); } return $tag; }
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
function showByModel() { global $order, $template, $db; expHistory::set('viewable', $this->params); $product = new product(); $model = $product->find("first", 'model="' . $this->params['model'] . '"'); //eDebug($model); $product_type = new $model->product_type($model->id); //eDebug($product_type); $tpl = $product_type->getForm('show'); if (!empty($tpl)) $template = new controllertemplate($this, $tpl); //eDebug($template); $this->grabConfig(); // grab the global config assign_to_template(array( 'config' => $this->config, 'product' => $product_type, 'last_category' => $order->lastcat )); }
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 backend($vars="") { if(!empty($_GET['page'])) { self::incBack($_GET['page']); }else{ self::incBack('default'); } }
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 from($dirName) { $this->from = $dirName; return $this; }
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 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 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 )); }
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 get($key, $default = null, $deep = false) { if ($deep) { @trigger_error('Using paths to find deeper items in '.__METHOD__.' is deprecated since version 2.8 and will be removed in 3.0. Filter the returned value in your own code instead.', E_USER_DEPRECATED); } if (!$deep || false === $pos = strpos($key, '[')) { return array_key_exists($key, $this->parameters) ? $this->parameters[$key] : $default; } $root = substr($key, 0, $pos); if (!array_key_exists($root, $this->parameters)) { return $default; } $value = $this->parameters[$root]; $currentKey = null; for ($i = $pos, $c = strlen($key); $i < $c; ++$i) { $char = $key[$i]; if ('[' === $char) { if (null !== $currentKey) { throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "[" at position %d.', $i)); } $currentKey = ''; } elseif (']' === $char) { if (null === $currentKey) { throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "]" at position %d.', $i)); } if (!is_array($value) || !array_key_exists($currentKey, $value)) { return $default; } $value = $value[$currentKey]; $currentKey = null; } else { if (null === $currentKey) { throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "%s" at position %d.', $char, $i)); } $currentKey .= $char; } } if (null !== $currentKey) { throw new \InvalidArgumentException(sprintf('Malformed path. Path must end with "]".')); } return $value; }
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 url($mod) { $url = Site::$url.'/inc/mod/'.$mod; return $url; }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public function testDoesNotTouchClosureListeners() { $this->getServer()->flush(); $this->getServer()->enqueue(array( "HTTP/1.1 200 OK\r\n" . "Date: Mon, 12 Nov 2012 03:06:37 GMT\r\n" . "Cache-Control: private, s-maxage=0, max-age=0, must-revalidate\r\n" . "Last-Modified: Mon, 12 Nov 2012 02:53:38 GMT\r\n" . "Content-Length: 2\r\n\r\nhi", "HTTP/1.0 304 Not Modified\r\n" . "Date: Mon, 12 Nov 2012 03:06:38 GMT\r\n" . "Content-Type: text/html; charset=UTF-8\r\n" . "Last-Modified: Mon, 12 Nov 2012 02:53:38 GMT\r\n" . "Age: 6302\r\n\r\n", "HTTP/1.0 304 Not Modified\r\n" . "Date: Mon, 12 Nov 2012 03:06:38 GMT\r\n" . "Content-Type: text/html; charset=UTF-8\r\n" . "Last-Modified: Mon, 12 Nov 2012 02:53:38 GMT\r\n" . "Age: 6302\r\n\r\n", )); $client = new Client($this->getServer()->getUrl()); $client->addSubscriber(new CachePlugin()); $client->getEventDispatcher()->addListener('command.after_send', function(){}); $this->assertEquals(200, $client->get()->send()->getStatusCode()); $this->assertEquals(200, $client->get()->send()->getStatusCode()); $this->assertEquals(200, $client->get()->send()->getStatusCode()); }
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 getCategory() { $category = $this->categoryModel->getById($this->request->getIntegerParam('category_id')); if (empty($category)) { throw new PageNotFoundException(); } return $category; }
0
PHP
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
public function showByTitle() { expHistory::set('viewable', $this->params); $modelname = $this->basemodel_name; // first we'll check to see if this matches the sef_url field...if not then we'll look for the // title field $this->params['title'] = expString::escape($this->params['title']); // escape title to prevent sql injection $record = $this->$modelname->find('first', "sef_url='" . $this->params['title'] . "'"); if (!is_object($record)) { $record = $this->$modelname->find('first', "title='" . $this->params['title'] . "'"); } $this->loc = unserialize($record->location_data); 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 function withStatus($code, $reasonPhrase = '') { $new = clone $this; $new->statusCode = (int) $code; if ($reasonPhrase == '' && isset(self::$phrases[$new->statusCode])) { $reasonPhrase = self::$phrases[$new->statusCode]; } $new->reasonPhrase = $reasonPhrase; return $new; }
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
$criteria->addCondition (" $userCondition OR user IN ( SELECT DISTINCT b.username FROM x2_group_to_user a JOIN x2_group_to_user b ON a.groupId=b.groupId WHERE a.username=:getAccessCriteria_username ) OR ( associationType='User' AND associationId in ( SELECT DISTINCT b.id FROM x2_group_to_user a JOIN x2_group_to_user b ON a.groupId=b.groupId WHERE a.userId=:getAccessCriteria_userId ) )"); } else { // default history privacy (public or assigned) $criteria->addCondition (" $userCondition OR visibility=1 "); } } if ($profile) { $criteria->params[':getAccessCriteria_profileUsername'] = $profile->username; /* only show events associated with current profile which current user has permission to see */ $criteria->addCondition ("user=:getAccessCriteria_profileUsername"); if (!Yii::app()->params->isAdmin) { $criteria->addCondition ("visibility=1"); } } return $criteria; }
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
$section = new section($this->params); } else { notfoundController::handle_not_found(); exit; } if (!empty($section->id)) { $check_id = $section->id; } else { $check_id = $section->parent; } if (expPermissions::check('manage', expCore::makeLocation('navigation', '', $check_id))) { if (empty($section->id)) { $section->active = 1; $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(), )); } else { // User does not have permission to manage sections. Throw a 403 notfoundController::handle_not_authorized(); } }
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 ($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
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = false) { $this->catch = $catch; $this->backendRequest = $request; return parent::handle($request, $type, $catch); }
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($image_name) { $imageFile = storage_path('app/'.str_replace("-","/",$image_name)); if(!is_file($imageFile)){ abort(404); } $image = Image::make($imageFile); if(config('tipask.upload.open_watermark') && $image_name != config('tipask.upload.watermark_image') && str_contains($image_name,'attachments')){ $watermarkImage = storage_path('app/'.str_replace("-","/",config('tipask.upload.watermark_image'))); $image->insert($watermarkImage, 'bottom-right', 15, 10); } $response = response()->make($image->encode('jpg')); $response->header('Content-Type', 'image/jpeg'); $response->header('Expires', date(DATE_RFC822,strtotime(" 7 day"))); $response->header('Cache-Control', 'private, max-age=259200, pre-check=259200'); return $response; }
0
PHP
CWE-494
Download of Code Without Integrity Check
The product downloads source code or an executable from a remote location and executes the code without sufficiently verifying the origin and integrity of the code.
https://cwe.mitre.org/data/definitions/494.html
vulnerable
public static function getTemplateHierarchyFlat($parent, $depth = 1) { global $db; $arr = array(); $kids = $db->selectObjects('section_template', 'parent=' . $parent, 'rank'); // $kids = expSorter::sort(array('array'=>$kids,'sortby'=>'rank', 'order'=>'ASC')); for ($i = 0, $iMax = count($kids); $i < $iMax; $i++) { $page = $kids[$i]; $page->depth = $depth; $page->first = ($i == 0 ? 1 : 0); $page->last = ($i == count($kids) - 1 ? 1 : 0); $arr[] = $page; $arr = array_merge($arr, self::getTemplateHierarchyFlat($page->id, $depth + 1)); } return $arr; }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public function activate_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
protected function cacheDir($path) { $this->dirsCache[$path] = array(); $sql = 'SELECT f.id, f.parent_id, f.name, f.size, f.mtime AS ts, f.mime, f.read, f.write, f.locked, f.hidden, f.width, f.height, IF(ch.id, 1, 0) AS dirs FROM '.$this->tbf.' AS f LEFT JOIN '.$this->tbf.' AS ch ON ch.parent_id=f.id AND ch.mime="directory" WHERE f.parent_id="'.$path.'" GROUP BY f.id'; $res = $this->query($sql); if ($res) { while ($row = $res->fetch_assoc()) { // debug($row); $id = $row['id']; if ($row['parent_id']) { $row['phash'] = $this->encode($row['parent_id']); } if ($row['mime'] == 'directory') { unset($row['width']); unset($row['height']); } else { unset($row['dirs']); } unset($row['id']); unset($row['parent_id']); if (($stat = $this->updateCache($id, $row)) && empty($stat['hidden'])) { $this->dirsCache[$path][] = $id; } } } return $this->dirsCache[$path]; }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
array_push($stack, $node); } } return array( 'status' => 'success', 'nodes' => $nodes); } else { return array( 'status' => 'error', 'errorcode' => 56, 'errormsg' => 'User cannot access node content'); } }
0
PHP
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
public function confirm() { $task = $this->getTask(); $comment = $this->getComment(); $this->response->html($this->template->render('comment/remove', array( 'comment' => $comment, 'task' => $task, 'title' => t('Remove a comment') ))); }
0
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
public static function getSocialSubtypes () { $dropdown = Dropdowns::model()->findByPk(113); if (!$dropdown) return array (); return json_decode ( $dropdown->options,true); }
1
PHP
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
public function setParent($plist) { $this->parent = $plist; }
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 countFoldersInFolder(Folder $folder, $useFilters = true, $recursive = false) { $this->assureFolderReadPermission($folder); $filters = $useFilters ? $this->fileAndFolderNameFilters : []; return $this->driver->countFoldersInFolder($folder->getIdentifier(), $recursive, $filters); }
0
PHP
CWE-319
Cleartext Transmission of Sensitive Information
The software transmits sensitive or security-critical data in cleartext in a communication channel that can be sniffed by unauthorized actors.
https://cwe.mitre.org/data/definitions/319.html
vulnerable
function update() { global $db, $user; $this->params['content_type'] = preg_replace("/[^[:alnum:][:space:]]/u", '', $this->params['content_type']); $this->params['subtype'] = preg_replace("/[^[:alnum:][:space:]]/u", '', $this->params['subtype']); $this->params['id'] = $db->selectValue('content_expRatings','expratings_id',"content_id='".$this->params['content_id']."' AND content_type='".$this->params['content_type']."' AND subtype='".$this->params['subtype']."' AND poster='".$user->id."'"); $msg = gt('Thank you for your rating'); $rating = new expRating($this->params); if (!empty($rating->id)) $msg = gt('Your rating has been adjusted'); // save the rating $rating->update($this->params); // attach the rating to the datatype it belongs to (blog, news, etc..); $obj = new stdClass(); $obj->content_type = $this->params['content_type']; $obj->content_id = $this->params['content_id']; $obj->expratings_id = $rating->id; $obj->poster = $rating->poster; if(isset($this->params['subtype'])) $obj->subtype = $this->params['subtype']; $db->insertObject($obj, $rating->attachable_table); $ar = new expAjaxReply(200,$msg); $ar->send(); // flash('message', $msg); // 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
static function author() { return "Dave Leffler"; }
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
$section = new section($this->params); } else { notfoundController::handle_not_found(); exit; } if (!empty($section->id)) { $check_id = $section->id; } else { $check_id = $section->parent; } if (expPermissions::check('manage', expCore::makeLocation('navigation', '', $check_id))) { if (empty($section->id)) { $section->active = 1; $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(), )); } else { // User does not have permission to manage sections. Throw a 403 notfoundController::handle_not_authorized(); } }
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
$chrootPath = realpath($chrootPath); if ($chrootPath !== false && strpos($realfile, $chrootPath) === 0) { $chrootValid = true; break; } } if ($chrootValid !== true) { Helpers::record_warnings(E_USER_WARNING, "Permission denied on $remoteFile. The file could not be found under the paths specified by Options::chroot.", __FILE__, __LINE__); return false; } } if (!$realfile) { Helpers::record_warnings(E_USER_WARNING, "File '$realfile' not found.", __FILE__, __LINE__); return false; } $remoteFile = $realfile; } 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; }
0
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
vulnerable
public function getQueryGroupby() { return $this->getBind()->getQueryGroupby(); }
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 preview() { if ($this->params['id'] == 0) { // we want the default editor $demo = new stdClass(); $demo->id = 0; $demo->name = "Default"; if ($this->params['editor'] == 'ckeditor') { $demo->skin = 'kama'; } elseif ($this->params['editor'] == 'tinymce') { $demo->skin = 'lightgray'; } } else { $demo = self::getEditorSettings($this->params['id'], expString::escape($this->params['editor'])); } assign_to_template( array( 'demo' => $demo, 'editor' => $this->params['editor'] ) ); }
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 static function desc($vars){ if(!empty($vars)){ $desc = substr(strip_tags(htmlspecialchars_decode($vars).". ".Options::get('sitedesc')),0,150); }else{ $desc = substr(Options::get('sitedesc'),0,150); } return $desc; }
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 getFontSize() { $fs = $GLOBALS['PMA_Config']->get('fontsize'); if (!is_null($fs)) { return $fs; } if (isset($_COOKIE['pma_fontsize'])) { return $_COOKIE['pma_fontsize']; } return '82%'; }
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 updateObject($object, $table, $where=null, $identifier='id', $is_revisioned=false) { if ($is_revisioned) { $object->revision_id++; //if ($table=="text") eDebug($object); $res = $this->insertObject($object, $table); //if ($table=="text") eDebug($object,true); $this->trim_revisions($table, $object->$identifier, WORKFLOW_REVISION_LIMIT); return $res; } $sql = "UPDATE " . $this->prefix . "$table SET "; foreach (get_object_vars($object) as $var => $val) { //We do not want to save any fields that start with an '_' //if($is_revisioned && $var=='revision_id') $val++; if ($var{0} != '_') { if (is_array($val) || is_object($val)) { $val = serialize($val); $sql .= "`$var`='".$val."',"; } else { $sql .= "`$var`='" . $this->escapeString($val) . "',"; } } } $sql = substr($sql, 0, -1) . " WHERE "; if ($where != null) $sql .= $this->injectProof($where); else $sql .= "`" . $identifier . "`=" . $object->$identifier; //if ($table == 'text') eDebug($sql,true); $res = (@mysqli_query($this->connection, $sql) != false); return $res; }
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 main() { $ret = null; var_dump(fb_unserialize("\x14\x02\x01\x14\x02\x01\x02\x01\x01\x01", inout $ret)); var_dump($ret); }
1
PHP
CWE-674
Uncontrolled Recursion
The product does not properly control the amount of recursion which takes place, consuming excessive resources, such as allocated memory or the program stack.
https://cwe.mitre.org/data/definitions/674.html
safe
public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) { $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding); $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding); return self::mb_strrpos($haystack, $needle, $offset, $encoding); }
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 testInvalidUrisThrowException($invalidUri) { new Uri($invalidUri); }
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 editspeed() { 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']); assign_to_template(array( 'calculator'=>$calc )); }
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 load($id) { try { $select = $this->zdb->select(self::TABLE); $select->where(self::PK . ' = ' . $id); $results = $this->zdb->execute($select); $result = $results->current(); if ($result) { $this->loadFromRs($result); } } catch (Throwable $e) { Analog::log( 'Unable to retrieve field type for field ' . $id . ' | ' . $e->getMessage(), Analog::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
public function upload() { // upload the file, but don't save the record yet... if ($this->params['resize'] != 'false') { $maxwidth = $this->params['max_width']; } else { $maxwidth = null; } $file = expFile::fileUpload('Filedata',false,false,null,null,$maxwidth); // since most likely this function will only get hit via flash in YUI Uploader // and since Flash can't pass cookies, we lose the knowledge of our $user // so we're passing the user's ID in as $_POST data. We then instantiate a new $user, // and then assign $user->id to $file->poster so we have an audit trail for the upload if (is_object($file)) { $resized = !empty($file->resized) ? true : false; $user = new user($this->params['usrid']); $file->poster = $user->id; $file->posted = $file->last_accessed = time(); $file->save(); if (!empty($this->params['cat'])) { $expcat = new expCat($this->params['cat']); $params['expCat'][0] = $expcat->id; $file->update($params); } // a echo so YUI Uploader is notified of the function's completion if ($resized) { echo gt('File resized and then saved'); } else { echo gt('File saved'); } } else { echo gt('File was NOT uploaded!'); // flash('error',gt('File was not uploaded!')); } }
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 imgCrop($path, $width, $height, $x, $y, $destformat = null, $jpgQuality = null) { if (($s = @getimagesize($path)) == false) { return false; } $result = false; if (!$jpgQuality) { $jpgQuality = $this->options['jpgQuality']; } switch ($this->imgLib) { case 'imagick': try { $img = new imagick($path); } catch (Exception $e) { return false; } $ani = ($img->getNumberImages() > 1); if ($ani && is_null($destformat)) { $img = $img->coalesceImages(); do { $img->setImagePage($s[0], $s[1], 0, 0); $img->cropImage($width, $height, $x, $y); $img->setImagePage($width, $height, 0, 0); } while ($img->nextImage()); $img = $img->optimizeImageLayers(); $result = $img->writeImages($path, true); } else { if ($ani) { $img->setFirstIterator(); } $img->setImagePage($s[0], $s[1], 0, 0); $img->cropImage($width, $height, $x, $y); $img->setImagePage($width, $height, 0, 0); $result = $this->imagickImage($img, $path, $destformat, $jpgQuality); } $img->clear(); return $result ? $path : false; break; case 'gd': $img = $this->gdImageCreate($path,$s['mime']); if ($img && false != ($tmp = imagecreatetruecolor($width, $height))) { $this->gdImageBackground($tmp,$this->options['tmbBgColor']); $size_w = $width; $size_h = $height; if ($s[0] < $width || $s[1] < $height) { $size_w = $s[0]; $size_h = $s[1]; } if (!imagecopy($tmp, $img, 0, 0, $x, $y, $size_w, $size_h)) { return false; } $result = $this->gdImage($tmp, $path, $destformat, $s['mime'], $jpgQuality); imagedestroy($img); imagedestroy($tmp); return $result ? $path : false; } break; } 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
function update_upcharge() { $this->loc->src = "@globalstoresettings"; $config = new expConfig($this->loc); $this->config = $config->config; //This will make sure that only the country or region that given a rate value will be saved in the db $upcharge = array(); foreach($this->params['upcharge'] as $key => $item) { if(!empty($item)) { $upcharge[$key] = $item; } } $this->config['upcharge'] = $upcharge; $config->update(array('config'=>$this->config)); flash('message', gt('Configuration updated')); expHistory::back(); }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public function edit_discount() { $id = empty($this->params['id']) ? null : $this->params['id']; $discount = new discounts($id); //grab all user groups $group = new group(); //create two 'default' groups: $groups = array( -1 => 'ALL LOGGED IN USERS', -2 => 'ALL NON-LOGGED IN USERS' ); //loop our groups and append them to the array // foreach ($group->find() as $g){ //this is a workaround for older code. Use the previous line if possible: $allGroups = group::getAllGroups(); if (count($allGroups)) { foreach ($allGroups as $g) { $groups[$g->id] = $g->name; }; } //find our selected groups for this discount already // eDebug($discount); $selected_groups = array(); if (!empty($discount->group_ids)) { $selected_groups = expUnserialize($discount->group_ids); } if ($discount->minimum_order_amount == "") $discount->minimum_order_amount = 0; if ($discount->discount_amount == "") $discount->discount_amount = 0; if ($discount->discount_percent == "") $discount->discount_percent = 0; // get the shipping options and their methods $shipping_services = array(); $shipping_methods = array(); // $shipping = new shipping(); foreach (shipping::listAvailableCalculators() as $calcid=>$name) { if (class_exists($name)) { $calc = new $name($calcid); $shipping_services[$calcid] = $calc->title; $shipping_methods[$calcid] = $calc->availableMethods(); } } assign_to_template(array( 'discount'=>$discount, 'groups'=>$groups, 'selected_groups'=>$selected_groups, 'shipping_services'=>$shipping_services, 'shipping_methods'=>$shipping_methods )); }
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 uploadCustomLogoAction(Request $request) { $fileExt = File::getFileExtension($_FILES['Filedata']['name']); if (!in_array($fileExt, ['svg', 'png', 'jpg'])) { throw new \Exception('Unsupported file format'); } if($fileExt === 'svg') { if(strpos(file_get_contents($_FILES['Filedata']['tmp_name']), '<script')) { throw new \Exception('Scripts in SVG files are not supported'); } } $storage = Tool\Storage::get('admin'); $storage->writeStream(self::CUSTOM_LOGO_PATH, fopen($_FILES['Filedata']['tmp_name'], 'rb')); // set content-type to text/html, otherwise (when application/json is sent) chrome will complain in // Ext.form.Action.Submit and mark the submission as failed $response = $this->adminJson(['success' => true]); $response->headers->set('Content-Type', 'text/html'); return $response; }
1
PHP
CWE-434
Unrestricted Upload of File with Dangerous Type
The software allows the attacker to upload or transfer files of dangerous types that can be automatically processed within the product's environment.
https://cwe.mitre.org/data/definitions/434.html
safe
public static function botlist() { $botlist = array( 'Teoma', 'alexa', 'froogle', 'inktomi', 'looksmart', 'URL_Spider_SQL', 'Firefly', 'NationalDirectory', 'Ask Jeeves', 'TECNOSEEK', 'InfoSeek', 'WebFindBot', 'girafabot', 'crawler', 'www.galaxy.com', 'Googlebot', 'Scooter', 'Slurp', 'appie', 'FAST', 'WebBug', 'Spade', 'ZyBorg', 'rabaz', 'Twitterbot', 'MJ12bot', 'AhrefsBot', 'bingbot', 'YandexBot', 'spbot', ); return $botlist; }
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 layout_navbar() { $t_logo_url = config_get('logo_url'); echo '<div id="navbar" class="navbar navbar-default navbar-collapse navbar-fixed-top noprint">'; echo '<div id="navbar-container" class="navbar-container">'; echo '<button id="menu-toggler" type="button" class="navbar-toggle menu-toggler pull-left hidden-lg" data-target="#sidebar">'; echo '<span class="sr-only">Toggle sidebar</span>'; echo '<span class="icon-bar"></span>'; echo '<span class="icon-bar"></span>'; echo '<span class="icon-bar"></span>'; echo '</button>'; echo '<div class="navbar-header">'; echo '<a href="' . $t_logo_url . '" class="navbar-brand">'; echo '<span class="smaller-75"> '; echo string_display_line( config_get('window_title') ); echo ' </span>'; echo '</a>'; $t_toggle_class = (OFF == config_get('show_avatar') ? 'navbar-toggle' : 'navbar-toggle-img'); echo '<button type="button" class="navbar-toggle ' . $t_toggle_class . ' collapsed pull-right hidden-sm hidden-md hidden-lg" data-toggle="collapse" data-target=".navbar-buttons,.navbar-menu">'; echo '<span class="sr-only">Toggle user menu</span>'; if (auth_is_user_authenticated()) { layout_navbar_user_avatar(); } echo '</button>'; echo '</div>'; echo '<div class="navbar-buttons navbar-header navbar-collapse collapse">'; echo '<ul class="nav ace-nav">'; if (auth_is_user_authenticated()) { # shortcuts button bar layout_navbar_button_bar(); # projects dropdown menu layout_navbar_projects_menu(); # user buttons such as messages, notifications and user menu layout_navbar_user_menu(); } echo '</ul>'; echo '</div>'; echo '</div>'; echo '</div>'; }
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(string $appName, IRequest $request, ITimeFactory $timeFactory, IInitialState $initialState, BookingService $bookingService, AppointmentConfigService $appointmentConfigService, URLGenerator $urlGenerator, LoggerInterface $logger) { parent::__construct($appName, $request); $this->bookingService = $bookingService; $this->timeFactory = $timeFactory; $this->appointmentConfigService = $appointmentConfigService; $this->initialState = $initialState; $this->urlGenerator = $urlGenerator; $this->logger = $logger; }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The software constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
public function __construct($def, $element) { $this->def = $def; $this->element = $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
public function enable() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->enable($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane updated successfully.')); } else { $this->flash->failure(t('Unable to update this swimlane.')); } $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); }
0
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
public function disable() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->disable($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane updated successfully.')); } else { $this->flash->failure(t('Unable to update this swimlane.')); } $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); }
0
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
public function 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
public function connected() { if (is_resource($this->smtp_conn)) { $sock_status = stream_get_meta_data($this->smtp_conn); if ($sock_status['eof']) { // The socket is valid but we are not connected $this->edebug( 'SMTP NOTICE: EOF caught while checking if connected', self::DEBUG_CLIENT ); $this->close(); return false; } return true; // everything looks good } return false; }
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 static function login() { user::login(expString::escape(expString::sanitize($_POST['username'])),expString::escape(expString::sanitize($_POST['password']))); if (!isset($_SESSION[SYS_SESSION_KEY]['user'])) { // didn't successfully log in flash('error', gt('Invalid Username / Password')); if (expSession::is_set('redirecturl_error')) { $url = expSession::get('redirecturl_error'); expSession::un_set('redirecturl_error'); header("Location: ".$url); } else { expHistory::back(); } } else { // we're logged in global $user; if (expSession::get('customer-login')) expSession::un_set('customer-login'); if (!empty($_POST['username'])) flash('message', gt('Welcome back').' '.expString::sanitize($_POST['username'])); if ($user->isAdmin()) { expHistory::back(); } else { foreach ($user->groups as $g) { if (!empty($g->redirect)) { $url = URL_FULL.$g->redirect; break; } } if (isset($url)) { header("Location: ".$url); } else { 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 testSitePages () { $this->visitPages ($this->getPages ('^site')); }
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 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-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 rules() { // NOTE: you should only define rules for those attributes that // will receive user inputs. return array( array ('tag', 'validateTag'), array('type, itemId, taggedBy, tag', 'required'), array('itemId, timestamp', 'numerical', 'integerOnly'=>true), array('type, taggedBy', 'length', 'max'=>50), array('tag, itemName', 'length', 'max'=>250), array( 'tag', 'application.extensions.unique-attributes-validator.UniqueAttributesValidator', 'with'=>'tag,type,itemId' ), // The following rule is used by search(). // Please remove those attributes that should not be searched. array('id, type, itemId, taggedBy, tag, timestamp, itemName', 'safe', 'on'=>'search'), ); }
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 uninstallPage() { $id = $this->getId(); if(empty($_POST['uninstall_confirm'])) { $plug_vars = e107::getPlug()->load($id)->getMeta(); $name = e107::getPlug()->getName(); $this->addTitle(EPL_ADLAN_63); $this->addTitle($name); return $this->pluginConfirmUninstall($plug_vars); } $post = e107::getParser()->filter($_POST); if(empty($_POST['e-token'])) { return false; } // $id = e107::getPlugin $text = e107::getPlugin()->uninstall($id, $post); e107::getMessage()->add($text, E_MESSAGE_SUCCESS); $log = e107::getPlugin()->getLog(); e107::getDebug()->log($log); $this->redirectAction('list'); }
1
PHP
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
safe
public static function getHelpVersion($version_id) { global $db; return $db->selectValue('help_version', 'version', 'id="'.intval($version_id).'"'); }
1
PHP
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/74.html
safe