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 testBadSMTP()
{
$this->Mail->smtpConnect();
$smtp = $this->Mail->getSMTPInstance();
$this->assertFalse($smtp->mail("somewhere\nbad"), 'Bad SMTP command containing breaks accepted');
} | 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 testDefaultReturnValuesOfGetters()
{
$uri = new Uri();
$this->assertSame('', $uri->getScheme());
$this->assertSame('', $uri->getAuthority());
$this->assertSame('', $uri->getUserInfo());
$this->assertSame('', $uri->getHost());
$this->assertNull($uri->getPort());
$this->assertSame('', $uri->getPath());
$this->assertSame('', $uri->getQuery());
$this->assertSame('', $uri->getFragment());
} | 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 displayname() {
return "Events";
} | 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 sendAndMail($from)
{
return $this->sendCommand('SAML', "SAML FROM:$from", 250);
} | 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 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-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 |
$count += $db->dropTable($basename);
}
flash('message', gt('Deleted').' '.$count.' '.gt('unused tables').'.');
expHistory::back();
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
public function get_item( $request ) {
$id = (int) $request['id'];
$comment = get_comment( $id );
if ( empty( $comment ) ) {
return new WP_Error( 'rest_comment_invalid_id', __( 'Invalid comment ID.' ), array( 'status' => 404 ) );
}
if ( ! empty( $comment->comment_post_ID ) ) {
$post = get_post( $comment->comment_post_ID );
if ( empty( $post ) ) {
return new WP_Error( 'rest_post_invalid_id', __( 'Invalid post ID.' ), array( 'status' => 404 ) );
}
}
$data = $this->prepare_item_for_response( $comment, $request );
$response = rest_ensure_response( $data );
return $response;
} | 0 | PHP | NVD-CWE-noinfo | null | null | null | vulnerable |
protected function validate() {
// Special case:
if ($this->n === '+0' || $this->n === '-0') $this->n = '0';
if ($this->n === '0' && $this->unit === false) return true;
if (!ctype_lower($this->unit)) $this->unit = strtolower($this->unit);
if (!isset(HTMLPurifier_Length::$allowedUnits[$this->unit])) return false;
// Hack:
$def = new HTMLPurifier_AttrDef_CSS_Number();
$result = $def->validate($this->n, false, false);
if ($result === false) return false;
$this->n = $result;
return true;
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
public function getListStart() {
// increase start value of ordered lists at multi-column output
//The offset that comes from the URL parameter is zero based, but has to be +1'ed for display.
$offset = $this->getParameters()->getParameter( 'offset' ) + 1;
if ( $offset != 0 ) {
//@TODO: So this adds the total count of articles to the offset. I have not found a case where this does not mess up the displayed count. I am commenting this out for now.
//$offset += $this->offsetCount;
}
return sprintf( $this->listStart, $this->listAttributes . ' start="' . $offset . '"' );
} | 0 | PHP | CWE-400 | Uncontrolled Resource Consumption | The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources. | https://cwe.mitre.org/data/definitions/400.html | vulnerable |
public static function decode($jwt, $key = null, $verify = true)
{
$tks = explode('.', $jwt);
if (count($tks) != 3) {
throw new Exception('Wrong number of segments');
}
list($headb64, $payloadb64, $cryptob64) = $tks;
if (null === ($header = json_decode(JWT::urlsafeB64Decode($headb64)))) {
throw new Exception('Invalid segment encoding');
}
if (null === $payload = json_decode(JWT::urlsafeB64Decode($payloadb64))) {
throw new Exception('Invalid segment encoding');
}
$sig = JWT::urlsafeB64Decode($cryptob64);
if ($verify) {
if (empty($header->alg)) {
throw new DomainException('Empty algorithm');
}
if (!JWT::verifySignature($sig, "$headb64.$payloadb64", $key, $header->alg)) {
throw new UnexpectedValueException('Signature verification failed');
}
}
return $payload;
} | 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 |
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');
} | 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 |
deleteUserGroupMember($userid, $rc['id']);
}
if(count($fails)) {
$cnt = 'some';
$code = 36;
if(count($fails) == count($users)) {
$cnt = 'any';
$code = 37;
}
return array('status' => 'warning',
'failedusers' => $fails,
'warningcode' => $code,
'warningmsg' => "failed to remove $cnt users from user group");
}
return array('status' => 'success');
} | 1 | PHP | CWE-264 | Permissions, Privileges, and Access Controls | Weaknesses in this category are related to the management of permissions, privileges, and other security features that are used to perform access control. | https://cwe.mitre.org/data/definitions/264.html | safe |
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');
} | 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 transform($tag, $config, $context) {
if ($tag instanceof HTMLPurifier_Token_End) {
$new_tag = clone $tag;
$new_tag->name = $this->transform_to;
return $new_tag;
}
$attr = $tag->attr;
$prepend_style = '';
// handle color transform
if (isset($attr['color'])) {
$prepend_style .= 'color:' . $attr['color'] . ';';
unset($attr['color']);
}
// handle face transform
if (isset($attr['face'])) {
$prepend_style .= 'font-family:' . $attr['face'] . ';';
unset($attr['face']);
}
// handle size transform
if (isset($attr['size'])) {
// normalize large numbers
if ($attr['size'] !== '') {
if ($attr['size']{0} == '+' || $attr['size']{0} == '-') {
$size = (int) $attr['size'];
if ($size < -2) $attr['size'] = '-2';
if ($size > 4) $attr['size'] = '+4';
} else {
$size = (int) $attr['size'];
if ($size > 7) $attr['size'] = '7';
}
}
if (isset($this->_size_lookup[$attr['size']])) {
$prepend_style .= 'font-size:' .
$this->_size_lookup[$attr['size']] . ';';
}
unset($attr['size']);
}
if ($prepend_style) {
$attr['style'] = isset($attr['style']) ?
$prepend_style . $attr['style'] :
$prepend_style;
}
$new_tag = clone $tag;
$new_tag->name = $this->transform_to;
$new_tag->attr = $attr;
return $new_tag;
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
public function attributeLabels() {
return array(
'actionId' => Yii::t('actions','Action ID'),
'text' => Yii::t('actions','Action Text'),
);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
static function isSearchable() {
return true;
} | 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 |
$contents[] = ['class' => 'text-center', 'text' => tep_draw_bootstrap_button(IMAGE_SAVE, 'fas fa-save', null, 'primary', null, 'btn-success xxx text-white mr-2') . tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-times', tep_href_link('manufacturers.php', 'page=' . $_GET['page'] . '&mID=' . (int)$mInfo->manufacturers_id), null, null, 'btn-light')]; | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function insertServiceCategorieInDB(){
global $pearDB, $centreon;
if (testServiceCategorieExistence($_POST["sc_name"])){
$DBRESULT = $pearDB->query("INSERT INTO `service_categories` (`sc_name`, `sc_description`, `level`, `icon_id`, `sc_activate` )
VALUES ('".$_POST["sc_name"]."', '".$_POST["sc_description"]."', ".
(isset($_POST['sc_severity_level']) && $_POST['sc_type'] ? $pearDB->escape($_POST['sc_severity_level']):"NULL").", ".
(isset($_POST['sc_severity_icon']) && $_POST['sc_type'] ? $pearDB->escape($_POST['sc_severity_icon']) : "NULL").", ".
"'".$_POST["sc_activate"]["sc_activate"]."')"); | 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 getBlockLength()
{
return $this->block_size << 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 load_template()
{
global $DB;
global $website;
$template = new template();
if( $this->association == 'free' ||
($this->association == 'category' && $this->embedding == '0'))
{
$template->load($this->template);
}
else
{
$category_template = $DB->query_single(
'template',
'nv_structure',
' id = '.protect($this->category).' AND website = '.$website->id
);
$template->load($category_template);
}
return $template;
}
| 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
foreach ($day as $extevent) {
$event_cache = new stdClass();
$event_cache->feed = $extgcalurl;
$event_cache->event_id = $extevent->event_id;
$event_cache->title = $extevent->title;
$event_cache->body = $extevent->body;
$event_cache->eventdate = $extevent->eventdate->date;
if (isset($extevent->dateFinished) && $extevent->dateFinished != -68400)
$event_cache->dateFinished = $extevent->dateFinished;
if (isset($extevent->eventstart))
$event_cache->eventstart = $extevent->eventstart;
if (isset($extevent->eventend))
$event_cache->eventend = $extevent->eventend;
if (isset($extevent->is_allday))
$event_cache->is_allday = $extevent->is_allday;
$found = false;
if ($extevent->eventdate->date < $start) // prevent duplicating events crossing month boundaries
$found = $db->selectObject('event_cache','feed="'.$extgcalurl.'" AND event_id="'.$event_cache->event_id.'" AND eventdate='.$event_cache->eventdate);
if (!$found)
$db->insertObject($event_cache,'event_cache');
}
| 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
public function setRemoteUrl($name, $url, array $params = NULL)
{
$this->run('remote', 'set-url', $params, $name, $url);
return $this;
} | 0 | PHP | CWE-77 | Improper Neutralization of Special Elements used in a Command ('Command Injection') | The software constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/77.html | vulnerable |
public function localFileSystemInotify($path, $standby, $compare) {
if (isset($this->sessionCache['localFileSystemInotify_disable'])) {
return false;
}
$path = realpath($path);
$mtime = filemtime($path);
if ($mtime != $compare) {
return $mtime;
}
$inotifywait = defined('ELFINER_INOTIFYWAIT_PATH')? ELFINER_INOTIFYWAIT_PATH : 'inotifywait';
$path = escapeshellarg($path);
$standby = max(1, intval($standby));
$cmd = $inotifywait.' '.$path.' -t '.$standby.' -e moved_to,moved_from,move,close_write,delete,delete_self';
$this->procExec($cmd , $o, $r);
if ($r === 0) {
// changed
clearstatcache();
$mtime = @filemtime($path); // error on busy?
return $mtime? $mtime : time();
} else if ($r === 2) {
// not changed (timeout)
return $compare;
}
// error
// cache to $_SESSION
$this->sessionCache['localFileSystemInotify_disable'] = true;
$this->session->set($this->id, $this->sessionCache, 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 html() {
switch( $this->type ) {
case FILE_ADDED:
$t_string = 'timeline_issue_file_added';
break;
case FILE_DELETED:
$t_string = 'timeline_issue_file_deleted';
break;
default:
throw new ServiceException( 'Unknown Event Type', ERROR_GENERIC );
}
$t_bug_link = string_get_bug_view_link( $this->issue_id );
$t_html = $this->html_start( 'fa-file-o' );
$t_html .= '<div class="action">'
. sprintf( lang_get( $t_string ),
prepare_user_name( $this->user_id ),
$t_bug_link,
$this->filename
)
. '</div>';
$t_html .= $this->html_end();
return $t_html;
} | 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 db_properties($table)
{
global $DatabaseType, $DatabaseUsername;
switch ($DatabaseType) {
case 'mysqli':
$result = DBQuery("SHOW COLUMNS FROM $table");
while ($row = db_fetch_row($result)) {
$properties[strtoupper($row['FIELD'])]['TYPE'] = strtoupper($row['TYPE'], strpos($row['TYPE'], '('));
if (!$pos = strpos($row['TYPE'], ','))
$pos = strpos($row['TYPE'], ')');
else
$properties[strtoupper($row['FIELD'])]['SCALE'] = substr($row['TYPE'], $pos + 1);
$properties[strtoupper($row['FIELD'])]['SIZE'] = substr($row['TYPE'], strpos($row['TYPE'], '(') + 1, $pos);
if ($row['NULL'] != '')
$properties[strtoupper($row['FIELD'])]['NULL'] = "Y";
else
$properties[strtoupper($row['FIELD'])]['NULL'] = "N";
}
break;
}
return $properties;
} | 0 | PHP | CWE-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 isRaw()
{
return $this->raw;
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
public function manage() {
expHistory::set('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-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 |
$confirm_string .= tep_draw_hidden_field('chosen[]', $customer_id);
}
} else {
$confirm_string .= tep_draw_hidden_field('global', 'true');
}
$confirm_string .= tep_draw_bootstrap_button(IMAGE_SEND, 'fas fa-paper-plane', null, 'primary', null, 'btn-success btn-block btn-lg');
$confirm_string .= '</form>';
}
$confirm_string .= tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-angle-left', tep_href_link('newsletters.php', 'page=' . $_GET['page'] . '&nID=' . $_GET['nID'] . '&action=send'), 'primary', null, 'btn-light mt-2');
return $confirm_string;
} | 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 |
$module_views[$key]['name'] = gt($value['name']);
}
// look for a config form for this module's current view
// $controller->loc->mod = expModules::getControllerClassName($controller->loc->mod);
//check to see if hcview was passed along, indicating a hard-coded module
// if (!empty($controller->params['hcview'])) {
// $viewname = $controller->params['hcview'];
// } else {
// $viewname = $db->selectValue('container', 'view', "internal='".serialize($controller->loc)."'");
// }
// $viewconfig = $viewname.'.config';
// foreach ($modpaths as $path) {
// if (file_exists($path.'/'.$viewconfig)) {
// $fileparts = explode('_', $viewname);
// if ($fileparts[0]=='show'||$fileparts[0]=='showall') array_shift($fileparts);
// $module_views[$viewname]['name'] = ucwords(implode(' ', $fileparts)).' '.gt('View Configuration');
// $module_views[$viewname]['file'] =$path.'/'.$viewconfig;
// }
// }
// sort the views highest to lowest by filename
// we are reverse sorting now so our array merge
// will overwrite property..we will run array_reverse
// when we're finished to get them back in the right order
krsort($common_views);
krsort($module_views);
if (!empty($moduleconfig)) $common_views = array_merge($common_views, $moduleconfig);
$views = array_merge($common_views, $module_views);
$views = array_reverse($views);
return $views;
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
function edit_optiongroup_master() {
expHistory::set('editable', $this->params);
$id = isset($this->params['id']) ? $this->params['id'] : null;
$record = new optiongroup_master($id);
assign_to_template(array(
'record'=>$record
));
} | 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() {
global $user;
$count = $this->address->find('count', 'user_id=' . $user->id);
if($count > 1)
{
$address = new address($this->params['id']);
if ($user->isAdmin() || ($user->id == $address->user_id)) {
if ($address->is_billing)
{
$billAddress = $this->address->find('first', 'user_id=' . $user->id . " AND id != " . $address->id);
$billAddress->is_billing = true;
$billAddress->save();
}
if ($address->is_shipping)
{
$shipAddress = $this->address->find('first', 'user_id=' . $user->id . " AND id != " . $address->id);
$shipAddress->is_shipping = true;
$shipAddress->save();
}
parent::delete();
}
}
else
{
flash("error", gt("You must have at least one address."));
}
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 |
private function _adduser( $option, $tableAlias = '' ) {
$tableAlias = ( !empty( $tableAlias ) ? $tableAlias . '.' : '' );
$this->addSelect(
[
$tableAlias . 'revactor_actor',
]
);
} | 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 |
function selectArraysBySql($sql) {
$res = @mysqli_query($this->connection, $this->injectProof($sql));
if ($res == null)
return array();
$arrays = array();
for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)
$arrays[] = mysqli_fetch_assoc($res);
return $arrays;
} | 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 final function setAction($strAction) {
$this->strAction = $strAction;
} | 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 testRaisesExceptionOnInvalidClientFilename($filename)
{
$this->setExpectedException('InvalidArgumentException', 'filename');
new UploadedFile(fopen('php://temp', 'wb+'), 0, UPLOAD_ERR_OK, $filename);
} | 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 validate_redirects( $location ) {
if ( ! wp_http_validate_url( $location ) ) {
throw new Requests_Exception( __('A valid URL was not provided.'), 'wp_http.redirect_failed_validation' );
}
} | 1 | PHP | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | safe |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$tag_id = $this->request->getIntegerParam('tag_id');
$tag = $this->tagModel->getById($tag_id);
if ($tag['project_id'] != $project['id']) {
throw new AccessForbiddenException();
}
if ($this->tagModel->remove($tag_id)) {
$this->flash->success(t('Tag removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this tag.'));
}
$this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id'])));
} | 0 | PHP | CWE-639 | Authorization Bypass Through User-Controlled Key | The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. | https://cwe.mitre.org/data/definitions/639.html | vulnerable |
public static function go($input, $path, $allowed='', $uniq=false, $size='', $width = '', $height = ''){
$filename = Typo::cleanX($_FILES[$input]['name']);
$filename = str_replace(' ', '_', $filename);
if(isset($_FILES[$input]) && $_FILES[$input]['error'] == 0){
if($uniq == true){
$uniqfile = sha1(microtime().$filename);
}else{
$uniqfile = '';
}
$extension = pathinfo($_FILES[$input]['name'], PATHINFO_EXTENSION);
$filetmp = $_FILES[$input]['tmp_name'];
$filepath = GX_PATH.$path.$uniqfile.$filename;
if(!in_array(strtolower($extension), $allowed)){
$result['error'] = 'File not allowed';
}else{
if(move_uploaded_file(
$filetmp,
$filepath)
){
$result['filesize'] = filesize($filepath);
$result['filename'] = $uniqfile.$filename;
$result['path'] = $path.$uniqfile.$filename;
$result['filepath'] = $filepath;
$result['fileurl'] = Site::$url.$path.$uniqfile.$filename;
}else{
$result['error'] = 'Cannot upload to directory, please check
if directory is exist or You had permission to write it.';
}
}
}else{
//$result['error'] = $_FILES[$input]['error'];
$result['error'] = '';
}
return $result;
} | 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 remove($id)
{
global $DB;
global $website;
if(empty($id))
return 'invalid_id';
$DB->execute('
DELETE FROM nv_notes
WHERE website = '.protect($website->id).'
AND id = '.protect($id).'
LIMIT 1'
);
return 'true';
}
| 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
public function getItems2 (
$prefix='', $page=0, $limit=20, $valueAttr='name', $nameAttr='name') {
$modelClass = get_class ($this->owner);
$model = CActiveRecord::model ($modelClass);
$table = $model->tableName ();
$offset = intval ($page) * intval ($limit);
AuxLib::coerceToArray ($valueAttr);
$modelClass::checkThrowAttrError (array_merge ($valueAttr, array ($nameAttr)));
$params = array ();
if ($prefix !== '') {
$params[':prefix'] = $prefix . '%';
}
if ($limit !== -1) {
$offset = abs ((int) $offset);
$limit = abs ((int) $limit);
$limitClause = "LIMIT $offset, $limit";
}
if ($model->asa ('permissions')) {
list ($accessCond, $permissionsParams) = $model->getAccessSQLCondition ();
$params = array_merge ($params, $permissionsParams);
}
$command = Yii::app()->db->createCommand ("
SELECT " . implode (',', $valueAttr) . ", $nameAttr as __name
FROM $table as t
WHERE " . ($prefix === '' ?
'1=1' : ($nameAttr . ' LIKE :prefix')
) . (isset ($accessCond) ? " AND $accessCond" : '') . " | 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 transform($attr, $config, $context) {
// If we add support for other objects, we'll need to alter the
// transforms.
switch ($attr['name']) {
// application/x-shockwave-flash
// Keep this synchronized with Injector/SafeObject.php
case 'allowScriptAccess':
$attr['value'] = 'never';
break;
case 'allowNetworking':
$attr['value'] = 'internal';
break;
case 'allowFullScreen':
if ($config->get('HTML.FlashAllowFullScreen')) {
$attr['value'] = ($attr['value'] == 'true') ? 'true' : 'false';
} else {
$attr['value'] = 'false';
}
break;
case 'wmode':
$attr['value'] = $this->wmode->validate($attr['value'], $config, $context);
break;
case 'movie':
case 'src':
$attr['name'] = "movie";
$attr['value'] = $this->uri->validate($attr['value'], $config, $context);
break;
case 'flashvars':
// we're going to allow arbitrary inputs to the SWF, on
// the reasoning that it could only hack the SWF, not us.
break;
// add other cases to support other param name/value pairs
default:
$attr['name'] = $attr['value'] = null;
}
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 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();
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
public function __construct($obj) {
parent::__construct();
$this->obj = $obj;
} | 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 decrypt($string, $key) {
$result = '';
$string = base64_decode($string);
for ($i=0; $i<strlen($string); $i++) {
$char = substr($string, $i, 1);
$keychar = substr($key, ($i % strlen($key))-1, 1);
$char = chr(ord($char)-ord($keychar));
$result .= $char;
}
return Toolbox::unclean_cross_side_scripting_deep($result);
} | 0 | PHP | CWE-798 | Use of Hard-coded Credentials | The software contains hard-coded credentials, such as a password or cryptographic key, which it uses for its own inbound authentication, outbound communication to external components, or encryption of internal data. | https://cwe.mitre.org/data/definitions/798.html | vulnerable |
public function store()
{
$title = $this->title;
if ($title === null || trim($title) === '') {
$title = new Expression('NULL');
}
$subtitle = $this->subtitle;
if ($subtitle === null || trim($subtitle) === '') {
$subtitle = new Expression('NULL');
}
$data = array(
'model_header' => $this->header,
'model_footer' => $this->footer,
'model_type' => $this->type,
'model_title' => $title,
'model_subtitle' => $subtitle,
'model_body' => $this->body,
'model_styles' => $this->styles
);
try {
if ($this->id !== null) {
$update = $this->zdb->update(self::TABLE);
$update->set($data)->where(
self::PK . '=' . $this->id
);
$this->zdb->execute($update);
} else {
$data['model_name'] = $this->name;
$insert = $this->zdb->insert(self::TABLE);
$insert->values($data);
$add = $this->zdb->execute($insert);
if (!($add->count() > 0)) {
Analog::log('Not stored!', Analog::ERROR);
return false;
}
}
return true;
} catch (Throwable $e) {
Analog::log(
'An error occurred storing model: ' . $e->getMessage() .
"\n" . print_r($data, true),
Analog::ERROR
);
throw $e;
}
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
protected function lookup($array) {
$ret = array();
foreach ($array as $val) $ret[$val] = true;
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 getAnonymousModule() {
if (!$this->_anonModule) {
$this->_anonModule = new HTMLPurifier_HTMLModule();
$this->_anonModule->name = 'Anonymous';
}
return $this->_anonModule;
} | 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 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 subscriptions() {
global $db;
expHistory::set('manageable', $this->params);
// make sure we have what we need.
if (empty($this->params['key'])) expQueue::flashAndFlow('error', gt('The security key for account was not supplied.'));
if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The subscriber id for account was not supplied.'));
// verify the id/key pair
$sub = new subscribers($this->params['id']);
if (empty($sub->id)) expQueue::flashAndFlow('error', gt('We could not find any subscriptions matching the ID and Key you provided.'));
// get this users subscriptions
$subscriptions = $db->selectColumn('expeAlerts_subscribers', 'expeAlerts_id', 'subscribers_id='.$sub->id);
// get a list of all available E-Alerts
$ealerts = new expeAlerts();
assign_to_template(array(
'subscriber'=>$sub,
'subscriptions'=>$subscriptions,
'ealerts'=>$ealerts->find('all')
));
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
public function update()
{
global $DB;
$ok = $DB->execute('
UPDATE nv_menus
SET codename = :codename, icon = :icon, lid = :lid, notes = :notes,
functions = :functions, enabled = :enabled
WHERE id = :id',
array(
'id' => $this->id,
'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());
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 actionSeoFileLink($url, $robots = '', $canonical = '', $inline = true, $fileName = '')
{
$url = base64_decode($url);
$robots = base64_decode($robots);
$canonical = base64_decode($canonical);
$url = UrlHelper::absoluteUrlWithProtocol($url);
$contents = file_get_contents($url);
$response = Craft::$app->getResponse();
if ($contents) {
// Add the X-Robots-Tag header
if (!empty($robots)) {
$headerValue = $robots;
$response->headers->add('X-Robots-Tag', $headerValue);
}
// Add the Link header
if (!empty($canonical)) {
$headerValue = '<'.$canonical.'>; rel="canonical"';
$response->headers->add('Link', $headerValue);
}
// Ensure the file type is allowed
// ref: https://craftcms.com/docs/3.x/config/config-settings.html#allowedfileextensions
$allowedExtensions = Craft::$app->getConfig()->getGeneral()->allowedFileExtensions;
if (($ext = pathinfo($fileName, PATHINFO_EXTENSION)) !== '') {
$ext = strtolower($ext);
}
if ($ext === '' || !in_array($ext, $allowedExtensions, true)) {
throw new ServerErrorHttpException(Craft::t('seomatic', 'File format not allowed.'));
}
// Send the file as a stream, so it can exist anywhere
$response->sendContentAsFile(
$contents,
$fileName,
[
'inline' => $inline,
'mimeType' => FileHelper::getMimeTypeByExtension($fileName)
]
);
} else {
throw new NotFoundHttpException(Craft::t('seomatic', 'File not found.'));
}
return $response;
} | 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 sum($return_amount = true)
{
if ($return_amount) {
return $this->app->cart_repository->getCartAmount();
} else {
return $this->app->cart_repository->getCartItemsCount();
}
} | 1 | 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 | safe |
foreach($findAffilFuncs as $func) {
if($func($_user, $dump))
$affilok = 1;
} | 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 newpassword() {
if ($token = $this->param('token')) {
$user = $this->app->storage->findOne('cockpit/accounts', ['_reset_token' => $token]);
if (!$user) {
return false;
}
$user['md5email'] = md5($user['email']);
return $this->render('cockpit:views/layouts/newpassword.php', compact('user', 'token'));
}
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 |
$evs = $this->event->find('all', "id=" . $edate->event_id . $featuresql);
foreach ($evs as $key=>$event) {
if ($condense) {
$eventid = $event->id;
$multiday_event = array_filter($events, create_function('$event', 'global $eventid; return $event->id === $eventid;'));
if (!empty($multiday_event)) {
unset($evs[$key]);
continue;
}
}
$evs[$key]->eventstart += $edate->date;
$evs[$key]->eventend += $edate->date;
$evs[$key]->date_id = $edate->id;
if (!empty($event->expCat)) {
$catcolor = empty($event->expCat[0]->color) ? null : trim($event->expCat[0]->color);
// if (substr($catcolor,0,1)=='#') $catcolor = '" style="color:'.$catcolor.';';
$evs[$key]->color = $catcolor;
}
}
if (count($events) < 500) { // magic number to not crash loop?
$events = array_merge($events, $evs);
} else {
// $evs[$key]->title = gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!');
// $events = array_merge($events, $evs);
flash('notice',gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!'));
break; // keep from breaking system by too much data
}
} | 1 | PHP | CWE-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 itemLocked($hash)
{
if (!elFinder::$commonTempPath) {
return false;
}
$lock = elFinder::$commonTempPath . DIRECTORY_SEPARATOR . $hash . '.lock';
if (file_exists($lock)) {
if (filemtime($lock) + $this->itemLockExpire < time()) {
unlink($lock);
return false;
}
return true;
}
return false;
} | 0 | PHP | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
public function setup($config) {
$max = $config->get('HTML.MaxImgLength');
$img = $this->addElement(
'img', 'Inline', 'Empty', 'Common',
array(
'alt*' => 'Text',
// According to the spec, it's Length, but percents can
// be abused, so we allow only Pixels.
'height' => 'Pixels#' . $max,
'width' => 'Pixels#' . $max,
'longdesc' => 'URI',
'src*' => new HTMLPurifier_AttrDef_URI(true), // embedded
)
);
if ($max === null || $config->get('HTML.Trusted')) {
$img->attr['height'] =
$img->attr['width'] = 'Length';
}
// kind of strange, but splitting things up would be inefficient
$img->attr_transform_pre[] =
$img->attr_transform_post[] =
new HTMLPurifier_AttrTransform_ImgRequired();
} | 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 |
$link_text = wp_get_attachment_image( $_post->ID, $size, $icon, $attr );
} else {
$link_text = '';
}
if ( trim( $link_text ) == '' )
$link_text = $_post->post_title;
/**
* Filters a retrieved attachment page link.
*
* @since 2.7.0
*
* @param string $link_html The page link HTML output.
* @param int $id Post ID.
* @param string|array $size Size of the image. Image size or array of width and height values (in that order).
* Default 'thumbnail'.
* @param bool $permalink Whether to add permalink to image. Default false.
* @param bool $icon Whether to include an icon. Default false.
* @param string|bool $text If string, will be link text. Default false.
*/
return apply_filters( 'wp_get_attachment_link', "<a href='" . esc_url( $url ) . "'>$link_text</a>", $id, $size, $permalink, $icon, $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 |
public function delete() {
global $db;
/* The global constants can be overriden by passing appropriate params */
//sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];
// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];
// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];
// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];
if (empty($this->params['id'])) {
flash('error', gt('Missing id for the comment you would like to delete'));
expHistory::back();
}
// delete the comment
$comment = new expComment($this->params['id']);
$comment->delete();
// delete the association too
$db->delete($comment->attachable_table, 'expcomments_id='.$this->params['id']);
// send the user back where they came from.
expHistory::back();
} | 0 | PHP | CWE-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 build_daterange_sql($timestamp, $endtimestamp=null, $field='date', $multiday=false) {
if (empty($endtimestamp)) {
$date_sql = "((".$field." >= " . expDateTime::startOfDayTimestamp($timestamp) . " AND ".$field." <= " . expDateTime::endOfDayTimestamp($timestamp) . ")";
} else {
$date_sql = "((".$field." >= " . expDateTime::startOfDayTimestamp($timestamp) . " AND ".$field." <= " . expDateTime::endOfDayTimestamp($endtimestamp) . ")";
}
if ($multiday)
$date_sql .= " OR (" . expDateTime::startOfDayTimestamp($timestamp) . " BETWEEN ".$field." AND dateFinished)";
$date_sql .= ")";
return $date_sql;
} | 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 testCodeOptions()
{
$code = 'This contains a [url=http://jbbcode.com]url[/url] which uses an option.';
$html = 'This contains a <a href="http://jbbcode.com">url</a> which uses an option.';
$this->assertProduces($code, $html);
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
public function editTitle() {
global $user;
$file = new expFile($this->params['id']);
if ($user->id==$file->poster || $user->isAdmin()) {
$file->title = $this->params['newValue'];
$file->save();
$ar = new expAjaxReply(200, gt('Your title was updated successfully'), $file);
} else {
$ar = new expAjaxReply(300, gt("You didn't create this file, so you can't edit it."));
}
$ar->send();
} | 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 getAttribute($attribute, $default = null)
{
if (false === array_key_exists($attribute, $this->attributes)) {
return $default;
}
return $this->attributes[$attribute];
} | 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 getCode()
{
return $this->getParameter('code');
} | 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()
{
global $DB;
global $user;
global $events;
$ok = false;
if($user->permission("themes.delete")=="false")
throw new Exception(t(610, "Sorry, you are not allowed to execute this function."));
if(file_exists(NAVIGATE_PATH.'/plugins/'.$this->code.'/'.$this->code.'.plugin'))
{
core_remove_folder(NAVIGATE_PATH.'/plugins/'.$this->code);
$ok = $DB->execute('
DELETE FROM nv_extensions
WHERE id = '.protect($this->id)
);
if(method_exists($events, 'trigger'))
{
$events->trigger(
'extension',
'delete',
array(
'extension' => $this
)
);
}
}
return $ok;
}
| 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 character($s, $l = 0) {
if($s + $l < $this->EOF) {
if($l === 0) {
return $this->data[$s];
} else {
return substr($this->data, $s, $l);
}
}
} | 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 addDirective($directive) {
if (isset($this->directives[$i = $directive->id->toString()])) {
throw new HTMLPurifier_ConfigSchema_Exception("Cannot redefine directive '$i'");
}
$this->directives[$i] = $directive;
} | 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 selectBillingOptions() {
} | 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 pending() {
// global $db;
// make sure we have what we need.
if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('Your subscriber ID was not supplied.'));
// find the subscriber and their pending subscriptions
$ealerts = expeAlerts::getPendingBySubscriber($this->params['id']);
$subscriber = new subscribers($this->params['id']);
// render the template
assign_to_template(array(
'subscriber'=>$subscriber,
'ealerts'=>$ealerts
));
} | 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 |
protected function _joinPath($dir, $name)
{
return rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $name;
} | 0 | PHP | CWE-78 | Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') | The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/78.html | vulnerable |
public function update_item_permissions_check( $request ) {
$user = $this->get_user( $request['id'] );
if ( is_wp_error( $user ) ) {
return $user;
}
if ( ! current_user_can( 'edit_user', $user->ID ) ) {
return new WP_Error( 'rest_cannot_edit', __( 'Sorry, you are not allowed to edit this user.' ), array( 'status' => rest_authorization_required_code() ) );
}
if ( ! empty( $request['roles'] ) && ! current_user_can( 'edit_users' ) ) {
return new WP_Error( 'rest_cannot_edit_roles', __( 'Sorry, you are not allowed to edit roles of this user.' ), array( 'status' => rest_authorization_required_code() ) );
}
return true;
} | 1 | PHP | NVD-CWE-noinfo | null | null | null | safe |
function searchName() { return gt('Webpage'); } | 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 |
public function testGetStreamReturnsStreamForFile()
{
$this->cleanup[] = $stream = tempnam(sys_get_temp_dir(), 'stream_file');
$upload = new UploadedFile($stream, 0, UPLOAD_ERR_OK);
$uploadStream = $upload->getStream();
$r = new ReflectionProperty($uploadStream, 'filename');
$r->setAccessible(true);
$this->assertSame($stream, $r->getValue($uploadStream));
} | 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 testOrderSuccess()
{
$this->setMockHttpResponse('ExpressOrderSuccess.txt');
$response = $this->gateway->order($this->options)->send();
$this->assertInstanceOf('\Omnipay\PayPal\Message\ExpressAuthorizeResponse', $response);
$this->assertFalse($response->isPending());
$this->assertFalse($response->isSuccessful());
$this->assertTrue($response->isRedirect());
$this->assertEquals('https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&useraction=commit&token=EC-42721413K79637829', $response->getRedirectUrl());
} | 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 error($vars = '', $val = '')
{
if (isset($vars) && $vars != '') {
$file = GX_PATH.'/inc/lib/Control/Error/'.$vars.'.control.php';
if (file_exists($file)) {
include $file;
}
} else {
include GX_PATH.'/inc/lib/Control/Error/unknown.control.php';
}
} | 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 doEnterNode(Node $node, Environment $env)
{
if ($node instanceof ModuleNode) {
$this->inAModule = true;
$this->tags = [];
$this->filters = [];
$this->functions = [];
return $node;
} elseif ($this->inAModule) {
// look for tags
if ($node->getNodeTag() && !isset($this->tags[$node->getNodeTag()])) {
$this->tags[$node->getNodeTag()] = $node;
}
// look for filters
if ($node instanceof FilterExpression && !isset($this->filters[$node->getNode('filter')->getAttribute('value')])) {
$this->filters[$node->getNode('filter')->getAttribute('value')] = $node;
}
// look for functions
if ($node instanceof FunctionExpression && !isset($this->functions[$node->getAttribute('name')])) {
$this->functions[$node->getAttribute('name')] = $node;
}
// the .. operator is equivalent to the range() function
if ($node instanceof RangeBinary && !isset($this->functions['range'])) {
$this->functions['range'] = $node;
}
// wrap print to check __toString() calls
if ($node instanceof PrintNode) {
return new SandboxedPrintNode($node->getNode('expr'), $node->getTemplateLine(), $node->getNodeTag());
}
}
return $node;
} | 0 | PHP | NVD-CWE-noinfo | null | null | null | vulnerable |
function update_upcharge() {
$this->loc->src = "@globalstoresettings";
$config = new expConfig($this->loc);
$this->config = $config->config;
//This will make sure that only the country or region that given a rate value will be saved in the db
$upcharge = array();
foreach($this->params['upcharge'] as $key => $item) {
if(!empty($item)) {
$upcharge[$key] = $item;
}
}
$this->config['upcharge'] = $upcharge;
$config->update(array('config'=>$this->config));
flash('message', gt('Configuration updated'));
expHistory::back();
} | 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 |
imagepng( $im_crop, $output );
}
$new_avatar = false;
if ( file_exists( $output ) ) {
$old_avatar = get_user_meta( $user_id, '_lp_profile_picture', true );
if ( file_exists( $upload_dir['basedir'] . '/' . $old_avatar ) ) {
@unlink( $upload_dir['basedir'] . '/' . $old_avatar );
}
$new_avatar = preg_replace( '!^/!', '', $upload_dir['subdir'] ) . '/' . $newname;
update_user_meta( $user_id, '_lp_profile_picture', $new_avatar );
update_user_meta( $user_id, '_lp_profile_picture_changed', 'yes' );
$new_avatar = $upload_dir['baseurl'] . '/' . $new_avatar;
}
@unlink( $path );
return $new_avatar;
} | 0 | PHP | CWE-610 | Externally Controlled Reference to a Resource in Another Sphere | The product uses an externally controlled name or reference that resolves to a resource that is outside of the intended control sphere. | https://cwe.mitre.org/data/definitions/610.html | vulnerable |
static function validUTF($string) {
if(!mb_check_encoding($string, 'UTF-8') OR !($string === mb_convert_encoding(mb_convert_encoding($string, 'UTF-32', 'UTF-8' ), 'UTF-8', 'UTF-32'))) {
return false;
}
return true;
} | 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 prepare( $query, $args ) {
if ( is_null( $query ) )
return;
// This is not meant to be foolproof -- but it will catch obviously incorrect usage.
if ( strpos( $query, '%' ) === false ) {
_doing_it_wrong( 'wpdb::prepare', sprintf( __( 'The query argument of %s must have a placeholder.' ), 'wpdb::prepare()' ), '3.9.0' );
}
$args = func_get_args();
array_shift( $args );
// If args were passed as an array (as in vsprintf), move them up
if ( is_array( $args[0] ) && count( $args ) == 1 ) {
$args = $args[0];
}
foreach ( $args as $arg ) {
if ( ! is_scalar( $arg ) ) {
_doing_it_wrong( 'wpdb::prepare', sprintf( __( 'Unsupported value type (%s).' ), gettype( $arg ) ), '4.8.2' );
}
}
$query = str_replace( "'%s'", '%s', $query ); // in case someone mistakenly already singlequoted it
$query = str_replace( '"%s"', '%s', $query ); // doublequote unquoting
$query = preg_replace( '|(?<!%)%f|' , '%F', $query ); // Force floats to be locale unaware
$query = preg_replace( '|(?<!%)%s|', "'%s'", $query ); // quote the strings, avoiding escaped strings like %%s
array_walk( $args, array( $this, 'escape_by_ref' ) );
return @vsprintf( $query, $args );
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
private function getSwimlane()
{
$swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id'));
if (empty($swimlane)) {
throw new PageNotFoundException();
}
return $swimlane;
} | 0 | PHP | CWE-639 | Authorization Bypass Through User-Controlled Key | The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. | https://cwe.mitre.org/data/definitions/639.html | vulnerable |
public function 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 |
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;
} | 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 make($path, $name, $mime) {
$sql = 'INSERT INTO %s (`parent_id`, `name`, `size`, `mtime`, `mime`, `content`, `read`, `write`) VALUES ("%s", "%s", 0, %d, "%s", "", "%d", "%d")';
$sql = sprintf($sql, $this->tbf, $path, $this->db->real_escape_string($name), time(), $mime, $this->defaults['read'], $this->defaults['write']);
// echo $sql;
return $this->query($sql) && $this->db->affected_rows > 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 __construct(BufferingLogger $bootstrappingLogger = null)
{
if ($bootstrappingLogger) {
$this->bootstrappingLogger = $bootstrappingLogger;
$this->setDefaultLogger($bootstrappingLogger);
}
$this->traceReflector = new \ReflectionProperty('Exception', 'trace');
$this->traceReflector->setAccessible(true);
} | 0 | PHP | CWE-209 | Generation of Error Message Containing Sensitive Information | The software generates an error message that includes sensitive information about its environment, users, or associated data. | https://cwe.mitre.org/data/definitions/209.html | vulnerable |
public function __construct()
{
$this->setBlockedMethods($this->blockedMethods);
} | 1 | 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 | safe |
public function delete($id)
{
if ($this->securityController->isWikiHibernated()) {
throw new \Exception(_t('WIKI_IN_HIBERNATION'));
}
// tests of if $formId is int
if (strval(intval($id)) != strval($id)) {
return null ;
}
$this->clear($id);
return $this->dbService->query('DELETE FROM ' . $this->dbService->prefixTable('nature') . 'WHERE bn_id_nature=' . $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 static function userid($id){
$usr = Db::result(
sprintf("SELECT * FROM `user` WHERE `id` = '%d' LIMIT 1",
Typo::int($id)
)
);
return $usr[0]->userid;
}
| 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 prepareExchangedData($data, $type)
{
global $SETTINGS;
//load ClassLoader
require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
//Load AES
$aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'].'/includes/libraries');
$aes->register();
if ($type == "encode") {
if (isset($SETTINGS['encryptClientServer'])
&& $SETTINGS['encryptClientServer'] === "0"
) {
return json_encode(
$data,
JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP
);
} else {
return Encryption\Crypt\aesctr::encrypt(
json_encode(
$data,
JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP
),
$_SESSION['key'],
256
);
}
} elseif ($type == "decode") {
if (isset($SETTINGS['encryptClientServer'])
&& $SETTINGS['encryptClientServer'] === "0"
) {
return json_decode(
$data,
true
);
} else {
return json_decode(
Encryption\Crypt\aesctr::decrypt(
$data,
$_SESSION['key'],
256
),
true
);
}
}
} | 1 | 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 | safe |
function check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) {
if ( -1 == $action ) {
_doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.2.0' );
}
$adminurl = strtolower( admin_url() );
$referer = strtolower( wp_get_referer() );
$result = isset( $_REQUEST[ $query_arg ] ) ? wp_verify_nonce( $_REQUEST[ $query_arg ], $action ) : false;
/**
* Fires once the admin request has been validated or not.
*
* @since 1.5.1
*
* @param string $action The nonce action.
* @param false|int $result False if the nonce is invalid, 1 if the nonce is valid and generated between
* 0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
*/
do_action( 'check_admin_referer', $action, $result );
if ( ! $result && ! ( -1 == $action && strpos( $referer, $adminurl ) === 0 ) ) {
wp_nonce_ays( $action );
die();
}
return $result;
} | 0 | PHP | CWE-352 | Cross-Site Request Forgery (CSRF) | The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request. | https://cwe.mitre.org/data/definitions/352.html | vulnerable |
function 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 |
foreach ($data['alertred'] as $alert) {
# code...
echo "<li>$alert</li>\n";
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
public function get_view_config() {
global $template;
// set paths we will search in for the view
$paths = array(
BASE.'themes/'.DISPLAY_THEME.'/modules/common/views/file/configure',
BASE.'framework/modules/common/views/file/configure',
);
foreach ($paths as $path) {
$view = $path.'/'.$this->params['view'].'.tpl';
if (is_readable($view)) {
if (bs(true)) {
$bstrapview = $path.'/'.$this->params['view'].'.bootstrap.tpl';
if (file_exists($bstrapview)) {
$view = $bstrapview;
}
}
if (bs3(true)) {
$bstrapview = $path.'/'.$this->params['view'].'.bootstrap3.tpl';
if (file_exists($bstrapview)) {
$view = $bstrapview;
}
}
$template = new controllertemplate($this, $view);
$ar = new expAjaxReply(200, 'ok');
$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 |
protected function makeReplace($uri, $config, $context) {
$string = $uri->toString();
// always available
$this->replace['%s'] = $string;
$this->replace['%r'] = $context->get('EmbeddedURI', true);
$token = $context->get('CurrentToken', true);
$this->replace['%n'] = $token ? $token->name : null;
$this->replace['%m'] = $context->get('CurrentAttr', true);
$this->replace['%p'] = $context->get('CurrentCSSProperty', true);
// not always available
if ($this->secretKey) $this->replace['%t'] = sha1($this->secretKey . ':' . $string);
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
public function testGetConfigWithBrokenSystem() {
$slideshow = true;
$exceptionMessage = 'Aïe!';
$this->configService->expects($this->any())
->method('getFeaturesList')
->willThrowException(new ServiceException($exceptionMessage));
$this->request
->expects($this->once())
->method('getId')
->willReturn('1234');
$errorMessage = [
'message' => 'An error occurred. Request ID: 1234',
'success' => false
];
/** @type JSONResponse $response */
$response = $this->controller->get($slideshow);
$this->assertEquals($errorMessage, $response->getData());
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
public function confirm()
{
$project = $this->getProject();
$filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id'));
$this->response->html($this->helper->layout->project('custom_filter/remove', array(
'project' => $project,
'filter' => $filter,
'title' => t('Remove a custom filter')
)));
} | 0 | PHP | CWE-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);
// build out a SQL query that gets all the data we need and is sortable.
$sql = 'SELECT b.*, c.title as companyname, f.expfiles_id as file_id ';
$sql .= 'FROM '.DB_TABLE_PREFIX.'_banner b, '.DB_TABLE_PREFIX.'_companies c , '.DB_TABLE_PREFIX.'_content_expFiles f ';
$sql .= 'WHERE b.companies_id = c.id AND (b.id = f.content_id AND f.content_type="banner")';
$page = new expPaginator(array(
'model'=>'banner',
'sql'=>$sql,
'order'=>'title',
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->params['controller'],
'action'=>$this->params['action'],
'src'=>$this->loc->src,
'columns'=>array(
gt('Title')=>'title',
gt('Company')=>'companyname',
gt('Impressions')=>'impressions',
gt('Clicks')=>'clicks'
)
));
assign_to_template(array(
'page'=>$page
));
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
public function manage() {
expHistory::set('manageable', $this->params);
// build out a SQL query that gets all the data we need and is sortable.
$sql = 'SELECT b.*, c.title as companyname, f.expfiles_id as file_id ';
$sql .= 'FROM '.DB_TABLE_PREFIX.'_banner b, '.DB_TABLE_PREFIX.'_companies c , '.DB_TABLE_PREFIX.'_content_expFiles f ';
$sql .= 'WHERE b.companies_id = c.id AND (b.id = f.content_id AND f.content_type="banner")';
$page = new expPaginator(array(
'model'=>'banner',
'sql'=>$sql,
'order'=>'title',
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->params['controller'],
'action'=>$this->params['action'],
'src'=>$this->loc->src,
'columns'=>array(
gt('Title')=>'title',
gt('Company')=>'companyname',
gt('Impressions')=>'impressions',
gt('Clicks')=>'clicks'
)
));
assign_to_template(array(
'page'=>$page
));
} | 1 | PHP | CWE-74 | Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') | The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/74.html | safe |
function change_pass()
{
global $txp_user;
extract(psa(array('new_pass', 'mail_password')));
if (empty($new_pass)) {
author_list(array(gTxt('password_required'), E_ERROR));
return;
}
$rs = change_user_password($txp_user, $new_pass);
if ($rs) {
$message = gTxt('password_changed');
if ($mail_password) {
$email = fetch('email', 'txp_users', 'name', $txp_user);
send_new_password($new_pass, $email, $txp_user);
$message .= sp.gTxt('and_mailed_to').sp.$email;
}
$message .= '.';
author_list($message);
}
} | 0 | PHP | CWE-521 | Weak Password Requirements | The product does not require that users should have strong passwords, which makes it easier for attackers to compromise user accounts. | https://cwe.mitre.org/data/definitions/521.html | vulnerable |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.