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 testPortIsNullIfStandardPortForScheme() { // HTTPS standard port $uri = new Uri('https://example.com:443'); $this->assertNull($uri->getPort()); $this->assertSame('example.com', $uri->getAuthority()); $uri = (new Uri('https://example.com'))->withPort(443); $this->assertNull($uri->getPort()); $this->assertSame('example.com', $uri->getAuthority()); // HTTP standard port $uri = new Uri('http://example.com:80'); $this->assertNull($uri->getPort()); $this->assertSame('example.com', $uri->getAuthority()); $uri = (new Uri('http://example.com'))->withPort(80); $this->assertNull($uri->getPort()); $this->assertSame('example.com', $uri->getAuthority()); }
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 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 getDisplayName ($plural=true) { return Yii::t('workflow', '{process}', array( '{process}' => Modules::displayName($plural, 'Process'), )); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public function execute(&$params){ $options = &$this->config['options']; $event = new Events; $notif = new Notification; $user = $this->parseOption('user', $params); $type = $this->parseOption('type', $params); if($type === 'auto'){ if(!isset($params['model'])) return array (false, ''); $notif->modelType = get_class($params['model']); $notif->modelId = $params['model']->id; $notif->type = $this->getNotifType(); $event->associationType = get_class($params['model']); $event->associationId = $params['model']->id; $event->type = $this->getEventType(); if($params['model']->hasAttribute('visibility')) $event->visibility = $params['model']->visibility; // $event->user = $this->parseOption('user',$params); } else{ $text = $this->parseOption('text', $params); $notif->type = 'custom'; $notif->text = $text; $event->type = 'feed'; $event->subtype = $type; $event->text = $text; if($user == 'auto' && isset($params['model']) && $params['model']->hasAttribute('assignedTo') && !empty($params['model']->assignedTo)){ $event->user = $params['model']->assignedTo; }elseif(!empty($user)){ $event->user = $user; }else{ $event->user = 'admin'; } } if(!$this->parseOption('createNotif', $params)) { if (!$notif->save()) { return array(false, array_shift($notif->getErrors())); } } if ($event->save()) { return array (true, ""); } else { return array(false, array_shift($event->getErrors())); } }
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 teampass_decrypt_pw($encrypted, $salt, $rand_key, $itcount = 2072) { $encrypted = base64_decode($encrypted); $pass_salt = substr($encrypted, -64); $encrypted = substr($encrypted, 0, -64); $key = teampass_pbkdf2_hash($salt, $pass_salt, $itcount, 16, 32); $iv = base64_decode(substr($encrypted, 0, 43) . '=='); $encrypted = substr($encrypted, 43); $mac = substr($encrypted, -64); $encrypted = substr($encrypted, 0, -64); if ($mac !== hash_hmac('sha256', $encrypted, $salt)) return null; return substr(rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $encrypted, 'ctr', $iv), "\0\4"), strlen($rand_key)); }
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 manage_upcharge() { $this->loc->src = "@globalstoresettings"; $config = new expConfig($this->loc); $this->config = $config->config; $gc = new geoCountry(); $countries = $gc->find('all'); $gr = new geoRegion(); $regions = $gr->find('all',null,'rank asc,name asc'); assign_to_template(array( 'countries'=>$countries, 'regions'=>$regions, 'upcharge'=>!empty($this->config['upcharge'])?$this->config['upcharge']:'' )); }
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 umount() { $this->connect && @ftp_close($this->connect); }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
function manage() { global $db; expHistory::set('manageable', $this->params); // $classes = array(); $dir = BASE."framework/modules/ecommerce/billingcalculators"; if (is_readable($dir)) { $dh = opendir($dir); while (($file = readdir($dh)) !== false) { if (is_file("$dir/$file") && substr("$dir/$file", -4) == ".php") { include_once("$dir/$file"); $classname = substr($file, 0, -4); $id = $db->selectValue('billingcalculator', 'id', 'calculator_name="'.$classname.'"'); if (empty($id)) { // $calobj = null; $calcobj = new $classname(); if ($calcobj->isSelectable() == true) { $obj = new billingcalculator(array( 'title'=>$calcobj->name(), // 'user_title'=>$calcobj->title, 'body'=>$calcobj->description(), 'calculator_name'=>$classname, 'enabled'=>false)); $obj->save(); } } } } } $bcalc = new billingcalculator(); $calculators = $bcalc->find('all'); assign_to_template(array( 'calculators'=>$calculators )); }
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 _isInline($token) { return isset($this->htmlDefinition->info['p']->child->elements[$token->name]); }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
protected function getUserzoneCookie() { $cookie = $this->getContext()->getRequest()->getCookie('userzone'); $length = strlen($cookie); if ($length <= 0) return null; $serialized_data = substr($cookie, 0, $length - 32); $hash_signiture = substr($cookie, $length - 32); // check the signiture if (md5($serialized_data . $this->cookieSecret) != $hash_signiture) return null; $userzone_data = unserialize(base64_decode($serialized_data)); return array($userzone_data['id'], $userzone_data['email'], $userzone_data['screenname']); }
0
PHP
CWE-798
Use of Hard-coded Credentials
The software contains hard-coded credentials, such as a password or cryptographic key, which it uses for its own inbound authentication, outbound communication to external components, or encryption of internal data.
https://cwe.mitre.org/data/definitions/798.html
vulnerable
public static function types_update($array) { global $DB; global $website; $array = array_filter($array); sort($array); $array = serialize($array); $ok = $DB->execute(' UPDATE nv_websites SET block_types = '.protect($array).' WHERE id = '.$website->id ); if(!$ok) throw new Exception($DB->last_error()); return true; }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public function searchNew() { global $db, $user; //$this->params['query'] = str_ireplace('-','\-',$this->params['query']); $sql = "select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid, "; $sql .= "match (p.title,p.model,p.body) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) as relevance, "; $sql .= "CASE when p.model like '" . $this->params['query'] . "%' then 1 else 0 END as modelmatch, "; $sql .= "CASE when p.title like '%" . $this->params['query'] . "%' then 1 else 0 END as titlematch "; $sql .= "from " . $db->prefix . "product as p INNER JOIN " . $db->prefix . "content_expFiles as cef ON p.id=cef.content_id AND cef.content_type IN ('product','eventregistration','donation','giftcard') AND cef.subtype='mainimage' INNER JOIN " . $db->prefix . "expFiles as f ON cef.expFiles_id = f.id WHERE "; if (!$user->isAdmin()) $sql .= '(p.active_type=0 OR p.active_type=1) AND '; $sql .= " match (p.title,p.model,p.body) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) AND p.parent_id=0 "; $sql .= " HAVING relevance > 0 "; //$sql .= "GROUP BY p.id "; $sql .= "order by modelmatch,titlematch,relevance desc LIMIT 10"; eDebug($sql); $res = $db->selectObjectsBySql($sql); eDebug($res, true); $ar = new expAjaxReply(200, gt('Here\'s the items you wanted'), $res); $ar->send(); }
1
PHP
CWE-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 show() { $task = $this->getTask(); $subtask = $this->getSubtask(); $this->response->html($this->template->render('subtask_converter/show', array( 'subtask' => $subtask, 'task' => $task, ))); }
0
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
$cont_title = substr(Typo::Xclean(Typo::strip($data['posts'][0]->title)), 0, $limit); $titlelength = strlen($data['posts'][0]->title); } else {
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 admin () { }
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
$comments->records[$key]->avatar = $db->selectObject('user_avatar',"user_id='".$record->poster."'"); } if (empty($this->params['config']['disable_nested_comments'])) $comments->records = self::arrangecomments($comments->records); // eDebug($sql, true); // count the unapproved comments if ($require_approval == 1 && $user->isAdmin()) { $sql = 'SELECT count(com.id) as c FROM '.$db->prefix.'expComments com '; $sql .= 'JOIN '.$db->prefix.'content_expComments cnt ON com.id=cnt.expcomments_id '; $sql .= 'WHERE cnt.content_id='.$this->params['content_id']." AND cnt.content_type='".expString::escape($this->params['content_type'])."' "; $sql .= 'AND com.approved=0'; $unapproved = $db->countObjectsBySql($sql); } else { $unapproved = 0; } $this->config = $this->params['config']; $type = !empty($this->params['type']) ? $this->params['type'] : gt('Comment'); $ratings = !empty($this->params['ratings']) ? true : false; assign_to_template(array( 'comments'=>$comments, 'config'=>$this->params['config'], 'unapproved'=>$unapproved, 'content_id'=>$this->params['content_id'], 'content_type'=>$this->params['content_type'], 'user'=>$user, 'hideform'=>$this->params['hideform'], 'hidecomments'=>$this->params['hidecomments'], 'title'=>$this->params['title'], 'formtitle'=>$this->params['formtitle'], 'type'=>$type, 'ratings'=>$ratings, 'require_login'=>$require_login, 'require_approval'=>$require_approval, 'require_notification'=>$require_notification, 'notification_email'=>$notification_email, )); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
private function _allrevisionsbefore( $option ) { $this->addTable( 'revision_actor_temp', 'rev' ); $this->addSelect( [ 'rev.revactor_rev', 'rev.revactor_timestamp' ] ); $this->addOrderBy( 'rev.revactor_rev' ); $this->setOrderDir( 'DESC' ); $this->addWhere( [ $this->tableNames['page'] . '.page_id = rev.revactor_page', 'rev.revactor_timestamp < ' . $this->convertTimestamp( $option ) ] ); }
0
PHP
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
vulnerable
public function getRemovedIds() { return [ 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => 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 Mail($from) { $this->error = null; // so no confusion is caused if(!$this->connected()) { $this->error = array( "error" => "Called Mail() without being connected"); return false; } $useVerp = ($this->do_verp ? " XVERP" : ""); fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF); $rply = $this->get_lines(); $code = substr($rply,0,3); if($this->do_debug >= 2) { $this->edebug("SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />'); } if($code != 250) { $this->error = array("error" => "MAIL not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4)); if($this->do_debug >= 1) { $this->edebug("SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />'); } return false; } return true; }
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 update($vars) { if (is_array($vars)) { //$slug = Typo::slugify($vars['title']); //$vars = array_merge($vars, array('slug' => $slug)); //print_r($vars); $id = Typo::int($_GET['id']); $ins = array( 'table' => 'posts', 'id' => $id, 'key' => $vars, ); $post = Db::update($ins); Hooks::run('post_sqladd_action', $vars, $id); if (Pinger::is_on()) { $pinger = Options::v('pinger'); Pinger::run($pinger); } } return $post; }
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 searchAdmin(){ $criteria = new CDbCriteria; return $this->searchBase($criteria); }
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 read($source) { $source = $this->escapePath($source); // close the single quote, open a double quote where we put the single quote... $source = str_replace('\'', '\'"\'"\'', $source); // since returned stream is closed by the caller we need to create a new instance // since we can't re-use the same file descriptor over multiple calls $workgroupArgument = ($this->server->getWorkgroup()) ? ' -W ' . escapeshellarg($this->server->getWorkgroup()) : ''; $command = sprintf('%s %s --authentication-file=/proc/self/fd/3 //%s/%s -c \'get %s /proc/self/fd/5\'', Server::CLIENT, $workgroupArgument, $this->server->getHost(), $this->name, $source ); $connection = new Connection($command); $connection->writeAuthentication($this->server->getUser(), $this->server->getPassword()); $fh = $connection->getFileOutputStream(); stream_context_set_option($fh, 'file', 'connection', $connection); return $fh; }
1
PHP
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
public function testCanCreateNewResponseWithStatusAndReason() { $r = new Response(200); $r2 = $r->withStatus(201, 'Foo'); $this->assertEquals(200, $r->getStatusCode()); $this->assertEquals('OK', $r->getReasonPhrase()); $this->assertEquals(201, $r2->getStatusCode()); $this->assertEquals('Foo', $r2->getReasonPhrase()); }
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 testGetFilteredEventsDataProvider () { TestingAuxLib::loadX2NonWebUser (); $testUser = $this->users ('testUser'); TestingAuxLib::suLogin ($testUser->username); Yii::app()->settings->historyPrivacy = null; $profile = Profile::model()->findByAttributes(array('username' => $testUser->username)); $retVal = Events::getFilteredEventsDataProvider ($profile, true, null, false); $dataProvider = $retVal['dataProvider']; $events = $dataProvider->getData (); $expectedEvents = Events::getEvents (0, 0, count ($events), $profile); // verify events from getData $this->assertEquals ( Yii::app()->db->createCommand (" select id from x2_events where user='testuser' or visibility or ( associationType='User' and associationId=:userId) order by timestamp desc, id desc ")->queryColumn (array (':userId' => $testUser->id)), array_map ( function ($event) { return $event->id; }, $expectedEvents['events'] ) ); // ensure that getFilteredEventsDataProvider returns same events as getData $this->assertEquals ( array_map ( function ($event) { return $event->id; }, $expectedEvents['events'] ), array_map ( function ($event) { return $event->id; }, $events ) ); }
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
$description = "User (" . $this->User->id . "): " . $this->Auth->user('email'); $fieldsResult = "Password changed."; } // query $this->Log = ClassRegistry::init('Log'); $this->Log->create(); $this->Log->save(array( 'org' => $this->Auth->user('Organisation')['name'], 'model' => $model, 'model_id' => $modelId, 'email' => $this->Auth->user('email'), 'action' => $action, 'title' => $description, 'change' => isset($fieldsResult) ? $fieldsResult : '')); // write to syslogd as well App::import('Lib', 'SysLog.SysLog'); $syslog = new SysLog(); if (isset($fieldsResult) && $fieldsResult) { $syslog->write('notice', $description . ' -- ' . $action . ' -- ' . $fieldsResult); } else { $syslog->write('notice', $description . ' -- ' . $action); } }
0
PHP
CWE-269
Improper Privilege Management
The software does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor.
https://cwe.mitre.org/data/definitions/269.html
vulnerable
public static function returnChildrenAsJSON() { global $db; //$nav = section::levelTemplate(intval($_REQUEST['id'], 0)); $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $nav = $db->selectObjects('section', 'parent=' . $id, 'rank'); //FIXME $manage_all is moot w/ cascading perms now? $manage_all = false; if (expPermissions::check('manage', expCore::makeLocation('navigation', '', $id))) { $manage_all = true; } //FIXME recode to use foreach $key=>$value $navcount = count($nav); for ($i = 0; $i < $navcount; $i++) { if ($manage_all || expPermissions::check('manage', expCore::makeLocation('navigation', '', $nav[$i]->id))) { $nav[$i]->manage = 1; $view = true; } else { $nav[$i]->manage = 0; $view = $nav[$i]->public ? true : expPermissions::check('view', expCore::makeLocation('navigation', '', $nav[$i]->id)); } $nav[$i]->link = expCore::makeLink(array('section' => $nav[$i]->id), '', $nav[$i]->sef_name); if (!$view) unset($nav[$i]); } $nav= array_values($nav); // $nav[$navcount - 1]->last = true; if (count($nav)) $nav[count($nav) - 1]->last = true; // echo expJavascript::ajaxReply(201, '', $nav); $ar = new expAjaxReply(201, '', $nav); $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
function main() { var_dump(unserialize("O:3:\"foo\":1:{S:\x00\x00\x00\x00\x00\x00\x00\x00;s:5:\"value\";}")); }
1
PHP
CWE-119
Improper Restriction of Operations within the Bounds of a Memory Buffer
The software performs operations on a memory buffer, but it can read from or write to a memory location that is outside of the intended boundary of the buffer.
https://cwe.mitre.org/data/definitions/119.html
safe
function db_case($array) { global $DatabaseType; $counter = 0; if ($DatabaseType == 'mysqli') { $array_count = count($array); $string = " CASE WHEN $array[0] ="; $counter++; $arr_count = count($array); for ($i = 1; $i < $arr_count; $i++) { $value = $array[$i]; if ($value == "''" && substr($string, -1) == '=') { $value = ' IS NULL'; $string = substr($string, 0, -1); } $string .= "$value"; if ($counter == ($array_count - 2) && $array_count % 2 == 0) $string .= " ELSE "; elseif ($counter == ($array_count - 1)) $string .= " END "; elseif ($counter % 2 == 0) $string .= " WHEN $array[0]="; elseif ($counter % 2 == 1) $string .= " THEN "; $counter++; } } return $string; }
0
PHP
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
vulnerable
public static function isPublic($s) { if ($s == null) { return false; } while ($s->public && $s->parent > 0) { $s = new section($s->parent); } $lineage = (($s->public) ? 1 : 0); return $lineage; }
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
$logo = "<img src=\"".Options::get('siteurl').Options::get('logo')."\" style=\"width: $width; height: $height; margin: 1px;\">"; }else{ $logo = "<span class=\"mg genixcms-logo\"></span>"; } return $logo; }
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 test_compare_2() { $this->assertEquals($this->databaseBackend->compare( "//system/powermanagement", [ "cpufreq" => 0, "powerbtn" => "nothing" ] ), -1); }
1
PHP
CWE-94
Improper Control of Generation of Code ('Code Injection')
The software constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
safe
public function handle($stanza, $parent = false) { $message = $stanza->forwarded->message; $jid = explode('/',(string)$message->attributes()->from); $to = current(explode('/',(string)$message->attributes()->to)); if($message->composing) $this->event('composing', array($jid[0], $to)); if($message->paused) $this->event('paused', array($jid[0], $to)); if($message->gone) $this->event('gone', array($jid[0], $to)); if($message->body || $message->subject) { $m = new \Modl\Message; $m->set($message, $stanza->forwarded); if(!preg_match('#^\?OTR#', $m->body)) { $md = new \Modl\MessageDAO; $md->set($m); $this->pack($m); $this->deliver(); } } }
0
PHP
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
function getRights($interface = 'central') { $values = [READ => __('Read'), CREATE => __('Create'), PURGE => _x('button', 'Delete permanently'), self::CHECKUPDATE => __('Check for upgrade')]; return $values; }
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 transform($attr, $config, $context) { if (!isset($attr['href'])) { return $attr; } // XXX Kind of inefficient $url = $this->parser->parse($attr['href']); $scheme = $url->getSchemeObj($config, $context); if ($scheme->browsable && !$url->isBenign($config, $context)) { $attr['target'] = '_blank'; } return $attr; }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public function save() { $user = $this->getUser(); $values = $this->request->getValues(); if (! $this->userSession->isAdmin()) { if (isset($values['role'])) { unset($values['role']); } } list($valid, $errors) = $this->userValidator->validateModification($values); if ($valid) { if ($this->userModel->update($values)) { $this->flash->success(t('User updated successfully.')); $this->response->redirect($this->helper->url->to('UserViewController', 'show', array('user_id' => $user['id'])), true); return; } else { $this->flash->failure(t('Unable to update this user.')); } } $this->show($values, $errors); }
0
PHP
CWE-640
Weak Password Recovery Mechanism for Forgotten Password
The software contains a mechanism for users to recover or change their passwords without knowing the original password, but the mechanism is weak.
https://cwe.mitre.org/data/definitions/640.html
vulnerable
public function getError() { return $this->error; }
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
foreach ($nodes as $node) { if ((($perm == 'view' && $node->public == 1) || expPermissions::check($perm, expCore::makeLocation('navigation', '', $node->id))) && !in_array($node->id, $ignore_ids)) { if ($node->active == 1) { $text = str_pad('', ($depth + ($full ? 1 : 0)) * 3, '.', STR_PAD_LEFT) . $node->name; } else { $text = str_pad('', ($depth + ($full ? 1 : 0)) * 3, '.', STR_PAD_LEFT) . '(' . $node->name . ')'; } $ar[$node->id] = $text; foreach (self::levelDropdownControlArray($node->id, $depth + 1, $ignore_ids, $full, $perm, $addstandalones, $addinternalalias) as $id => $text) { $ar[$id] = $text; } } }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
private function runCallback() { foreach ($this->records as &$record) { if (isset($record->ref_type)) { $refType = $record->ref_type; if (class_exists($record->ref_type)) { $type = new $refType(); $classinfo = new ReflectionClass($type); if ($classinfo->hasMethod('paginationCallback')) { $item = new $type($record->original_id); $item->paginationCallback($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
protected function _joinPath($dir, $name) { $sql = 'SELECT id FROM '.$this->tbf.' WHERE parent_id=\''.$dir.'\' AND name=\''.$this->db->real_escape_string($name).'\''; if (($res = $this->query($sql)) && ($r = $res->fetch_assoc())) { $this->updateCache($r['id'], $this->_stat($r['id'])); return $r['id']; } return -1; }
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 execute_backup($command) { $backup_options = get_option('dbmanager_options'); check_backup_files(); if( realpath( $backup_options['path'] ) === false ) { return sprintf( __( '%s is not a valid backup path', 'wp-dbmanager' ), stripslashes( $backup_options['path'] ) ); } else if( dbmanager_is_valid_path( $backup_options['mysqldumppath'] ) === 0 ) { return sprintf( __( '%s is not a valid mysqldump path', 'wp-dbmanager' ), stripslashes( $backup_options['mysqldumppath'] ) ); } else if( dbmanager_is_valid_path( $backup_options['mysqlpath'] ) === 0 ) { return sprintf( __( '%s is not a valid mysql path', 'wp-dbmanager' ), stripslashes( $backup_options['mysqlpath'] ) ); } if( substr( PHP_OS, 0, 3 ) === 'WIN' ) { $writable_dir = $backup_options['path']; $tmpnam = $writable_dir.'/wp-dbmanager.bat'; $fp = fopen( $tmpnam, 'w' ); fwrite ($fp, $command ); fclose( $fp ); system( $tmpnam.' > NUL', $error ); unlink( $tmpnam ); } else { passthru( $command, $error ); } return $error; }
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 testCanParseFalseyUriParts() { $uri = new Uri('0://0:0@0/0?0#0'); $this->assertSame('0', $uri->getScheme()); $this->assertSame('0:0@0', $uri->getAuthority()); $this->assertSame('0:0', $uri->getUserInfo()); $this->assertSame('0', $uri->getHost()); $this->assertSame('/0', $uri->getPath()); $this->assertSame('0', $uri->getQuery()); $this->assertSame('0', $uri->getFragment()); $this->assertSame('0://0:0@0/0?0#0', (string) $uri); }
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 __construct($mongo, array $options) { if (!($mongo instanceof \MongoDB\Client || $mongo instanceof \MongoClient || $mongo instanceof \Mongo)) { throw new \InvalidArgumentException('MongoClient or Mongo instance required'); } if (!isset($options['database']) || !isset($options['collection'])) { throw new \InvalidArgumentException('You must provide the "database" and "collection" option for MongoDBSessionHandler'); } $this->mongo = $mongo; $this->options = array_merge(array( 'id_field' => '_id', 'data_field' => 'data', 'time_field' => 'time', 'expiry_field' => 'expires_at', ), $options); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public function confirm() { $project = $this->getProject(); $action = $this->getAction($project); $this->response->html($this->helper->layout->project('action/remove', array( 'action' => $action, 'available_events' => $this->eventManager->getAll(), 'available_actions' => $this->actionManager->getAvailableActions(), 'project' => $project, 'title' => t('Remove an action') ))); }
1
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
safe
private function getSwimlane() { $swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id')); if (empty($swimlane)) { throw new PageNotFoundException(); } return $swimlane; }
0
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
function show_vendor () { $vendor = new vendor(); if(isset($this->params['id'])) { $vendor = $vendor->find('first', 'id =' .$this->params['id']); $vendor_title = $vendor->title; $state = new geoRegion($vendor->state); $vendor->state = $state->name; //Removed unnecessary fields unset( $vendor->title, $vendor->table, $vendor->tablename, $vendor->classname, $vendor->identifier ); assign_to_template(array( 'vendor_title' => $vendor_title, 'vendor'=>$vendor )); } }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public function __construct() { $this->percentEncoder = new HTMLPurifier_PercentEncoder(); }
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 cleanX ($c) { $val = self::strip_tags_content($c, '<script>', TRUE); $val = htmlspecialchars( $val, ENT_QUOTES|ENT_HTML5, "utf-8" ); // $val = htmlentities( // $c, // ENT_QUOTES | ENT_IGNORE, "UTF-8"); return $val; }
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 generateMessageFileName() { $time = microtime(true); return date('Ymd-His-', $time) . sprintf('%04d', (int) (($time - (int) $time) * 10000)) . '-' . sprintf('%04d', mt_rand(0, 10000)) . '.eml'; }
0
PHP
CWE-330
Use of Insufficiently Random Values
The software uses insufficiently random numbers or values in a security context that depends on unpredictable numbers.
https://cwe.mitre.org/data/definitions/330.html
vulnerable
public function insert($ip, $username) { $this->Log = ClassRegistry::init('Log'); $this->Log->create(); $expire = time() + Configure::read('SecureAuth.expire'); $expire = date('Y-m-d H:i:s', $expire); $bruteforceEntry = array( 'ip' => $ip, 'username' => $username, 'expire' => $expire ); $this->save($bruteforceEntry); $title = 'Failed login attempt using username ' . $username . ' from IP: ' . $_SERVER['REMOTE_ADDR'] . '.'; if ($this->isBlacklisted($ip, $username)) { $title .= 'This has tripped the bruteforce protection after ' . Configure::read('SecureAuth.amount') . ' failed attempts. The user is now blacklisted for ' . Configure::read('SecureAuth.expire') . ' seconds.'; } $log = array( 'org' => 'SYSTEM', 'model' => 'User', 'model_id' => 0, 'email' => $username, 'action' => 'login_fail', 'title' => $title ); $this->Log->save($log); }
0
PHP
NVD-CWE-noinfo
null
null
null
vulnerable
protected function setUp() { static::$functions = []; static::$fopen = null; static::$fread = null; parent::setUp(); $this->security = new ExposedSecurity(); $this->security->derivationIterations = 1000; // speed up test running }
0
PHP
CWE-330
Use of Insufficiently Random Values
The software uses insufficiently random numbers or values in a security context that depends on unpredictable numbers.
https://cwe.mitre.org/data/definitions/330.html
vulnerable
$emails[$u->email] = trim(user::getUserAttribution($u->id)); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public function deleteCommentAction(CustomerComment $comment) { $customerId = $comment->getCustomer()->getId(); try { $this->repository->deleteComment($comment); } catch (\Exception $ex) { $this->flashDeleteException($ex); } return $this->redirectToRoute('customer_details', ['id' => $customerId]); }
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 approvedFileExtension($filename, $type = 'image') { $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); if ($type == 'image') { switch ($ext) { case 'gif': case 'png': case 'jpeg': case 'jpg': case 'svg': return true; default: return false; } } elseif ($type == 'cert') { switch ($ext) { case 'pem': return true; default: return false; } } }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
$result = $f->filter($uri, $config, $context); if (!$result) return false; } return true; }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public function approvedFileExtension($filename, $type = 'image') { $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); if ($type == 'image') { switch ($ext) { case 'gif': case 'png': case 'jpeg': case 'jpg': case 'svg': return true; default: return false; } } elseif ($type == 'cert') { switch ($ext) { case 'pem': return true; default: return false; } } }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
private function _categoriesminmax( $option ) { if ( is_numeric( $option[0] ) ) { $this->addWhere( intval( $option[0] ) . ' <= (SELECT count(*) FROM ' . $this->tableNames['categorylinks'] . ' WHERE ' . $this->tableNames['categorylinks'] . '.cl_from=page_id)' ); } if ( is_numeric( $option[1] ) ) { $this->addWhere( intval( $option[1] ) . ' >= (SELECT count(*) FROM ' . $this->tableNames['categorylinks'] . ' WHERE ' . $this->tableNames['categorylinks'] . '.cl_from=page_id)' ); } }
0
PHP
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
vulnerable
protected function assertNoErrors () { $this->assertElementNotPresent('css=.xdebug-error'); $this->assertElementNotPresent('css=#x2-php-error'); $this->storeEval ( "window.document.body.attributes['x2-js-error'] ? 'true' : 'false'", 'hasJsErrorAttr'); $hasJsErrorAttr = $this->getExpression ('${hasJsErrorAttr}'); if ($hasJsErrorAttr === 'true') { $this->storeAttribute ('dom=document.body@x2-js-error', 'errorMessage'); $errorMessage = $this->getExpression ('${errorMessage}'); println ($errorMessage); $this->assertTrue (false, $errorMessage); } }
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 request($method, $uri = '', array $options = []) { $options[RequestOptions::SYNCHRONOUS] = true; return $this->requestAsync($method, $uri, $options)->wait(); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public function save_change_password() { global $user; $isuser = ($this->params['uid'] == $user->id) ? 1 : 0; if (!$user->isAdmin() && !$isuser) { flash('error', gt('You do not have permissions to change this users password.')); expHistory::back(); } if (($isuser && empty($this->params['password'])) || (!empty($this->params['password']) && $user->password != user::encryptPassword($this->params['password']))) { flash('error', gt('The current password you entered is not correct.')); expHistory::returnTo('editable'); } //eDebug($user); $u = new user($this->params['uid']); $ret = $u->setPassword($this->params['new_password1'], $this->params['new_password2']); //eDebug($u, true); if (is_string($ret)) { flash('error', $ret); expHistory::returnTo('editable'); } else { $params = array(); $params['is_admin'] = !empty($u->is_admin); $params['is_acting_admin'] = !empty($u->is_acting_admin); $u->update($params); } if (!$isuser) { flash('message', gt('The password for') . ' ' . $u->username . ' ' . gt('has been changed.')); } else { $user->password = $u->password; flash('message', gt('Your password has been changed.')); } 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
} elseif ($type == 'customlayout') { $layoutData = unserialize($data['name']); $className = $layoutData['className']; $layoutName = $layoutData['name']; if ($item['name'] == $layoutName && $item['className'] == $className) { $class = DataObject\ClassDefinition::getByName($className); if (!$class) { throw new \Exception('Class does not exist'); } $classId = $class->getId(); $layoutList = new DataObject\ClassDefinition\CustomLayout\Listing(); $db = \Pimcore\Db::get(); $layoutList->setCondition('name = ' . $db->quote($layoutName) . ' AND classId = ' . $classId); $layoutList = $layoutList->load(); $layoutDefinition = null; if ($layoutList) { $layoutDefinition = $layoutList[0]; } if (!$layoutDefinition) { $layoutDefinition = new DataObject\ClassDefinition\CustomLayout(); $layoutDefinition->setName($layoutName); $layoutDefinition->setClassId($classId); } try { $layoutDefinition->setDescription($item['description']); $layoutDef = DataObject\ClassDefinition\Service::generateLayoutTreeFromArray($item['layoutDefinitions'], true); $layoutDefinition->setLayoutDefinitions($layoutDef); $layoutDefinition->save(); } catch (\Exception $e) { Logger::error($e->getMessage()); return $this->adminJson(['success' => false, 'message' => $e->getMessage()]); } } } } return $this->adminJson(['success' => true]); }
0
PHP
CWE-502
Deserialization of Untrusted Data
The application deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
public function prepare($config, $context) { parent::prepare($config, $context); }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public function remove($key) { $closed = false; if (! $this->started) { $closed = true; $this->start(); } list($cat, $name) = array_pad(explode('.', $key, 2), 2, null); if (is_null($name)) { if (! isset($this->keys[$cat])) { $name = $cat; $cat = 'default'; } } if (isset($this->keys[$cat])) { $cat = $this->keys[$cat]; } else { $name = $cat . '.' . $name; $cat = $this->keys['default']; } if (is_null($name)) { unset($_SESSION[$cat]); } else { if (isset($_SESSION[$cat]) && is_array($_SESSION[$cat])) { unset($_SESSION[$cat][$name]); } } if ($closed) { $this->close(); } return $this; }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
function prepareInputForUpdate($input) { if (isset($input["passwd"])) { if (empty($input["passwd"])) { unset($input["passwd"]); } else { $input["passwd"] = Toolbox::encrypt(stripslashes($input["passwd"]), GLPIKEY); } } if (isset($input["_blank_passwd"]) && $input["_blank_passwd"]) { $input['passwd'] = ''; } if (isset($input['mail_server']) && !empty($input['mail_server'])) { $input["host"] = Toolbox::constructMailServerConfig($input); } if (isset($input['name']) && !NotificationMailing::isUserAddressValid($input['name'])) { Session::addMessageAfterRedirect(__('Invalid email address'), false, ERROR); } return $input; }
0
PHP
CWE-798
Use of Hard-coded Credentials
The software contains hard-coded credentials, such as a password or cryptographic key, which it uses for its own inbound authentication, outbound communication to external components, or encryption of internal data.
https://cwe.mitre.org/data/definitions/798.html
vulnerable
public function save() { global $DB; if(!empty($this->id)) return $this->update(); else return $this->insert(); }
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 IsTransactionValid($id, $bRemoveTransaction = true) { // Constraint the transaction file within APPROOT.'data/transactions' $sTransactionDir = realpath(APPROOT.'data/transactions'); $sFilepath = utils::RealPath($sTransactionDir.'/'.$id, $sTransactionDir); if (($sFilepath === false) || (strlen($sTransactionDir) == strlen($sFilepath))) { return false; } clearstatcache(true, $sFilepath); $bResult = file_exists($sFilepath); if ($bResult) { if ($bRemoveTransaction) { $bResult = @unlink($sFilepath); if (!$bResult) { self::Error('IsTransactionValid: FAILED to remove transaction '.$id); } else { self::Info('IsTransactionValid: OK. Removed transaction: '.$id); } } } else { self::Info("IsTransactionValid: Transaction '$id' not found. Pending transactions for this user:\n".implode("\n", self::GetPendingTransactions())); } return $bResult; }
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
$newFullPath = realpath(rtrim($destinationFullPath, '/')) . '/' . $basename; $safeDir = $this->getAssetsPath(); if ($originalFullPath == $newFullPath) { continue; } if (!starts_with($newFullPath, $safeDir)) { throw new ApplicationException(Lang::get( 'cms::lang.asset.error_moving_file', ['file' => $basename] )); } if (is_file($originalFullPath)) { if (!@File::move($originalFullPath, $newFullPath)) { throw new ApplicationException(Lang::get( 'cms::lang.asset.error_moving_file', ['file' => $basename] )); } } elseif (is_dir($originalFullPath)) { if (!@File::copyDirectory($originalFullPath, $newFullPath)) { throw new ApplicationException(Lang::get( 'cms::lang.asset.error_moving_directory', ['dir' => $basename] )); } if (strpos($originalFullPath, '../') !== false) { throw new ApplicationException(Lang::get( 'cms::lang.asset.error_deleting_directory', ['dir' => $basename] )); } if (strpos($originalFullPath, $safeDir) !== 0) { throw new ApplicationException(Lang::get( 'cms::lang.asset.error_deleting_directory', ['dir' => $basename] )); } if (!@File::deleteDirectory($originalFullPath)) { throw new ApplicationException(Lang::get( 'cms::lang.asset.error_deleting_directory', ['dir' => $basename] )); } } }
1
PHP
CWE-73
External Control of File Name or Path
The software allows user input to control or influence paths or file names that are used in filesystem operations.
https://cwe.mitre.org/data/definitions/73.html
safe
public function transform($attr, $config, $context) { if (!isset($attr[$this->attr])) return $attr; $value = trim($attr[$this->attr]); unset($attr[$this->attr]); if (!$this->caseSensitive) $value = strtolower($value); if (!isset($this->enumToCSS[$value])) { return $attr; } $this->prependCSS($attr, $this->enumToCSS[$value]); return $attr; }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
function barcode_encode_genbarcode($code,$encoding) { global $genbarcode_loc; // Clean parameters if (preg_match("/^ean$/i", $encoding) && strlen($code)==13) $code=substr($code,0,12); if (!$encoding) $encoding="ANY"; $encoding=preg_replace("/[\\\|]/", "_", $encoding); $code=preg_replace("/[\\\|]/", "_", $code); $command=escapeshellarg($genbarcode_loc); $paramclear=" \"".str_replace("\"", "\\\"",$code)."\" \"".str_replace("\"", "\\\"",strtoupper($encoding))."\""; $fullcommandclear=$command." ".$paramclear." 2>&1"; //print $fullcommandclear."<br>\n"; dol_syslog("Run command ".$fullcommandclear); $fp=popen($fullcommandclear, "r"); if ($fp) { $bars=fgets($fp, 1024); $text=fgets($fp, 1024); $encoding=fgets($fp, 1024); pclose($fp); } else { dol_syslog("barcode.lib.php::barcode_encode_genbarcode failed to run popen ".$fullcommandclear, LOG_ERR); return false; } //var_dump($bars); $ret=array( "encoding" => trim($encoding), "bars" => trim($bars), "text" => trim($text) ); //var_dump($ret); if (!$ret['encoding']) return false; if (!$ret['bars']) return false; if (!$ret['text']) return false; return $ret; }
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 autocomplete() { return; global $db; $model = $this->params['model']; $mod = new $model(); $srchcol = explode(",",$this->params['searchoncol']); /*for ($i=0; $i<count($srchcol); $i++) { if ($i>=1) $sql .= " OR "; $sql .= $srchcol[$i].' LIKE \'%'.$this->params['query'].'%\''; }*/ // $sql .= ' AND parent_id=0'; //eDebug($sql); //$res = $mod->find('all',$sql,'id',25); $sql = "select DISTINCT(p.id), p.title, model, sef_url, f.id as fileid from ".$db->prefix."product as p INNER JOIN ".$db->prefix."content_expfiles as cef ON p.id=cef.content_id INNER JOIN ".$db->prefix."expfiles as f ON cef.expfiles_id = f.id where match (p.title,p.model,p.body) against ('" . $this->params['query'] . "') AND p.parent_id=0 order by match (p.title,p.model,p.body) against ('" . $this->params['query'] . "') desc LIMIT 25"; //$res = $db->selectObjectsBySql($sql); //$res = $db->selectObjectBySql('SELECT * FROM `exponent_product`'); $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
$newret = recyclebin::restoreFromRecycleBin($iLoc, $page_id); if (!empty($newret)) $ret .= $newret . '<br>'; if ($iLoc->mod == 'container') { $ret .= scan_container($container->internal, $page_id); } } return $ret; }
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
app('files')->delete(LaravelLogViewer::pathToLogFile(base64_decode($this->request->input('del'))));
0
PHP
CWE-312
Cleartext Storage of Sensitive Information
The application stores sensitive information in cleartext within a resource that might be accessible to another control sphere.
https://cwe.mitre.org/data/definitions/312.html
vulnerable
$return[$index] = strip_tags($value); if($return[$index] == 'zero') $return[$index] = '0'; } } elseif($type == ARG_MULTISTRING) { foreach($return as $index => $value) { $return[$index] = strip_tags($value); } } else $return = strip_tags($return); if(! empty($return) && $type == ARG_NUMERIC) { if(! is_numeric($return)) { return preg_replace('([^\d])', '', $return); } } elseif(! empty($return) && $type == ARG_STRING) { if(! is_string($return)) $return = $defaultvalue; } elseif(! empty($return) && $type == ARG_MULTINUMERIC) { foreach($return as $index => $value) { if(! is_numeric($value)) { $return[$index] = preg_replace('([^\d])', '', $value); } } return $return; } elseif(! empty($return) && $type == ARG_MULTISTRING) { foreach($return as $index => $value) { if(! is_string($value)) $return[$index] = $defaultvalue; elseif($addslashes) $return[$index] = mysql_real_escape_string($value); } return $return; } if(is_string($return)) { if(strlen($return) == 0) $return = $defaultvalue; elseif($addslashes) $return = mysql_real_escape_string($return); } return $return; }
1
PHP
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
protected function assertCsvUploaded($csv) { $uploadedPath = implode(DIRECTORY_SEPARATOR, array( Yii::app()->basePath, 'data', 'data.csv' )); $this->assertFileExists ($uploadedPath); $this->assertFileEquals ($csv, $uploadedPath); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public function delete($id) { $this->CRUD->delete($id); $responsePayload = $this->CRUD->getResponsePayload(); if (!empty($responsePayload)) { return $responsePayload; } $this->set('metaGroup', 'Trust Circles'); }
0
PHP
CWE-668
Exposure of Resource to Wrong Sphere
The product exposes a resource to the wrong control sphere, providing unintended actors with inappropriate access to the resource.
https://cwe.mitre.org/data/definitions/668.html
vulnerable
protected function readlink($path) { if (!($target = readlink($path))) { return null; } if (strpos($target, $this->systemRoot) !== 0) { $target = $this->_joinPath(dirname($path), $target); } if (!file_exists($target)) { return false; } return $target; }
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 initializeNavigation() { $sections = section::levelTemplate(0, 0); return $sections; }
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 core_load_function($fid) { global $DB; global $menu_layout; // check if fid is an internal function // or we need to retrieve its information from the database switch($fid) { case 'utils': $func = new stdClass(); $func->id = 'utils'; $func->codename = 'utils'; $func->category = 'internal'; $func->icon = ''; $func->lid = ''; $func->enabled = 1; break; case 'grid_notes': $func = new stdClass(); $func->id = 'grid_notes'; $func->codename = 'grid_notes'; $func->category = 'content'; $func->icon = ''; $func->lid = ''; $func->enabled = 1; break; case 'permissions': $func = new stdClass(); $func->id = 'permissions'; $func->codename = 'permissions'; $func->category = 'config'; $func->icon = ''; $func->lid = ''; $func->enabled = 1; break; default: if(is_numeric($fid)) $where = 'id = '.intval($fid); else $where = 'codename = '.protect($fid); $DB->query('SELECT * FROM nv_functions WHERE '.$where.' AND enabled = 1'); $func = $DB->first(); if(!$menu_layout->function_is_displayed($func->id)) $func = false; } return $func; }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public function confirm() { $project = $this->getProject(); $category = $this->getCategory(); $this->response->html($this->helper->layout->project('category/remove', array( 'project' => $project, 'category' => $category, ))); }
0
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
public function buildCurrentUrl() { $url = URL_BASE; if ($this->url_style == 'sef') { if (count($this->params) > 2) { $url .= substr(PATH_RELATIVE,0,-1).'/'.$this->params['controller'].'/'.$this->params['action']; foreach ($this->params as $key=>$value) { if ($key != 'controller' && $key != 'action') { $url .= '/' . $key . '/' . $value; } } } else { $url .= substr(PATH_RELATIVE,0,-1).$this->sefPath; //fixme do we need to clean this up? } } else { $url .= urldecode((empty($_SERVER['REQUEST_URI'])) ? $_ENV['REQUEST_URI'] : $_SERVER['REQUEST_URI']); } return expString::escape(expString::sanitize($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 confirm() { $project = $this->getProject(); $this->response->html($this->helper->layout->project('action/remove', array( 'action' => $this->actionModel->getById($this->request->getIntegerParam('action_id')), 'available_events' => $this->eventManager->getAll(), 'available_actions' => $this->actionManager->getAvailableActions(), 'project' => $project, 'title' => t('Remove an action') ))); }
0
PHP
CWE-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 update() { global $DB; global $events; if(!is_array($this->categories)) $this->categories = array(); $ok = $DB->execute(' UPDATE nv_feeds SET categories = :categories, format = :format, image = :image, entries = :entries, content = :content, views = :views, permission = :permission, enabled = :enabled WHERE id = :id AND website = :website', array( 'id' => $this->id, 'website' => $this->website, 'categories' => implode(',', $this->categories), 'format' => $this->format, 'image' => value_or_default($this->image, 0), 'entries' => value_or_default($this->entries, 10), 'content' => $this->content, 'views' => value_or_default($this->views, 0), 'permission' => value_or_default($this->permission, 0), 'enabled' => value_or_default($this->enabled, 0) ) ); if(!$ok) throw new Exception($DB->get_last_error()); webdictionary::save_element_strings('feed', $this->id, $this->dictionary); path::saveElementPaths('feed', $this->id, $this->paths); if(method_exists($events, 'trigger')) { $events->trigger( 'feed', 'save', array( 'feed' => $this ) ); } return true; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public static function email($id){ $usr = Db::result( sprintf("SELECT * FROM `user` WHERE `id` = '%d' OR `userid` = '%s' LIMIT 1", Typo::int($id), Typo::cleanX($id) ) ); return $usr[0]->email; }
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 _getMetaTags() { $retval = '<meta charset="utf-8" />'; $retval .= '<meta name="robots" content="noindex,nofollow" />'; $retval .= '<meta http-equiv="X-UA-Compatible" content="IE=Edge">'; $retval .= '<style>html{display: none;}</style>'; return $retval; }
0
PHP
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
function unlockTables() { $sql = "UNLOCK TABLES"; $res = mysqli_query($this->connection, $sql); return $res; }
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 testIsExpiredReturnsTrueIfCompiledFileDoesntExist() { $compiler = new BladeCompiler($files = $this->getFiles(), __DIR__); $files->shouldReceive('exists')->once()->with(__DIR__.'/'.sha1('foo').'.php')->andReturn(false); $this->assertTrue($compiler->isExpired('foo')); }
0
PHP
CWE-327
Use of a Broken or Risky Cryptographic Algorithm
The use of a broken or risky cryptographic algorithm is an unnecessary risk that may result in the exposure of sensitive information.
https://cwe.mitre.org/data/definitions/327.html
vulnerable
public static function get_param($key = NULL) { $info = [ 'stype' => htmlentities(self::$search_type), 'stext' => htmlentities(self::$search_text), 'method' => htmlentities(self::$search_method), 'datelimit' => self::$search_date_limit, 'fields' => self::$search_fields, 'sort' => self::$search_sort, 'chars' => htmlentities(self::$search_chars), 'order' => self::$search_order, 'forum_id' => self::$forum_id, 'memory_limit' => self::$memory_limit, 'composevars' => self::$composevars, 'rowstart' => self::$rowstart, 'search_param' => htmlentities(self::$search_param), ]; return $key === NULL ? $info : (isset($info[$key]) ? $info[$key] : NULL); }
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 showallSubcategories() { // global $db; expHistory::set('viewable', $this->params); // $parent = isset($this->params['cat']) ? $this->params['cat'] : expSession::get('catid'); $catid = expSession::get('catid'); $parent = !empty($catid) ? $catid : (!empty($this->params['cat']) ? $this->params['cat'] : 0); $category = new storeCategory($parent); $categories = $category->getEcomSubcategories(); $ancestors = $category->pathToNode(); assign_to_template(array( 'categories' => $categories, 'ancestors' => $ancestors, 'category' => $category )); }
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 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'] )); }
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 __construct( protected RequestHelper $requestHelper, protected ContentSecurityPolicyHandler $contentSecurityPolicyHandler, protected Config $config ) { }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public static function canView($section) { global $db; if ($section == null) { return false; } if ($section->public == 0) { // Not a public section. Check permissions. return expPermissions::check('view', expCore::makeLocation('navigation', '', $section->id)); } else { // Is public. check parents. if ($section->parent <= 0) { // Out of parents, and since we are still checking, we haven't hit a private section. return true; } else { $s = $db->selectObject('section', 'id=' . $section->parent); return self::canView($s); } } }
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 clearTags() { $this->_tags = array(); // clear tag cache return (bool) CActiveRecord::model('Tags')->deleteAllByAttributes(array( 'type' => get_class($this->getOwner()), 'itemId' => $this->getOwner()->id) ); }
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 setModelAttributes(&$model,&$attributeList,&$params) { $data = array (); foreach($attributeList as &$attr) { if(!isset($attr['name'],$attr['value'])) continue; if(null !== $field = $model->getField($attr['name'])) { // first do variable/expression evaluation, // then process with X2Fields::parseValue() $type = $field->type; $value = $attr['value']; if(is_string($value)){ if(strpos($value, '=') === 0){ $evald = X2FlowFormatter::parseFormula($value, $params); if(!$evald[0]) return false; $value = $evald[1]; } elseif($params !== null){ if(is_string($value) && isset($params['model'])){ $value = X2FlowFormatter::replaceVariables( $value, $params, $type); } } } $data[$attr['name']] = $value; } } if (!isset ($model->scenario)) $model->setScenario ('X2Flow'); $model->setX2Fields ($data); if ($model instanceof Actions && isset($data['complete'])) { switch($data['complete']) { case 'Yes': $model->complete(); break; case 'No': $model->uncomplete(); break; } } return true; }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public function __construct($exceptions = null) { if ($exceptions !== null) { $this->exceptions = (boolean)$exceptions; } }
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 page($vars) { switch (SMART_URL) { case true: # code... $url = Options::get('siteurl')."/".self::slug($vars).GX_URL_PREFIX; break; default: # code... $url = Options::get('siteurl')."/index.php?page={$vars}"; break; } return $url; }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public function testOverNesting() { $parser = new JBBCode\Parser(); $parser->addCodeDefinitionSet(new JBBCode\DefaultCodeDefinitionSet()); $parser->addBBCode('quote', '<blockquote>{param}</blockquote>', false, true, 2); $bbcode = '[quote][quote][quote]wut[/quote] huh?[/quote] i don\'t know[/quote]'; $parser->parse($bbcode); $expectedBbcode = '[quote][quote] huh?[/quote] i don\'t know[/quote]'; $expectedHtml = '<blockquote><blockquote> huh?</blockquote> i don\'t know</blockquote>'; $this->assertEquals($expectedBbcode, $parser->getAsBBCode()); $this->assertEquals($expectedHtml, $parser->getAsHtml()); }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
protected function _filePutContents($path, $content) { if (file_put_contents($path, $content, LOCK_EX) !== false) { clearstatcache(); return true; } return false; }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
$layout[$loc] = array_merge($layout[$loc],$data); } } } return $layout; }
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
private function defaultParse($bbcode) { $parser = new JBBCode\Parser(); $parser->addCodeDefinitionSet(new JBBCode\DefaultCodeDefinitionSet()); $parser->parse($bbcode); return $parser->getAsHtml(); }
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 process_subsections($parent_section, $subtpl) { global $db, $router; $section = new stdClass(); $section->parent = $parent_section->id; $section->name = $subtpl->name; $section->sef_name = $router->encode($section->name); $section->subtheme = $subtpl->subtheme; $section->active = $subtpl->active; $section->public = $subtpl->public; $section->rank = $subtpl->rank; $section->page_title = $subtpl->page_title; $section->keywords = $subtpl->keywords; $section->description = $subtpl->description; $section->id = $db->insertObject($section, 'section'); self::process_section($section, $subtpl); }
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_submit() { if (empty($this->params['id'])) { flash('error', gt('No ID supplied for comment to approve')); expHistory::back(); } /* 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->body = $this->params['body']; $comment->approved = $this->params['approved']; $comment->save(); 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