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 testInvalidRequests($requestRange) { $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'))->setAutoEtag(); // prepare a request for a range of the testing file $request = Request::create('/'); $request->headers->set('Range', $requestRange); $response = clone $response; $response->prepare($request); $response->sendContent(); $this->assertEquals(416, $response->getStatusCode()); $this->assertEquals('bytes */35', $response->headers->get('Content-Range')); }
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 netmountPrepare($options) { if (!empty($_REQUEST['encoding']) && iconv('UTF-8', $_REQUEST['encoding'], '') !== false) { $options['encoding'] = $_REQUEST['encoding']; if (!empty($_REQUEST['locale']) && setlocale(LC_ALL, $_REQUEST['locale'])) { setlocale(LC_ALL, elFinder::$locale); $options['locale'] = $_REQUEST['locale']; } } $options['statOwner'] = true; $options['allowChmodReadOnly'] = true; return $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 getRecordTitle($id) { if (isset($this->faqRecord['id']) && ($this->faqRecord['id'] == $id)) { return $this->faqRecord['title']; } $question = ''; $query = sprintf( "SELECT thema AS question FROM %sfaqdata WHERE id = %d AND lang = '%s'", PMF_Db::getTablePrefix(), $id, $this->_config->getLanguage()->getLanguage() ); $result = $this->_config->getDb()->query($query); if ($this->_config->getDb()->numRows($result) > 0) { while ($row = $this->_config->getDb()->fetchObject($result)) { $question = $row->question; } } else { $question = $this->pmf_lang['no_cats']; } return $question; }
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 loadUserByUsername($username) { return $this->inner->loadUserByUsername($username); }
0
PHP
CWE-384
Session Fixation
Authenticating a user, or otherwise establishing a new user session, without invalidating any existing session identifier gives an attacker the opportunity to steal authenticated sessions.
https://cwe.mitre.org/data/definitions/384.html
vulnerable
static function isSearchable() { 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 get($type) { // determine if there is any extra info tacked on if (strpos($type, '#') !== false) list($type, $string) = explode('#', $type, 2); else $string = ''; if (!isset($this->info[$type])) { trigger_error('Cannot retrieve undefined attribute type ' . $type, E_USER_ERROR); return; } return $this->info[$type]->make($string); }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public function testSetActivePhp54() { $this->proxy->setActive(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
private static function getSubpart($pos, $part, $haystack, $encoding) { if (false === $pos) { return false; } if ($part) { return self::mb_substr($haystack, 0, $pos, $encoding); } return self::mb_substr($haystack, $pos, null, $encoding); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public static function type($id) { $id = sprintf('%d', $id); if(isset($id)){ $cat = Db::result("SELECT `type` FROM `cat` WHERE `id` = '{$id}' LIMIT 1"); //print_r($cat); if(isset($cat['error'])){ return ''; }else{ return $cat[0]->type; } }else{ echo "No ID Selected"; } //print_r($cat); }
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 stripClean($str) { return $this->stripTags($this->xssClean($str)); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public function __construct( AuthManager $auth, Repository $config, CacheRepository $cache, UserRepositoryInterface $repository, ViewFactory $view ) { parent::__construct($auth, $config); $this->view = $view; $this->cache = $cache; $this->repository = $repository; }
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
public function generateBaseDirectoryPath($config) { $base = $config->get('Cache.SerializerPath'); $base = is_null($base) ? HTMLPURIFIER_PREFIX . '/HTMLPurifier/DefinitionCache/Serializer' : $base; return $base; }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
} elseif (!empty($this->params['src'])) { if ($this->params['src'] == $loc->src) { $this->config = $config->config; break; } } }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
function phoromatic_error_page($title, $description) { echo phoromatic_webui_header(array(''), ''); $box = '<h1>' . $title . '</h1> <h2>' . $description . '</h2> <p>To fix this error, try <a onclick="javascript:window.history.back();">returning to the previous page</a>. Still having problems? Consider <a href="https://github.com/phoronix-test-suite/phoronix-test-suite/issues?state=open">opening a GitHub issue report</a>; commercial support customers should contact Phoronix Media.</p><hr /><hr />'; echo phoromatic_webui_box($box); 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
foreach ($grpusers as $u) { $emails[$u->email] = trim(user::getUserAttribution($u->id)); }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
function XMLRPCremoveImageGroupFromComputerGroup($imageGroup, $computerGroup) { $imageid = getResourceGroupID("image/$imageGroup"); $compid = getResourceGroupID("computer/$computerGroup"); if($imageid && $compid) { $tmp = getUserResources(array("imageAdmin"), array("manageMapping"), 1); $imagegroups = $tmp['image']; $tmp = getUserResources(array("computerAdmin"), array("manageMapping"), 1); $computergroups = $tmp['computer']; if(array_key_exists($compid, $computergroups) && array_key_exists($imageid, $imagegroups)) { $mapping = getResourceMapping("image", "computer", $imageid, $compid); if(array_key_exists($imageid, $mapping) && in_array($compid, $mapping[$imageid])) { $query = "DELETE FROM resourcemap " . "WHERE resourcegroupid1 = $imageid AND " . "resourcetypeid1 = 13 AND " . "resourcegroupid2 = $compid AND " . "resourcetypeid2 = 12"; doQuery($query, 101); } return array('status' => 'success'); } else { return array('status' => 'error', 'errorcode' => 84, 'errormsg' => 'cannot access computer and/or image group'); } } else { return array('status' => 'error', 'errorcode' => 83, 'errormsg' => 'invalid resource group name'); } }
1
PHP
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
public function confirm() { $project = $this->getProject(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); $this->response->html($this->template->render('project_tag/remove', array( 'tag' => $tag, 'project' => $project, ))); }
0
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
private function _createdby( $option ) { $this->addTable( 'revision', 'creation_rev' ); $this->addTable( 'revision_actor_temp', 'creation_rev_actor' ); $this->_adduser( null, 'creation_rev_actor' ); $user = new \User; $this->addWhere( [ $this->DB->addQuotes( $user->newFromName( $option )->getActorId() ) . ' = creation_rev_actor.revactor_actor', 'creation_rev_actor.revactor_page = page_id', 'creation_rev.rev_parent_id = 0' ] ); }
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 deleteFileInStorage(Attachment $attachment) { $storage = $this->getStorage(); $dirPath = dirname($attachment->path); $storage->delete($attachment->path); if (count($storage->allFiles($dirPath)) === 0) { $storage->deleteDirectory($dirPath); } }
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 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
public function Quit($close_on_error = true) { $this->error = null; // so there is no confusion if(!$this->connected()) { $this->error = array( "error" => "Called Quit() without being connected"); return false; } // send the quit command to the server fputs($this->smtp_conn,"quit" . $this->CRLF); // get any good-bye messages $byemsg = $this->get_lines(); if($this->do_debug >= 2) { $this->edebug("SMTP -> FROM SERVER:" . $byemsg . $this->CRLF . '<br />'); } $rval = true; $e = null; $code = substr($byemsg,0,3); if($code != 221) { // use e as a tmp var cause Close will overwrite $this->error $e = array("error" => "SMTP server rejected quit command", "smtp_code" => $code, "smtp_rply" => substr($byemsg,4)); $rval = false; if($this->do_debug >= 1) { $this->edebug("SMTP -> ERROR: " . $e["error"] . ": " . $byemsg . $this->CRLF . '<br />'); } } if(empty($e) || $close_on_error) { $this->Close(); } return $rval; }
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 transfer(RequestInterface $request, array $options) { // save_to -> sink if (isset($options['save_to'])) { $options['sink'] = $options['save_to']; unset($options['save_to']); } // exceptions -> http_errors if (isset($options['exceptions'])) { $options['http_errors'] = $options['exceptions']; unset($options['exceptions']); } $request = $this->applyOptions($request, $options); $handler = $options['handler']; try { return Promise\promise_for($handler($request, $options)); } catch (\Exception $e) { return Promise\rejection_for($e); } }
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 edit_vendor() { $vendor = new vendor(); if(isset($this->params['id'])) { $vendor = $vendor->find('first', 'id =' .$this->params['id']); assign_to_template(array( '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
$product = X2Model::model('Products')->findByAttributes(array('name'=>$lineItem->name)); if (isset($product)) $lineItem->productId = $product->id; if(empty($lineItem->currency)) $lineItem->currency = $defaultCurrency; if($lineItem->isPercentAdjustment) { $lineItem->adjustment = Fields::strToNumeric( $lineItem->adjustment,'percentage'); } else { $lineItem->adjustment = Fields::strToNumeric( $lineItem->adjustment,'currency',$curSym); } $lineItem->price = Fields::strToNumeric($lineItem->price,'currency',$curSym); $lineItem->total = Fields::strToNumeric($lineItem->total,'currency',$curSym); }
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 __get($var) { switch ($var) { case 'configuration_array': $this->configuration_array = array(); if ($this->configuration != ''){ $jsonData = json_decode($this->configuration,true); if ($jsonData !== null) { $this->configuration_array = $jsonData; } else { $this->configuration_array = array(); } } return $this->configuration_array; break; case 'name_support': return $this->name_support = $this->nick; break; case 'has_photo': return $this->filename != ''; break; case 'photo_path': $this->photo_path = ($this->filepath != '' ? '//' . $_SERVER['HTTP_HOST'] . erLhcoreClassSystem::instance()->wwwDir() : erLhcoreClassSystem::instance()->wwwImagesDir() ) .'/'. $this->filepath . $this->filename; return $this->photo_path; break; case 'file_path_server': return $this->filepath . $this->filename; break; default: break; } }
0
PHP
CWE-116
Improper Encoding or Escaping of Output
The software prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. As a result, the intended structure of the message is not preserved.
https://cwe.mitre.org/data/definitions/116.html
vulnerable
function teampass_whitelist() { $bdd = teampass_connect(); $apiip_pool = teampass_get_ips(); if (count($apiip_pool) > 0 && !array_search($_SERVER['REMOTE_ADDR'], $apiip_pool)) { rest_error('IPWHITELIST'); } }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
protected function checkMaintenanceMode() { if (Yii::$app->settings->get('maintenanceMode')) { if (!Yii::$app->user->isGuest) { Yii::$app->user->logout(); Yii::$app->getView()->warn(Yii::t('error', 'Maintenance mode activated: You have been automatically logged out and will no longer have access the platform until the maintenance has been completed.')); } return Yii::$app->getResponse()->redirect(['/user/auth/login']); } }
0
PHP
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
public function validateRequest(App\Request $request) { $request->validateReadAccess(); }
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 url() { return Site::$url.'/inc/lib/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
$this->Attribute->save($attribute); } return true; }
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
private function getCategory() { $category = $this->categoryModel->getById($this->request->getIntegerParam('category_id')); if (empty($category)) { throw new PageNotFoundException(); } return $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 setTracks($value) { return $this->setParameter('tracks', $value); }
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 enable() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->enable($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane updated successfully.')); } else { $this->flash->failure(t('Unable to update this swimlane.')); } $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); }
0
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
public function load($id) { try { $select = $this->zdb->select($this->table); $select->where($this->fpk . ' = ' . $id); $results = $this->zdb->execute($select); if ($results->count() > 0) { $result = $results->current(); $this->loadFromRS($result); return true; } else { Analog::log( 'Unknown ID ' . $id, Analog::ERROR ); return false; } } catch (Throwable $e) { Analog::log( 'Cannot load ' . $this->getType() . ' from id `' . $id . '` | ' . $e->getMessage(), Analog::WARNING ); throw $e; } }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public function edit(Request $request, $id) { return $this->view('product::admin.product.edit', [ 'content_id'=>$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
public function testRenderWithTrustedHeaderDisabled() { Request::setTrustedHeaderName(Request::HEADER_CLIENT_IP, ''); $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest(Request::create('/'))); $this->assertSame('foo', $strategy->render('/', Request::create('/'))->getContent()); }
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 _getHtmlHeaderColumn($title, $name, $pageName, $entityIds, $listorder, $orderdirection, $showColumn = true) { $str = ''; $entity = htmlspecialchars(_getEntityString($entityIds), ENT_QUOTES); $pageName = htmlspecialchars($pageName, ENT_QUOTES); if ($listorder == $name) { if (($orderdirection == '') || ($orderdirection == 'down')) { $str = "<a href='$pageName?{$entity}orderdirection=up'><img src='" . OX::assetPath() . "/images/caret-ds.gif' border='0' alt='' title=''></a>"; } else { $str = "<a href='$pageName?{$entity}orderdirection=down'><img src='" . OX::assetPath() . "/images/caret-u.gif' border='0' alt='' title=''></a>"; } } return $showColumn ? "<b><a href='$pageName?{$entity}listorder=".urlencode($name)."'>$title</a>$str</b>" : ''; }
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 render($ns, $directive, $value, $name, $config) { if (is_array($config) && isset($config[0])) { $gen_config = $config[0]; $config = $config[1]; } else { $gen_config = $config; } $this->prepareGenerator($gen_config); $ret = ''; $ret .= $this->start('label', array('for' => "$name:Null_$ns.$directive")); $ret .= $this->element('span', "$ns.$directive:", array('class' => 'verbose')); $ret .= $this->text(' Null/Disabled'); $ret .= $this->end('label'); $attr = array( 'type' => 'checkbox', 'value' => '1', 'class' => 'null-toggle', 'name' => "$name"."[Null_$ns.$directive]", 'id' => "$name:Null_$ns.$directive", 'onclick' => "toggleWriteability('$name:$ns.$directive',checked)" // INLINE JAVASCRIPT!!!! ); if ($this->obj instanceof HTMLPurifier_Printer_ConfigForm_bool) { // modify inline javascript slightly $attr['onclick'] = "toggleWriteability('$name:Yes_$ns.$directive',checked);toggleWriteability('$name:No_$ns.$directive',checked)"; } if ($value === null) $attr['checked'] = 'checked'; $ret .= $this->elementEmpty('input', $attr); $ret .= $this->text(' or '); $ret .= $this->elementEmpty('br'); $ret .= $this->obj->render($ns, $directive, $value, $name, array($gen_config, $config)); return $ret; }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
function delete_option_master() { global $db; $masteroption = new option_master($this->params['id']); // delete any implementations of this option master $db->delete('option', 'option_master_id='.$masteroption->id); $masteroption->delete('optiongroup_master_id=' . $masteroption->optiongroup_master_id); //eDebug($masteroption); expHistory::back(); }
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 getDisplayName ($plural=true) { return Yii::t('calendar', 'Calendar'); }
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
$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='".$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, )); }
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 rules() { $rules = [ 'password'=>'max:500', 'first_name'=>'max:500', 'last_name'=>'max:500', 'phone'=>'max:500', 'username' => 'required|unique:users,username|max:500', 'email' => 'unique:users,email|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
public static function rss() { switch (SMART_URL) { case true: # code... $url = Options::get('siteurl')."/rss".GX_URL_PREFIX; break; default: # code... $url = Options::get('siteurl')."/index.php?rss"; break; } return $url; }
0
PHP
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
vulnerable
function edit() { if (empty($this->params['content_id'])) { flash('message',gt('An error occurred: No content id set.')); expHistory::back(); } /* The global constants can be overridden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet // $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login']; // $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval']; // $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification']; // $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email']; $id = empty($this->params['id']) ? null : $this->params['id']; $comment = new expComment($id); //FIXME here is where we might sanitize the comment before displaying/editing it assign_to_template(array( 'content_id'=>$this->params['content_id'], 'content_type'=>$this->params['content_type'], 'comment'=>$comment )); }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
function delete_vendor() { global $db; if (!empty($this->params['id'])){ $db->delete('vendor', 'id =' .$this->params['id']); } 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 db_properties($table) { global $DatabaseType, $DatabaseUsername; switch ($DatabaseType) { case 'mysqli': $result = DBQuery("SHOW COLUMNS FROM $table"); while ($row = db_fetch_row($result)) { $properties[strtoupper($row['FIELD'])]['TYPE'] = strtoupper($row['TYPE'], strpos($row['TYPE'], '(')); if (!$pos = strpos($row['TYPE'], ',')) $pos = strpos($row['TYPE'], ')'); else $properties[strtoupper($row['FIELD'])]['SCALE'] = substr($row['TYPE'], $pos + 1); $properties[strtoupper($row['FIELD'])]['SIZE'] = substr($row['TYPE'], strpos($row['TYPE'], '(') + 1, $pos); if ($row['NULL'] != '') $properties[strtoupper($row['FIELD'])]['NULL'] = "Y"; else $properties[strtoupper($row['FIELD'])]['NULL'] = "N"; } break; } return $properties; }
0
PHP
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
vulnerable
protected function setError($message, $detail = '', $smtp_code = '', $smtp_code_ex = '') { $this->error = array( 'error' => $message, 'detail' => $detail, 'smtp_code' => $smtp_code, 'smtp_code_ex' => $smtp_code_ex ); }
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 _makeMpName($value) { if ($value != '') { $get_name = DBGet(DBQuery('SELECT TITLE FROM marking_periods WHERE marking_period_id=' . $value)); return $get_name[1]['TITLE']; } else return ''._customCoursePeriod.''; }
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 countFilesInFolder(Folder $folder, $useFilters = true, $recursive = false) { $this->assureFolderReadPermission($folder); $filters = $useFilters ? $this->fileAndFolderNameFilters : []; return $this->driver->countFilesInFolder($folder->getIdentifier(), $recursive, $filters); }
0
PHP
CWE-319
Cleartext Transmission of Sensitive Information
The software transmits sensitive or security-critical data in cleartext in a communication channel that can be sniffed by unauthorized actors.
https://cwe.mitre.org/data/definitions/319.html
vulnerable
$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-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function updateObject($object, $table, $where=null, $identifier='id', $is_revisioned=false) { if ($is_revisioned) { $object->revision_id++; //if ($table=="text") eDebug($object); $res = $this->insertObject($object, $table); //if ($table=="text") eDebug($object,true); $this->trim_revisions($table, $object->$identifier, WORKFLOW_REVISION_LIMIT); return $res; } $sql = "UPDATE " . $this->prefix . "$table SET "; foreach (get_object_vars($object) as $var => $val) { //We do not want to save any fields that start with an '_' //if($is_revisioned && $var=='revision_id') $val++; if ($var{0} != '_') { if (is_array($val) || is_object($val)) { $val = serialize($val); $sql .= "`$var`='".$val."',"; } else { $sql .= "`$var`='" . $this->escapeString($val) . "',"; } } } $sql = substr($sql, 0, -1) . " WHERE "; if ($where != null) $sql .= $this->injectProof($where); else $sql .= "`" . $identifier . "`=" . $object->$identifier; //if ($table == 'text') eDebug($sql,true); $res = (@mysqli_query($this->connection, $sql) != false); return $res; }
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 section($nodes, $id, $filters, $start, $end, $otag, $ctag, $level) { $source = var_export(substr($this->source, $start, $end - $start), true); $callable = $this->getCallable(); if ($otag !== '{{' || $ctag !== '}}') { $delimTag = var_export(sprintf('{{= %s %s =}}', $otag, $ctag), true); $helper = sprintf('$this->lambdaHelper->withDelimiters(%s)', $delimTag); $delims = ', ' . $delimTag; } else { $helper = '$this->lambdaHelper'; $delims = ''; } $key = ucfirst(md5($delims . "\n" . $source)); if (!isset($this->sections[$key])) { $this->sections[$key] = sprintf($this->prepare(self::SECTION), $key, $callable, $source, $helper, $delims, $this->walk($nodes, 2)); } $method = $this->getFindMethod($id); $id = var_export($id, true); $filters = $this->getFilters($filters, $level); return sprintf($this->prepare(self::SECTION_CALL, $level), $id, $method, $id, $filters, $key); }
0
PHP
CWE-1336
Improper Neutralization of Special Elements Used in a Template Engine
The product uses a template engine to insert or process externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements or syntax that can be interpreted as template expressions or other code directives when processed by the engine.
https://cwe.mitre.org/data/definitions/1336.html
vulnerable
public function testPortPassedAsStringIsCastedToInt() { $uri = (new Uri('//example.com'))->withPort('8080'); $this->assertSame(8080, $uri->getPort(), 'Port is returned as integer'); $this->assertSame('example.com:8080', $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 remove() { $this->checkCSRFParam(); $project = $this->getProject(); $filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id')); $this->checkPermission($project, $filter); if ($this->customFilterModel->remove($filter['id'])) { $this->flash->success(t('Custom filter removed successfully.')); } else { $this->flash->failure(t('Unable to remove this custom filter.')); } $this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id']))); }
0
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
public function getHtmlForControlButtons() { $ret = ''; $cfgRelation = PMA_getRelationsParam(); if ($cfgRelation['navwork']) { $db = $this->realParent()->real_name; $item = $this->real_name; $ret = '<span class="navItemControls">' . '<a href="navigation.php?' . PMA_URL_getCommon() . '&hideNavItem=true' . '&itemType=' . urldecode($this->getItemType()) . '&itemName=' . urldecode($item) . '&dbName=' . urldecode($db) . '"' . ' class="hideNavItem ajax">' . PMA_Util::getImage('lightbulb_off.png', __('Hide')) . '</a></span>'; } return $ret; }
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 manage() { expHistory::set('viewable', $this->params); // $category = new storeCategory(); // $categories = $category->getFullTree(); // // // foreach($categories as $i=>$val){ // // if (!empty($this->values) && in_array($val->id,$this->values)) { // // $this->tags[$i]->value = true; // // } else { // // $this->tags[$i]->value = false; // // } // // $this->tags[$i]->draggable = $this->draggable; // // $this->tags[$i]->checkable = $this->checkable; // // } // // $obj = json_encode($categories); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public function setUseOption($option) { $this->useOption = $option; return $this; }
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 = null, array $options = []) { $options[RequestOptions::SYNCHRONOUS] = true; return $this->requestAsync($method, $uri, $options)->wait(); }
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 call($methodname, $args) { if (!$this->hasMethod($methodname)) { return new Error(-32601, 'server error. requested method ' . $methodname . ' does not exist.'); } $method = $this->callbacks[$methodname]; // Perform the callback and send the response if (count($args) == 1) { // If only one paramater just send that instead of the whole array $args = $args[0]; } // Are we dealing with a function or a method? if (is_string($method) && substr($method, 0, 5) == 'this:') { // It's a class method - check it exists $method = substr($method, 5); if (!method_exists($this, $method)) { return new Error(-32601, 'server error. requested class method "' . $method . '" does not exist.'); } //Call the method $result = $this->$method($args); } else { // It's a function - does it exist? if (is_array($method)) { if (!is_callable([$method[0], $method[1]])) { return new Error(-32601, 'server error. requested object method "' . $method[1] . '" does not exist.'); } } else { if (!function_exists($method)) { return new Error(-32601, 'server error. requested function "' . $method . '" does not exist.'); } } // Call the function $result = call_user_func($method, $args); } return $result; }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
private function edebug($str) { if ($this->Debugoutput == "error_log") { error_log($str); } else { echo $str; } }
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 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') { if (preg_match('/"/',trim($out))) $out=''; else if (preg_match('/(\.\.\/)+/',trim($out))) $out=''; } } return $out; }
1
PHP
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
safe
$p = $vars['paging']-(ceil($maxpage/2)-1); $limit = $curr+ceil($maxpage/2)-1; // echo "more maxpage"; }else{ $p = $vars['paging']-(ceil($maxpage/2)-1); $limit = $curr + floor($maxpage/2); } for ($i=$p ; $i <= $limit /*ceil($total/$vars['max'])+1*/ ; $i++ ) { # code... if($smart == true){ $url = $vars['url']."/paging/".$i; }else{ $url = $vars['url']."&paging=".$i; } if($vars['paging'] == $i){ $sel = "class=\"active\"";}else{$sel='';} $r .= "<li {$sel}><a href=\"{$url}\">$i</a></li>"; } $r .= "</ul>"; }elseif(isset($vars['type']) && $vars['type'] == 'pager'){ // PAGER
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 limit($value) { if ($value >= 0) { $this->limit = $value; } return $this; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
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-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 accessToItemIsGranted($item_id) { // Load item data $data = DB::queryFirstRow( "SELECT id_tree FROM ".prefix_table("items")." WHERE id = %i", $item_id ); // Check if user can access this folder if (!in_array($data['id'], $_SESSION['groupes_visibles'])) { return "ERR_FOLDER_NOT_ALLOWED"; } 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
foreach ($data['alertred'] as $alert) { # code... echo "<li>$alert</li>\n"; }
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
self::$instance = new HTMLPurifier($prototype); } else { self::$instance = new HTMLPurifier(); } } return self::$instance; }
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 insertCommandCategorieInDB(){ global $pearDB; if (testCommandCategorieExistence($_POST["category_name"])){ $DBRESULT = $pearDB->query("INSERT INTO `command_categories` (`category_name` , `category_alias`, `category_order`) VALUES ('".$_POST["category_name"]."', '".$_POST["category_alias"]."', '1')"); } }
0
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
vulnerable
public function setFrom($address, $name = '', $auto = true) { $address = trim($address); $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim if (!$this->validateAddress($address)) { $this->setError($this->lang('invalid_address') . ': ' . $address); $this->edebug($this->lang('invalid_address') . ': ' . $address); if ($this->exceptions) { throw new phpmailerException($this->lang('invalid_address') . ': ' . $address); } return false; } $this->From = $address; $this->FromName = $name; if ($auto) { if (empty($this->Sender)) { $this->Sender = $address; } } return true; }
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 save() { $project = $this->getProject(); $values = $this->request->getValues(); list($valid, $errors) = $this->categoryValidator->validateCreation($values); if ($valid) { if ($this->categoryModel->create($values) !== false) { $this->flash->success(t('Your category have been created successfully.')); $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])), true); return; } else { $errors = array('name' => array(t('Another category with the same name exists in this project'))); } } $this->create($values, $errors); }
0
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
public function saveUpdatedUpload(UploadedFile $uploadedFile, Attachment $attachment) { if (!$attachment->external) { $this->deleteFileInStorage($attachment); } $attachmentName = $uploadedFile->getClientOriginalName(); $attachmentPath = $this->putFileInStorage($uploadedFile); $attachment->name = $attachmentName; $attachment->path = $attachmentPath; $attachment->external = false; $attachment->extension = $uploadedFile->getClientOriginalExtension(); $attachment->save(); return $attachment; }
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
new HTMLPurifier_Token_Text( $gen->generateFromToken($token) ); } else {
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(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); if ($tag['project_id'] != $project['id']) { throw new AccessForbiddenException(); } if ($this->tagModel->remove($tag_id)) { $this->flash->success(t('Tag removed successfully.')); } else { $this->flash->failure(t('Unable to remove this tag.')); } $this->response->redirect($this->helper->url->to('ProjectTagController', '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 index() { System::gZip(); Control::handler('frontend'); System::Zipped(); }
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 remove() { $project = $this->getProject(); $this->checkCSRFParam(); $column_id = $this->request->getIntegerParam('column_id'); if ($this->columnModel->remove($column_id)) { $this->flash->success(t('Column removed successfully.')); } else { $this->flash->failure(t('Unable to remove this column.')); } $this->response->redirect($this->helper->url->to('ColumnController', '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
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
foreach ($days as $value) { $regitem[] = $value; }
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 static function getParent($id){ $q = self::getId($id); return $q[0]->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
$args['name'][$i] = $this->normalize($name, $opts); } } else { $args['name'] = $this->normalize($args['name'], $opts); } } 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 getEscapeChar() { return $this->escapeChar; }
1
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
safe
function manage() { global $db, $router, $user; expHistory::set('manageable', $router->params); assign_to_template(array( 'canManageStandalones' => self::canManageStandalones(), 'sasections' => $db->selectObjects('section', 'parent=-1'), 'user' => $user, // 'canManagePagesets' => $user->isAdmin(), // 'templates' => $db->selectObjects('section_template', 'parent=0'), )); }
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 remove() { $this->checkCSRFParam(); $project = $this->getProject(); $action = $this->getAction($project); if (! empty($action) && $this->actionModel->remove($action['id'])) { $this->flash->success(t('Action removed successfully.')); } else { $this->flash->failure(t('Unable to remove this action.')); } $this->response->redirect($this->helper->url->to('ActionController', 'index', array('project_id' => $project['id']))); }
1
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
safe
public static function insert($vars){ if(is_array($vars)){ $sql = array( 'table' => 'menus', 'key' => $vars ); $menu = Db::insert($sql); } }
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 remove() { $this->checkCSRFParam(); $project = $this->getProject(); $action = $this->actionModel->getById($this->request->getIntegerParam('action_id')); if (! empty($action) && $this->actionModel->remove($action['id'])) { $this->flash->success(t('Action removed successfully.')); } else { $this->flash->failure(t('Unable to remove this action.')); } $this->response->redirect($this->helper->url->to('ActionController', '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 rss() { switch (SMART_URL) { case true: # code... $url = Site::$url."/rss".GX_URL_PREFIX; break; default: # code... $url = Site::$url."/index.php?rss"; break; } return $url; }
1
PHP
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
safe
function edit_section() { global $db, $user; $parent = new section($this->params['parent']); if (empty($parent->id)) $parent->id = 0; assign_to_template(array( 'haveStandalone' => ($db->countObjects('section', 'parent=-1') && $parent->id >= 0), 'parent' => $parent, 'isAdministrator' => $user->isAdmin(), )); }
0
PHP
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/74.html
vulnerable
private static function listFilesInDirectory($dir, $omitSymlinks, $prefix = '') { if (!is_dir($dir)) { return false; } $excludes = array(".",".."); $result = array(); $files = self::localScandir($dir); if(!$files) { return array(); } foreach($files as $file) { if(!in_array($file, $excludes)) { $path = $dir.DIRECTORY_SEPARATOR.$file; if(is_link($path)) { if($omitSymlinks) { continue; } else { $result[] = $prefix.$file; } } else if(is_dir($path)) { $result[] = $prefix.$file.DIRECTORY_SEPARATOR; $subs = elFinderVolumeFTP::listFilesInDirectory($path, $omitSymlinks, $prefix.$file.DIRECTORY_SEPARATOR); if($subs) { $result = array_merge($result, $subs); } } else { $result[] = $prefix.$file; } } } return $result; }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
spl_autoload_unregister($func); } spl_autoload_register($autoload); foreach ($funcs as $func) spl_autoload_register($func); } } }
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 XMLRPCremoveImageFromGroup($name, $imageid) { if($groupid = getResourceGroupID("image/$name")) { $groups = getUserResources(array("imageAdmin"), array("manageGroup"), 1); if(! array_key_exists($groupid, $groups['image'])) { return array('status' => 'error', 'errorcode' => 46, 'errormsg' => 'Unable to access image group'); } $resources = getUserResources(array("imageAdmin"), array("manageGroup")); if(! array_key_exists($imageid, $resources['image'])) { return array('status' => 'error', 'errorcode' => 47, 'errormsg' => 'Unable to access image'); } $allimages = getImages(0, $imageid); $query = "DELETE FROM resourcegroupmembers " . "WHERE resourceid = {$allimages[$imageid]['resourceid']} AND " . "resourcegroupid = $groupid"; doQuery($query); return array('status' => 'success'); } else { return array('status' => 'error', 'errorcode' => 83, 'errormsg' => 'invalid resource group name'); } }
1
PHP
CWE-264
Permissions, Privileges, and Access Controls
Weaknesses in this category are related to the management of permissions, privileges, and other security features that are used to perform access control.
https://cwe.mitre.org/data/definitions/264.html
safe
function searchByModelForm() { // get the search terms $terms = expString::escape($this->params['search_string']); $sql = "model like '%" . $terms . "%'"; $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10; $page = new expPaginator(array( 'model' => 'product', 'where' => $sql, 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit, 'order' => 'title', 'dir' => 'DESC', 'page' => (isset($this->params['page']) ? $this->params['page'] : 1), 'controller' => $this->params['controller'], 'action' => $this->params['action'], 'columns' => array( gt('Model #') => 'model', gt('Product Name') => 'title', gt('Price') => 'base_price' ), )); assign_to_template(array( 'page' => $page, 'terms' => $terms )); }
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 testGetConnection() { $method = new \ReflectionMethod($this->storage, 'getMongo'); $method->setAccessible(true); if (phpversion('mongodb')) { $mongoClass = 'MongoDB\Client'; } else { $mongoClass = version_compare(phpversion('mongo'), '1.3.0', '<') ? 'Mongo' : 'MongoClient'; } $this->assertInstanceOf($mongoClass, $method->invoke($this->storage)); }
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
$emails[$u->email] = trim(user::getUserAttribution($u->id)); }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public function rules() { return [ 'sku' => ['required'], 'name' => ['required', Rule::unique('products')->ignore($this->segment(3))], 'quantity' => ['required', 'integer', 'min:0'], 'price' => ['required', 'numeric', 'min:0'], 'sale_price' => ['nullable', 'numeric'], 'weight' => ['nullable', 'numeric', 'min:0'] ]; }
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 checkPermissions($permission,$location) { global $exponent_permissions_r, $router; // only applies to the 'manage' method if (empty($location->src) && empty($location->int) && ((!empty($router->params['action']) && $router->params['action'] == 'manage') || strpos($router->current_url, 'action=manage') !== false)) { if (!empty($exponent_permissions_r['navigation'])) foreach ($exponent_permissions_r['navigation'] as $page) { foreach ($page as $pageperm) { if (!empty($pageperm['manage'])) 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
public function confirm() { $project = $this->getProject(); $swimlane = $this->getSwimlane(); $this->response->html($this->helper->layout->project('swimlane/remove', array( 'project' => $project, 'swimlane' => $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
$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-610
Externally Controlled Reference to a Resource in Another Sphere
The product uses an externally controlled name or reference that resolves to a resource that is outside of the intended control sphere.
https://cwe.mitre.org/data/definitions/610.html
safe
public function authenticate($website, $username, $password) { global $DB; global $events; $username = trim($username); $username = mb_strtolower($username); $A1 = md5($username.':'.APP_REALM.':'.$password); $website_check = ''; if($website > 0) $website_check = 'AND website = '.protect($website); if($DB->query('SELECT * FROM nv_webusers WHERE ( access = 0 OR (access = 2 AND (access_begin = 0 OR access_begin < '.time().') AND (access_end = 0 OR access_end > '.time().') ) ) '.$website_check.' AND LOWER(username) = '.protect($username)) ) { $data = $DB->result(); if(!empty($data)) { if($data[0]->password==$A1) { $this->load_from_resultset($data); // maybe this function is called without initializing $events if(method_exists($events, 'trigger')) { $events->trigger( 'webuser', 'sign_in', array( 'webuser' => $this, 'by' => 'authenticate' ) ); } return true; } } } 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 function addReplyTo($address, $name = '') { return $this->addAnAddress('Reply-To', $address, $name); }
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 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(); }
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 getTemplateHierarchyFlat($parent, $depth = 1) { global $db; $arr = array(); $kids = $db->selectObjects('section_template', 'parent=' . $parent, 'rank'); // $kids = expSorter::sort(array('array'=>$kids,'sortby'=>'rank', 'order'=>'ASC')); for ($i = 0, $iMax = count($kids); $i < $iMax; $i++) { $page = $kids[$i]; $page->depth = $depth; $page->first = ($i == 0 ? 1 : 0); $page->last = ($i == count($kids) - 1 ? 1 : 0); $arr[] = $page; $arr = array_merge($arr, self::getTemplateHierarchyFlat($page->id, $depth + 1)); } return $arr; }
1
PHP
CWE-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