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
function dashboard_panel_top_pages($params) { global $DB; global $website; $stats = &$params['statistics']; $navibars = &$params['navibars']; /* TOP PAGES */ $sql = ' SELECT i.views as page_views, i.id as id_item, i.category as id_category, p.views as path_views, p.path as path FROM nv_items i, nv_paths p WHERE i.website = '.protect($website->id).' AND i.template > 0 AND i.embedding = 0 AND p.website = '.protect($website->id).' AND p.type = "item" AND p.object_id = i.id UNION ALL SELECT s.views as page_views, NULL as id_item, s.id as id_category, p.views as path_views, p.path as path FROM nv_structure s, nv_paths p WHERE s.website = '.protect($website->id).' AND p.website = '.protect($website->id).' AND p.type = "structure" AND p.object_id = s.id ORDER BY path_views DESC LIMIT 10 '; $DB->query($sql, 'array'); $pages = $DB->result(); $pages_html = ''; $url = $website->protocol; if(!empty($website->subdomain)) $url .= $website->subdomain.'.'; $url .= $website->domain; $url .= $website->folder; for($e = 0; $e < 10; $e++) { if(!$pages[$e]) break; $pages_html .= '<div class="navigate-panel-recent-comments-username ui-corner-all items-comment-status-public">'. '<a href="'.$url.$pages[$e]['path'].'" target="_blank">'. '<strong>'.$pages[$e]['path_views'].'</strong> <img align="absmiddle" src="img/icons/silk/bullet_star.png" align="absmiddle"> '.$pages[$e]['path']. '</a>'. '</div>'; } $navibars->add_tab_content_panel( '<img src="img/icons/silk/award_star_gold_3.png" align="absmiddle" /> '.t(296, 'Top pages'), $pages_html, 'navigate-panel-top-pages', '100%', '314px' ); }
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(protected Config $config, protected array $cspHeaderOptions = []) { $resolver = new OptionsResolver(); $this->configureOptions($resolver); $this->cspHeaderOptions = $resolver->resolve($cspHeaderOptions); }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
static function 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
function get_the_generator( $type = '' ) { if ( empty( $type ) ) { $current_filter = current_filter(); if ( empty( $current_filter ) ) { return; } switch ( $current_filter ) { case 'rss2_head': case 'commentsrss2_head': $type = 'rss2'; break; case 'rss_head': case 'opml_head': $type = 'comment'; break; case 'rdf_header': $type = 'rdf'; break; case 'atom_head': case 'comments_atom_head': case 'app_head': $type = 'atom'; break; } } switch ( $type ) { case 'html': $gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '">'; break; case 'xhtml': $gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '" />'; break; case 'atom': $gen = '<generator uri="https://wordpress.org/" version="' . get_bloginfo_rss( 'version' ) . '">WordPress</generator>'; break; case 'rss2': $gen = '<generator>https://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '</generator>'; break; case 'rdf': $gen = '<admin:generatorAgent rdf:resource="https://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '" />'; break; case 'comment': $gen = '<!-- generator="WordPress/' . get_bloginfo( 'version' ) . '" -->'; break; case 'export': $gen = '<!-- generator="WordPress/' . get_bloginfo_rss( 'version' ) . '" created="' . date( 'Y-m-d H:i' ) . '" -->'; break; } /** * Filters the HTML for the retrieved generator type. * * The dynamic portion of the hook name, `$type`, refers to the generator type. * * @since 2.5.0 * * @param string $gen The HTML markup output to wp_head(). * @param string $type The type of generator. Accepts 'html', 'xhtml', 'atom', * 'rss2', 'rdf', 'comment', 'export'. */ return apply_filters( "get_the_generator_{$type}", $gen, $type ); }
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 ($flatArray as $key => $value) { $pattern = '/' . $key . '([^.]|$)/'; if (preg_match($pattern, $expression, $matches)) { switch (gettype($flatArray[$key])) { case 'boolean': $expression = str_replace($key, $flatArray[$key] ? 'true' : 'false', $expression); break; case 'NULL': $expression = str_replace($key, 'false', $expression); break; case 'string': $expression = str_replace($key, '"' . $flatArray[$key] . '"', $expression); break; case 'object': $expression = self::executeClosure($expression, $key, $flatArray[$key], $flatArray); break; default: $expression = str_replace($key, $flatArray[$key], $expression); break; } $bool = eval("return $expression;"); } }
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 update_groupdiscounts() { global $db; if (empty($this->params['id'])) { // look for existing discounts for the same group $existing_id = $db->selectValue('groupdiscounts', 'id', 'group_id='.$this->params['group_id']); if (!empty($existing_id)) flashAndFlow('error',gt('There is already a discount for that group.')); } $gd = new groupdiscounts(); $gd->update($this->params); expHistory::back(); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public function setLoggerChannel($channel = 'Organizr', $username = null) { if ($this->hasDB()) { $setLogger = false; if ($username) { $username = htmlspecialchars($username); } if ($this->logger) { if ($channel) { if (strtolower($this->logger->getChannel()) !== strtolower($channel)) { $setLogger = true; } } if ($username) { if (strtolower($this->logger->getTraceId()) !== strtolower($channel)) { $setLogger = true; } } } else { $setLogger = true; } if ($setLogger) { $channel = $channel ?: 'Organizr'; return $this->setupLogger($channel, $username); } else { return $this->logger; } } }
0
PHP
CWE-434
Unrestricted Upload of File with Dangerous Type
The software allows the attacker to upload or transfer files of dangerous types that can be automatically processed within the product's environment.
https://cwe.mitre.org/data/definitions/434.html
vulnerable
protected function _mkdir($path, $name) { $path = $this->_joinPath($path, $name); if ($this->connect->mkdir($path) === false) { return false; } $this->options['dirMode'] && $this->connect->chmod($this->options['dirMode'], $path); return $path; }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
public function testOpportunitiesPages () { $this->visitPages ($this->getPages ('^opportunities')); }
1
PHP
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
public static function create() { self::ridOld(); $length = "80"; $token = ""; $codeAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; $codeAlphabet.= "abcdefghijklmnopqrstuvwxyz"; $codeAlphabet.= "0123456789"; $codeAlphabet.= SECURITY; for($i=0;$i<$length;$i++){ $token .= $codeAlphabet[Typo::crypto_rand_secure(0,strlen($codeAlphabet))]; } $url = $_SERVER['REQUEST_URI']; $url = htmlspecialchars($url, ENT_QUOTES, 'UTF-8'); $ip = $_SERVER['REMOTE_ADDR']; $time = time(); define('TOKEN', $token); define('TOKEN_URL', $url); define('TOKEN_IP', $ip); define('TOKEN_TIME', $time); $json = self::json(); Options::update('tokens',$json); return $token; }
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
$contents[] = ['class' => 'text-center', 'text' => tep_draw_bootstrap_button(IMAGE_SAVE, 'fas fa-save', null, null, null, 'btn-success xxx text-white mr-2') . tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-times', tep_href_link('tax_classes.php', 'page=' . $_GET['page']), null, null, 'btn-light')];
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 XMLRPCaddResourceGroupPriv($name, $type, $nodeid, $permissions) { return _XMLRPCchangeResourceGroupPriv_sub('add', $name, $type, $nodeid, $permissions); }
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
self::rpc($p); //echo "'$p'<br>"; } } }
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($single, $max = 4) { $this->single = $single; $this->max = $max; }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public function __construct() { self::$_data = self::load(); }
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-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 footer() { $my_server = ClassRegistry::init('Server'); $cmd = $my_server->getPythonVersion() . ' ' . $this->__scripts_dir . $this->__script_name; if (!empty($this->__auth)) { $this->__request_object['auth'] = $this->__auth; } if ($this->__search){ return $this->__search_query($cmd); } return $this->__delete ? $this->__delete_query($cmd) : $this->__add_query($cmd); }
1
PHP
NVD-CWE-noinfo
null
null
null
safe
public function saveconfig() { if (!empty($this->params['aggregate']) || !empty($this->params['pull_rss'])) { if ($this->params['order'] == 'rank ASC') { expValidator::failAndReturnToForm(gt('User defined ranking is not allowed when aggregating or pull RSS data feeds.'), $this->params); } } parent::saveconfig(); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
static function isSearchable() { return true; }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
} elseif ($token instanceof HTMLPurifier_Token_End) { $nesting--; }
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 paramRules() { return array( 'title' => Yii::t('studio',$this->title), 'info' => Yii::t('studio',$this->info), 'modelRequired' => 'Contacts', 'options' => array( array( 'name'=>'listId', 'label'=>Yii::t('studio','List'), 'type'=>'link', 'linkType'=>'X2List', 'linkSource'=>Yii::app()->controller->createUrl( CActiveRecord::model('X2List')->autoCompleteSource, array ( 'static' => 1 ) ) ), )); }
1
PHP
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
public function addChild(Node $child) { array_push($this->children, $child); $child->setParent($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 upload() { // upload the file, but don't save the record yet... if ($this->params['resize'] != 'false') { $maxwidth = $this->params['max_width']; } else { $maxwidth = null; } $file = expFile::fileUpload('Filedata',false,false,null,null,$maxwidth); // since most likely this function will only get hit via flash in YUI Uploader // and since Flash can't pass cookies, we lose the knowledge of our $user // so we're passing the user's ID in as $_POST data. We then instantiate a new $user, // and then assign $user->id to $file->poster so we have an audit trail for the upload if (is_object($file)) { $resized = !empty($file->resized) ? true : false; $user = new user($this->params['usrid']); $file->poster = $user->id; $file->posted = $file->last_accessed = time(); $file->save(); if (!empty($this->params['cat'])) { $expcat = new expCat($this->params['cat']); $params['expCat'][0] = $expcat->id; $file->update($params); } // a echo so YUI Uploader is notified of the function's completion if ($resized) { echo gt('File resized and then saved'); } else { echo gt('File saved'); } } else { echo gt('File was NOT uploaded!'); // flash('error',gt('File was not uploaded!')); } }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public static function inherit(HTMLPurifier_Config $config) { return new HTMLPurifier_Config($config->def, $config->plist); }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public function thumbnailTreeAction() { $this->checkPermission('thumbnails'); $thumbnails = []; $list = new Asset\Image\Thumbnail\Config\Listing(); $groups = []; foreach ($list->getThumbnails() as $item) { if ($item->getGroup()) { if (empty($groups[$item->getGroup()])) { $groups[$item->getGroup()] = [ 'id' => 'group_' . $item->getName(), 'text' => $item->getGroup(), 'expandable' => true, 'leaf' => false, 'allowChildren' => true, 'iconCls' => 'pimcore_icon_folder', 'group' => $item->getGroup(), 'children' => [], ]; } $groups[$item->getGroup()]['children'][] = [ 'id' => $item->getName(), 'text' => $item->getName(), 'leaf' => true, 'iconCls' => 'pimcore_icon_thumbnails', 'cls' => 'pimcore_treenode_disabled', 'writeable' => $item->isWriteable(), ]; } else { $thumbnails[] = [ 'id' => $item->getName(), 'text' => $item->getName(), 'leaf' => true, 'iconCls' => 'pimcore_icon_thumbnails', 'cls' => 'pimcore_treenode_disabled', 'writeable' => $item->isWriteable(), ]; } } foreach ($groups as $group) { $thumbnails[] = $group; } return $this->adminJson($thumbnails); }
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 captureAuthorization() { //eDebug($this->params,true); $order = new order($this->params['id']); /*eDebug($this->params); //eDebug($order,true);*/ //eDebug($order,true); //$billing = new billing(); //eDebug($billing, true); //$billing->calculator = new $calcname($order->billingmethod[0]->billingcalculator_id); $calc = $order->billingmethod[0]->billingcalculator->calculator; $calc->config = $order->billingmethod[0]->billingcalculator->config; //$calc = new $calc- //eDebug($calc,true); if (!method_exists($calc, 'delayed_capture')) { flash('error', gt('The Billing Calculator does not support delayed capture')); expHistory::back(); } $result = $calc->delayed_capture($order->billingmethod[0], $this->params['capture_amt'], $order); if (empty($result->errorCode)) { flash('message', gt('The authorized payment was successfully captured')); expHistory::back(); } else { flash('error', gt('An error was encountered while capturing the authorized payment.') . '<br /><br />' . $result->message); 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 static function quoteValue($value) { if ($value instanceof QueryParam || $value instanceof QueryExpression) { //no quote for query parameters nor expressions $value = $value->getValue(); } else if ($value === null || $value === 'NULL' || $value === 'null') { $value = 'NULL'; } else if (!preg_match("/^`.*?`$/", $value)) { //`field` is valid only for mysql :/ //phone numbers may start with '+' and will be considered as numeric $value = "'$value'"; } return $value; }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
protected function remove($path, $force = false) { $stat = $this->stat($path); if (empty($stat)) { return $this->setError(elFinder::ERROR_RM, $path, elFinder::ERROR_FILE_NOT_FOUND); } $stat['realpath'] = $path; $this->rmTmb($stat); $this->clearcache(); if (!$force && !empty($stat['locked'])) { return $this->setError(elFinder::ERROR_LOCKED, $this->path($stat['hash'])); } if ($stat['mime'] == 'directory' && empty($stat['thash'])) { $ret = $this->delTree($this->convEncIn($path)); $this->convEncOut(); if (!$ret) { return $this->setError(elFinder::ERROR_RM, $this->path($stat['hash'])); } } else { if ($this->convEncOut(!$this->_unlink($this->convEncIn($path)))) { return $this->setError(elFinder::ERROR_RM, $this->path($stat['hash'])); } $this->clearstatcache(); } $this->removed[] = $stat; 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
private function renderInvoice(InvoiceQuery $query, Request $request) { // use the current request locale as fallback, if no translation was configured if (null !== $query->getTemplate() && null === $query->getTemplate()->getLanguage()) { $query->getTemplate()->setLanguage($request->getLocale()); } try { $invoices = $this->service->createInvoices($query, $this->dispatcher); $this->flashSuccess('action.update.success'); if (\count($invoices) === 1) { return $this->redirectToRoute('admin_invoice_list', ['id' => $invoices[0]->getId()]); } return $this->redirectToRoute('admin_invoice_list'); } catch (Exception $ex) { $this->flashUpdateException($ex); } return $this->redirectToRoute('invoice'); }
0
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
protected function getSubtask() { $subtask = $this->subtaskModel->getById($this->request->getIntegerParam('subtask_id')); if (empty($subtask)) { throw new PageNotFoundException(); } return $subtask; }
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
$trimmed = trim($line); if ((strlen($trimmed) > 0) || ($readInitialData === true)) { $comment[] = $line; } $readInitialData = true; } switch ($type) { case 'commit': $object = $objectHash; $commitHash = $objectHash; break; case 'tag': $args = array(); $args[] = 'tag'; $args[] = $objectHash; $ret = $this->exe->Execute($tag->GetProject()->GetPath(), GIT_CAT_FILE, $args); $lines = explode("\n", $ret); foreach ($lines as $i => $line) { if (preg_match('/^tag (.+)$/', $line, $regs)) { $name = trim($regs[1]); $object = $name; } } break; case 'blob': $object = $objectHash; break; } return array( $type, $object, $commitHash, $tagger, $taggerEpoch, $taggerTimezone, $comment ); }
0
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
vulnerable
public function testPages() { \MicroweberPackages\Multilanguage\MultilanguageHelpers::setMultilanguageEnabled(false); $this->browse(function (Browser $browser) { $browser->within(new AdminLogin(), function ($browser) { $browser->fillForm(); }); $routeCollection = Route::getRoutes(); foreach ($routeCollection as $value) { if ($value->getActionMethod() == 'GET') { continue; } if (strpos($value->uri(), 'admin') !== false) { $browser->visit($value->uri()); $browser->within(new ChekForJavascriptErrors(), function ($browser) { $browser->validate(); }); $browser->pause(2000); } } }); }
0
PHP
CWE-601
URL Redirection to Untrusted Site ('Open Redirect')
A web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a Redirect. This simplifies phishing attacks.
https://cwe.mitre.org/data/definitions/601.html
vulnerable
public function isMail() { $this->Mailer = 'mail'; }
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
$schedules[$scheduleCode] = $this->model->createScheduleItem($scheduleCode); } return $this->schedulesCache = $schedules; }
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 backup($type='json') { global $DB; global $website; $out = array(); $DB->query('SELECT * FROM nv_properties WHERE website = '.protect($website->id), 'object'); if($type='json') $out['nv_properties'] = json_encode($DB->result()); $DB->query('SELECT * FROM nv_properties_items WHERE website = '.protect($website->id), 'object'); if($type='json') $out['nv_properties_items'] = json_encode($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 insert($ip, $username) { $this->Log = ClassRegistry::init('Log'); $this->Log->create(); $expire = time() + Configure::read('SecureAuth.expire'); $expire = date('Y-m-d H:i:s', $expire); $bruteforceEntry = array( 'ip' => $ip, 'username' => $username, 'expire' => $expire ); $this->save($bruteforceEntry); $title = 'Failed login attempt using username ' . $username . ' from IP: ' . $_SERVER['REMOTE_ADDR'] . '.'; if ($this->isBlacklisted($ip, $username)) { $title .= 'This has tripped the bruteforce protection after ' . Configure::read('SecureAuth.amount') . ' failed attempts. The user is now blacklisted for ' . Configure::read('SecureAuth.expire') . ' seconds.'; } $log = array( 'org' => 'SYSTEM', 'model' => 'User', 'model_id' => 0, 'email' => $username, 'action' => 'login_fail', 'title' => $title ); $this->Log->save($log); }
0
PHP
NVD-CWE-noinfo
null
null
null
vulnerable
$connecttext = preg_replace("/#connectport#/", $connectport, $connecttext); $connectMethods[$key]["connecttext"] = $connecttext; } return array('status' => 'ready', 'serverIP' => $serverIP, 'user' => $thisuser, 'password' => $passwd, 'connectport' => $connectport, 'connectMethods' => $connectMethods); } return array('status' => 'notready'); }
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 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-269
Improper Privilege Management
The software does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor.
https://cwe.mitre.org/data/definitions/269.html
safe
protected function _log($message, $backtrace = null) { if (!$this->_debug) return true; $data = sprintf("[%s] %s\n", date('r'), $message); if ($backtrace) { $debug = print_r($backtrace, true); $data .= $debug . "\n"; } $data = strtr($data, '<>', '..'); $filename = w3_debug_log('sns'); return @file_put_contents($filename, $data, FILE_APPEND); }
1
PHP
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
safe
public function browse() { $params = func_get_args(); $this->path = join('/', $params); // make sure there's a / at the end if (substr($this->path, -1, 1) != '/') $this->path .= '/'; //security // we dont allow back link if (strpos($this->path, '..') !== false) { /* if (Plugin::isEnabled('statistics_api')) { $user = null; if (AuthUser::isLoggedIn()) $user = AuthUser::getUserName(); $ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : ($_SERVER['REMOTE_ADDR']); $event = array('event_type' => 'hack_attempt', // simple event type identifier 'description' => __('A possible hack attempt was detected.'), // translatable description 'ipaddress' => $ip, 'username' => $user); Observer::notify('stats_file_manager_hack_attempt', $event); } */ } $this->path = str_replace('..', '', $this->path); // clean up nicely $this->path = str_replace('//', '', $this->path); // we dont allow leading slashes $this->path = preg_replace('/^\//', '', $this->path); $this->fullpath = FILES_DIR . '/' . $this->path; // clean up nicely $this->fullpath = preg_replace('/\/\//', '/', $this->fullpath); $this->display('file_manager/views/index', array( 'dir' => htmlContextCleaner($this->path), //'files' => $this->_getListFiles() 'files' => $this->_listFiles() )); }
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 getTopRated() { $url = "http://api.themoviedb.org/3/movie/top_rated?api_key=".$this->apikey; $top_rated = $this->curl($url); return $top_rated; }
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 _rmdir($path) { return $this->query(sprintf('DELETE FROM %s WHERE id=%d AND mime=\'directory\' LIMIT 1', $this->tbf, $path)) && $this->db->affected_rows; }
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 random_bytes($bytes) { try { $bytes = RandomCompat_intval($bytes); } catch (TypeError $ex) { throw new TypeError( 'random_bytes(): $bytes must be an integer' ); } if ($bytes < 1) { throw new Error( 'Length must be greater than 0' ); } /** * \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be * generated in one invocation. */ if ($bytes > 2147483647) { $buf = ''; for ($i = 0; $i < $bytes; $i += 1073741824) { $n = ($bytes - $i) > 1073741824 ? 1073741824 : $bytes - $i; $buf .= Sodium::randombytes_buf($n); } } else { $buf = Sodium::randombytes_buf($bytes); } if ($buf !== false) { if (RandomCompat_strlen($buf) === $bytes) { return $buf; } } /** * If we reach here, PHP has failed us. */ throw new Exception( 'Could not gather sufficient random data' ); }
1
PHP
CWE-335
Incorrect Usage of Seeds in Pseudo-Random Number Generator (PRNG)
The software uses a Pseudo-Random Number Generator (PRNG) but does not correctly manage seeds.
https://cwe.mitre.org/data/definitions/335.html
safe
$masteroption->delete(); } // delete the mastergroup $db->delete('optiongroup', 'optiongroup_master_id='.$mastergroup->id); $mastergroup->delete(); 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 showUnpublished() { expHistory::set('viewable', $this->params); // setup the where clause for looking up records. $where = parent::aggregateWhereClause(); $where = "((unpublish != 0 AND unpublish < ".time().") OR (publish > ".time().")) AND ".$where; if (isset($this->config['only_featured'])) $where .= ' AND is_featured=1'; $page = new expPaginator(array( 'model'=>'news', 'where'=>$where, 'limit'=>25, 'order'=>'unpublish', 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->baseclassname, 'action'=>$this->params['action'], 'src'=>$this->loc->src, 'columns'=>array( gt('Title')=>'title', gt('Published On')=>'publish', gt('Status')=>'unpublish' ), )); assign_to_template(array( 'page'=>$page )); }
1
PHP
CWE-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 testCookiePathWithEmptySetCookiePath($uriPath, $cookiePath) { $response = (new Response(200)) ->withAddedHeader( 'Set-Cookie', "foo=bar; expires={$this->futureExpirationDate()}; domain=www.example.com; path=;" ) ->withAddedHeader( 'Set-Cookie', "bar=foo; expires={$this->futureExpirationDate()}; domain=www.example.com; path=foobar;" ) ; $request = (new Request('GET', $uriPath))->withHeader('Host', 'www.example.com'); $this->jar->extractCookies($request, $response); self::assertSame($cookiePath, $this->jar->toArray()[0]['Path']); self::assertSame($cookiePath, $this->jar->toArray()[1]['Path']); }
0
PHP
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
public static function ridOld($tokens) { $time = time(); foreach ($tokens as $token => $value) { if ($time - $value['time'] > 3600) { unset($tokens[$token]); } } return $tokens; }
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 run () { $m = self::match(); // print_r($m); if (is_array($m)) { # code... $val = self::extract($m[0], $m[1]); if (isset($val) && $val != null ) { return $val; }else{ $val = ['error']; return $val; } }else{ $val = ['error']; return $val; } }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
$newret = recyclebin::restoreFromRecycleBin($iLoc, $page_id); if (!empty($newret)) $ret .= $newret . '<br>'; if ($iLoc->mod == 'container') { $ret .= scan_container($container->internal, $page_id); } } return $ret; }
1
PHP
CWE-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
protected function removeNetVolume($key, $volume) { $netVolumes = $this->getNetVolumes(); $res = true; if (is_object($volume) && method_exists($volume, 'netunmount')) { $res = $volume->netunmount($netVolumes, $key); } if ($res) { if (is_string($key) && isset($netVolumes[$key])) { unset($netVolumes[$key]); $this->saveNetVolumes($netVolumes); 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
$str .= $child->getAsBBCode(); } $str .= "[/".$this->tagName."]"; return $str; }
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 checkHTTP($link, $get_body = false) { if (! function_exists('curl_init')) { return null; } $handle = curl_init($link); if ($handle === false) { return null; } PMA_Util::configureCurl($handle); curl_setopt($handle, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, '2'); curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, '1'); curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($handle, CURLOPT_TIMEOUT, 5); curl_setopt($handle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); if (! defined('TESTSUITE')) { session_write_close(); } $data = @curl_exec($handle); if (! defined('TESTSUITE')) { ini_set('session.use_only_cookies', '0'); ini_set('session.use_cookies', '0'); ini_set('session.use_trans_sid', '0'); ini_set('session.cache_limiter', 'nocache'); session_start(); } if ($data === false) { return null; } $http_status = curl_getinfo($handle, CURLINFO_HTTP_CODE); if ($http_status == 200) { return $get_body ? $data : true; } if ($http_status == 404) { return false; } return null; }
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 handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = false) { $this->catch = $catch; $this->backendRequest = array($request::getTrustedProxies(), $this->trustedHeadersReflector->getValue(), $request); return parent::handle($request, $type, $catch); }
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 event() { $project = $this->getProject(); $values = $this->request->getValues(); $values['project_id'] = $project['id']; if (empty($values['action_name'])) { return $this->create(); } return $this->response->html($this->template->render('action_creation/event', array( 'values' => $values, 'project' => $project, 'available_actions' => $this->actionManager->getAvailableActions(), 'events' => $this->actionManager->getCompatibleEvents($values['action_name']), ))); }
1
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
safe
function update_option_master() { global $db; $id = empty($this->params['id']) ? null : $this->params['id']; $opt = new option_master($id); $oldtitle = $opt->title; $opt->update($this->params); // if the title of the master changed we should update the option groups that are already using it. if ($oldtitle != $opt->title) { }$db->sql('UPDATE '.$db->prefix.'option SET title="'.$opt->title.'" WHERE option_master_id='.$opt->id); expHistory::back(); }
0
PHP
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/74.html
vulnerable
public function rename($hash, $name) { if ($this->commandDisabled('rename')) { return $this->setError(elFinder::ERROR_PERM_DENIED); } if (!$this->nameAccepted($name)) { return $this->setError(elFinder::ERROR_INVALID_NAME, $name); } $mimeByName = elFinderVolumeDriver::mimetypeInternalDetect($name); if ($mimeByName && $mimeByName !== 'unknown' && !$this->allowPutMime($mimeByName)) { return $this->setError(elFinder::ERROR_INVALID_NAME, $name); } if (!($file = $this->file($hash))) { return $this->setError(elFinder::ERROR_FILE_NOT_FOUND); } if ($name == $file['name']) { return $file; } if (!empty($file['locked'])) { return $this->setError(elFinder::ERROR_LOCKED, $file['name']); } $path = $this->decode($hash); $dir = $this->dirnameCE($path); $stat = $this->stat($this->joinPathCE($dir, $name)); if ($stat) { return $this->setError(elFinder::ERROR_EXISTS, $name); } if (!$this->allowCreate($dir, $name, ($file['mime'] === 'directory'))) { return $this->setError(elFinder::ERROR_PERM_DENIED); } $this->rmTmb($file); // remove old name tmbs, we cannot do this after dir move if ($path = $this->convEncOut($this->_move($this->convEncIn($path), $this->convEncIn($dir), $this->convEncIn($name)))) { $this->clearcache(); return $this->stat($path); } 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
foreach ($project_templates as $project_template) { if ((int) $project_template->getGroupId() === \Project::ADMIN_PROJECT_ID) { continue; } $company_templates[] = new CompanyTemplate($project_template, $this->glyph_finder); }
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 static function fixName($name) { $name = preg_replace('/[^A-Za-z0-9\.]/','_',$name); if ($name[0] == '.') // attempt to upload a dot file $name[0] = '_'; $name = str_replace('_', '..', $name); // attempt to upload with redirection to new folder return $name; // return preg_replace('/[^A-Za-z0-9\.]/', '-', $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 authenticate_by_email($website, $email, $password) { global $DB; // find the webuser username assigned to an email address // because it may exist more than one account with the same email, // only the first _created_ will be used $username = $DB->query_single( 'username', 'nv_webusers', 'website = '.intval($website).' AND email = '.protect($email) ); if(empty($username)) return false; return $this->authenticate($website, $username, $password); }
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 _fclose($fp, $path='') { return @fclose($fp); }
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 loadonce($var){ require_once(GX_LIB."Vendor/".$var); }
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
$evs = $this->event->find('all', "id=" . $edate->event_id . $featuresql); foreach ($evs as $key=>$event) { if ($condense) { $eventid = $event->id; $multiday_event = array_filter($events, create_function('$event', 'global $eventid; return $event->id === $eventid;')); if (!empty($multiday_event)) { unset($evs[$key]); continue; } } $evs[$key]->eventstart += $edate->date; $evs[$key]->eventend += $edate->date; $evs[$key]->date_id = $edate->id; if (!empty($event->expCat)) { $catcolor = empty($event->expCat[0]->color) ? null : trim($event->expCat[0]->color); // if (substr($catcolor,0,1)=='#') $catcolor = '" style="color:'.$catcolor.';'; $evs[$key]->color = $catcolor; } } if (count($events) < 500) { // magic number to not crash loop? $events = array_merge($events, $evs); } else { // $evs[$key]->title = gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!'); // $events = array_merge($events, $evs); flash('notice',gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!')); break; // keep from breaking system by too much data } }
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 prepareExchangedData($data, $type) { global $SETTINGS; //load ClassLoader require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; //Load AES $aes = new SplClassLoader('Encryption\Crypt', '../includes/libraries'); $aes->register(); if ($type == "encode") { if (isset($SETTINGS['encryptClientServer']) && $SETTINGS['encryptClientServer'] === "0" ) { return json_encode( $data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP ); } else { return Encryption\Crypt\aesctr::encrypt( json_encode( $data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP ), $_SESSION['key'], 256 ); } } elseif ($type == "decode") { if (isset($SETTINGS['encryptClientServer']) && $SETTINGS['encryptClientServer'] === "0" ) { return json_decode( $data, true ); } else { return json_decode( Encryption\Crypt\aesctr::decrypt( $data, $_SESSION['key'], 256 ), true ); } } }
0
PHP
CWE-434
Unrestricted Upload of File with Dangerous Type
The software allows the attacker to upload or transfer files of dangerous types that can be automatically processed within the product's environment.
https://cwe.mitre.org/data/definitions/434.html
vulnerable
public function testConstructorDoesNotRaiseExceptionForInvalidStreamWhenErrorStatusPresent($status) { $uploadedFile = new UploadedFile('not ok', 0, $status); $this->assertSame($status, $uploadedFile->getError()); }
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 execute(&$params) { $options = $this->config['options']; $action = new Actions; $action->subject = $this->parseOption('subject',$params); $action->dueDate = $this->parseOption('dueDate',$params); $action->actionDescription = $this->parseOption('description',$params); $action->priority = $this->parseOption('priority',$params); $action->visibility = $this->parseOption('visibility',$params); if(isset($params['model'])) $action->assignedTo = $this->parseOption('assignedTo',$params); // if(isset($this->config['attributes'])) // $this->setModelAttributes($action,$this->config['attributes'],$params); if ($action->save()) { return array ( true, Yii::t('studio', "View created action: ").$action->getLink ()); } else { $errors = $action->getErrors (); return array(false, array_shift($errors)); } // if($this->parseOption('reminder',$params)) { // $notif=new Notification; // $notif->modelType='Actions'; // $notif->createdBy=Yii::app()->user->getName(); // $notif->modelId=$model->id; // if($_POST['notificationUsers']=='me'){ // $notif->user=Yii::app()->user->getName(); // }else{ // $notif->user=$model->assignedTo; // } // $notif->createDate=$model->dueDate-($_POST['notificationTime']*60); // $notif->type='action_reminder'; // $notif->save(); // if($_POST['notificationUsers']=='both' && Yii::app()->user->getName()!=$model->assignedTo){ // $notif2=new Notification; // $notif2->modelType='Actions'; // $notif2->createdBy=Yii::app()->user->getName(); // $notif2->modelId=$model->id; // $notif2->user=Yii::app()->user->getName(); // $notif2->createDate=$model->dueDate-($_POST['notificationTime']*60); // $notif2->type='action_reminder'; // $notif2->save(); // } // } }
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 approve() { expHistory::set('editable', $this->params); /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet // $require_login = empty($this->params['require_login']) ? 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('No ID supplied for comment to approve')); expHistory::back(); } $comment = new expComment($this->params['id']); assign_to_template(array( 'comment'=>$comment )); }
0
PHP
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/74.html
vulnerable
public static function initializeNavigation() { $sections = section::levelTemplate(0, 0); return $sections; }
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 update($vars) { if (is_array($vars)) { //print_r($vars); $u = $vars['user']; $sql = array( 'table' => 'user', 'id' => $vars['id'], 'key' => $u, ); Db::update($sql); if (isset($vars['detail']) && $vars['detail'] != '') { $u = $vars['detail']; $sql = array( 'table' => 'user_detail', 'id' => $vars['id'], 'key' => $u, ); Db::update($sql); } Hooks::run('user_sqledit_action', $vars); } }
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 delete() { if (!AuthUser::hasPermission('file_manager_delete')) { Flash::set('error', __('You do not have sufficient permissions to delete a file or directory.')); redirect(get_url('plugin/file_manager/browse/')); } $paths = func_get_args(); $file = urldecode(join('/', $paths)); // CSRF checks if (isset($_GET['csrf_token'])) { $csrf_token = $_GET['csrf_token']; if (!SecureToken::validateToken($csrf_token, BASE_URL.'plugin/file_manager/delete/'.$file)) { 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/')); } $file = FILES_DIR . '/' . str_replace('..', '', $file); $filename = array_pop($paths); $paths = join('/', $paths); if (is_file($file)) { if (!unlink($file)) Flash::set('error', __('Permission denied!')); } else { if (!$this->_rrmdir($file)) Flash::set('error', __('Permission denied!')); } redirect(get_url('plugin/file_manager/browse/' . $paths)); }
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
$cspHeaderOptions = array_map(function ($k, $v) { return "$k $v " . $this->getAllowedUrls($k); }, array_keys($this->cspHeaderOptions), array_values($this->cspHeaderOptions));
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 event() { $project = $this->getProject(); $values = $this->request->getValues(); if (empty($values['action_name']) || empty($values['project_id'])) { return $this->create(); } return $this->response->html($this->template->render('action_creation/event', array( 'values' => $values, 'project' => $project, 'available_actions' => $this->actionManager->getAvailableActions(), 'events' => $this->actionManager->getCompatibleEvents($values['action_name']), ))); }
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
$result = $search->getSearchResults($item->query, false, true); if(empty($result) && !in_array($item->query, $badSearchArr)) { $badSearchArr[] = $item->query; $badSearch[$ctr2]['query'] = $item->query; $badSearch[$ctr2]['count'] = $db->countObjects("search_queries", "query='{$item->query}'"); $ctr2++; } } //Check if the user choose from the dropdown if(!empty($user_default)) { if($user_default == $anonymous) { $u_id = 0; } else { $u_id = $user_default; } $where .= "user_id = {$u_id}"; } //Get all the search query records $records = $db->selectObjects('search_queries', $where); for ($i = 0, $iMax = count($records); $i < $iMax; $i++) { if(!empty($records[$i]->user_id)) { $u = user::getUserById($records[$i]->user_id); $records[$i]->user = $u->firstname . ' ' . $u->lastname; } } $page = new expPaginator(array( 'records' => $records, 'where'=>1, 'model'=>'search_queries', 'limit'=>(isset($this->config['limit']) && $this->config['limit'] != '') ? 10 : $this->config['limit'], 'order'=>empty($this->config['order']) ? 'timestamp' : $this->config['order'], 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->baseclassname, 'action'=>$this->params['action'], 'columns'=>array( 'ID'=>'id', gt('Query')=>'query', gt('Timestamp')=>'timestamp', gt('User')=>'user_id', ), )); $uname['id'] = implode($uname['id'],','); $uname['name'] = implode($uname['name'],','); assign_to_template(array( 'page'=>$page, 'users'=>$uname, 'user_default' => $user_default, 'badSearch' => $badSearch )); }
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 mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); }
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 validate($aIP, $config, $context) { if (!$this->ip4) $this->_loadRegex(); if (preg_match('#^' . $this->ip4 . '$#s', $aIP)) { return $aIP; } return false; }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
function edit_order_item() { $oi = new orderitem($this->params['id'], true, true); if (empty($oi->id)) { flash('error', gt('Order item doesn\'t exist.')); expHistory::back(); } $oi->user_input_fields = expUnserialize($oi->user_input_fields); $params['options'] = $oi->opts; $params['user_input_fields'] = $oi->user_input_fields; $oi->product = new product($oi->product->id, true, true); if ($oi->product->parent_id != 0) { $parProd = new product($oi->product->parent_id); //$oi->product->optiongroup = $parProd->optiongroup; $oi->product = $parProd; } //FIXME we don't use selectedOpts? // $oi->selectedOpts = array(); // if (!empty($oi->opts)) { // foreach ($oi->opts as $opt) { // $option = new option($opt[0]); // $og = new optiongroup($option->optiongroup_id); // if (!isset($oi->selectedOpts[$og->id]) || !is_array($oi->selectedOpts[$og->id])) // $oi->selectedOpts[$og->id] = array($option->id); // else // array_push($oi->selectedOpts[$og->id], $option->id); // } // } //eDebug($oi->selectedOpts); assign_to_template(array( 'oi' => $oi, 'params' => $params )); }
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 privateCore(&$response, $user, $permissions) { parent::privateCore($response, $user, $permissions); $this->model = new PageOption(); $this->loadSelectedViewName(); $this->backPage = $this->request->get('url') ?: $this->selectedViewName; $this->selectedUser = $this->user->admin ? $this->request->get('nick') : $this->user->nick; $this->loadPageOptions(); $action = $this->request->get('action', ''); switch ($action) { case 'delete': $this->deleteAction(); break; case 'save': $this->saveAction(); break; } }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function 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(); }
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 show() { $task = $this->getTask(); $subtask = $this->getSubtask(); $this->response->html($this->template->render('subtask_restriction/show', array( 'status_list' => array( SubtaskModel::STATUS_TODO => t('Todo'), SubtaskModel::STATUS_DONE => t('Done'), ), 'subtask_inprogress' => $this->subtaskStatusModel->getSubtaskInProgress($this->userSession->getId()), 'subtask' => $subtask, 'task' => $task, ))); }
0
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
public function approve_submit() { global $history; if (empty($this->params['id'])) { flash('error', gt('No ID supplied for comment to approve')); $lastUrl = expHistory::getLast('editable'); } /* 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']); //FIXME here is where we might sanitize the note before approving it $simplenote->body = $this->params['body']; $simplenote->approved = $this->params['approved']; $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 edit_freeform() { $section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params); if ($section->parent == -1) { notfoundController::handle_not_found(); exit; } // doesn't work for standalone pages if (empty($section->id)) { $section->public = 1; if (!isset($section->parent)) { // This is another precaution. The parent attribute // should ALWAYS be set by the caller. //FJD - if that's the case, then we should die. notfoundController::handle_not_authorized(); exit; //$section->parent = 0; } } assign_to_template(array( 'section' => $section, 'glyphs' => self::get_glyphs(), )); }
1
PHP
CWE-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
$date->delete(); // event automatically deleted if all assoc eventdates are deleted } 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 testMatchTags () { $contact = $this->contacts ('testAnyone'); $tags = array ('#test', '#test2', '#test3', '#test-test4'); $this->assertEquals ($tags, $contact->matchTags (implode (' , ', $tags))); }
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()); }
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 meta($cont_title='', $cont_desc='', $pre =''){ global $data; //print_r($data); //if(empty($data['posts'][0]->title)){ if(is_array($data) && isset($data['posts'][0]->title)){ $sitenamelength = strlen(Options::get('sitename')); $limit = 70-$sitenamelength-6; $cont_title = substr(Typo::Xclean(Typo::strip($data['posts'][0]->title)),0,$limit); $titlelength = strlen($data['posts'][0]->title); if($titlelength > $limit+3) { $dotted = "...";} else {$dotted = "";} $cont_title = "{$pre} {$cont_title}{$dotted} - "; }else{ $cont_title = ""; } if(is_array($data) && isset($data['posts'][0]->content)){ $desc = Typo::strip($data['posts'][0]->content); }else{ $desc = ""; } $meta = " <!--// Start Meta: Generated Automaticaly by GeniXCMS --> <!-- SEO: Title stripped 70chars for SEO Purpose --> <title>{$cont_title}".Options::get('sitename')."</title> <meta name=\"Keyword\" content=\"".Options::get('sitekeywords')."\"> <!-- SEO: Description stripped 150chars for SEO Purpose --> <meta name=\"Description\" content=\"".self::desc($desc)."\"> <meta name=\"Author\" content=\"Puguh Wijayanto | MetalGenix IT Solutions - www.metalgenix.com\"> <meta name=\"Generator\" content=\"GeniXCMS\"> <meta name=\"robots\" content=\"".Options::get('robots')."\"> <meta name=\"revisit-after\" content=\" days\"> <link rel=\"shortcut icon\" href=\"".Options::get('siteicon')."\" /> "; $meta .= " <!-- Generated Automaticaly by GeniXCMS :End Meta //-->"; echo $meta; }
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 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-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 editspeed() { global $db; if (empty($this->params['id'])) return false; $calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']); $calc = new $calcname($this->params['id']); assign_to_template(array( 'calculator'=>$calc )); }
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 load() { w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin.php'); $this->_page = w3tc_get_current_page(); /** * Run plugin action */ $action = false; foreach ($_REQUEST as $key => $value) { if (strpos($key, 'w3tc_') === 0) { $action = 'action_' . substr($key, 5); break; } } $flush = false; $cdn = false; $support = false; $action_handler = w3_instance('W3_AdminActions_ActionHandler'); $action_handler->set_default($this); $action_handler->set_current_page($this->_page); if ($action && $action_handler->exists($action)) { if (strpos($action, 'view') !== false) if (!wp_verify_nonce(W3_Request::get_string('_wpnonce'), 'w3tc')) wp_nonce_ays('w3tc'); else check_admin_referer('w3tc'); try { $action_handler->execute($action); } catch (Exception $e) { w3_admin_redirect_with_custom_messages(array(), array($e->getMessage())); } exit(); } }
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 disable() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->disable($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane updated successfully.')); } else { $this->flash->failure(t('Unable to update this swimlane.')); } $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); }
0
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
public function __construct() { $this->strategies[] = new HTMLPurifier_Strategy_RemoveForeignElements(); $this->strategies[] = new HTMLPurifier_Strategy_MakeWellFormed(); $this->strategies[] = new HTMLPurifier_Strategy_FixNesting(); $this->strategies[] = new HTMLPurifier_Strategy_ValidateAttributes(); }
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 getParent($parent='', $menuid = ''){ if(isset($menuid)){ $where = " AND `menuid` = '{$menuid}'"; }else{ $where = ''; } $sql = sprintf("SELECT * FROM `menus` WHERE `parent` = '%s' %s", $parent, $where); $menu = Db::result($sql); return $menu; }
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 save() { $data = $_POST['file']; // security (remove all ..) $data['name'] = str_replace('..', '', $data['name']); $file = FILES_DIR . DS . $data['name']; // CSRF checks if (isset($_POST['csrf_token'])) { $csrf_token = $_POST['csrf_token']; if (!SecureToken::validateToken($csrf_token, BASE_URL.'plugin/file_manager/save/'.$data['name'])) { Flash::set('error', __('Invalid CSRF token found!')); redirect(get_url('plugin/file_manager/view/'.$data['name'])); } } else { Flash::set('error', __('No CSRF token found!')); redirect(get_url('plugin/file_manager/view/'.$data['name'])); } if (file_exists($file)) { if (file_put_contents($file, $data['content']) !== false) { Flash::set('success', __('File has been saved with success!')); } else { Flash::set('error', __('File is not writable! File has not been saved!')); } } else { if (file_put_contents($file, $data['content'])) { Flash::set('success', __('File :name has been created with success!', array(':name' => $data['name']))); } else { Flash::set('error', __('Directory is not writable! File has not been saved!')); } } // save and quit or save and continue editing ? if (isset($_POST['commit'])) { redirect(get_url('plugin/file_manager/browse/' . substr($data['name'], 0, strrpos($data['name'], '/')))); } else { redirect(get_url('plugin/file_manager/view/' . $data['name'] . (endsWith($data['name'], URL_SUFFIX) ? '?has_url_suffix=1' : ''))); }
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 get_allowed_files_extensions_for_upload($fileTypes = 'images', $returnAsArray = false) { $are_allowed = ''; switch ($fileTypes) { case 'img': case 'image': case 'images': $are_allowed .= ',png,gif,jpg,jpeg,tiff,bmp,svg,webp,ico'; break; case 'audio': case 'audios': $are_allowed .= ',mp3,mp4,ogg,wav,flac'; break; case 'video': case 'videos': $are_allowed .= ',avi,asf,mpg,mpeg,mp4,flv,mkv,webm,ogg,ogv,3gp,3g2,wma,mov,wmv'; break; case 'file': case 'files': $are_allowed .= ',doc,docx,pdf,json,rtf,txt,zip,gzip,rar,cad,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,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); if ($returnAsArray) { return $are_allowed; } $are_allowed = implode(',', $are_allowed); } if ($returnAsArray) { return []; } return $are_allowed; }
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
$stmt->bindValue(":$field", $domain, SQLITE3_TEXT); if($bindcomment) { $stmt->bindValue(":comment", $comment, SQLITE3_TEXT); } if($stmt->execute() && $stmt->reset()) $num++; else { $stmt->close(); if($returnnum) return $num; else { if($num === 1) $plural = ""; else $plural = "s"; return "Error: ".$db->lastErrorMsg().", added ".$num." domain".$plural; } } } // Close prepared statement and return number of processed rows $stmt->close(); $db->exec("COMMIT;"); if($returnnum) return $num; else { $finalcount = intval($db->querySingle($countquery)); $modified = $finalcount - $initialcount; // If we add less domains than the user specified, then they wanted to add duplicates if($modified !== $num) { $delta = $num - $modified; $extra = " (skipped ".$delta." duplicates)"; } else { $extra = ""; } if($num === 1) $plural = ""; else $plural = "s"; return "Success, added ".$modified." of ".$num." domain".$plural.$extra; } }
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 insertObject($object, $table) { //if ($table=="text") eDebug($object,true); $sql = "INSERT INTO `" . $this->prefix . "$table` ("; $values = ") VALUES ("; foreach (get_object_vars($object) as $var => $val) { //We do not want to save any fields that start with an '_' if ($var{0} != '_') { $sql .= "`$var`,"; if ($values != ") VALUES (") { $values .= ","; } $values .= "'" . $this->escapeString($val) . "'"; } } $sql = substr($sql, 0, -1) . substr($values, 0) . ")"; //if($table=='text')eDebug($sql,true); if (@mysqli_query($this->connection, $sql) != false) { $id = mysqli_insert_id($this->connection); return $id; } else return 0; }
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 _getHtmlHeaderColumn($title, $name, $pageName, $entityIds, $listorder, $orderdirection, $showColumn = true) { $str = ''; $entity = _getEntityString($entityIds); 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=$name'>$title</a>$str</b>" : ''; }
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 read_cache( $cache_id, $check = false ) { global $cms_db; if ( $cache_id && $this->use_cache ) { if ( !$this->cache_db ) $this->cache_db = new DB_cms; $return = false; $sql = "SELECT val FROM " . $cms_db['db_cache'] . " WHERE name = '" . $this->cache_name . "' AND sid = '" . $cache_id . "'"; if ( !$this->cache_db->query( $sql ) ) return; $oldmode = $this->cache_db->get_fetch_mode(); $this->cache_db->set_fetch_mode( 'DB_FETCH_ASSOC' ); if( $this->cache_db->next_record() ) { if ( $check ) { $return = true; } else { $cache_pre = $this->cache_db->this_record(); $cache_val = $cache_pre['val']; $cache = unserialize( stripslashes( $cache_val ) ); if ( is_array( $cache ) ) { $this->cache = $cache; $return = true; } } } $this->cache_db->set_fetch_mode( $oldmode ); return $return; } else $this->cache_mode = ''; }
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 XMLRPCremoveUserGroup($name, $affiliation) { global $user, $mysql_link_vcl; if(! in_array('groupAdmin', $user['privileges'])) { return array('status' => 'error', 'errorcode' => 16, 'errormsg' => 'access denied for managing groups'); } $validate = array('name' => $name, 'affiliation' => $affiliation); $rc = validateAPIgroupInput($validate, 1); if($rc['status'] == 'error') return $rc; $query = "SELECT ownerid, " . "affiliationid, " . "custom, " . "courseroll " . "FROM usergroup " . "WHERE id = {$rc['id']}"; $qh = doQuery($query, 101); if(! $row = mysql_fetch_assoc($qh)) { return array('status' => 'error', 'errorcode' => 18, 'errormsg' => 'user group with submitted name and affiliation does not exist'); } // if custom and not owner or custom/courseroll and no federated user group access, no access to delete group if(($row['custom'] == 1 && $user['id'] != $row['ownerid']) || (($row['custom'] == 0 || $row['courseroll'] == 1) && ! checkUserHasPerm('Manage Federated User Groups (global)') && (! checkUserHasPerm('Manage Federated User Groups (affiliation only)') || $row['affiliationid'] != $user['affiliationid']))) { return array('status' => 'error', 'errorcode' => 29, 'errormsg' => 'access denied to delete user group with submitted name and affiliation'); } if(checkForGroupUsage($rc['id'], 'user')) { return array('status' => 'error', 'errorcode' => 72, 'errormsg' => 'group currently in use and cannot be removed'); } $query = "DELETE FROM usergroup " . "WHERE id = {$rc['id']}"; doQuery($query, 101); # validate something deleted if(mysql_affected_rows($mysql_link_vcl) == 0) { return array('status' => 'error', 'errorcode' => 30, 'errormsg' => 'failure while deleting group from database'); } return array('status' => 'success'); }
1
PHP
CWE-264
Permissions, Privileges, and Access Controls
Weaknesses in this category are related to the management of permissions, privileges, and other security features that are used to perform access control.
https://cwe.mitre.org/data/definitions/264.html
safe
public function upload() { // upload the file, but don't save the record yet... if ($this->params['resize'] != 'false') { $maxwidth = $this->params['max_width']; } else { $maxwidth = null; } $file = expFile::fileUpload('Filedata',false,false,null,null,$maxwidth); // since most likely this function will only get hit via flash in YUI Uploader // and since Flash can't pass cookies, we lose the knowledge of our $user // so we're passing the user's ID in as $_POST data. We then instantiate a new $user, // and then assign $user->id to $file->poster so we have an audit trail for the upload if (is_object($file)) { $resized = !empty($file->resized) ? true : false; $user = new user($this->params['usrid']); $file->poster = $user->id; $file->posted = $file->last_accessed = time(); $file->save(); if (!empty($this->params['cat'])) { $expcat = new expCat($this->params['cat']); $params['expCat'][0] = $expcat->id; $file->update($params); } // a echo so YUI Uploader is notified of the function's completion if ($resized) { echo gt('File resized and then saved'); } else { echo gt('File saved'); } } else { echo gt('File was NOT uploaded!'); // flash('error',gt('File was not uploaded!')); } }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public function update() { $project = $this->getProject(); $values = $this->request->getValues(); list($valid, $errors) = $this->swimlaneValidator->validateModification($values); if ($valid) { if ($this->swimlaneModel->update($values['id'], $values)) { $this->flash->success(t('Swimlane updated successfully.')); return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); } else { $errors = array('name' => array(t('Another swimlane with the same name exists in the project'))); } } return $this->edit($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
protected function getSwimlane(array $project) { $swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id')); if (empty($swimlane)) { throw new PageNotFoundException(); } if ($swimlane['project_id'] != $project['id']) { throw new AccessForbiddenException(); } return $swimlane; }
1
PHP
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
safe