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 static function render_page_process($PATH) { $search_query = $_REQUEST['search']; $main = null; if(strlen($search_query) < 4) { $main = '<h1>Search Failed</h1>'; $main .= '<p>Search Queries Must Be At Least Four Characters.</p>'; } else { $main .= '<h1>Search Results For: ' . $search_query . '</h1>'; $category_matches = 0; $tests = self::search_test_profiles($search_query); if($tests != null) { $category_matches++; $main .= '<h2>Test Profile Matches</h2>' . $tests . '<hr />'; } $local_suites = self::search_local_test_suites($search_query); if($local_suites != null) { $category_matches++; $main .= '<h2>Local Test Suite Matches</h2>' . $local_suites . '<hr />'; } $test_schedules = self::search_test_schedules($search_query); if($test_schedules != null) { $category_matches++; $main .= '<h2>Test Schedule Matches</h2>' . $test_schedules . '<hr />'; } $test_results = self::search_test_results($search_query); if($test_results != null) { $category_matches++; $main .= '<h2>Test Result Matches</h2>' . $test_results . '<hr />'; } $test_systems = self::search_test_systems($search_query); if($test_systems != null) { $category_matches++; $main .= '<h2>Test System Matches</h2>' . $test_systems . '<hr />'; } if($category_matches == 0) { $main .= '<h2>No Matches Found</h2>'; } } echo phoromatic_webui_header_logged_in(); echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in()); echo phoromatic_webui_footer(); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public function testRaisesExceptionOnInvalidClientMediaType($mediaType) { $this->setExpectedException('InvalidArgumentException', 'media type'); new UploadedFile(fopen('php://temp', 'wb+'), 0, UPLOAD_ERR_OK, 'foobar.baz', $mediaType); }
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 transform($tag, $config, $context) { $new_tag = clone $tag; $new_tag->name = $this->transform_to; if (!is_null($this->style) && ($new_tag instanceof HTMLPurifier_Token_Start || $new_tag instanceof HTMLPurifier_Token_Empty) ) { $this->prependCSS($new_tag->attr, $this->style); } return $new_tag; }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public static function autoload() { include (GX_LIB."Vendor/autoload.php"); }
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 actionView($id){ // add media object to user's recent item list User::addRecentItem('m', $id, Yii::app()->user->getId()); $this->render('view', array( 'model' => $this->loadModel($id), )); }
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
$db->updateObject($value, 'section'); } $db->updateObject($moveSec, 'section'); //handle re-ranking of previous parent $oldSiblings = $db->selectObjects("section", "parent=" . $oldParent . " AND rank>" . $oldRank . " ORDER BY rank"); $rerank = 1; foreach ($oldSiblings as $value) { if ($value->id != $moveSec->id) { $value->rank = $rerank; $db->updateObject($value, 'section'); $rerank++; } } if ($oldParent != $moveSec->parent) { //we need to re-rank the children of the parent that the moving section has just left $childOfLastMove = $db->selectObjects("section", "parent=" . $oldParent . " ORDER BY rank"); for ($i = 0, $iMax = count($childOfLastMove); $i < $iMax; $i++) { $childOfLastMove[$i]->rank = $i; $db->updateObject($childOfLastMove[$i], 'section'); } } } } self::checkForSectionalAdmins($move); expSession::clearAllUsersSessionCache('navigation'); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
function db_start() { global $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType; switch ($DatabaseType) { case 'mysqli': $connection = new mysqli($DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort); break; } // Error code for both. if ($connection === false) { switch ($DatabaseType) { case 'mysqli': $errormessage = mysqli_error($connection); break; } db_show_error("", "" . _couldNotConnectToDatabase . ": $DatabaseServer", $errormessage); } return $connection; }
0
PHP
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
vulnerable
private static function createUploadedFileFromSpec(array $value) { if (is_array($value['tmp_name'])) { return self::normalizeNestedFileSpec($value); } return new UploadedFile( $value['tmp_name'], (int) $value['size'], (int) $value['error'], $value['name'], $value['type'] ); }
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 publish($id) { $id = Typo::int($id); $ins = array( 'table' => 'posts', 'id' => $id, 'key' => array( 'status' => '1' ) ); $post = Db::update($ins); return $post; }
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() {}
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 testOmittedOption() { $code = 'This doesn\'t use the url option [url]http://jbbcode.com[/url].'; $html = 'This doesn\'t use the url option <a href="http://jbbcode.com">http://jbbcode.com</a>.'; $this->assertProduces($code, $html); }
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 navtojson() { return json_encode(self::navhierarchy()); }
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 manage() { expHistory::set('manageable', $this->params); // build out a SQL query that gets all the data we need and is sortable. $sql = 'SELECT b.*, c.title as companyname, f.expfiles_id as file_id '; $sql .= 'FROM '.DB_TABLE_PREFIX.'_banner b, '.DB_TABLE_PREFIX.'_companies c , '.DB_TABLE_PREFIX.'_content_expFiles f '; $sql .= 'WHERE b.companies_id = c.id AND (b.id = f.content_id AND f.content_type="banner")'; $page = new expPaginator(array( 'model'=>'banner', 'sql'=>$sql, 'order'=>'title', 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->params['controller'], 'action'=>$this->params['action'], 'src'=>$this->loc->src, 'columns'=>array( gt('Title')=>'title', gt('Company')=>'companyname', gt('Impressions')=>'impressions', gt('Clicks')=>'clicks' ) )); assign_to_template(array( 'page'=>$page )); }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public static function mb_substitute_character($c = null) { if (0 === strcasecmp($c, 'none')) { return true; } return null !== $c ? false : 'none'; }
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 renderText ($field, $makeLinks, $textOnly, $encode) { $fieldName = $field->fieldName; $value = $this->owner->$fieldName; if (is_string ($value)) { $value = preg_replace("/(\<br ?\/?\>)|\n/"," ",$value); return Yii::app()->controller->convertUrls($this->render ($value, $encode)); } else { return ''; } }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query(' SELECT * FROM nv_paths WHERE website = '.protect($website->id), 'object' ); $out = $DB->result(); if($type='json') $out = json_encode($out); return $out; }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public function __construct($exceptions = false) { $this->exceptions = ($exceptions == 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 function delete() { global $db, $history; /* 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('Missing id for the comment you would like to delete')); $lastUrl = expHistory::getLast('editable'); } // delete the note $simplenote = new expSimpleNote($this->params['id']); $rows = $simplenote->delete(); // delete the assocication too $db->delete($simplenote->attachable_table, 'expsimplenote_id='.$this->params['id']); // send the user back where they came from. $lastUrl = expHistory::getLast('editable'); if (!empty($this->params['tab'])) { $lastUrl .= "#".$this->params['tab']; } redirect_to($lastUrl); }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public function beforeFilter(EventInterface $event) { parent::beforeFilter($event); $this->Authentication->allowUnauthenticated(['index']); }
0
PHP
NVD-CWE-noinfo
null
null
null
vulnerable
public function confirm() { $project = $this->getProject(); $this->response->html($this->helper->layout->project('column/remove', array( 'column' => $this->columnModel->getById($this->request->getIntegerParam('column_id')), 'project' => $project, ))); }
0
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
public function actionGetItems($term){ X2LinkableBehavior::getItems ($term); }
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
foreach ($allusers as $uid) { $u = user::getUserById($uid); expPermissions::grant($u, '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
function categoryBreadcrumb() { // global $db, $router; //eDebug($this->category); /*if(isset($router->params['action'])) { $ancestors = $this->category->pathToNode(); }else if(isset($router->params['section'])) { $current = $db->selectObject('section',' id= '.$router->params['section']); $ancestors[] = $current; if( $current->parent != -1 || $current->parent != 0 ) { while ($db->selectObject('section',' id= '.$router->params['section']);) if ($section->id == $id) { $current = $section; break; } } } eDebug($sections); $ancestors = $this->category->pathToNode(); }*/ $ancestors = $this->category->pathToNode(); // eDebug($ancestors); assign_to_template(array( 'ancestors' => $ancestors )); }
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 setHeader( $header ) { if ( \DynamicPageListHooks::getDebugLevel() == 5 ) { $header = '<pre><nowiki>' . $header; } $this->header = $this->replaceVariables( $header ); }
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 static function install ($var) { include(GX_PATH.'/gxadmin/themes/install/'.$var.'.php'); }
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 onParserFirstCallInit( Parser &$parser ) { self::init(); //DPL offers the same functionality as Intersection. So we register the <DynamicPageList> tag in case LabeledSection Extension is not installed so that the section markers are removed. if ( \DPL\Config::getSetting( 'handleSectionTag' ) ) { $parser->setHook( 'section', [ __CLASS__, 'dplTag' ] ); } $parser->setHook( 'DPL', [ __CLASS__, 'dplTag' ] ); $parser->setHook( 'DynamicPageList', [ __CLASS__, 'intersectionTag' ] ); $parser->setFunctionHook( 'dpl', [ __CLASS__, 'dplParserFunction' ] ); $parser->setFunctionHook( 'dplnum', [ __CLASS__, 'dplNumParserFunction' ] ); $parser->setFunctionHook( 'dplvar', [ __CLASS__, 'dplVarParserFunction' ] ); $parser->setFunctionHook( 'dplreplace', [ __CLASS__, 'dplReplaceParserFunction' ] ); $parser->setFunctionHook( 'dplchapter', [ __CLASS__, 'dplChapterParserFunction' ] ); $parser->setFunctionHook( 'dplmatrix', [ __CLASS__, 'dplMatrixParserFunction' ] ); return true; }
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 getFormat($mimeType) { $canonicalMimeType = null; if (false !== $pos = strpos($mimeType, ';')) { $canonicalMimeType = substr($mimeType, 0, $pos); } if (null === static::$formats) { static::initializeFormats(); } foreach (static::$formats as $format => $mimeTypes) { if (in_array($mimeType, (array) $mimeTypes)) { return $format; } if (null !== $canonicalMimeType && in_array($canonicalMimeType, (array) $mimeTypes)) { return $format; } } }
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 showall() { expHistory::set('viewable', $this->params); // figure out if should limit the results if (isset($this->params['limit'])) { $limit = $this->params['limit'] == 'none' ? null : $this->params['limit']; } else { $limit = (isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10; } $order = isset($this->config['order']) ? $this->config['order'] : 'publish DESC'; // pull the news posts from the database $items = $this->news->find('all', $this->aggregateWhereClause(), $order); // merge in any RSS news and perform the sort and limit the number of posts we return to the configured amount. if (!empty($this->config['pull_rss'])) $items = $this->mergeRssData($items); // setup the pagination object to paginate the news stories. $page = new expPaginator(array( 'records'=>$items, 'limit'=>$limit, 'order'=>$order, 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->params['controller'], 'action'=>$this->params['action'], 'src'=>$this->loc->src, 'view'=>empty($this->params['view']) ? null : $this->params['view'] )); assign_to_template(array( 'page'=>$page, 'items'=>$page->records, 'rank'=>($order==='rank')?1:0, 'params'=>$this->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 scan_page($parent_id) { global $db; $sections = $db->selectObjects('section','parent=' . $parent_id); $ret = ''; foreach ($sections as $page) { $cLoc = serialize(expCore::makeLocation('container','@section' . $page->id)); $ret .= scan_container($cLoc, $page->id); $ret .= scan_page($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
public function test_empty_content_multiple_spaces() { $result = $this->myxmlrpcserver->wp_newComment( array( 1, 'administrator', 'administrator', self::$post->ID, array( 'content' => ' ', ), ) ); $this->assertIXRError( $result ); $this->assertSame( 403, $result->code ); }
0
PHP
CWE-862
Missing Authorization
The software does not perform an authorization check when an actor attempts to access a resource or perform an action.
https://cwe.mitre.org/data/definitions/862.html
vulnerable
function productFeed() { // global $db; //check query password to avoid DDOS /* * condition = new * description * id - SKU * link * price * title * brand - manufacturer * image link - fullsized image, up to 10, comma seperated * product type - category - "Electronics > Audio > Audio Accessories MP3 Player Accessories","Health & Beauty > Healthcare > Biometric Monitors > Pedometers" */ $out = '"id","condition","description","like","price","title","brand","image link","product type"' . chr(13) . chr(10); $p = new product(); $prods = $p->find('all', 'parent_id=0 AND '); //$prods = $db->selectObjects('product','parent_id=0 AND'); }
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 testSitePages () { $this->visitPages ($this->getPages ('^site')); }
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 __construct() { # code... self::$smtphost = Options::get('smtphost'); self::$smtpuser = Options::get('smtpuser'); self::$smtppass = Options::get('smtppass'); self::$smtpssl = Options::get('smtpssl'); self::$siteemail = Options::get('siteemail'); self::$sitename = Options::get('sitename'); }
0
PHP
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
vulnerable
public static function avatar($id) { $usr = Db::result( sprintf( "SELECT * FROM `user_detail` WHERE `id` = '%d' OR `userid` = '%s' LIMIT 1", Typo::int($id), Typo::cleanX($id) ) ); return $usr[0]->avatar; }
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() { if (!AuthUser::hasPermission('file_manager_upload')) { Flash::set('error', __('You do not have sufficient permissions to upload a file.')); redirect(get_url('plugin/file_manager/browse/')); } // CSRF checks if (isset($_POST['csrf_token'])) { $csrf_token = $_POST['csrf_token']; if (!SecureToken::validateToken($csrf_token, BASE_URL.'plugin/file_manager/upload')) { Flash::set('error', __('Invalid CSRF token found!')); redirect(get_url('plugin/file_manager/browse/')); } } else { Flash::set('error', __('No CSRF token found!')); redirect(get_url('plugin/file_manager/browse/')); } $mask = Plugin::getSetting('umask', 'file_manager'); umask(octdec($mask)); $data = $_POST['upload']; $path = str_replace('..', '', $data['path']); $overwrite = isset($data['overwrite']) ? true : false; // Clean filenames $filename = preg_replace('/ /', '_', $_FILES['upload_file']['name']); $filename = preg_replace('/[^a-z0-9_\-\.]/i', '', $filename); $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); if (in_array($ext, ['php', 'php3', 'php4', 'inc'])) { Flash::set('error', __('Not allowed to upload files with extension :ext', $ext)); redirect(get_url('plugin/file_manager/browse/')); } if (isset($_FILES)) { $file = $this->_upload_file($filename, FILES_DIR . '/' . $path . '/', $_FILES['upload_file']['tmp_name'], $overwrite); if ($file === false) Flash::set('error', __('File has not been uploaded!')); } redirect(get_url('plugin/file_manager/browse/' . $path)); }
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 delete_recurring() { $item = $this->event->find('first', 'id=' . $this->params['id']); if ($item->is_recurring == 1) { // need to give user options expHistory::set('editable', $this->params); assign_to_template(array( 'checked_date' => $this->params['date_id'], 'event' => $item, )); } else { // Process a regular delete $item->delete(); } }
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_linkURL($url) { if (!preg_match('#^https?://#', $url) || defined('PMA_SETUP')) { return $url; } if (!function_exists('PMA_URL_getCommon')) { include_once './libraries/url_generating.lib.php'; } $params = array(); $params['url'] = $url; $url = PMA_URL_getCommon($params); //strip off token and such sensitive information. Just keep url. $arr = parse_url($url); parse_str($arr["query"], $vars); $query = http_build_query(array("url" => $vars["url"])); $url = './url.php?' . $query; return $url; }
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
function move_standalone() { expSession::clearAllUsersSessionCache('navigation'); assign_to_template(array( 'parent' => $this->params['parent'], )); }
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 errorGeneric($var, $type) { $vtype = gettype($var); $this->error("Expected type ".HTMLPurifier_VarParser::getTypeName($type).", got $vtype"); }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $category = $this->getCategory(); if ($this->categoryModel->remove($category['id'])) { $this->flash->success(t('Category removed successfully.')); } else { $this->flash->failure(t('Unable to remove this category.')); } $this->response->redirect($this->helper->url->to('CategoryController', '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 static function mb_strrchr($haystack, $needle, $part = false, $encoding = null) { $encoding = self::getEncoding($encoding); $needle = self::mb_substr($needle, 0, 1, $encoding); $pos = iconv_strrpos($haystack, $needle, $encoding); return self::getSubpart($pos, $part, $haystack, $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
private function dumpParameter($name) { $name = (string) $name; if ($this->container->isCompiled() && $this->container->hasParameter($name)) { $value = $this->container->getParameter($name); $dumpedValue = $this->dumpValue($value, false); if (!$value || !\is_array($value)) { return $dumpedValue; } if (!preg_match("/\\\$this->(?:getEnv\('(?:\w++:)*+\w++'\)|targetDirs\[\d++\])/", $dumpedValue)) { return sprintf('$this->parameters[%s]', $this->doExport($name)); } } return sprintf('$this->getParameter(%s)', $this->doExport($name)); }
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 makeFixes() {}
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 testNoParsingWithBufferText() { $parser = new JBBCode\Parser(); $parser->addCodeDefinitionSet(new JBBCode\DefaultCodeDefinitionSet()); $parser->addBBCode('verbatim', '{param}', false, false); $parser->parse('buffer text[verbatim]buffer text[b]bold[/b]buffer text[/verbatim]buffer text'); $this->assertEquals('buffer textbuffer text[b]bold[/b]buffer textbuffer text', $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
$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
function send_reset_confirmation_request($name) { global $sitename; $rs = safe_row("email, nonce", 'txp_users', "name = '".doSlash($name)."'"); if ($rs) { extract($rs); $confirm = bin2hex(pack('H*', substr(md5($nonce), 0, 10)).$name); $message = gTxt('greeting').' '.$name.','. n.n.gTxt('password_reset_confirmation').': '. n.hu.'textpattern/index.php?confirm='.$confirm; if (txpMail($email, "[$sitename] ".gTxt('password_reset_confirmation_request'), $message)) { return gTxt('password_reset_confirmation_request_sent'); } else { return array(gTxt('could_not_mail'), E_ERROR); } } else { // Though 'unknown_author' could be thrown, send generic 'request_sent' // message instead so that (non-)existence of account names are not leaked. return gTxt('password_reset_confirmation_request_sent'); } }
0
PHP
CWE-521
Weak Password Requirements
The product does not require that users should have strong passwords, which makes it easier for attackers to compromise user accounts.
https://cwe.mitre.org/data/definitions/521.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(); }
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 isEnable() { if (Options::v('google_captcha_enable') === 'on') { return true; } else { return false; } }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public function store($zdb) { $data = array( 'short_label' => $this->short, 'long_label' => $this->long ); try { if ($this->id !== null && $this->id > 0) { $update = $zdb->update(self::TABLE); $update->set($data)->where( self::PK . '=' . $this->id ); $zdb->execute($update); } else { $insert = $zdb->insert(self::TABLE); $insert->values($data); $add = $zdb->execute($insert); if (!$add->count() > 0) { Analog::log('Not stored!', Analog::ERROR); return false; } $this->id = $zdb->getLastGeneratedValue($this); } return true; } catch (Throwable $e) { Analog::log( 'An error occurred storing title: ' . $e->getMessage() . "\n" . print_r($data, true), 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
function make_fb_serialize_vector($size) { return str_repeat("\x12", $size) . str_repeat("\x01", $size); }
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
foreach($image->expTag as $tag) { if (isset($used_tags[$tag->id])) { $used_tags[$tag->id]->count++; } else { $exptag = new expTag($tag->id); $used_tags[$tag->id] = $exptag; $used_tags[$tag->id]->count = 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
$period_days_append_sql= substr($period_days_append_sql,0,-4).'))'; } $exist_RET= DBGet(DBQuery("SELECT s.ID FROM schedule s WHERE student_id=". $student_id." AND s.syear='".UserSyear()."' {$mp_append_sql}{$period_days_append_sql} UNION SELECT s.ID FROM temp_schedule s WHERE student_id=". $student_id."{$mp_append_sql}{$period_days_append_sql}")); if($exist_RET) return 'There is a Period Conflict ('.$course_RET[1]['CP_TITLE'].')'; else { return true; } }
0
PHP
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
vulnerable
public function getFilePath($fileName = null) { if ($fileName === null) { $fileName = $this->fileName; } return $this->theme->getPath().'/'.$this->dirName.'/'.$fileName; }
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
function GETPOST($paramname,$check='',$method=0) { if (empty($method)) $out = isset($_GET[$paramname])?$_GET[$paramname]:(isset($_POST[$paramname])?$_POST[$paramname]:''); elseif ($method==1) $out = isset($_GET[$paramname])?$_GET[$paramname]:''; elseif ($method==2) $out = isset($_POST[$paramname])?$_POST[$paramname]:''; elseif ($method==3) $out = isset($_POST[$paramname])?$_POST[$paramname]:(isset($_GET[$paramname])?$_GET[$paramname]:''); if (! empty($check)) { // Check if numeric if ($check == 'int' && ! preg_match('/^[-\.,0-9]+$/i',trim($out))) $out=''; // Check if alpha //if ($check == 'alpha' && ! preg_match('/^[ =:@#\/\\\(\)\-\._a-z0-9]+$/i',trim($out))) $out=''; // '"' is dangerous because param in url can close the href= or src= and add javascript functions. if ($check == 'alpha' && preg_match('/"/',trim($out))) $out=''; } return $out; }
0
PHP
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
vulnerable
public function rules() { // todo with multilanguage $rules = [ 'title' => 'required|max:500', 'url' => 'max:500', 'description' => 'max:500', 'content_meta_title' => 'max:500', 'content_meta_keywords' => 'max:500', 'original_link' => 'max:500', ]; return $rules; }
1
PHP
CWE-190
Integer Overflow or Wraparound
The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control.
https://cwe.mitre.org/data/definitions/190.html
safe
foreach($image->expTag as $tag) { if (isset($used_tags[$tag->id])) { $used_tags[$tag->id]->count++; } else { $exptag = new expTag($tag->id); $used_tags[$tag->id] = $exptag; $used_tags[$tag->id]->count = 1; } }
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 verify(){ echo $_GET['challenge']; }
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 verifyCSRFToken() { $clean_referer = str_replace(array("http://","https://"),"//",$_SERVER["HTTP_REFERER"]); $clean_domain = str_replace(array("http://","https://"),"//",DOMAIN); $token = isset($_POST[$this->CSRFTokenField]) ? $_POST[$this->CSRFTokenField] : $_GET[$this->CSRFTokenField]; if (strpos($clean_referer, $clean_domain) === false || $token != $this->CSRFToken) { $this->stop("Cross site request forgery detected."); } }
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 approve_toggle() { global $history; if (empty($this->params['id'])) return; /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login']; $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval']; $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification']; $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email']; $simplenote = new expSimpleNote($this->params['id']); $simplenote->approved = $simplenote->approved == 1 ? 0 : 1; $simplenote->save(); $lastUrl = makelink($history->history[$history->history['lasts']['type']][count($history->history[$history->history['lasts']['type']])-1]['params']); if (!empty($this->params['tab'])) { $lastUrl .= "#".$this->params['tab']; } redirect_to($lastUrl); }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
function remove() { global $db; $section = $db->selectObject('section', 'id=' . $this->params['id']); if ($section) { section::removeLevel($section->id); $db->decrement('section', 'rank', 1, 'rank > ' . $section->rank . ' AND parent=' . $section->parent); $section->parent = -1; $db->updateObject($section, 'section'); expSession::clearAllUsersSessionCache('navigation'); expHistory::back(); } else { 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
public function approve_toggle() { global $history; if (empty($this->params['id'])) return; /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login']; $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval']; $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification']; $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email']; $simplenote = new expSimpleNote($this->params['id']); $simplenote->approved = $simplenote->approved == 1 ? 0 : 1; $simplenote->save(); $lastUrl = makelink($history->history[$history->history['lasts']['type']][count($history->history[$history->history['lasts']['type']])-1]['params']); if (!empty($this->params['tab'])) { $lastUrl .= "#".$this->params['tab']; } redirect_to($lastUrl); }
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 static function makeEnum($in) { return new HTMLPurifier_AttrDef_Clone(new HTMLPurifier_AttrDef_Enum(explode(',', $in))); }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public function confirm() { $project = $this->getProject(); $filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id')); $this->response->html($this->helper->layout->project('custom_filter/remove', array( 'project' => $project, 'filter' => $filter, 'title' => t('Remove a custom filter') ))); }
0
PHP
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
static function validUTF($string) { if(!mb_check_encoding($string, 'UTF-8') OR !($string === mb_convert_encoding(mb_convert_encoding($string, 'UTF-32', 'UTF-8' ), 'UTF-8', 'UTF-32'))) { return false; } return true; }
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 ($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; } } }
0
PHP
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/74.html
vulnerable
public static function filter() { //print_r(self::$hooks[$var]); $hooks = self::$hooks; $num_args = func_num_args(); $args = func_get_args(); // print_r($args); // if ($num_args < 2) // trigger_error("Insufficient arguments", E_USER_ERROR); // Hook name should always be first argument $hook_name = array_shift($args); if (!isset($hooks[$hook_name])) { return; } // No plugins have registered this hook // print_r($args[0]); // $args = (is_array($args))?$args[0]: $args; if (is_array($hooks[$hook_name])) { foreach ($hooks[$hook_name] as $func) { if ($func != '') { // $args = call_user_func_array($func, $args); // $args = $func((array) $args); } else { $args = $args; } } $args = $args; } else { $args = $args; } $args = is_array($args) ? $args[0] : $args; return $args; }
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
foreach ($day as $extevent) { $event_cache = new stdClass(); $event_cache->feed = $extgcalurl; $event_cache->event_id = $extevent->event_id; $event_cache->title = $extevent->title; $event_cache->body = $extevent->body; $event_cache->eventdate = $extevent->eventdate->date; if (isset($extevent->dateFinished) && $extevent->dateFinished != -68400) $event_cache->dateFinished = $extevent->dateFinished; if (isset($extevent->eventstart)) $event_cache->eventstart = $extevent->eventstart; if (isset($extevent->eventend)) $event_cache->eventend = $extevent->eventend; if (isset($extevent->is_allday)) $event_cache->is_allday = $extevent->is_allday; $found = false; if ($extevent->eventdate->date < $start) // prevent duplicating events crossing month boundaries $found = $db->selectObject('event_cache','feed="'.$extgcalurl.'" AND event_id="'.$event_cache->event_id.'" AND eventdate='.$event_cache->eventdate); if (!$found) $db->insertObject($event_cache,'event_cache'); }
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_from_post() { $this->codename = $_REQUEST['codename']; $this->icon = $_REQUEST['icon']; $this->lid = $_REQUEST['lid']; $this->notes = $_REQUEST['notes']; $this->enabled = ($_REQUEST['enabled']=='1'? '1' : '0'); // load associated functions $functions = explode('#', $_REQUEST['menu-functions']); $this->functions = array(); foreach($functions as $function) { if(!empty($function)) $this->functions[] = $function; } }
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 transform($attr, $config, $context) { if (isset($attr['dir'])) return $attr; $attr['dir'] = $config->get('Attr.DefaultTextDir'); 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
foreach ($info->attr as $attr => $x) { $keys = array("$tag@$attr", $attr, "*@$attr", "$tag.$attr", "*.$attr"); $delete = true; foreach ($keys as $key) { if ($delete && isset($allowed_attributes[$key])) { $delete = false; } if (isset($allowed_attributes_mutable[$key])) { unset($allowed_attributes_mutable[$key]); } } if ($delete) { if ($this->info[$tag]->attr[$attr]->required) { trigger_error("Required attribute '$attr' in element '$tag' was not allowed, which means '$tag' will not be allowed either", E_USER_WARNING); } unset($this->info[$tag]->attr[$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 toolbar() { // global $user; $menu = array(); $dirs = array( BASE.'framework/modules/administration/menus', BASE.'themes/'.DISPLAY_THEME.'/modules/administration/menus' ); foreach ($dirs as $dir) { if (is_readable($dir)) { $dh = opendir($dir); while (($file = readdir($dh)) !== false) { if (substr($file,-4,4) == '.php' && is_readable($dir.'/'.$file) && is_file($dir.'/'.$file)) { $menu[substr($file,0,-4)] = include($dir.'/'.$file); if (empty($menu[substr($file,0,-4)])) unset($menu[substr($file,0,-4)]); } } } } // sort the top level menus alphabetically by filename ksort($menu); $sorted = array(); foreach($menu as $m) $sorted[] = $m; // slingbar position if (isset($_COOKIE['slingbar-top'])){ $top = $_COOKIE['slingbar-top']; } else { $top = SLINGBAR_TOP; } assign_to_template(array( 'menu'=>(bs3()) ? $sorted : json_encode($sorted), "top"=>$top )); }
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 delParam($param, $post_id) { $sql = "DELETE FROM `posts_param` WHERE `post_id` = '{$post_id}' AND `param` = '{$param}' LIMIT 1"; $q = Db::query($sql); if ($q) { return true; }else{ 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
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; }
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 delete() { global $db; /* 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']; if (empty($this->params['id'])) { flash('error', gt('Missing id for the comment you would like to delete')); expHistory::back(); } // delete the comment $comment = new expComment($this->params['id']); $comment->delete(); // delete the association too $db->delete($comment->attachable_table, 'expcomments_id='.$this->params['id']); // send the user back where they came from. 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 getQuerySelect() { return ''; }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public function toolbar() { // global $user; $menu = array(); $dirs = array( BASE.'framework/modules/administration/menus', BASE.'themes/'.DISPLAY_THEME.'/modules/administration/menus' ); foreach ($dirs as $dir) { if (is_readable($dir)) { $dh = opendir($dir); while (($file = readdir($dh)) !== false) { if (substr($file,-4,4) == '.php' && is_readable($dir.'/'.$file) && is_file($dir.'/'.$file)) { $menu[substr($file,0,-4)] = include($dir.'/'.$file); if (empty($menu[substr($file,0,-4)])) unset($menu[substr($file,0,-4)]); } } } } // sort the top level menus alphabetically by filename ksort($menu); $sorted = array(); foreach($menu as $m) $sorted[] = $m; // slingbar position if (isset($_COOKIE['slingbar-top'])){ $top = $_COOKIE['slingbar-top']; } else { $top = SLINGBAR_TOP; } assign_to_template(array( 'menu'=>(bs3()) ? $sorted : json_encode($sorted), "top"=>$top )); }
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 PMA_cleanupPathInfo() { global $PMA_PHP_SELF, $_PATH_INFO; $PMA_PHP_SELF = PMA_getenv('PHP_SELF'); $_PATH_INFO = PMA_getenv('PATH_INFO'); if (! empty($_PATH_INFO) && ! empty($PMA_PHP_SELF)) { $path_info_pos = mb_strrpos($PMA_PHP_SELF, $_PATH_INFO); $pathLength = $path_info_pos + mb_strlen($_PATH_INFO); if ($pathLength === mb_strlen($PMA_PHP_SELF)) { $PMA_PHP_SELF = mb_substr($PMA_PHP_SELF, 0, $path_info_pos); } } $PMA_PHP_SELF = htmlspecialchars($PMA_PHP_SELF); }
0
PHP
CWE-254
7PK - Security Features
Software security is not security software. Here we're concerned with topics like authentication, access control, confidentiality, cryptography, and privilege management.
https://cwe.mitre.org/data/definitions/254.html
vulnerable
function delete() { global $db; if (empty($this->params['id'])) return false; $product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']); $product = new $product_type($this->params['id'], true, false); //eDebug($product_type); //eDebug($product, true); //if (!empty($product->product_type_id)) { //$db->delete($product_type, 'id='.$product->product_id); //} $db->delete('option', 'product_id=' . $product->id . " AND optiongroup_id IN (SELECT id from " . $db->prefix . "optiongroup WHERE product_id=" . $product->id . ")"); $db->delete('optiongroup', 'product_id=' . $product->id); //die(); $db->delete('product_storeCategories', 'product_id=' . $product->id . ' AND product_type="' . $product_type . '"'); if ($product->product_type == "product") { if ($product->hasChildren()) { $this->deleteChildren(); } } $product->delete(); flash('message', gt('Product deleted successfully.')); 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
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(); }
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 beforeSave () { $valid = parent::beforeSave (); if ($valid) { $table = Yii::app()->db->schema->tables[$this->myTableName]; $existing = array_key_exists($this->fieldName, $table->columns) && $table->columns[$this->fieldName] instanceof CDbColumnSchema; if($existing){ $valid = $this->modifyColumn(); } } return $valid; }
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
$db->insertObject($obj, 'expeAlerts_subscribers'); } $count = count($this->params['ealerts']); if ($count > 0) { flash('message', gt("Your subscriptions have been updated. You are now subscriber to")." ".$count.' '.gt('E-Alerts.')); } else { flash('error', gt("You have been unsubscribed from all E-Alerts.")); } expHistory::back(); }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
function 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 )); }
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 static function verifySignature($signature, $input, $key, $algo = 'HS256') { switch ($algo) { case'HS256': case'HS384': case'HS512': return JWT::sign($input, $key, $algo) === $signature; case 'RS256': return (boolean) openssl_verify($input, $signature, $key, OPENSSL_ALGO_SHA256); case 'RS384': return (boolean) openssl_verify($input, $signature, $key, OPENSSL_ALGO_SHA384); case 'RS512': return (boolean) openssl_verify($input, $signature, $key, OPENSSL_ALGO_SHA512); default: throw new Exception("Unsupported or invalid signing algorithm."); } }
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 testExportHiddenRecords() { $exportCsv = implode(DIRECTORY_SEPARATOR, array( Yii::app()->basePath, 'data', 'records_export.csv' )); // Without hidden records, should export 3 models $this->prepareExport ('contacts'); $this->beginExport (false); $this->assertEquals (3, count(file($exportCsv))); // With hidden records, should export 4 models instead $this->prepareExport ('contacts'); $this->beginExport (true); $this->assertEquals (4, count(file($exportCsv))); }
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 chmod() { if (!AuthUser::hasPermission('file_manager_chmod')) { Flash::set('error', __('You do not have sufficient permissions to change the permissions on a file or directory.')); redirect(get_url('plugin/file_manager/browse/')); } // CSRF checks if (isset($_POST['csrf_token'])) { $csrf_token = $_POST['csrf_token']; if (!SecureToken::validateToken($csrf_token, BASE_URL.'plugin/file_manager/chmod')) { Flash::set('error', __('Invalid CSRF token found!')); redirect(get_url('plugin/file_manager/browse/')); } } else { Flash::set('error', __('No CSRF token found!')); redirect(get_url('plugin/file_manager/browse/')); } $data = $_POST['file']; $data['name'] = str_replace('..', '', $data['name']); $file = FILES_DIR . '/' . $data['name']; if (file_exists($file)) { if (@!chmod($file, octdec($data['mode']))) Flash::set('error', __('Permission denied!')); } else { Flash::set('error', __('File or directory not found!')); } $path = substr($data['name'], 0, strrpos($data['name'], '/')); redirect(get_url('plugin/file_manager/browse/' . $path)); }
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
$db->updateObject($value, 'section'); } $db->updateObject($moveSec, 'section'); //handle re-ranking of previous parent $oldSiblings = $db->selectObjects("section", "parent=" . $oldParent . " AND rank>" . $oldRank . " ORDER BY rank"); $rerank = 1; foreach ($oldSiblings as $value) { if ($value->id != $moveSec->id) { $value->rank = $rerank; $db->updateObject($value, 'section'); $rerank++; } } if ($oldParent != $moveSec->parent) { //we need to re-rank the children of the parent that the moving section has just left $childOfLastMove = $db->selectObjects("section", "parent=" . $oldParent . " ORDER BY rank"); for ($i = 0, $iMax = count($childOfLastMove); $i < $iMax; $i++) { $childOfLastMove[$i]->rank = $i; $db->updateObject($childOfLastMove[$i], 'section'); } } } } self::checkForSectionalAdmins($move); expSession::clearAllUsersSessionCache('navigation'); }
1
PHP
CWE-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 userAuth() { $user = new User(); $nick = $this->request->request->get('fsNick', ''); if ($nick === '') { return $this->cookieAuth($user); } if ($user->loadFromCode($nick) && $user->enabled) { if ($user->verifyPassword($this->request->request->get('fsPassword'))) { // Execute actions from User model extensions $user->pipe('login'); $this->updateCookies($user, true); ToolBox::ipFilter()->clear(); ToolBox::i18nLog()->debug('login-ok', ['%nick%' => $user->nick]); ToolBox::log()::setContext('nick', $user->nick); return $user; } $this->ipWarning(); ToolBox::i18nLog()->warning('login-password-fail'); return false; } $this->ipWarning(); ToolBox::i18nLog()->warning('login-user-not-found', ['%nick%' => $nick]); return false; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function showByModel() { global $order, $template, $db; expHistory::set('viewable', $this->params); $product = new product(); $model = $product->find("first", 'model="' . expString::escape($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 )); }
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
foreach ($data['alertDanger'] as $alert) { # code... echo "<li>$alert</li>\n"; }
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 remove_old_unconfirmed_accounts() { global $DB; global $website; $ok = false; $DB->query(' SELECT ex.id FROM ( SELECT id, activation_key, SUBSTRING_INDEX(activation_key, "-", -1) AS expiration_time FROM nv_webusers WHERE website = ' . protect($website->id) . ' AND access = 1 AND activation_key != "" ) ex WHERE ex.activation_key <> ex.expiration_time AND '.time().' > ex.expiration_time '); $rs = $DB->result('id'); if(!empty($rs)) { $ok = $DB->execute(' DELETE FROM nv_webusers wu WHERE wu.id IN ('.implode(",", $rs).') '); } if($ok) return count($rs); else return 0; }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
function selectBillingOptions() { }
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 buildControl() { $control = new colorcontrol(); if (!empty($this->params['value'])) $control->value = $this->params['value']; if ($this->params['value'][0] != '#') $this->params['value'] = '#' . $this->params['value']; $control->default = $this->params['value']; if (!empty($this->params['hide'])) $control->hide = $this->params['hide']; if (isset($this->params['flip'])) $control->flip = $this->params['flip']; $this->params['name'] = !empty($this->params['name']) ? $this->params['name'] : ''; $control->name = $this->params['name']; $this->params['id'] = !empty($this->params['id']) ? $this->params['id'] : ''; $control->id = isset($this->params['id']) && $this->params['id'] != "" ? $this->params['id'] : ""; //echo $control->id; if (empty($control->id)) $control->id = $this->params['name']; if (empty($control->name)) $control->name = $this->params['id']; // attempt to translate the label if (!empty($this->params['label'])) { $this->params['label'] = gt($this->params['label']); } else { $this->params['label'] = null; } echo $control->toHTML($this->params['label'], $this->params['name']); // $ar = new expAjaxReply(200, gt('The control was created'), json_encode(array('data'=>$code))); // $ar->send(); }
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 get_allowed_files_extensions_for_upload($fileTypes = 'images') { $are_allowed = ''; switch ($fileTypes) { case 'img': case 'image': case 'images': $are_allowed .= ',png,gif,jpg,jpeg,tiff,bmp,svg'; break; case 'video': case 'videos': $are_allowed .= ',avi,asf,mpg,mpeg,mp4,flv,mkv,webm,ogg,wma,mov,wmv'; break; case 'file': case 'files': $are_allowed .= ',doc,docx,pdf,html,js,css,htm,rtf,txt,zip,gzip,rar,cad,xml,psd,xlsx,csv,7z'; break; case 'documents': case 'doc': $are_allowed .= ',doc,docx,pdf,log,msg,odt,pages,rtf,tex,txt,wpd,wps,pps,ppt,pptx,xml,htm,html,xlr,xls,xlsx'; break; case 'archives': case 'arc': case 'arch': $are_allowed .= ',zip,zipx,gzip,rar,gz,7z,cbr,tar.gz'; break; case 'all': $are_allowed .= ',*'; break; case '*': $are_allowed .= ',*'; break; default: $are_allowed .= ',' . $fileTypes; } if($are_allowed){ $are_allowed = explode(',',$are_allowed); array_unique($are_allowed); $are_allowed = array_filter($are_allowed); $are_allowed = implode(',', $are_allowed); } return $are_allowed; }
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 convertUTF($string) { return $string = str_replace('?', '', htmlspecialchars($string, ENT_IGNORE, 'UTF-8')); }
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 validate($string, $config, $context) { $token = $context->get('CurrentToken', true); if (!$token || $token->name !== $this->tag) { return $this->withoutTag->validate($string, $config, $context); } else { return $this->withTag->validate($string, $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 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-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 _mergeAssocArray(&$a1, $a2) { foreach ($a2 as $k => $v) { if ($v === false) { if (isset($a1[$k])) unset($a1[$k]); continue; } $a1[$k] = $v; } }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
private static function title_case_upper($s) { return self::mb_convert_case($s[0], MB_CASE_UPPER, 'UTF-8'); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public function recipient($toaddr) { return $this->sendCommand( 'RCPT TO', 'RCPT TO:<' . $toaddr . '>', array(250, 251) ); }
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 scopeSearch(Builder $query, array $search = []) { if (empty($search)) { return $query; } if (!array_intersect(array_keys($search), $this->searchable)) { return $query; } return $query->where($search); }
0
PHP
CWE-287
Improper Authentication
When an actor claims to have a given identity, the software does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
vulnerable