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 validateForField(App\Request $request) { $fieldModel = Vtiger_Module_Model::getInstance($request->getModule())->getFieldByName($request->getByType('fieldName', 2)); if (!$fieldModel || !$fieldModel->isActiveField() || !$fieldModel->isViewEnabled()) { throw new \App\Exceptions\NoPermitted('ERR_NO_PERMISSIONS_TO_FIELD', 406); } $recordModel = \Vtiger_Record_Model::getCleanInstance($fieldModel->getModuleName()); $fieldModel->getUITypeModel()->setValueFromRequest($request, $recordModel, 'fieldValue'); $response = new Vtiger_Response(); $response->setResult([ 'raw' => $recordModel->get($fieldModel->getName()), 'display' => $recordModel->getDisplayValue($fieldModel->getName()), ]); $response->emit(); }
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 getLoginFormURL() { return './index.php'; }
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
function move_standalone() { expSession::clearAllUsersSessionCache('navigation'); assign_to_template(array( 'parent' => $this->params['parent'], )); }
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 getSerial() { if (empty($this->serial)) { $this->serial = sha1(serialize($this->getAll())); } return $this->serial; }
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 admin_view($id = null) { $this->User->id = $id; if (!$this->User->exists()) { throw new NotFoundException(__('Invalid user')); } $user = $this->User->read(null, $id); if (!empty($user['User']['gpgkey'])) { $pgpDetails = $this->User->verifySingleGPG($user); $user['User']['pgp_status'] = isset($pgpDetails[2]) ? $pgpDetails[2] : 'OK'; $user['User']['fingerprint'] = !empty($pgpDetails[4]) ? $pgpDetails[4] : 'N/A'; } $user['User']['orgAdmins'] = $this->User->getOrgAdminsForOrg($user['User']['org_id'], $user['User']['id']); if (empty($this->Auth->user('Role')['perm_site_admin']) && !(empty($user['Role']['perm_site_admin']))) { $user['User']['authkey'] = __('Redacted'); } $this->set('user', $user); if (!$this->_isSiteAdmin() && !($this->_isAdmin() && $this->Auth->user('org_id') == $user['User']['org_id'])) { throw new MethodNotAllowedException(); } if ($this->_isRest()) { $user['User']['password'] = '*****'; return $this->RestResponse->viewData(array('User' => $user['User']), $this->response->type()); } else { $temp = $this->User->data['User']['invited_by']; $this->set('id', $id); $this->set('user2', $this->User->read(null, $temp)); } }
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
public function Hello($host = '') { $this->error = null; // so no confusion is caused if(!$this->connected()) { $this->error = array( "error" => "Called Hello() without being connected"); return false; } // if hostname for HELO was not specified send default if(empty($host)) { // determine appropriate default to send to server $host = "localhost"; } // Send extended hello first (RFC 2821) if(!$this->SendHello("EHLO", $host)) { if(!$this->SendHello("HELO", $host)) { return false; } } return true; }
0
PHP
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
public function update() { global $DB; global $events; if(!is_array($this->categories)) $this->categories = array(); $ok = $DB->execute(' UPDATE nv_feeds SET categories = :categories, format = :format, image = :image, entries = :entries, content = :content, views = :views, permission = :permission, enabled = :enabled WHERE id = :id AND website = :website', array( 'id' => $this->id, 'website' => $this->website, 'categories' => implode(',', $this->categories), 'format' => $this->format, 'image' => value_or_default($this->image, 0), 'entries' => value_or_default($this->entries, 10), 'content' => $this->content, 'views' => value_or_default($this->views, 0), 'permission' => value_or_default($this->permission, 0), 'enabled' => value_or_default($this->enabled, 0) ) ); if(!$ok) throw new Exception($DB->get_last_error()); webdictionary::save_element_strings('feed', $this->id, $this->dictionary); path::saveElementPaths('feed', $this->id, $this->paths); if(method_exists($events, 'trigger')) { $events->trigger( 'feed', 'save', array( 'feed' => $this ) ); } return true; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
$return[$index] = strip_tags($value); if($return[$index] == 'zero') $return[$index] = '0'; } } elseif($type == ARG_MULTISTRING) { foreach($return as $index => $value) { $return[$index] = strip_tags($value); } } else $return = strip_tags($return); if(! empty($return) && $type == ARG_NUMERIC) { if(! is_numeric($return)) { return preg_replace('([^\d])', '', $return); } } elseif(! empty($return) && $type == ARG_STRING) { if(! is_string($return)) $return = $defaultvalue; } elseif(! empty($return) && $type == ARG_MULTINUMERIC) { foreach($return as $index => $value) { if(! is_numeric($value)) { $return[$index] = preg_replace('([^\d])', '', $value); } } return $return; } elseif(! empty($return) && $type == ARG_MULTISTRING) { foreach($return as $index => $value) { if(! is_string($value)) $return[$index] = $defaultvalue; elseif($addslashes) $return[$index] = addslashes($value); } return $return; } if(is_string($return)) { if(strlen($return) == 0) $return = $defaultvalue; elseif($addslashes) $return = addslashes($return); } return $return; }
0
PHP
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
public static function create() { $length = '80'; $token = ''; $codeAlphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $codeAlphabet .= 'abcdefghijklmnopqrstuvwxyz'; $codeAlphabet .= '0123456789'; // $codeAlphabet.= "!@#$%^&*()[]\/{}|:\<>"; //$codeAlphabet.= SECURITY_KEY; 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
public function get_item_permissions_check( $request ) { $post = $this->get_post( $request['id'] ); if ( is_wp_error( $post ) ) { return $post; } if ( 'edit' === $request['context'] && $post && ! $this->check_update_permission( $post ) ) { return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit this post.' ), array( 'status' => rest_authorization_required_code() ) ); } if ( $post && ! empty( $request['password'] ) ) { // Check post password, and return error if invalid. if ( ! hash_equals( $post->post_password, $request['password'] ) ) { return new WP_Error( 'rest_post_incorrect_password', __( 'Incorrect post password.' ), array( 'status' => 403 ) ); } } // Allow access to all password protected posts if the context is edit. if ( 'edit' === $request['context'] ) { add_filter( 'post_password_required', '__return_false' ); } if ( $post ) { return $this->check_read_permission( $post ); } return true; }
1
PHP
NVD-CWE-noinfo
null
null
null
safe
function send_feedback() { $success = false; if (isset($this->params['id'])) { $ed = new eventdate($this->params['id']); // $email_addrs = array(); if ($ed->event->feedback_email != '') { $msgtemplate = expTemplate::get_template_for_action($this, 'email/_' . expString::escape($this->params['formname']), $this->loc); $msgtemplate->assign('params', $this->params); $msgtemplate->assign('event', $ed); $email_addrs = explode(',', $ed->event->feedback_email); //This is an easy way to remove duplicates $email_addrs = array_flip(array_flip($email_addrs)); $email_addrs = array_map('trim', $email_addrs); $mail = new expMail(); $success += $mail->quickSend(array( "text_message" => $msgtemplate->render(), 'to' => $email_addrs, 'from' => !empty($this->params['email']) ? $this->params['email'] : trim(SMTP_FROMADDRESS), 'subject' => $this->params['subject'], )); } } if ($success) { flashAndFlow('message', gt('Your feedback was successfully sent.')); } else { flashAndFlow('error', gt('We could not send your feedback. Please contact your administrator.')); } }
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 manage_vendors () { expHistory::set('viewable', $this->params); $vendor = new vendor(); $vendors = $vendor->find('all'); assign_to_template(array( 'vendors'=>$vendors )); }
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 unichr($code) { if($code > 1114111 or $code < 0 or ($code >= 55296 and $code <= 57343) ) { // bits are set outside the "valid" range as defined // by UNICODE 4.1.0 return ''; } $x = $y = $z = $w = 0; if ($code < 128) { // regular ASCII character $x = $code; } else { // set up bits for UTF-8 $x = ($code & 63) | 128; if ($code < 2048) { $y = (($code & 2047) >> 6) | 192; } else { $y = (($code & 4032) >> 6) | 128; if($code < 65536) { $z = (($code >> 12) & 15) | 224; } else { $z = (($code >> 12) & 63) | 128; $w = (($code >> 18) & 7) | 240; } } } // set up the actual character $ret = ''; if($w) $ret .= chr($w); if($z) $ret .= chr($z); if($y) $ret .= chr($y); $ret .= chr($x); 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
public function getStartingChars() { return $this->startingChars; }
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; expHistory::set('manageable', $this->params); // $classes = array(); $dir = BASE."framework/modules/ecommerce/billingcalculators"; if (is_readable($dir)) { $dh = opendir($dir); while (($file = readdir($dh)) !== false) { if (is_file("$dir/$file") && substr("$dir/$file", -4) == ".php") { include_once("$dir/$file"); $classname = substr($file, 0, -4); $id = $db->selectValue('billingcalculator', 'id', 'calculator_name="'.$classname.'"'); if (empty($id)) { // $calobj = null; $calcobj = new $classname(); if ($calcobj->isSelectable() == true) { $obj = new billingcalculator(array( 'title'=>$calcobj->name(), // 'user_title'=>$calcobj->title, 'body'=>$calcobj->description(), 'calculator_name'=>$classname, 'enabled'=>false)); $obj->save(); } } } } } $bcalc = new billingcalculator(); $calculators = $bcalc->find('all'); assign_to_template(array( 'calculators'=>$calculators )); }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public function __construct(private \Git_Exec $git_exec, private BranchCreationExecutor $branch_creation_executor) { }
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
public function getDebugLevel() { return $this->do_debug; }
1
PHP
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
protected function execute(InputInterface $input, OutputInterface $output) { /** @psalm-suppress PossiblyNullReference */ $command = $this->getApplication()->find('db:check'); $arguments = array( 'command' => 'db:check', ); $cmdInput = new ArrayInput($arguments); $returnCode = $command->run($cmdInput, $output); if ($returnCode === 1) { $output->writeln(array( 'Database update starting', '========================', )); $Config = Config::getConfig(); $Update = new Update($Config, new Sql()); $Update->runUpdateScript(); $output->writeln('All done.'); } return 0; }
0
PHP
CWE-307
Improper Restriction of Excessive Authentication Attempts
The software does not implement sufficient measures to prevent multiple failed authentication attempts within in a short time frame, making it more susceptible to brute force attacks.
https://cwe.mitre.org/data/definitions/307.html
vulnerable
foreach ($allusers as $uid) { $u = user::getUserById($uid); expPermissions::grant($u, 'manage', $sloc); }
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
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['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 manage() { expHistory::set('manageable',$this->params); $gc = new geoCountry(); $countries = $gc->find('all'); $gr = new geoRegion(); $regions = $gr->find('all',null,'rank asc,name asc'); assign_to_template(array( 'countries'=>$countries, 'regions'=>$regions )); }
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 __construct(public Config $Config, private Sql $Sql) { $this->Db = Db::getConnection(); }
0
PHP
CWE-307
Improper Restriction of Excessive Authentication Attempts
The software does not implement sufficient measures to prevent multiple failed authentication attempts within in a short time frame, making it more susceptible to brute force attacks.
https://cwe.mitre.org/data/definitions/307.html
vulnerable
$chrootPath = realpath($chrootPath); if ($chrootPath !== false && strpos($realfile, $chrootPath) === 0) { $chrootValid = true; break; } } if ($chrootValid !== true) { Helpers::record_warnings(E_USER_WARNING, "Permission denied on $file. The file could not be found under the paths specified by Options::chroot.", __FILE__, __LINE__); return; } } if (!$realfile) { Helpers::record_warnings(E_USER_WARNING, "File '$realfile' not found.", __FILE__, __LINE__); return; } $file = $realfile; } [$css, $http_response_header] = Helpers::getFileContent($file, $this->_dompdf->getHttpContext()); $good_mime_type = true; // See http://the-stickman.com/web-development/php/getting-http-response-headers-when-using-file_get_contents/ if (isset($http_response_header) && !$this->_dompdf->getQuirksmode()) { foreach ($http_response_header as $_header) { if (preg_match("@Content-Type:\s*([\w/]+)@i", $_header, $matches) && ($matches[1] !== "text/css") ) { $good_mime_type = false; } } } if (!$good_mime_type || $css === null) { Helpers::record_warnings(E_USER_WARNING, "Unable to load css file $file", __FILE__, __LINE__); return; } } $this->_parse_css($css); }
0
PHP
CWE-73
External Control of File Name or Path
The software allows user input to control or influence paths or file names that are used in filesystem operations.
https://cwe.mitre.org/data/definitions/73.html
vulnerable
public static function validateNumber( $path, $values, $allow_neg, $allow_zero, $max_value, $error_string ) { if ($values[$path] === '') { return ''; } if (intval($values[$path]) != $values[$path] || (! $allow_neg && $values[$path] < 0) || (! $allow_zero && $values[$path] == 0) || $values[$path] > $max_value ) { return $error_string; } return ''; }
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
$date->delete(); // event automatically deleted if all assoc eventdates are deleted } 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 __construct() { // setup the factory parent::__construct(); $this->factory = new HTMLPurifier_TokenFactory(); }
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 canImportData() { 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
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
$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'); }
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 theme_switch() { if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change the theme.')); } expSettings::change('DISPLAY_THEME_REAL', $this->params['theme']); expSession::set('display_theme',$this->params['theme']); $sv = isset($this->params['sv'])?$this->params['sv']:''; if (strtolower($sv)=='default') { $sv = ''; } expSettings::change('THEME_STYLE_REAL',$sv); expSession::set('theme_style',$sv); expDatabase::install_dbtables(); // update tables to include any custom definitions in the new theme // $message = (MINIFY != 1) ? "Exponent is now minifying Javascript and CSS" : "Exponent is no longer minifying Javascript and CSS" ; // flash('message',$message); $message = gt("You have selected the")." '".$this->params['theme']."' ".gt("theme"); if ($sv != '') { $message .= ' '.gt('with').' '.$this->params['sv'].' '.gt('style variation'); } flash('message',$message); // expSession::un_set('framework'); expSession::set('force_less_compile', 1); // expTheme::removeSmartyCache(); expSession::clearAllUsersSessionCache(); expHistory::returnTo('manageable'); }
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
$this->AddValidationError($prop, "$prop exceeds the maximum length of " . $fm->FieldSize . ""); } if ($this->$prop == "" && ($fm->DefaultValue || $fm->IsAutoInsert)) { // these fields are auto-populated so we don't need to validate them unless // a specific value was provided } else { switch ($fm->FieldType) { case FM_TYPE_INT: case FM_TYPE_SMALLINT: case FM_TYPE_TINYINT: case FM_TYPE_MEDIUMINT: case FM_TYPE_BIGINT: case FM_TYPE_DECIMAL: if (! is_numeric($this->$prop)) { $this->AddValidationError($prop, "$prop is not a valid number"); } break; case FM_TYPE_DATE: case FM_TYPE_DATETIME: if (strtotime($this->$prop) === '') { $this->AddValidationError($prop, "$prop is not a valid date/time value."); } break; case FM_TYPE_ENUM: if (! in_array($this->$prop, $fm->GetEnumValues())) { $this->AddValidationError($prop, "$prop is not valid value. Allowed values: " . implode(', ', $fm->GetEnumValues())); } break; default: break; } } }
0
PHP
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
$db->updateObject($value, 'section'); } $db->updateObject($moveSec, 'section'); //handle re-ranking of previous parent $oldSiblings = $db->selectObjects("section", "parent=" . $oldParent . " AND rank>" . $oldRank . " ORDER BY rank"); $rerank = 1; foreach ($oldSiblings as $value) { if ($value->id != $moveSec->id) { $value->rank = $rerank; $db->updateObject($value, 'section'); $rerank++; } } if ($oldParent != $moveSec->parent) { //we need to re-rank the children of the parent that the moving section has just left $childOfLastMove = $db->selectObjects("section", "parent=" . $oldParent . " ORDER BY rank"); for ($i = 0, $iMax = count($childOfLastMove); $i < $iMax; $i++) { $childOfLastMove[$i]->rank = $i; $db->updateObject($childOfLastMove[$i], 'section'); } } } } self::checkForSectionalAdmins($move); expSession::clearAllUsersSessionCache('navigation'); }
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 testCanConstructWithHeadersAsArray() { $r = new Response(200, [ 'Foo' => ['baz', 'bar'] ]); $this->assertSame(['Foo' => ['baz', 'bar']], $r->getHeaders()); $this->assertSame('baz, bar', $r->getHeaderLine('Foo')); $this->assertSame(['baz', 'bar'], $r->getHeader('Foo')); }
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 mergeInAttrIncludes(&$attr, $attr_includes) { if (!is_array($attr_includes)) { if (empty($attr_includes)) $attr_includes = array(); else $attr_includes = array($attr_includes); } $attr[0] = $attr_includes; }
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 isLocal($config, $context) { if ($this->host === null) return true; $uri_def = $config->getDefinition('URI'); if ($uri_def->host === $this->host) return true; 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
public function testValidColorBBCode() { $parser = new JBBCode\Parser(); $parser->addCodeDefinitionSet(new JBBCode\DefaultCodeDefinitionSet()); $parser->parse('[color=red]colorful text[/color]'); $this->assertEquals('<span style="color: red">colorful text</span>', $parser->getAsHtml()); $parser->parse('[color=#00ff00]green[/color]'); $this->assertEquals('<span style="color: #00ff00">green</span>', $parser->getAsHtml()); }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public function position($l = null, $c = null) { $this->line = $l; $this->col = $c; }
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 getTextColumns($table) { $sql = "SHOW COLUMNS FROM " . $this->prefix.$table . " WHERE type = 'text' OR type like 'varchar%'"; $res = @mysqli_query($this->connection, $sql); if ($res == null) return array(); $records = array(); while($row = mysqli_fetch_object($res)) { $records[] = $row->Field; } return $records; }
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
static function convertXMLFeedSafeChar($str) { $str = str_replace("<br>","",$str); $str = str_replace("</br>","",$str); $str = str_replace("<br/>","",$str); $str = str_replace("<br />","",$str); $str = str_replace("&quot;",'"',$str); $str = str_replace("&#39;","'",$str); $str = str_replace("&rsquo;","'",$str); $str = str_replace("&lsquo;","'",$str); $str = str_replace("&#174;","",$str); $str = str_replace("�","-", $str); $str = str_replace("�","-", $str); $str = str_replace("�", '"', $str); $str = str_replace("&rdquo;",'"', $str); $str = str_replace("�", '"', $str); $str = str_replace("&ldquo;",'"', $str); $str = str_replace("\r\n"," ",$str); $str = str_replace("�"," 1/4",$str); $str = str_replace("&#188;"," 1/4", $str); $str = str_replace("�"," 1/2",$str); $str = str_replace("&#189;"," 1/2",$str); $str = str_replace("�"," 3/4",$str); $str = str_replace("&#190;"," 3/4",$str); $str = str_replace("�", "(TM)", $str); $str = str_replace("&trade;","(TM)", $str); $str = str_replace("&reg;","(R)", $str); $str = str_replace("�","(R)",$str); $str = str_replace("&","&amp;",$str); $str = str_replace(">","&gt;",$str); return trim($str); }
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 paramRules() { $parentRules = parent::paramRules (); $parentRules['options'] = array_merge ( $parentRules['options'], array ( array( 'name'=>'to', 'label'=>Yii::t( 'studio','To:'), 'type'=>'email' ), array( 'name' => 'template', 'label' => Yii::t('studio', 'Template'), 'type' => 'dropdown', 'defaultVal' => '', 'options' => array('' => Yii::t('studio', 'Custom')) + Docs::getEmailTemplates('email', 'Contacts') ), array( 'name' => 'subject', 'label' => Yii::t('studio', 'Subject'), 'optional' => 1 ), array( 'name' => 'cc', 'label' => Yii::t('studio', 'CC:'), 'optional' => 1, 'type' => 'email' ), array( 'name' => 'bcc', 'label' => Yii::t('studio', 'BCC:'), 'optional' => 1, 'type' => 'email' ), array( 'name' => 'body', 'label' => Yii::t('studio', 'Message'), 'optional' => 1, 'type' => 'richtext' ), ) ); return $parentRules; }
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 delete() { global $db, $history; /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login']; $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval']; $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification']; $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email']; if (empty($this->params['id'])) { flash('error', gt('Missing id for the comment you would like to delete')); $lastUrl = expHistory::getLast('editable'); } // delete the note $simplenote = new expSimpleNote($this->params['id']); $rows = $simplenote->delete(); // delete the assocication too $db->delete($simplenote->attachable_table, 'expsimplenote_id='.$this->params['id']); // send the user back where they came from. $lastUrl = expHistory::getLast('editable'); if (!empty($this->params['tab'])) { $lastUrl .= "#".$this->params['tab']; } redirect_to($lastUrl); }
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 invalidFilenamesAndMediaTypes() { return [ 'true' => [true], 'false' => [false], 'int' => [1], 'float' => [1.1], 'array' => [['string']], 'object' => [(object) ['string']], ]; }
1
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public function transform($attr, $config, $context) { if (!isset($attr[$this->attr])) return $attr; $width = $this->confiscateAttr($attr, $this->attr); // some validation could happen here if (!isset($this->css[$this->attr])) return $attr; $style = ''; foreach ($this->css[$this->attr] as $suffix) { $property = "margin-$suffix"; $style .= "$property:{$width}px;"; } $this->prependCSS($attr, $style); return $attr; }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
foreach($findAffilFuncs as $func) { if($func($_user, $dump)) $affilok = 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 __construct($parent = null) { $this->parent = $parent; }
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 singleQuoteReplace($param1 = false, $param2 = false, $param3) { return str_replace("'", "''", str_replace("\'", "'", $param3)); }
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 __construct() { $this->options['alias'] = ''; // alias to replace root dir name $this->options['dirMode'] = 0755; // new dirs mode $this->options['fileMode'] = 0644; // new files mode $this->options['quarantine'] = '.quarantine'; // quarantine folder name - required to check archive (must be hidden) $this->options['rootCssClass'] = 'elfinder-navbar-root-local'; $this->options['followSymLinks'] = true; $this->options['detectDirIcon'] = ''; // file name that is detected as a folder icon e.g. '.diricon.png' $this->options['keepTimestamp'] = array('copy', 'move'); // keep timestamp at inner filesystem allowed 'copy', 'move' and 'upload' }
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 filter(&$uri, $config, $context) { // check if filter not applicable if (!$config->get('HTML.SafeIframe')) return true; // check if the filter should actually trigger if (!$context->get('EmbeddedURI', true)) return true; $token = $context->get('CurrentToken', true); if (!($token && $token->name == 'iframe')) return true; // check if we actually have some whitelists enabled if ($this->regexp === null) return false; // actually check the whitelists return preg_match($this->regexp, $uri->toString()); }
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 transform($attr, $config, $context) { if (!isset($attr['type'])) $t = 'text'; else $t = strtolower($attr['type']); if (isset($attr['checked']) && $t !== 'radio' && $t !== 'checkbox') { unset($attr['checked']); } if (isset($attr['maxlength']) && $t !== 'text' && $t !== 'password') { unset($attr['maxlength']); } if (isset($attr['size']) && $t !== 'text' && $t !== 'password') { $result = $this->pixels->validate($attr['size'], $config, $context); if ($result === false) unset($attr['size']); else $attr['size'] = $result; } if (isset($attr['src']) && $t !== 'image') { unset($attr['src']); } if (!isset($attr['value']) && ($t === 'radio' || $t === 'checkbox')) { $attr['value'] = ''; } return $attr; }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public function testNestingTags() { $code = '[url=http://jbbcode.com][b]hello [u]world[/u][/b][/url]'; $html = '<a href="http://jbbcode.com"><strong>hello <u>world</u></strong></a>'; $this->assertProduces($code, $html); }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
private function char() { return ($this->char < $this->EOF) ? $this->data[$this->char] : 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
protected function getComment() { $comment = $this->commentModel->getById($this->request->getIntegerParam('comment_id')); if (empty($comment)) { throw new PageNotFoundException(); } if (! $this->userSession->isAdmin() && $comment['user_id'] != $this->userSession->getId()) { throw new AccessForbiddenException(); } return $comment; }
0
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
protected function evalExpression($expr) { $var = null; $result = eval("\$var = $expr;"); if ($result === false) { throw new HTMLPurifier_VarParserException("Fatal error in evaluated code"); } return $var; }
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
$loc = expCore::makeLocation('navigation', '', $standalone->id); if (expPermissions::check('manage', $loc)) 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 testPages () { $this->visitPages ( $this->allPages ); }
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 getSelectorsBySpecificity($sSpecificitySearch = null) { if (is_numeric($sSpecificitySearch) || is_numeric($sSpecificitySearch[0])) { $sSpecificitySearch = "== $sSpecificitySearch"; } $aResult = array(); $this->allSelectors($aResult, $sSpecificitySearch); return $aResult; }
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
$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 )); }
1
PHP
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/74.html
safe
private function applyParts(array $parts) { $this->scheme = isset($parts['scheme']) ? $this->filterScheme($parts['scheme']) : ''; $this->userInfo = isset($parts['user']) ? $parts['user'] : ''; $this->host = isset($parts['host']) ? $parts['host'] : ''; $this->port = !empty($parts['port']) ? $this->filterPort($this->scheme, $this->host, $parts['port']) : null; $this->path = isset($parts['path']) ? $this->filterPath($parts['path']) : ''; $this->query = isset($parts['query']) ? $this->filterQueryAndFragment($parts['query']) : ''; $this->fragment = isset($parts['fragment']) ? $this->filterQueryAndFragment($parts['fragment']) : ''; if (isset($parts['pass'])) { $this->userInfo .= ':' . $parts['pass']; } }
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
$folders = ['root' => $rootObj->getName()] + $folders;
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 saveconfig() { 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']); $conf = serialize($calc->parseConfig($this->params)); $calc->update(array('config'=>$conf)); 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 buildCurrentUrl() { $url = URL_BASE; if ($this->url_style == 'sef') { $url .= substr(PATH_RELATIVE,0,-1).$this->sefPath; } else { $url .= urldecode((empty($_SERVER['REQUEST_URI'])) ? $_ENV['REQUEST_URI'] : $_SERVER['REQUEST_URI']); } return expString::sanitize($url); }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
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-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 moveVotes() { $sql = "SELECT * FROM package_proposal_votes WHERE pkg_prop_id = {$this->proposal}"; $res = $this->mdb2->query($sql); if (MDB2::isError($res)) { throw new RuntimeException("DB error occurred: {$res->getDebugInfo()}"); } if ($res->numRows() == 0) { return; // nothing to do } $insert = "INSERT INTO package_proposal_comments ("; $insert .= "user_handle, pkg_prop_id, timestamp, comment"; $insert .= ") VALUES(%s, {$this->proposal}, %d, %s)"; $delete = "DELETE FROM package_proposal_votes WHERE"; $delete .= " pkg_prop_id = {$this->proposal}"; $delete .= " AND user_handle = %s"; while ($row = $res->fetchRow(MDB2_FETCHMODE_OBJECT)) { $comment = "Original vote: {$row->value}\n"; $comment .= "Conditional vote: " . ($row->is_conditional != 0)?'yes':'no' . "\n"; $comment .= "Comment on vote: " . $row->comment . "\n\n"; $comment .= "Reviewed: " . implode(", ", unserialize($row->reviews)); $sql = sprintf( $insert, $this->mdb2->quote($row->user_handle), $row->timestamp, $this->mdb2->quote($comment) ); $this->queryChange($sql); $sql = sprintf( $delete, $this->mdb2->quote($row->user_handle) ); $this->queryChange($sql); }
0
PHP
CWE-502
Deserialization of Untrusted Data
The application deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
} elseif ($part != '.' || $part === '') { $depath++; }
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
public function show() { $task = $this->getTask(); $subtask = $this->getSubtask(); $this->response->html($this->template->render('subtask_converter/show', array( 'subtask' => $subtask, 'task' => $task, ))); }
0
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
function log($msg) { $data = sprintf("[%s] [%s] [%s] %s\n", date('r'), $_SERVER['REQUEST_URI'], (!empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '-'), $msg); $data = strtr($data, '<>', '..'); $filename = w3_debug_log('minify'); 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 configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ self::DEFAULT_OPT => "'self'", self::IMG_OPT => "* data: blob:", self::MEDIA_OPT => "'self' data:", self::SCRIPT_OPT => "'self' 'nonce-" . $this->getNonce() . "' 'unsafe-inline' 'unsafe-eval'", self::STYLE_OPT => "'self' 'unsafe-inline'", self::FRAME_OPT => "'self'", self::CONNECT_OPT => "'self' blob:", self::FONT_OPT => "'self'", ]); }
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 params() { $project = $this->getProject(); $values = $this->request->getValues(); $values['project_id'] = $project['id']; if (empty($values['action_name']) || empty($values['event_name'])) { $this->create(); return; } $action = $this->actionManager->getAction($values['action_name']); $action_params = $action->getActionRequiredParameters(); if (empty($action_params)) { $this->doCreation($project, $values + array('params' => array())); } $projects_list = $this->projectUserRoleModel->getActiveProjectsByUser($this->userSession->getId()); unset($projects_list[$project['id']]); $this->response->html($this->template->render('action_creation/params', array( 'values' => $values, 'action_params' => $action_params, 'columns_list' => $this->columnModel->getList($project['id']), 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id']), 'projects_list' => $projects_list, 'colors_list' => $this->colorModel->getList(), 'categories_list' => $this->categoryModel->getList($project['id']), 'links_list' => $this->linkModel->getList(0, false), 'priorities_list' => $this->projectTaskPriorityModel->getPriorities($project), 'project' => $project, 'available_actions' => $this->actionManager->getAvailableActions(), 'swimlane_list' => $this->swimlaneModel->getList($project['id']), '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
public function save() { global $DB; if(!empty($this->id)) return $this->update(); else return $this->insert(); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
private function decryptContentEncryptionKey($private_key_or_secret) { $this->generateContentEncryptionKey(null); # NOTE: run this always not to make timing difference $fake_content_encryption_key = $this->content_encryption_key; switch ($this->header['alg']) { case 'RSA1_5': $rsa = $this->rsa($private_key_or_secret, RSA::ENCRYPTION_PKCS1); $this->content_encryption_key = $rsa->decrypt($this->jwe_encrypted_key); break; case 'RSA-OAEP': $rsa = $this->rsa($private_key_or_secret, RSA::ENCRYPTION_OAEP); $this->content_encryption_key = $rsa->decrypt($this->jwe_encrypted_key); break; case 'dir': $this->content_encryption_key = $private_key_or_secret; break; case 'A128KW': case 'A256KW': case 'ECDH-ES': case 'ECDH-ES+A128KW': case 'ECDH-ES+A256KW': throw new JOSE_Exception_UnexpectedAlgorithm('Algorithm not supported'); default: throw new JOSE_Exception_UnexpectedAlgorithm('Unknown algorithm'); } if (!$this->content_encryption_key) { # NOTE: # Not to disclose timing difference between CEK decryption error and others. # Mitigating Bleichenbacher Attack on PKCS#1 v1.5 # ref.) http://inaz2.hatenablog.com/entry/2016/01/26/222303 $this->content_encryption_key = $fake_content_encryption_key; } }
1
PHP
CWE-310
Cryptographic Issues
Weaknesses in this category are related to the design and implementation of data confidentiality and integrity. Frequently these deal with the use of encoding techniques, encryption libraries, and hashing algorithms. The weaknesses in this category could lead to a degradation of the quality data if they are not addressed.
https://cwe.mitre.org/data/definitions/310.html
safe
public function afterSave($event) { // look up current tags $oldTags = $this->getTags(); $newTags = array(); foreach ($this->scanForTags() as $tag) { if (!$this->hasTag ($tag, $oldTags)) { // don't add duplicates if there are already tags $tagModel = new Tags; $tagModel->tag = $tag; $tagModel->type = get_class($this->getOwner()); $tagModel->itemId = $this->getOwner()->id; $tagModel->itemName = $this->getOwner()->name; $tagModel->taggedBy = Yii::app()->getSuName(); $tagModel->timestamp = time(); if ($tagModel->save()) $newTags[] = $tag; } } $this->_tags = $newTags + $oldTags; // update tag cache if (!empty($newTags) && $this->flowTriggersEnabled) { X2Flow::trigger('RecordTagAddTrigger', array( 'model' => $this->getOwner(), 'tags' => $newTags, )); } }
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 testBuildsRequestTargetWithFalseyQuery() { $r1 = new Request('GET', 'http://foo.com/baz?0'); $this->assertEquals('/baz?0', $r1->getRequestTarget()); }
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 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 refreshUser(UserInterface $user) { $user = $this->inner->refreshUser($user); $alterUser = \Closure::bind(function (InMemoryUser $user) { $user->password = 'foo'; }, null, class_exists(User::class) ? User::class : InMemoryUser::class); $alterUser($user); return $user; }
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
private function isStringNotEmpty($param) { return is_string($param) && false === empty($param); }
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 getKeyLength() { return $this->key_length << 3; }
1
PHP
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
safe
public function testQuotesPages () { $this->visitPages ($this->getPages ('^quotes')); }
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
$this->error("alias '$alias'", 'must be an alias to an allowed value'); } } }
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 setup($config) { // TODO: create custom child-definition for noscript that // auto-wraps stray #PCDATA in a similar manner to // blockquote's custom definition (we would use it but // blockquote's contents are optional while noscript's contents // are required) // TODO: convert this to new syntax, main problem is getting // both content sets working // In theory, this could be safe, but I don't see any reason to // allow it. $this->info['noscript'] = new HTMLPurifier_ElementDef(); $this->info['noscript']->attr = array( 0 => array('Common') ); $this->info['noscript']->content_model = 'Heading | List | Block'; $this->info['noscript']->content_model_type = 'required'; $this->info['script'] = new HTMLPurifier_ElementDef(); $this->info['script']->attr = array( 'defer' => new HTMLPurifier_AttrDef_Enum(array('defer')), 'src' => new HTMLPurifier_AttrDef_URI(true), 'type' => new HTMLPurifier_AttrDef_Enum(array('text/javascript')) ); $this->info['script']->content_model = '#PCDATA'; $this->info['script']->content_model_type = 'optional'; $this->info['script']->attr_transform_pre[] = $this->info['script']->attr_transform_post[] = new HTMLPurifier_AttrTransform_ScriptRequired(); }
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 setup($config) { $ol = $this->addElement('ol', 'List', new HTMLPurifier_ChildDef_List(), 'Common'); $ul = $this->addElement('ul', 'List', new HTMLPurifier_ChildDef_List(), 'Common'); // XXX The wrap attribute is handled by MakeWellFormed. This is all // quite unsatisfactory, because we generated this // *specifically* for lists, and now a big chunk of the handling // is done properly by the List ChildDef. So actually, we just // want enough information to make autoclosing work properly, // and then hand off the tricky stuff to the ChildDef. $ol->wrap = 'li'; $ul->wrap = 'li'; $this->addElement('dl', 'List', 'Required: dt | dd', 'Common'); $this->addElement('li', false, 'Flow', 'Common'); $this->addElement('dd', false, 'Flow', 'Common'); $this->addElement('dt', false, 'Inline', 'Common'); }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
private function getResponse($size = 128) { $response = fgets($this->pop_conn, $size); if ($this->do_debug >= 1) { echo "Server -> Client: $response"; } return $response; }
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 addCallback($method, $callback, $args, $help) { $this->callbacks[$method] = $callback; $this->signatures[$method] = $args; $this->help[$method] = $help; }
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 testLDAPConnection($auths_id, $replicate_id = -1) { $config_ldap = new self(); $res = $config_ldap->getFromDB($auths_id); // we prevent some delay... if (!$res) { return false; } //Test connection to a replicate if ($replicate_id != -1) { $replicate = new AuthLdapReplicate(); $replicate->getFromDB($replicate_id); $host = $replicate->fields["host"]; $port = $replicate->fields["port"]; } else { //Test connection to a master ldap server $host = $config_ldap->fields['host']; $port = $config_ldap->fields['port']; } $ds = self::connectToServer($host, $port, $config_ldap->fields['rootdn'], Toolbox::decrypt($config_ldap->fields['rootdn_passwd'], GLPIKEY), $config_ldap->fields['use_tls'], $config_ldap->fields['deref_option']); if ($ds) { return true; } return false; }
0
PHP
CWE-327
Use of a Broken or Risky Cryptographic Algorithm
The use of a broken or risky cryptographic algorithm is an unnecessary risk that may result in the exposure of sensitive information.
https://cwe.mitre.org/data/definitions/327.html
vulnerable
function GoodAuthDigestTestController($serverPort) { $args = array('Authorization' => 'Digest username="admin", ' . 'realm="Restricted area", nonce="564a12611dae8", ' . 'uri="/test_auth_digest.php", cnonce="MjIyMTg1", nc=00000001, ' . 'qop="auth", response="e544aaed06917adea3e5c74dd49f0e32", ' . 'opaque="cdce8a5c95a1427d74df7acbf41c9ce0"'); var_dump(request(php_uname('n'), $serverPort, "test_auth_digest.php", [], [], $args)); }
0
PHP
CWE-668
Exposure of Resource to Wrong Sphere
The product exposes a resource to the wrong control sphere, providing unintended actors with inappropriate access to the resource.
https://cwe.mitre.org/data/definitions/668.html
vulnerable
public function buildControl() { $control = new colorcontrol(); if (!empty($this->params['value'])) $control->value = $this->params['value']; if ($this->params['value'][0] != '#') $this->params['value'] = '#' . $this->params['value']; $control->default = $this->params['value']; if (!empty($this->params['hide'])) $control->hide = $this->params['hide']; if (isset($this->params['flip'])) $control->flip = $this->params['flip']; $this->params['name'] = !empty($this->params['name']) ? $this->params['name'] : ''; $control->name = $this->params['name']; $this->params['id'] = !empty($this->params['id']) ? $this->params['id'] : ''; $control->id = isset($this->params['id']) && $this->params['id'] != "" ? $this->params['id'] : ""; //echo $control->id; if (empty($control->id)) $control->id = $this->params['name']; if (empty($control->name)) $control->name = $this->params['id']; // attempt to translate the label if (!empty($this->params['label'])) { $this->params['label'] = gt($this->params['label']); } else { $this->params['label'] = null; } echo $control->toHTML($this->params['label'], $this->params['name']); // $ar = new expAjaxReply(200, gt('The control was created'), json_encode(array('data'=>$code))); // $ar->send(); }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public static function getHelpVersion($version_id) { global $db; return $db->selectValue('help_version', 'version', 'id="'.$version_id.'"'); }
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 insert() { global $DB; $ok = $DB->execute(' INSERT INTO nv_menus (id, codename, icon, lid, notes, functions, enabled) VALUES ( 0, :codename, :icon, :lid, :notes, :functions, :enabled)', array( 'codename' => value_or_default($this->codename, ""), 'icon' => value_or_default($this->icon, ""), 'lid' => value_or_default($this->lid, 0), 'notes' => value_or_default($this->notes, ""), 'functions' => json_encode($this->functions), 'enabled' => value_or_default($this->enabled, 0) ) ); if(!$ok) throw new Exception($DB->get_last_error()); $this->id = $DB->get_last_id(); 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 get_filedisplay_views() { expTemplate::get_filedisplay_views(); $paths = array( BASE.'framework/modules/common/views/file/', BASE.'themes/'.DISPLAY_THEME.'modules/common/views/file/', ); $views = array(); foreach ($paths as $path) { if (is_readable($path)) { $dh = opendir($path); while (($file = readdir($dh)) !== false) { if (is_readable($path.'/'.$file) && substr($file, -4) == '.tpl' && substr($file, -14) != '.bootstrap.tpl' && substr($file, -15) != '.bootstrap3.tpl' && substr($file, -10) != '.newui.tpl') { $filename = substr($file, 0, -4); $views[$filename] = gt($filename); } } } } return $views; }
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 accept(NodeVisitor $nodeVisitor) { $this->treeRoot->accept($nodeVisitor); }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
protected function registerBackendPermissions() { BackendAuth::registerCallback(function ($manager) { $manager->registerPermissions('October.Backend', [ 'backend.access_dashboard' => [ 'label' => 'system::lang.permissions.view_the_dashboard', 'tab' => 'system::lang.permissions.name' ], 'backend.manage_default_dashboard' => [ 'label' => 'system::lang.permissions.manage_default_dashboard', 'tab' => 'system::lang.permissions.name', ], 'backend.manage_users' => [ 'label' => 'system::lang.permissions.manage_other_administrators', 'tab' => 'system::lang.permissions.name' ], 'backend.impersonate_users' => [ 'label' => 'system::lang.permissions.impersonate_users', 'tab' => 'system::lang.permissions.name', ], 'backend.manage_preferences' => [ 'label' => 'system::lang.permissions.manage_preferences', 'tab' => 'system::lang.permissions.name' ], 'backend.manage_editor' => [ 'label' => 'system::lang.permissions.manage_editor', 'tab' => 'system::lang.permissions.name' ], 'backend.manage_branding' => [ 'label' => 'system::lang.permissions.manage_branding', 'tab' => 'system::lang.permissions.name' ], 'media.manage_media' => [ 'label' => 'backend::lang.permissions.manage_media', 'tab' => 'system::lang.permissions.name', ] ]); }); }
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); }
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 delete_version() { if (empty($this->params['id'])) { flash('error', gt('The version you are trying to delete could not be found')); } // get the version $version = new help_version($this->params['id']); if (empty($version->id)) { flash('error', gt('The version you are trying to delete could not be found')); } // if we have errors than lets get outta here! if (!expQueue::isQueueEmpty('error')) expHistory::back(); // delete the version $version->delete(); expSession::un_set('help-version'); flash('message', gt('Deleted version').' '.$version->version.' '.gt('and all documents in that version.')); 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 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 function onKernelResponse(ResponseEvent $event) { if (!$this->config['admin_csp_header']['enabled']) { return; } $request = $event->getRequest(); if (!$event->isMainRequest()) { return; } if (!$this->matchesPimcoreContext($request, PimcoreContextResolver::CONTEXT_ADMIN)) { return; } if ($this->requestHelper->isFrontendRequestByAdmin($request)) { return; } if (!empty($this->config['admin_csp_header']['exclude_paths'])) { $requestUri = $request->getRequestUri(); foreach ($this->config['admin_csp_header']['exclude_paths'] as $path) { if (@preg_match($path, $requestUri)) { return; } } } $response = $event->getResponse(); // set CSP header with random nonce string to the response $response->headers->set('Content-Security-Policy', $this->contentSecurityPolicyHandler->getCspHeader()); }
1
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public function search() { // global $db, $user; global $db; $sql = "select DISTINCT(a.id) as id, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email "; $sql .= "from " . $db->prefix . "addresses as a "; //R JOIN " . //$db->prefix . "billingmethods as bm ON bm.addresses_id=a.id "; $sql .= " WHERE match (a.firstname,a.lastname,a.email,a.organization) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) "; $sql .= "order by match (a.firstname,a.lastname,a.email,a.organization) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) ASC LIMIT 12"; $res = $db->selectObjectsBySql($sql); foreach ($res as $key=>$record) { $res[$key]->title = $record->firstname . ' ' . $record->lastname; } //eDebug($sql); $ar = new expAjaxReply(200, gt('Here\'s the items you wanted'), $res); $ar->send(); }
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
$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); }
1
PHP
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
safe
protected function getComment() { $comment = $this->commentModel->getById($this->request->getIntegerParam('comment_id')); if (empty($comment)) { throw new PageNotFoundException(); } if (! $this->userSession->isAdmin() && $comment['user_id'] != $this->userSession->getId()) { throw new AccessForbiddenException(); } return $comment; }
0
PHP
CWE-639
Authorization Bypass Through User-Controlled Key
The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.
https://cwe.mitre.org/data/definitions/639.html
vulnerable
public 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-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
public function escape($input) { // Ensure we have valid correctly encoded string.. // http://stackoverflow.com/questions/1412239/why-call-mb-convert-encoding-to-sanitize-text $input = mb_convert_encoding($input, "UTF-8", "UTF-8"); // why are we using html entities? this -> http://stackoverflow.com/a/110576/992171 return htmlentities($input, ENT_QUOTES, 'UTF-8'); }
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 actionGetItems(){ $model = X2Model::model ($this->modelClass); if (isset ($model)) { $tableName = $model->tableName (); $sql = 'SELECT id, fileName as value FROM '.$tableName.' WHERE associationType!="theme" and fileName LIKE :qterm ORDER BY fileName ASC'; $command = Yii::app()->db->createCommand($sql); $qterm = $_GET['term'].'%'; $command->bindParam(":qterm", $qterm, PDO::PARAM_STR); $result = $command->queryAll(); echo CJSON::encode($result); } Yii::app()->end(); }
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