code
stringlengths 12
2.05k
| label
int64 0
1
| programming_language
stringclasses 9
values | cwe_id
stringlengths 6
14
| cwe_name
stringlengths 5
103
⌀ | description
stringlengths 36
1.23k
⌀ | url
stringlengths 36
48
⌀ | label_name
stringclasses 2
values |
---|---|---|---|---|---|---|---|
public static function getParent($id){
$q = self::getId($id);
return $q[0]->parent;
}
| 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
public function load_by_profile($network, $network_user_id)
{
global $DB;
global $session;
// the profile exists (connected to a social network)?
$swuser = $DB->query_single(
'webuser',
'nv_webuser_profiles',
' network = '.protect($network).' AND '.
' network_user_id = '.protect($network_user_id)
);
if(!empty($swuser))
$this->load($swuser);
}
| 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 notifyEnd($token) {} | 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()
{
} | 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 updateAmazonOrderTracking($order_id, $courier_id, $courier_from_list, $tracking_no) {
$this->db->query("
UPDATE `" . DB_PREFIX . "amazon_order`
SET `courier_id` = '" . $this->db->escape($courier_id) . "',
`courier_other` = " . (int)!$courier_from_list . ",
`tracking_no` = '" . $this->db->escape($tracking_no) . "'
WHERE `order_id` = " . (int)$order_id . ""); | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $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 static function getParam($param, $post_id)
{
$sql = "SELECT * FROM `posts_param` WHERE `post_id` = '{$post_id}' AND `param` = '{$param}' LIMIT 1";
$q = Db::result($sql);
if (Db::$num_rows > 0) {
return $q[0]->value;
} else {
return '';
}
} | 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 disconnect()
{
$this->sendString('QUIT');
//The QUIT command may cause the daemon to exit, which will kill our connection
//So ignore errors here
try {
@fclose($this->pop_conn);
} catch (Exception $e) {
//Do nothing
};
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
public function remove()
{
$id = (int)$this->id;
try {
$delete = $this->zdb->delete(self::TABLE);
$delete->where(
self::PK . ' = ' . $id
);
$this->zdb->execute($delete);
Analog::log(
'Saved search #' . $id . ' (' . $this->name
. ') deleted successfully.',
Analog::INFO
);
return true;
} catch (\RuntimeException $re) {
throw $re;
} catch (Throwable $e) {
Analog::log(
'Unable to delete saved search ' . $id . ' | ' . $e->getMessage(),
Analog::ERROR
);
throw $e;
}
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
function csv_log_html($logname='') {
check_file_dir_name($logname);
$html_str = "<div class='filetext'>".PHP_EOL."<ol class='logview'>".PHP_EOL;
$fp = csv_edih_basedir().DS.'log'.DS.$logname;
if ( is_file($fp) ) {
$fh = fopen( $fp, 'r');
if ($fh !== FALSE) {
while (($buffer = fgets($fh)) !== false) {
$html_str .= "<li>".$buffer."</li>".PHP_EOL;
}
$html_str .= "</ol>".PHP_EOL."</div>".PHP_EOL;
if (!feof($fh)) {
$html_str .= "<p>Error in logfile: unexpected file ending</p>".PHP_EOL;
}
fclose($fh);
} else {
$html_str = "<p>Error: unable to open log file</p>".PHP_EOL;
}
}
return $html_str;
} | 1 | PHP | CWE-116 | Improper Encoding or Escaping of Output | The software prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. As a result, the intended structure of the message is not preserved. | https://cwe.mitre.org/data/definitions/116.html | safe |
public static function getErrorMessage ($pcreConstant) {
$definedConstants = get_defined_constants (true);
$pcreConstantsByErrorCodes = array_flip ($definedConstants['pcre']);
return isset ($pcreConstantsByErrorCodes[$pcreConstant]) ?
$pcreConstantsByErrorCodes[$pcreConstant] : '';
} | 1 | PHP | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | safe |
foreach ($day as $extevent) {
$event_cache = new stdClass();
$event_cache->feed = $extgcalurl;
$event_cache->event_id = $extevent->event_id;
$event_cache->title = $extevent->title;
$event_cache->body = $extevent->body;
$event_cache->eventdate = $extevent->eventdate->date;
if (isset($extevent->dateFinished) && $extevent->dateFinished != -68400)
$event_cache->dateFinished = $extevent->dateFinished;
if (isset($extevent->eventstart))
$event_cache->eventstart = $extevent->eventstart;
if (isset($extevent->eventend))
$event_cache->eventend = $extevent->eventend;
if (isset($extevent->is_allday))
$event_cache->is_allday = $extevent->is_allday;
$found = false;
if ($extevent->eventdate->date < $start) // prevent duplicating events crossing month boundaries
$found = $db->selectObject('event_cache','feed="'.$extgcalurl.'" AND event_id="'.$event_cache->event_id.'" AND eventdate='.$event_cache->eventdate);
if (!$found)
$db->insertObject($event_cache,'event_cache');
}
| 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
private function getCategory()
{
$category = $this->categoryModel->getById($this->request->getIntegerParam('category_id'));
if (empty($category)) {
throw new PageNotFoundException();
}
return $category;
} | 0 | PHP | CWE-639 | Authorization Bypass Through User-Controlled Key | The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. | https://cwe.mitre.org/data/definitions/639.html | vulnerable |
protected function text($text) {
return $this->generator->generateFromToken(
new HTMLPurifier_Token_Text($text)
);
} | 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 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 .= ',css,json,zip,gzip,csv,7z';
break;
case 'documents':
case 'doc':
$are_allowed .= ',doc,docx,pdf,odt,pages,rtf,txt,pps,ppt,pptx,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;
} | 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 () {
if (self::existConf()) {
# code...
self::config('config');
self::lang(GX_LANG);
}else{
GxMain::install();
}
} | 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 testReturnsIdentityWhenRemovingMissingHeader()
{
$r = new Response();
$this->assertSame($r, $r->withoutHeader('foo'));
} | 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 referenceFixtures() {
return array(
'campaign' => array ('Campaign', '.CampaignMailingBehaviorTest'),
'lists' => 'X2List',
'credentials' => 'Credentials',
'users' => 'User',
'profile' => array('Profile','.marketing'),
'actions' => 'Actions'
);
} | 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 getFallbackFor($code) {
$this->loadLanguage($code);
return $this->cache[$code]['fallback'];
} | 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 isStruct($array)
{
$expected = 0;
foreach ($array as $key => $value) {
if ((string)$key != (string)$expected) {
return true;
}
$expected++;
}
return false;
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
public function 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;
}
$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 createText($data) {
$p = clone $this->p_text;
$p->__construct($data);
return $p;
} | 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 getTaskLink()
{
$link = $this->taskLinkModel->getById($this->request->getIntegerParam('link_id'));
if (empty($link)) {
throw new PageNotFoundException();
}
return $link;
} | 0 | PHP | CWE-639 | Authorization Bypass Through User-Controlled Key | The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. | https://cwe.mitre.org/data/definitions/639.html | vulnerable |
private function __uploadLogo($orgId)
{
if (!isset($this->request->data['Organisation']['logo']['size'])) {
return false;
}
$logo = $this->request->data['Organisation']['logo'];
if ($logo['size'] > 0 && $logo['error'] == 0) {
$extension = pathinfo($logo['name'], PATHINFO_EXTENSION);
$filename = $orgId . '.' . ($extension === 'svg' ? 'svg' : 'png');
if ($extension === 'svg' && !Configure::read('Security.enable_svg_logos')) {
$this->Flash->error(__('Invalid file extension, SVG images are not allowed.'));
return false;
}
if (!empty($logo['tmp_name']) && is_uploaded_file($logo['tmp_name'])) {
return move_uploaded_file($logo['tmp_name'], APP . 'webroot/img/orgs/' . $filename);
}
} | 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 getEntries($id) {
$mod = new BigTreeModule("btx_form_builder_entries");
return $mod->getMatching("form",$id,"id DESC");
} | 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 withStatus($code, $reasonPhrase = '')
{
$new = clone $this;
$new->statusCode = (int) $code;
if (!$reasonPhrase && isset(self::$phrases[$new->statusCode])) {
$reasonPhrase = self::$phrases[$new->statusCode];
}
$new->reasonPhrase = $reasonPhrase;
return $new;
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$swimlane_id = $this->request->getIntegerParam('swimlane_id');
if ($this->swimlaneModel->remove($project['id'], $swimlane_id)) {
$this->flash->success(t('Swimlane removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove 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 |
protected function _dirname($path) {
return dirname($path);
} | 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 quicksearch($text)
{
global $DB;
global $website;
$like = ' LIKE '.protect('%'.$text.'%');
// we search for the IDs at the dictionary NOW (to avoid inefficient requests)
$DB->query('SELECT DISTINCT (nvw.node_id)
FROM nv_webdictionary nvw
WHERE nvw.node_type = "feed"
AND nvw.website = '.$website->id.'
AND nvw.text '.$like, 'array');
$dict_ids = $DB->result("node_id");
// all columns to look for
$cols[] = 'i.id' . $like;
if(!empty($dict_ids))
$cols[] = 'i.id IN ('.implode(',', $dict_ids).')';
$where = ' AND ( ';
$where.= implode( ' OR ', $cols);
$where .= ')';
return $where;
}
| 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 |
$removed[] = $fi->getFilename();
}
if ($removed = implode(', ', $removed)) {
$result .= $removed . ' ' . dgettext('tuleap-tracker', 'removed');
}
$added = $this->fetchAddedFiles(array_diff($this->files, $changeset_value->getFiles()), $format, $is_for_mail);
if ($added && $result) {
$result .= $format === 'html' ? '; ' : PHP_EOL;
}
$result .= $added;
return $result;
}
return false;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function __toString()
{
$str = $this->data['Name'] . '=' . $this->data['Value'] . '; ';
foreach ($this->data as $k => $v) {
if ($k != 'Name' && $k != 'Value' && $v !== null && $v !== false) {
if ($k == 'Expires') {
$str .= 'Expires=' . gmdate('D, d M Y H:i:s \G\M\T', $v) . '; ';
} else {
$str .= ($v === true ? $k : "{$k}={$v}") . '; ';
}
}
}
return rtrim($str, '; ');
} | 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 renderImageByGD($code)
{
$image = imagecreatetruecolor($this->width, $this->height);
$backColor = imagecolorallocate(
$image,
(int) ($this->backColor % 0x1000000 / 0x10000),
(int) ($this->backColor % 0x10000 / 0x100),
$this->backColor % 0x100
);
imagefilledrectangle($image, 0, 0, $this->width - 1, $this->height - 1, $backColor);
imagecolordeallocate($image, $backColor);
if ($this->transparent) {
imagecolortransparent($image, $backColor);
}
$foreColor = imagecolorallocate(
$image,
(int) ($this->foreColor % 0x1000000 / 0x10000),
(int) ($this->foreColor % 0x10000 / 0x100),
$this->foreColor % 0x100
);
$length = strlen($code);
$box = imagettfbbox(30, 0, $this->fontFile, $code);
$w = $box[4] - $box[0] + $this->offset * ($length - 1);
$h = $box[1] - $box[5];
$scale = min(($this->width - $this->padding * 2) / $w, ($this->height - $this->padding * 2) / $h);
$x = 10;
$y = round($this->height * 27 / 40);
for ($i = 0; $i < $length; ++$i) {
$fontSize = (int) (mt_rand(26, 32) * $scale * 0.8);
$angle = mt_rand(-10, 10);
$letter = $code[$i];
$box = imagettftext($image, $fontSize, $angle, $x, $y, $foreColor, $this->fontFile, $letter);
$x = $box[2] + $this->offset;
}
imagecolordeallocate($image, $foreColor);
ob_start();
imagepng($image);
imagedestroy($image);
return ob_get_clean();
} | 0 | PHP | CWE-330 | Use of Insufficiently Random Values | The software uses insufficiently random numbers or values in a security context that depends on unpredictable numbers. | https://cwe.mitre.org/data/definitions/330.html | vulnerable |
public function 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-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 updateProfile($data) {
global $bigtree;
$name = sqlescape(htmlspecialchars($data["name"]));
$company = sqlescape(htmlspecialchars($data["company"]));
$daily_digest = $data["daily_digest"] ? "on" : "";
$id = sqlescape($this->ID);
if ($data["password"]) {
$phpass = new PasswordHash($bigtree["config"]["password_depth"], TRUE);
$password = sqlescape($phpass->HashPassword($data["password"]));
sqlquery("UPDATE bigtree_users SET `password` = '$password', `name` = '$name', `company` = '$company', `daily_digest` = '$daily_digest' WHERE id = '$id'");
} else {
sqlquery("UPDATE bigtree_users SET `name` = '$name', `company` = '$company', `daily_digest` = '$daily_digest' WHERE id = '$id'");
}
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
public function actionHideWidget() {
if (isset($_POST['name'])) {
$name = $_POST['name'];
$layout = Yii::app()->params->profile->getLayout();
// the widget could be in any of the blocks in the page, so check all of them
foreach ($layout as $b => &$block) {
if (isset($block[$name])) {
if ($b == 'right') {
$layout['hiddenRight'][$name] = $block[$name];
} else {
$layout['hidden'][$name] = $block[$name];
}
unset($block[$name]);
Yii::app()->params->profile->saveLayout($layout);
break;
}
}
// make a list of hidden widgets, using <li>, to send back to the browser
$list = "";
foreach ($layout['hidden'] as $name => $widget) {
$list .= "<li><span class=\"x2-widget-menu-item\" id=\"$name\">{$widget['title']}</span></li>";
}
foreach ($layout['hiddenRight'] as $name => $widget) {
$list .= "<li><span class=\"x2-widget-menu-item right\" id=\"$name\">{$widget['title']}</span></li>";
}
echo Yii::app()->params->profile->getWidgetMenu();
}
} | 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_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 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));
} | 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 build(ContainerBuilder $container)
{
// auto-tag GDPR data providers
$container
->registerForAutoconfiguration(DataProviderInterface::class)
->addTag('pimcore.gdpr.data-provider');
$container->addCompilerPass(new SerializerPass());
$container->addCompilerPass(new GDPRDataProviderPass());
$container->addCompilerPass(new ImportExportLocatorsPass());
$container->addCompilerPass(new TranslationServicesPass());
$container->addCompilerPass(new ContentSecurityPolicyUrlsPass());
/** @var SecurityExtension $extension */
$extension = $container->getExtension('security');
$extension->addSecurityListenerFactory(new PreAuthenticatedAdminSessionFactory());
} | 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 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 static function navtojson() {
return json_encode(self::navhierarchy());
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
$navs[$i]->link = expCore::makeLink(array('section' => $navs[$i]->id), '', $navs[$i]->sef_name);
if (!$view) {
// unset($navs[$i]); //FIXME this breaks jstree if we remove a parent and not the child
$attr = new stdClass();
$attr->class = 'hidden'; // bs3 class to hide elements
$navs[$i]->li_attr = $attr;
}
} | 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 __toString()
{
return self::createUriString(
$this->scheme,
$this->getAuthority(),
$this->getPath(),
$this->query,
$this->fragment
);
} | 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 |
AND lang = '.protect($lang).'
AND subtype IN ('.implode(",", array_map(function($k){ return protect($k);}, $subtypes)).')'
);
| 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 delete($id)
{
$id = Typo::int($id);
try {
$vars1 = array(
'table' => 'posts',
'where' => array(
'id' => $id,
),
);
$d = Db::delete($vars1);
$vars2 = array(
'table' => 'posts_param',
'where' => array(
'post_id' => $id,
),
);
$d = Db::delete($vars2);
Hooks::run('post_sqldel_action', $id);
return true;
} catch (Exception $e) {
return $e->getMessage();
}
} | 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()
{
self::$key = Options::v('google_captcha_sitekey');
self::$secret = Options::v('google_captcha_secret');
self::$lang = Options::v('google_captcha_lang');
} | 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 |
$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 static function fromGlobals()
{
$method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
$headers = function_exists('getallheaders') ? getallheaders() : [];
$uri = self::getUriFromGlobals();
$body = new LazyOpenStream('php://input', 'r+');
$protocol = isset($_SERVER['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $_SERVER['SERVER_PROTOCOL']) : '1.1';
$serverRequest = new ServerRequest($method, $uri, $headers, $body, $protocol, $_SERVER);
return $serverRequest
->withCookieParams($_COOKIE)
->withQueryParams($_GET)
->withParsedBody($_POST)
->withUploadedFiles(self::normalizeFiles($_FILES));
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
public static function options($var) {
if (self::optionsExist($var)) {
include(GX_THEME.$var.'/options.php');
}
}
| 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
private function isWindows()
{
return DIRECTORY_SEPARATOR !== '/';
} | 0 | PHP | CWE-330 | Use of Insufficiently Random Values | The software uses insufficiently random numbers or values in a security context that depends on unpredictable numbers. | https://cwe.mitre.org/data/definitions/330.html | vulnerable |
public function serialize() {
$this->getDefinition('HTML');
$this->getDefinition('CSS');
$this->getDefinition('URI');
return serialize($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 static function checkPermissions($permission,$location) {
global $exponent_permissions_r, $router;
// only applies to the 'manage' method
if (empty($location->src) && empty($location->int) && (!empty($router->params['action']) && $router->params['action'] == 'manage') || strpos($router->current_url, 'action=manage') !== false) {
if (!empty($exponent_permissions_r['navigation'])) foreach ($exponent_permissions_r['navigation'] as $page) {
foreach ($page as $pageperm) {
if (!empty($pageperm['manage'])) return true;
}
}
}
return false;
}
| 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 destroy()
{
session_destroy();
unset($_SESSION['gxsess']);
} | 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 strip_tags($input, $encode = TRUE)
{
require_once APPPATH.'libraries/htmlpurifier/HTMLPurifier.auto.php';
$config = HTMLPurifier_Config::createDefault();
// Defaults to UTF-8
// $config->set('Core.Encoding', 'UTF-8');
// $config->set('HTML.Doctype', 'XHTML 1.0 Transitional');
$config->set('Core.EnableIDNA', TRUE);
$config->set('HTML.Allowed', "");
$purifier = new HTMLPurifier($config);
$clean_html = $purifier->purify($input);
return $encode ? self::escape($clean_html) : $clean_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 |
function MAX_displayAcls($acls, $aParams)
{
$tabindex =& $GLOBALS['tabindex'];
$page = basename($_SERVER['SCRIPT_NAME']);
$conf = $GLOBALS['_MAX']['CONF'];
echo "<form action='{$page}' method='post'>";
echo "<input type='hidden' name='token' value='".urlencode(phpAds_SessionGetToken())."' />";
echo "<label><img src='" . OX::assetPath() . "/images/icon-acl-add.gif' align='absmiddle'> ". $GLOBALS['strACLAdd'] .": ";
echo "<select name='type' accesskey='{$GLOBALS['keyAddNew']}' tabindex='".($tabindex++)."'>"; | 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 |
$this->info[$k] = new HTMLPurifier_AttrDef_CSS_ImportantDecorator($v, $allow_important);
}
$this->setupConfigStuff($config);
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
public function Delete()
{
// Delete "main" ticket
$del_stmt = Database::prepare('
DELETE FROM `' . TABLE_PANEL_TICKETS . '` WHERE `id` = :tid');
Database::pexecute($del_stmt, array(
'tid' => $this->tid
));
// Delete "answers" to ticket"
$del_stmt = Database::prepare('
DELETE FROM `' . TABLE_PANEL_TICKETS . '` WHERE `answerto` = :tid');
Database::pexecute($del_stmt, array(
'tid' => $this->tid
));
return true;
} | 1 | PHP | CWE-732 | Incorrect Permission Assignment for Critical Resource | The product specifies permissions for a security-critical resource in a way that allows that resource to be read or modified by unintended actors. | https://cwe.mitre.org/data/definitions/732.html | safe |
public function update() {
//populate the alt tag field if the user didn't
if (empty($this->params['alt'])) $this->params['alt'] = $this->params['title'];
// call expController update to save the image
parent::update();
} | 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 getQuerySelect()
{
$R1 = 'R1_' . $this->id;
$R2 = 'R2_' . $this->id;
return "$R2.value AS `" . $this->name . "`";
} | 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 lockTable($table,$lockType="WRITE") {
$sql = "LOCK TABLES `" . $this->prefix . "$table` $lockType";
$res = mysqli_query($this->connection, $sql);
return $res;
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
echo '</SCHOOL_' . htmlentities($i) . '>';
$i++;
}
echo '</SCHOOL_ACCESS>';
// }
echo '</STAFF_' . htmlentities($j) . '>';
$j++;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public static function sortByPriority( $parameters ) {
if ( !is_array( $parameters ) ) {
throw new \MWException( __METHOD__ . ': A non-array was passed.' );
}
//'category' to get category headings first for ordermethod.
//'include'/'includepage' to make sure section labels are ready for 'table'.
$priority = [
'distinct' => 1,
'openreferences' => 2,
'ignorecase' => 3,
'category' => 4,
'title' => 5,
'goal' => 6,
'ordercollation' => 7,
'ordermethod' => 8,
'includepage' => 9,
'include' => 10
];
$_first = [];
foreach ( $priority as $parameter => $order ) {
if ( isset( $parameters[$parameter] ) ) {
$_first[$parameter] = $parameters[$parameter];
unset( $parameters[$parameter] );
}
}
$parameters = $_first + $parameters;
return $parameters;
} | 0 | PHP | CWE-400 | Uncontrolled Resource Consumption | The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources. | https://cwe.mitre.org/data/definitions/400.html | vulnerable |
public function create_file() {
if (!AuthUser::hasPermission('file_manager_mkfile')) {
Flash::set('error', __('You do not have sufficient permissions to create a file.'));
redirect(get_url('plugin/file_manager/browse/'));
}
// CSRF checks
if (isset($_POST['csrf_token'])) {
$csrf_token = $_POST['csrf_token'];
if (!SecureToken::validateToken($csrf_token, BASE_URL.'plugin/file_manager/create_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/'));
}
$data = $_POST['file'];
$path = str_replace('..', '', $data['path']);
$filename = str_replace('..', '', $data['name']);
$file = FILES_DIR . DS . $path . DS . $filename;
if (file_put_contents($file, '') !== false) {
$mode = Plugin::getSetting('filemode', 'file_manager');
chmod($file, octdec($mode));
} else {
Flash::set('error', __('File :name has not been created!', array(':name' => $filename)));
}
redirect(get_url('plugin/file_manager/browse/' . $path));
} | 0 | PHP | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
public function remove()
{
$project = $this->getProject();
$this->checkCSRFParam();
$column_id = $this->request->getIntegerParam('column_id');
if ($this->columnModel->remove($column_id)) {
$this->flash->success(t('Column removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this column.'));
}
$this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])));
} | 0 | PHP | CWE-639 | Authorization Bypass Through User-Controlled Key | The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. | https://cwe.mitre.org/data/definitions/639.html | vulnerable |
protected function setUp()
{
$this->object = new PMA_Config;
$GLOBALS['server'] = 0;
$_SESSION['is_git_revision'] = true;
$GLOBALS['PMA_Config'] = new PMA_Config(CONFIG_FILE);
$GLOBALS['cfg']['ProxyUrl'] = '';
//for testing file permissions
$this->permTestObj = new PMA_Config("./config.sample.inc.php");
} | 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 testUnsubTokenReplacement () {
$admin = Yii::app()->settings;
$admin->externalBaseUrl = 'http://examplecrm.com';
$admin->externalBaseUri = '/X2Engine';
$cmb = $this->instantiate();
$contact = $this->contacts('testUser_unsent');
$campaign = $this->campaign('unsubToken');
list($subject,$message,$uniqueId) = $cmb->prepareEmail($campaign,$contact);
// Insert unsubscribe link(s):
$unsubUrl = Yii::app()->createExternalUrl('/marketing/marketing/click', array(
'uid' => $uniqueId,
'type' => 'unsub',
'email' => $contact->email
));
$unsubLinkText = Yii::app()->settings->doNotEmailLinkText;
$expectedLink =
'<a href="'.$unsubUrl.'">'.Yii::t('marketing', $unsubLinkText).'</a>';
$this->assertRegExp(
'/'.preg_quote($expectedLink, '/').'/', $message, 'Unsubscribe link not inserted');
} | 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 manage_messages() {
expHistory::set('manageable', $this->params);
$page = new expPaginator(array(
'model'=>'order_status_messages',
'where'=>1,
'limit'=>10,
'order'=>'body',
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->params['controller'],
'action'=>$this->params['action'],
//'columns'=>array('Name'=>'title')
));
//eDebug($page);
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 |
static function validUTF($string) {
if(!mb_check_encoding($string, 'UTF-8') OR !($string === mb_convert_encoding(mb_convert_encoding($string, 'UTF-32', 'UTF-8' ), 'UTF-8', 'UTF-32'))) {
return false;
}
return true;
} | 0 | PHP | CWE-74 | Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') | The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/74.html | vulnerable |
public static function referenceFixtures () {
return array (
'contacts' => 'Contacts',
'tags' => '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 |
protected function redirectToGroup(Thread $thread, $group_id)
{
if ($thread->state != Thread::STATE_CHATTING) {
// We can redirect only threads which are in proggress now.
return false;
}
// Redirect the thread
$thread->state = Thread::STATE_WAITING;
$thread->nextAgent = 0;
$thread->groupId = $group_id;
$thread->agentId = 0;
$thread->agentName = '';
$thread->save();
// Send notification message
$thread->postMessage(
Thread::KIND_EVENTS,
getlocal(
'Operator {0} redirected you to another operator. Please wait a while.',
array(get_operator_name($this->getOperator())),
$thread->locale,
true
)
);
return true;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function manage_sitemap() {
global $db, $user, $sectionObj, $sections;
expHistory::set('viewable', $this->params);
$id = $sectionObj->id;
$current = null;
// all we need to do is determine the current section
$navsections = $sections;
if ($sectionObj->parent == -1) {
$current = $sectionObj;
} else {
foreach ($navsections as $section) {
if ($section->id == $id) {
$current = $section;
break;
}
}
}
assign_to_template(array(
'sasections' => $db->selectObjects('section', 'parent=-1'),
'sections' => $navsections,
'current' => $current,
'canManage' => ((isset($user->is_acting_admin) && $user->is_acting_admin == 1) ? 1 : 0),
));
}
| 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
public function setHeadListAttributes( $attributes ) {
$this->headListAttributes = \Sanitizer::fixTagAttributes( $attributes, 'ul' );
} | 0 | PHP | CWE-400 | Uncontrolled Resource Consumption | The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources. | https://cwe.mitre.org/data/definitions/400.html | vulnerable |
public function save() {
return $this->tree->save();
} | 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 addParam($param, $value, $post_id)
{
$sql = array(
'table' => 'posts_param',
'key' => array(
'post_id' => $post_id,
'param' => $param,
'value' => $value,
),
);
$q = Db::insert($sql);
if ($q) {
return true;
} else {
return false;
}
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
public function setAutoLogin()
{
// create object and set current session data to AutoLogin
$this->mAutoLogin = new AutoLogin($this->db);
$this->mAutoLogin->setValue('atl_session_id', $this->getValue('ses_session_id'));
$this->mAutoLogin->setValue('atl_org_id', (int) $this->getValue('ses_org_id'));
$this->mAutoLogin->setValue('atl_usr_id', (int) $this->getValue('ses_usr_id'));
// set new auto_login_id and save data
$this->mAutoLogin->setValue('atl_auto_login_id', $this->mAutoLogin->generateAutoLoginId((int) $this->getValue('ses_usr_id')));
$this->mAutoLogin->save();
// save cookie for autologin
$currDateTime = new \DateTime();
$oneYearDateInterval = new \DateInterval('P1Y');
$oneYearAfterDateTime = $currDateTime->add($oneYearDateInterval);
$timestampExpired = $oneYearAfterDateTime->getTimestamp();
self::setCookie($this->cookieAutoLoginId, $this->mAutoLogin->getValue('atl_auto_login_id'), $timestampExpired);
} | 0 | PHP | CWE-613 | Insufficient Session Expiration | According to WASC, "Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization." | https://cwe.mitre.org/data/definitions/613.html | vulnerable |
public function showByTitle() {
expHistory::set('viewable', $this->params);
$modelname = $this->basemodel_name;
// first we'll check to see if this matches the sef_url field...if not then we'll look for the
// title field
$this->params['title'] = expString::escape($this->params['title']); // escape title to prevent sql injection
$record = $this->$modelname->find('first', "sef_url='" . $this->params['title'] . "'");
if (!is_object($record)) {
$record = $this->$modelname->find('first', "title='" . $this->params['title'] . "'");
}
$this->loc = unserialize($record->location_data);
assign_to_template(array(
'record' => $record,
));
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
public static function getParent($id=''){
$sql = sprintf("SELECT `parent` FROM `cat`
WHERE `id` = '%d'", $id);
$cat = Db::result($sql);
return $cat;
}
| 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
public function beforeExecute () {} | 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 setXML($xml_string)
{
$this->xml = $xml_string;
$this->doc = new DOMDocument;
if (!$this->doc) {
return false;
}
if (!@$this->doc->loadXML($xml_string)) {
return false;
}
$this->xpath = new DOMXPath($this->doc);
if ($this->xpath) {
return true;
} else {
return false;
}
} | 0 | PHP | NVD-CWE-noinfo | null | null | null | vulnerable |
$obj = new $modelname(intval($id));
$obj->rank = $rank;
$obj->save(false, true);
$rank++;
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
private function doctypeState() {
/* Consume the next input character: */
$this->char++;
$char = $this->char();
if(preg_match('/^[\t\n\x0b\x0c ]$/', $char)) {
$this->state = 'beforeDoctypeName';
} else {
$this->char--;
$this->state = 'beforeDoctypeName';
}
} | 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 assertProduces($bbcode, $html)
{
$parser = new \JBBCode\Parser();
$parser->addCodeDefinitionSet(new JBBCode\DefaultCodeDefinitionSet());
$parser->parse($bbcode);
$this->assertEquals($html, $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 manage() {
expHistory::set('viewable', $this->params);
$page = new expPaginator(array(
'model'=>'order_status',
'where'=>1,
'limit'=>10,
'order'=>'rank',
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->params['controller'],
'action'=>$this->params['action'],
//'columns'=>array('Name'=>'title')
));
assign_to_template(array(
'page'=>$page
));
} | 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 manage() {
expHistory::set('viewable', $this->params);
$page = new expPaginator(array(
'model'=>'order_status',
'where'=>1,
'limit'=>10,
'order'=>'rank',
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->params['controller'],
'action'=>$this->params['action'],
//'columns'=>array('Name'=>'title')
));
assign_to_template(array(
'page'=>$page
));
} | 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 wp_embed_handler_youtube( $matches, $attr, $url, $rawattr ) {
global $wp_embed;
$embed = $wp_embed->autoembed( sprintf( "https://youtube.com/watch?v=%s", urlencode( $matches[2] ) ) );
/**
* Filters the YoutTube embed output.
*
* @since 4.0.0
*
* @see wp_embed_handler_youtube()
*
* @param string $embed YouTube embed output.
* @param array $attr An array of embed attributes.
* @param string $url The original URL that was matched by the regex.
* @param array $rawattr The original unmodified attributes.
*/
return apply_filters( 'wp_embed_handler_youtube', $embed, $attr, $url, $rawattr );
} | 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 testValidUrl()
{
$urlValidator = new \JBBCode\validators\UrlValidator();
$this->assertTrue($urlValidator->validate('http://google.com'));
$this->assertTrue($urlValidator->validate('http://jbbcode.com/docs'));
$this->assertTrue($urlValidator->validate('https://www.maps.google.com'));
} | 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 |
$_ret[$_k] = $this->convEnc($_v, $from, $to, '', false, $unknown = '_');
}
$var = $_ret;
} else {
$_var = false;
if (is_string($var)) {
$_var = $var;
if (false !== ($_var = iconv($from, $to.'//TRANSLIT', $_var))) {
$_var = str_replace('?', $unknown, $_var);
}
}
if ($_var !== false) {
$var = $_var;
}
}
if ($restoreLocale) {
setlocale(LC_ALL, elFinder::$locale);
}
}
return $var;
} | 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 testOnKernelResponseListenerRemovesItself()
{
$session = $this->createMock(SessionInterface::class);
$session->expects($this->any())->method('getName')->willReturn('SESSIONNAME');
$tokenStorage = $this->createMock(TokenStorageInterface::class);
$dispatcher = $this->createMock(EventDispatcherInterface::class);
$listener = new ContextListener($tokenStorage, [], 'key123', null, $dispatcher);
$request = new Request();
$request->attributes->set('_security_firewall_run', '_security_key123');
$request->setSession($session);
$event = new ResponseEvent($this->createMock(HttpKernelInterface::class), $request, HttpKernelInterface::MAIN_REQUEST, new Response());
$dispatcher->expects($this->once())
->method('removeListener')
->with(KernelEvents::RESPONSE, [$listener, 'onKernelResponse']);
$listener->onKernelResponse($event);
} | 1 | PHP | CWE-287 | Improper Authentication | When an actor claims to have a given identity, the software does not prove or insufficiently proves that the claim is correct. | https://cwe.mitre.org/data/definitions/287.html | safe |
public function setAttributes ($values, $safeOnly=true) {
if (isset ($values['type']) && $this->type !== $values['type']) {
$this->_typeChanged = true;
}
return parent::setAttributes ($values, $safeOnly);
} | 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($course_RET as $period_date)
{
// $period_days_append_sql .="(sp.start_time<='$period_date[END_TIME]' AND '$period_date[START_TIME]'<=sp.end_time AND IF(course_period_date IS NULL, course_period_date='$period_date[COURSE_PERIOD_DATE]',DAYS LIKE '%$period_date[DAYS]%')) OR ";
$period_days_append_sql .="(sp.start_time<='$period_date[END_TIME]' AND '$period_date[START_TIME]'<=sp.end_time AND (cpv.course_period_date IS NULL OR cpv.course_period_date='$period_date[COURSE_PERIOD_DATE]') AND cpv.DAYS LIKE '%$period_date[DAYS]%') OR ";
} | 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 |
$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-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 save_change_password() {
global $user;
$isuser = ($this->params['uid'] == $user->id) ? 1 : 0;
if (!$user->isAdmin() && !$isuser) {
flash('error', gt('You do not have permissions to change this users password.'));
expHistory::back();
}
if (($isuser && empty($this->params['password'])) || (!empty($this->params['password']) && $user->password != user::encryptPassword($this->params['password']))) {
flash('error', gt('The current password you entered is not correct.'));
expHistory::returnTo('editable');
}
//eDebug($user);
$u = new user($this->params['uid']);
$ret = $u->setPassword($this->params['new_password1'], $this->params['new_password2']);
//eDebug($u, true);
if (is_string($ret)) {
flash('error', $ret);
expHistory::returnTo('editable');
} else {
$params = array();
$params['is_admin'] = !empty($u->is_admin);
$params['is_acting_admin'] = !empty($u->is_acting_admin);
$u->update($params);
}
if (!$isuser) {
flash('message', gt('The password for') . ' ' . $u->username . ' ' . gt('has been changed.'));
} else {
$user->password = $u->password;
flash('message', gt('Your password has been changed.'));
}
expHistory::back();
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
$t = preg_split('/[ \t]/', trim($enclosure[2]) );
$type = $t[0];
/**
* Filters the RSS enclosure HTML link tag for the current post.
*
* @since 2.2.0
*
* @param string $html_link_tag The HTML link tag with a URI and other attributes.
*/
echo apply_filters( 'rss_enclosure', '<enclosure url="' . trim( htmlspecialchars( $enclosure[0] ) ) . '" length="' . trim( $enclosure[1] ) . '" type="' . $type . '" />' . "\n" );
}
}
} | 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 searchName() { return gt('Webpage'); } | 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 testInvalidBodyUrlBBCode()
{
$parser = new JBBCode\Parser();
$parser->addCodeDefinitionSet(new JBBCode\DefaultCodeDefinitionSet());
$parser->parse('[url]javascript:alert("HACKED!");[/url]');
$this->assertEquals('[url]javascript:alert("HACKED!");[/url]', $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 |
[$result, $message] = $rule($file);
if (!$result) {
Helpers::record_warnings(E_USER_WARNING, "Error loading $file: $message", __FILE__, __LINE__);
return;
}
}
}
[$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->_protocol, $this->_base_host, $this->_base_path] = $parsed_url;
}
$this->_parse_css($css);
} | 1 | PHP | CWE-73 | External Control of File Name or Path | The software allows user input to control or influence paths or file names that are used in filesystem operations. | https://cwe.mitre.org/data/definitions/73.html | safe |
public static function isActive($mod){
$json = Options::v('modules');
$mods = json_decode($json, true);
//print_r($mods);
if (!is_array($mods) || $mods == "") {
$mods = array();
}
if(in_array($mod, $mods)){
return true;
}else{
return false;
}
}
| 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
$arrDetail['total_price'] = sc_currency_value($cartItem->price) * $cartItem->qty;
$arrCartDetail[] = $arrDetail;
}
//Set session info order
session(['dataOrder' => $dataOrder]);
session(['arrCartDetail' => $arrCartDetail]);
//Create new order
$newOrder = (new ShopOrder)->createOrder($dataOrder, $dataTotal, $arrCartDetail);
if ($newOrder['error'] == 1) {
return redirect(sc_route('cart'))->with(['error' => $newOrder['msg']]);
}
//Set session orderID
session(['orderID' => $newOrder['orderID']]);
//Create new address
if ($address_process == 'new') {
$addressNew = [
'first_name' => $shippingAddress['first_name'] ?? '',
'last_name' => $shippingAddress['last_name'] ?? '',
'first_name_kana' => $shippingAddress['first_name_kana'] ?? '',
'last_name_kana' => $shippingAddress['last_name_kana'] ?? '',
'postcode' => $shippingAddress['postcode'] ?? '',
'address1' => $shippingAddress['address1'] ?? '',
'address2' => $shippingAddress['address2'] ?? '',
'country' => $shippingAddress['country'] ?? '',
'phone' => $shippingAddress['phone'] ?? '',
];
ShopCustomer::find($uID)->addresses()->save(new ShopCustomerAddress(sc_clean($addressNew)));
session()->forget('address_process'); //destroy address_process
}
$paymentMethod = sc_get_class_plugin_controller('Payment', session('paymentMethod'));
if ($paymentMethod) {
// Check payment method
return (new $paymentMethod)->processOrder();
} else {
return (new ShopCartController)->completeOrder();
}
} | 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 |
$ret = array_merge($ret, csrf_flattenpost2(1, $n, $v));
} | 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 getQueryGroupby()
{
$R1 = 'R1_' . $this->field->id;
$R2 = 'R2_' . $this->field->id;
return "$R2.id";
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
public function connect($host, $port = false, $tval = 30)
{
// Are we already connected?
if ($this->connected) {
return true;
}
//On Windows this will raise a PHP Warning error if the hostname doesn't exist.
//Rather than suppress it with @fsockopen, capture it cleanly instead
set_error_handler(array($this, 'catchWarning'));
if (false === $port) {
$port = $this->POP3_PORT;
}
// connect to the POP3 server
$this->pop_conn = fsockopen(
$host, // POP3 Host
$port, // Port #
$errno, // Error Number
$errstr, // Error Message
$tval
); // Timeout (seconds)
// Restore the error handler
restore_error_handler();
// Did we connect?
if (false === $this->pop_conn) {
// It would appear not...
$this->setError(array(
'error' => "Failed to connect to server $host on port $port",
'errno' => $errno,
'errstr' => $errstr
));
return false;
}
// Increase the stream time-out
stream_set_timeout($this->pop_conn, $tval, 0);
// Get the POP3 server response
$pop3_response = $this->getResponse();
// Check for the +OK
if ($this->checkResponse($pop3_response)) {
// The connection is established and the POP3 server is talking
$this->connected = true;
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.