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 testInvalidUrl()
{
$urlValidator = new \JBBCode\validators\UrlValidator();
$this->assertFalse($urlValidator->validate('#yolo#swag'));
$this->assertFalse($urlValidator->validate('giehtiehwtaw352353%3'));
} | 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 testUnclosedWithinClosed()
{
$this->assertProduces('[url=http://jbbcode.com][b]oh yeah[/url]',
'<a href="http://jbbcode.com"><strong>oh yeah</strong></a>');
} | 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 getTagName()
{
return $this->tagName;
} | 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 set($name, $value) {
$this->data[$name] = $value;
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
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 |
public static function isExist($user)
{
if (isset($_GET['act']) && $_GET['act'] == 'edit') {
$id = Typo::int($_GET['id']);
$where = "AND `id` != '{$id}' ";
} else {
$where = '';
}
$user = sprintf('%s', Typo::cleanX($user));
$sql = sprintf("SELECT `userid` FROM `user` WHERE `userid` = '%s' %s ", $user, $where);
$usr = Db::result($sql);
$n = Db::$num_rows;
if ($n > 0) {
return false;
} else {
return true;
}
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
function updateCommandCategorieInDB(){
global $pearDB;
$DBRESULT = $pearDB->query("UPDATE `command_categories` SET `category_name` = '".$pearDB->escape($_POST["category_name"])."' , `category_alias` = '".$pearDB->escape($_POST["category_alias"])."' , `category_order` = '".$pearDB->escape($_POST["category_order"])."' WHERE `cmd_category_id` = '".$pearDB->escape($_POST["cmd_category_id"])."'");
} | 1 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The software constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | 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-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 referenceFixtures() {
return array(
'campaign' => array ('Campaign', '.CampaignMailingBehaviorTest'),
'lists' => 'X2List',
'credentials' => 'Credentials',
'users' => 'User',
'profile' => array('Profile','.marketing')
);
} | 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-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 canImportData() {
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 static function incBack($vars) {
$file = GX_PATH.'/inc/lib/Control/Backend/'.$vars.'.control.php';
if ( file_exists($file) ) {
# code...
include($file);
}else{
self::error('404');
}
}
| 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 setFrom($address, $name = '', $auto = true)
{
$address = trim($address);
$name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
if (!$this->validateAddress($address)) {
$this->setError($this->lang('invalid_address') . ': ' . $address);
$this->edebug($this->lang('invalid_address') . ': ' . $address);
if ($this->exceptions) {
throw new phpmailerException($this->lang('invalid_address') . ': ' . $address);
}
return false;
}
$this->From = $address;
$this->FromName = $name;
if ($auto) {
if (empty($this->Sender)) {
$this->Sender = $address;
}
}
return true;
} | 1 | PHP | CWE-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 approve_toggle() {
if (empty($this->params['id'])) return;
/* 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'];
$comment = new expComment($this->params['id']);
$comment->approved = $comment->approved == 1 ? 0 : 1;
if ($comment->approved) {
$this->sendApprovalNotification($comment,$this->params);
}
$comment->save();
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 |
$res = @unserialize ( base64_decode (str_replace ( array ( "|02" , "|01" ) , array ( "/" , "|" ) , $str ) ) ) ; | 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 update_discount() {
$id = empty($this->params['id']) ? null : $this->params['id'];
$discount = new discounts($id);
// find required shipping method if needed
if ($this->params['required_shipping_calculator_id'] > 0) {
$this->params['required_shipping_method'] = $this->params['required_shipping_methods'][$this->params['required_shipping_calculator_id']];
} else {
$this->params['required_shipping_calculator_id'] = 0;
}
$discount->update($this->params);
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 |
} elseif ($p->group == 1) {
$grp = SUPERVISOR;
} elseif ($p->group == 2) { | 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($config, $context) {
$this->config = $config;
$this->_scriptFix = $config->get('Output.CommentScriptContents');
$this->_innerHTMLFix = $config->get('Output.FixInnerHTML');
$this->_sortAttr = $config->get('Output.SortAttr');
$this->_flashCompat = $config->get('Output.FlashCompat');
$this->_def = $config->getHTMLDefinition();
$this->_xhtml = $this->_def->doctype->xml;
} | 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 getQuerySelect()
{
return "R_{$this->id}.rank 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 |
foreach ($allgroups as $gid) {
$g = group::getGroupById($gid);
expPermissions::grantGroup($g, 'manage', $sloc);
} | 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 |
$eml->prepareBody();
}
list ($success, $message) = $this->checkDoNotEmailFields ($eml);
if (!$success) {
return array ($success, $message);
}
$result = $eml->send($historyFlag);
if (isset($result['code']) && $result['code'] == 200) {
if (YII_UNIT_TESTING) {
return array(true, $eml->message);
} else {
return array(true, "");
}
} else {
return array (false, Yii::t('app', "Email could not be sent"));
}
} | 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 testMultipleTags()
{
$bbcode = <<<EOD
this is some text with [b]bold tags[/b] and [i]italics[/i] and
things like [u]that[/u].
EOD;
$html = <<<EOD
this is some text with <strong>bold tags</strong> and <em>italics</em> and
things like <u>that</u>.
EOD;
$this->assertProduces($bbcode, $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 mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); } | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
public function getHeaders()
{
return $this->headerLines;
} | 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() {
$data = $_POST['file'];
// security (remove all ..)
$data['name'] = str_replace('..', '', $data['name']);
$file = FILES_DIR . DS . $data['name'];
// CSRF checks
if (isset($_POST['csrf_token'])) {
$csrf_token = $_POST['csrf_token'];
if (!SecureToken::validateToken($csrf_token, BASE_URL.'plugin/file_manager/save/'.$data['name'])) {
Flash::set('error', __('Invalid CSRF token found!'));
redirect(get_url('plugin/file_manager/view/'.$data['name']));
}
}
else {
Flash::set('error', __('No CSRF token found!'));
redirect(get_url('plugin/file_manager/view/'.$data['name']));
}
if (file_exists($file)) {
if (file_put_contents($file, $data['content']) !== false) {
Flash::set('success', __('File has been saved with success!'));
} else {
Flash::set('error', __('File is not writable! File has not been saved!'));
}
} else {
if (file_put_contents($file, $data['content'])) {
Flash::set('success', __('File :name has been created with success!', array(':name' => $data['name'])));
} else {
Flash::set('error', __('Directory is not writable! File has not been saved!'));
}
}
// save and quit or save and continue editing ?
if (isset($_POST['commit'])) {
redirect(get_url('plugin/file_manager/browse/' . substr($data['name'], 0, strrpos($data['name'], '/'))));
} else {
redirect(get_url('plugin/file_manager/view/' . $data['name'] . (endsWith($data['name'], URL_SUFFIX) ? '?has_url_suffix=1' : '')));
} | 1 | PHP | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | safe |
function delete_recurring() {
$item = $this->event->find('first', 'id=' . $this->params['id']);
if ($item->is_recurring == 1) { // need to give user options
expHistory::set('editable', $this->params);
assign_to_template(array(
'checked_date' => $this->params['date_id'],
'event' => $item,
));
} else { // Process a regular delete
$item->delete();
}
}
| 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 tearDown()
{
static::$functions = [];
static::$fopen = null;
static::$fread = null;
parent::tearDown();
} | 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 static function recent($vars, $type = 'post') {
$sql = "SELECT * FROM `posts` WHERE `type` = '{$type}' ORDER BY `date` DESC LIMIT {$vars}";
$posts = Db::result($sql);
if(isset($posts['error'])){
$posts['error'] = "No Posts found.";
}else{
$posts = $posts;
}
return $posts;
} | 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 fetchFormFromTemplate($id) {
} | 0 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The software constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | vulnerable |
function manage () {
expHistory::set('viewable', $this->params);
$vendor = new vendor();
$vendors = $vendor->find('all');
if(!empty($this->params['vendor'])) {
$purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']);
} else {
$purchase_orders = $this->purchase_order->find('all');
}
assign_to_template(array(
'purchase_orders'=>$purchase_orders,
'vendors' => $vendors,
'vendor_id' => @$this->params['vendor']
));
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
public function attributeLabels() {
return array(
'actionId' => Yii::t('actions','Action ID'),
'text' => Yii::t('actions','Description'),
);
} | 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 |
$fontfile = self::_getfontpath().$file;
} elseif (@file_exists($file)) {
$fontfile = $file;
}
return $fontfile;
} | 0 | PHP | CWE-502 | Deserialization of Untrusted Data | The application deserializes untrusted data without sufficiently verifying that the resulting data will be valid. | https://cwe.mitre.org/data/definitions/502.html | vulnerable |
public function manage_versions() {
expHistory::set('manageable', $this->params);
$hv = new help_version();
$current_version = $hv->find('first', 'is_current=1');
$sql = 'SELECT hv.*, COUNT(h.title) AS num_docs FROM '.DB_TABLE_PREFIX.'_help h ';
$sql .= 'RIGHT JOIN '.DB_TABLE_PREFIX.'_help_version hv ON h.help_version_id=hv.id GROUP BY hv.version';
$page = new expPaginator(array(
'sql'=>$sql,
'limit'=>30,
'order' => (isset($this->params['order']) ? $this->params['order'] : 'version'),
'dir' => (isset($this->params['dir']) ? $this->params['dir'] : 'DESC'),
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->baseclassname,
'action'=>$this->params['action'],
'src'=>$this->loc->src,
'columns'=>array(
gt('Version')=>'version',
gt('Title')=>'title',
gt('Current')=>'is_current',
gt('# of Docs')=>'num_docs'
),
));
assign_to_template(array(
'current_version'=>$current_version,
'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 addOrderBy( $orderBy ) {
if ( empty( $orderBy ) ) {
throw new \MWException( __METHOD__ . ': An empty order by clause was passed.' );
}
$this->orderBy[] = $orderBy;
return true;
} | 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 testLineBreakReplacementErrorTest () {
$this->setExpectedException (
'StringUtilException', '',
StringUtilException::PREG_REPLACE_ERROR);
ini_set('pcre.backtrack_limit', '0');
ini_set('pcre.recursion_limit', '0');
Yii::app()->controller = new MarketingController (
'campaign', new MarketingModule ('campaign', null));
$_SERVER['SERVER_NAME'] = 'localhost';
$cmb = $this->instantiate();
$contact = $this->contacts('testUser_unsent');
list($subject,$message,$uniqueId) = $cmb->prepareEmail(
$this->campaign('redirectLinkGeneration'), $contact);
} | 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 getTypeName($nb = 0) {
return __('Maintenance');
} | 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 remove($transaction = true)
{
global $emitter;
try {
if ($transaction) {
$this->zdb->connection->beginTransaction();
}
$delete = $this->zdb->delete(self::TABLE);
$delete->where(self::PK . ' = ' . $this->_id);
$del = $this->zdb->execute($delete);
if ($del->count() > 0) {
$this->updateDeadline();
$this->dynamicsRemove(true);
} else {
Analog::log(
'Contribution has not been removed!',
Analog::WARNING
);
return false;
}
if ($transaction) {
$this->zdb->connection->commit();
}
$emitter->emit('contribution.remove', $this);
return true;
} catch (Throwable $e) {
if ($transaction) {
$this->zdb->connection->rollBack();
}
Analog::log(
'An error occurred trying to remove contribution #' .
$this->_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 |
public function getPath()
{
return $this->path;
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id'));
$this->checkPermission($project, $filter);
if ($this->customFilterModel->remove($filter['id'])) {
$this->flash->success(t('Custom filter removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this custom filter.'));
}
$this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id'])));
} | 0 | PHP | CWE-639 | Authorization Bypass Through User-Controlled Key | The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. | https://cwe.mitre.org/data/definitions/639.html | vulnerable |
public function run(){
if (Yii::app()->user->isGuest) {
Yii::app()->controller->redirect(Yii::app()->controller->createUrl('/site/login'));
}
if (Yii::app()->request->getRequestType () === 'GET') {
$_POST = $_GET;
}
if (isset ($_POST['passConfirm']) && $_POST['passConfirm']) {
MassAction::superMassActionPasswordConfirmation ();
return;
}
if (!isset ($_POST['massAction']) ||
((!isset ($_POST['superCheckAll']) || !$_POST['superCheckAll']) &&
(!isset ($_POST['gvSelection']) || !is_array ($_POST['gvSelection'])))) {
/**/AuxLib::debugLogR ('run error');
throw new CHttpException (400, Yii::t('app', 'Bad Request'));
}
$massAction = $_POST['massAction'];
$massActionInstance = $this->getInstanceFor ($massAction);
if (isset ($_POST['superCheckAll']) && $_POST['superCheckAll']) {
$uid = $_POST['uid'];
$idChecksum = $_POST['idChecksum'];
$totalItemCount = intval ($_POST['totalItemCount']);
$massActionInstance->superExecute ($uid, $totalItemCount, $idChecksum);
} else {
$gvSelection = $_POST['gvSelection'];
$massActionInstance->beforeExecute ();
$massActionInstance->execute ($gvSelection);
$massActionInstance::echoFlashes ();
}
} | 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 rules()
{
$rules = [
'first_name'=>'max:500',
'last_name'=>'max:500',
'phone'=>'max:500',
'username' => 'required|unique:users,username|max:500',
'email' => 'unique:users,email|max:500',
];
return $rules;
} | 1 | PHP | CWE-190 | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
public function edit(Request $request, $id) {
return $this->view('page::admin.page.edit', [
'content_id'=>intval($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 buildACLConditions($user)
{
$conditions = [];
if (!$user['Role']['perm_site_admin']) {
$conditions = $this->GalaxyCluster->buildConditions($user);
}
return $conditions;
} | 1 | PHP | CWE-862 | Missing Authorization | The software does not perform an authorization check when an actor attempts to access a resource or perform an action. | https://cwe.mitre.org/data/definitions/862.html | 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 |
protected function getSubtask()
{
$subtask = $this->subtaskModel->getById($this->request->getIntegerParam('subtask_id'));
if (empty($subtask)) {
throw new PageNotFoundException();
}
return $subtask;
} | 0 | PHP | CWE-639 | Authorization Bypass Through User-Controlled Key | The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. | https://cwe.mitre.org/data/definitions/639.html | vulnerable |
function productFeed() {
// global $db;
//check query password to avoid DDOS
/*
* condition = new
* description
* id - SKU
* link
* price
* title
* brand - manufacturer
* image link - fullsized image, up to 10, comma seperated
* product type - category - "Electronics > Audio > Audio Accessories MP3 Player Accessories","Health & Beauty > Healthcare > Biometric Monitors > Pedometers"
*/
$out = '"id","condition","description","like","price","title","brand","image link","product type"' . chr(13) . chr(10);
$p = new product();
$prods = $p->find('all', 'parent_id=0 AND ');
//$prods = $db->selectObjects('product','parent_id=0 AND');
} | 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()
{
$R = 'R_' . $this->id;
return "$R.value_id 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 getFilePath($fileName = null)
{
if ($fileName === null) {
$fileName = $this->fileName;
}
return $this->theme->getPath().'/'.$this->dirName.'/'.$fileName;
} | 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 |
public function showall() {
global $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(
'sections' => $navsections,
'current' => $current,
'canManage' => ((isset($user->is_acting_admin) && $user->is_acting_admin == 1) ? 1 : 0),
));
} | 1 | PHP | CWE-74 | Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') | The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/74.html | safe |
public function getDisplayName ($plural=true, $ofModule=true) {
return Yii::t('contacts', '{contact} Lists|{contact} List', array(
(int) $plural,
'{contact}' => Modules::displayName(false, 'Contacts'),
));
} | 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 |
private function curl($url) {
$ca = curl_init();
curl_setopt($ca, CURLOPT_URL, $url);
curl_setopt($ca, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ca, CURLOPT_HEADER, FALSE);
curl_setopt($ca, CURLOPT_HTTPHEADER, array("Accept: application/json"));
$response = curl_exec($ca);
curl_close($ca);
//var_dump($response);
$result = json_decode($response, true);
return $result;
}
| 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
public static function navtojson() {
return json_encode(self::navhierarchy());
} | 1 | PHP | CWE-74 | Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') | The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/74.html | safe |
private function setClientMediaType($clientMediaType)
{
if (false === $this->isStringOrNull($clientMediaType)) {
throw new InvalidArgumentException(
'Upload file client media type must be a string or null'
);
}
$this->clientMediaType = $clientMediaType;
} | 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 returnChildrenAsJSON() {
global $db;
//$nav = section::levelTemplate(intval($_REQUEST['id'], 0));
$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
$nav = $db->selectObjects('section', 'parent=' . $id, 'rank');
//FIXME $manage_all is moot w/ cascading perms now?
$manage_all = false;
if (expPermissions::check('manage', expCore::makeLocation('navigation', '', $id))) {
$manage_all = true;
}
//FIXME recode to use foreach $key=>$value
$navcount = count($nav);
for ($i = 0; $i < $navcount; $i++) {
if ($manage_all || expPermissions::check('manage', expCore::makeLocation('navigation', '', $nav[$i]->id))) {
$nav[$i]->manage = 1;
$view = true;
} else {
$nav[$i]->manage = 0;
$view = $nav[$i]->public ? true : expPermissions::check('view', expCore::makeLocation('navigation', '', $nav[$i]->id));
}
$nav[$i]->link = expCore::makeLink(array('section' => $nav[$i]->id), '', $nav[$i]->sef_name);
if (!$view) unset($nav[$i]);
}
$nav= array_values($nav);
// $nav[$navcount - 1]->last = true;
if (count($nav)) $nav[count($nav) - 1]->last = true;
// echo expJavascript::ajaxReply(201, '', $nav);
$ar = new expAjaxReply(201, '', $nav);
$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 |
function wp_print_update_row_templates() {
?>
<script id="tmpl-item-update-row" type="text/template">
<tr class="plugin-update-tr update" id="{{ data.slug }}-update" data-slug="{{ data.slug }}" <# if ( data.plugin ) { #>data-plugin="{{ data.plugin }}"<# } #>>
<td colspan="{{ data.colspan }}" class="plugin-update colspanchange">
{{{ data.content }}}
</td>
</tr>
</script>
<script id="tmpl-item-deleted-row" type="text/template">
<tr class="plugin-deleted-tr inactive deleted" id="{{ data.slug }}-deleted" data-slug="{{ data.slug }}" <# if ( data.plugin ) { #>data-plugin="{{ data.plugin }}"<# } #>>
<td colspan="{{ data.colspan }}" class="plugin-update colspanchange">
<?php
printf(
/* translators: %s: Plugin or Theme name */
__( '%s was successfully deleted.' ),
'<strong>{{{ data.name }}}</strong>'
);
?>
</td>
</tr>
</script>
<?php
} | 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 |
protected function getAction(array $project)
{
$action = $this->actionModel->getById($this->request->getIntegerParam('action_id'));
if (empty($action)) {
throw new PageNotFoundException();
}
if ($action['project_id'] != $project['id']) {
throw new AccessForbiddenException();
}
return $action;
} | 1 | PHP | CWE-639 | Authorization Bypass Through User-Controlled Key | The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. | https://cwe.mitre.org/data/definitions/639.html | safe |
function __construct($template_mod = "general")
{
parent::__construct();
$this->template_mod = $template_mod;
$this->assign("FORM_ACTION", $GLOBALS['webroot'] . "/controller.php?" . attr($_SERVER['QUERY_STRING']));
$this->assign("TOP_ACTION", $GLOBALS['webroot'] . "/controller.php?" . "practice_settings" . "&");
$this->assign("STYLE", $GLOBALS['style']);
$this->direction = ($GLOBALS['_SESSION']['language_direction'] == 'rtl') ? 'right' : 'left';
if (!AclMain::aclCheckCore('admin', 'practice')) {
echo (new TwigContainer(null, $GLOBALS['kernel']))->getTwig()->render('core/unauthorized.html.twig', ['pageTitle' => xl("Practice Settings")]);
exit;
}
} | 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 rename(){
if($this->request->isMethod('POST')){
$new_file = $this->request->input('new_file');
if(!\Security::isExecutable($new_file) && \Storage::move($this->request->input('old_file'), $new_file)){
if($this->request->ajax()){
return response()->json(['success' => trans('File successfully renamed!')]);
}
}else{
if($this->request->ajax()){
return response()->json(['danger' => trans('message.something_went_wrong')]);
}
}
}
} | 0 | PHP | CWE-434 | Unrestricted Upload of File with Dangerous Type | The software allows the attacker to upload or transfer files of dangerous types that can be automatically processed within the product's environment. | https://cwe.mitre.org/data/definitions/434.html | vulnerable |
public function 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 supress it with @fsockopen, let's capture it cleanly instead
*/
set_error_handler(array(&$this, 'catchWarning'));
// 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();
// Does the Error Log now contain anything?
if ($this->error && $this->do_debug >= 1) {
$this->displayErrors();
}
// Did we connect?
if ($this->pop_conn == false) {
// It would appear not...
$this->error = array(
'error' => "Failed to connect to server $host on port $port",
'errno' => $errno,
'errstr' => $errstr
);
if ($this->do_debug >= 1) {
$this->displayErrors();
}
return false;
}
// Increase the stream time-out
// Check for PHP 4.3.0 or later
if (version_compare(phpversion(), '5.0.0', 'ge')) {
stream_set_timeout($this->pop_conn, $tval, 0);
} else {
// Does not work on Windows
if (substr(PHP_OS, 0, 3) !== 'WIN') {
socket_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;
} | 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 testSchemeMustHaveCorrectType()
{
(new Uri())->withScheme([]);
} | 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 remove($var)
{
unset($_SESSION['gxsess']['val'][$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 remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$action = $this->getAction($project);
if (! empty($action) && $this->actionModel->remove($action['id'])) {
$this->flash->success(t('Action removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this action.'));
}
$this->response->redirect($this->helper->url->to('ActionController', 'index', array('project_id' => $project['id'])));
} | 1 | PHP | CWE-200 | Exposure of Sensitive Information to an Unauthorized Actor | The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. | https://cwe.mitre.org/data/definitions/200.html | safe |
function yourls_verify_nonce( $action, $nonce = false, $user = false, $return = '' ) {
// get user
if( false == $user )
$user = defined( 'YOURLS_USER' ) ? YOURLS_USER : '-1';
// get current nonce value
if( false == $nonce && isset( $_REQUEST['nonce'] ) )
$nonce = $_REQUEST['nonce'];
// Allow plugins to short-circuit the rest of the function
$valid = yourls_apply_filter( 'verify_nonce', false, $action, $nonce, $user, $return );
if ($valid) {
return true;
}
// what nonce should be
$valid = yourls_create_nonce( $action, $user );
if( $nonce == $valid ) {
return true;
} else {
if( $return )
die( $return );
yourls_die( yourls__( 'Unauthorized action or expired link' ), yourls__( 'Error' ), 403 );
}
} | 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 params()
{
$project = $this->getProject();
$values = $this->request->getValues();
$values['project_id'] = $project['id'];
if (empty($values['action_name']) || empty($values['event_name'])) {
$this->create();
return;
}
$action = $this->actionManager->getAction($values['action_name']);
$action_params = $action->getActionRequiredParameters();
if (empty($action_params)) {
$this->doCreation($project, $values + array('params' => array()));
}
$projects_list = $this->projectUserRoleModel->getActiveProjectsByUser($this->userSession->getId());
unset($projects_list[$project['id']]);
$this->response->html($this->template->render('action_creation/params', array(
'values' => $values,
'action_params' => $action_params,
'columns_list' => $this->columnModel->getList($project['id']),
'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id']),
'projects_list' => $projects_list,
'colors_list' => $this->colorModel->getList(),
'categories_list' => $this->categoryModel->getList($project['id']),
'links_list' => $this->linkModel->getList(0, false),
'priorities_list' => $this->projectTaskPriorityModel->getPriorities($project),
'project' => $project,
'available_actions' => $this->actionManager->getAvailableActions(),
'swimlane_list' => $this->swimlaneModel->getList($project['id']),
'events' => $this->actionManager->getCompatibleEvents($values['action_name']),
)));
} | 1 | PHP | CWE-639 | Authorization Bypass Through User-Controlled Key | The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. | https://cwe.mitre.org/data/definitions/639.html | safe |
public function createEnd($name) {
$p = clone $this->p_end;
$p->__construct($name);
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 |
function XMLRPCremoveImageFromGroup($name, $imageid){
$groups = getUserResources(array("imageAdmin"), array("manageGroup"), 1);
if($groupid = getResourceGroupID("image/$name")){
if(!array_key_exists($groupid, $groups['image'])){
return array('status' => 'error',
'errorcode' => 46,
'errormsg' => 'Unable to access image group');
}
$resources = getUserResources(array("imageAdmin"), array("manageGroup"));
if(!array_key_exists($imageid, $resources['image'])){
return array('status' => 'error',
'errorcode' => 47,
'errormsg' => 'Unable to access image');
}
$allimages = getImages();
$query = "DELETE FROM resourcegroupmembers "
. "WHERE resourceid={$allimages[$imageid]['resourceid']} "
. "AND resourcegroupid=$groupid";
doQuery($query, 287);
return array('status' => 'success');
} else {
return array('status' => 'error',
'errorcode' => 83,
'errormsg' => 'invalid resource group name');
}
} | 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_version() {
// get the current version
$hv = new help_version();
$current_version = $hv->find('first', 'is_current=1');
// check to see if the we have a new current version and unset the old current version.
if (!empty($this->params['is_current'])) {
// $db->sql('UPDATE '.DB_TABLE_PREFIX.'_help_version set is_current=0');
help_version::clearHelpVersion();
}
expSession::un_set('help-version');
// save the version
$id = empty($this->params['id']) ? null : $this->params['id'];
$version = new help_version();
// if we don't have a current version yet so we will force this one to be it
if (empty($current_version->id)) $this->params['is_current'] = 1;
$version->update($this->params);
// if this is a new version we need to copy over docs
if (empty($id)) {
self::copydocs($current_version->id, $version->id);
}
// let's update the search index to reflect the current help version
searchController::spider();
flash('message', gt('Saved help version').' '.$version->version);
expHistory::back();
} | 1 | PHP | CWE-74 | Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') | The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/74.html | safe |
$resource = fopen($request->getUri(), 'r', null, $context);
$this->lastHeaders = $http_response_header;
return $resource;
}
); | 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 doCreation(array $project, array $values)
{
$values['project_id'] = $project['id'];
list($valid, ) = $this->actionValidator->validateCreation($values);
if ($valid) {
if ($this->actionModel->create($values) !== false) {
$this->flash->success(t('Your automatic action have been created successfully.'));
} else {
$this->flash->failure(t('Unable to create your automatic action.'));
}
}
$this->response->redirect($this->helper->url->to('ActionController', 'index', array('project_id' => $project['id'])));
} | 1 | PHP | CWE-639 | Authorization Bypass Through User-Controlled Key | The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. | https://cwe.mitre.org/data/definitions/639.html | safe |
$q = self::$mysqli->query($vars) ;
if($q === false) {
Control::error('db',"Query failed: ".self::$mysqli->error."<br />\n");
}
}
return $q;
} | 1 | PHP | CWE-352 | Cross-Site Request Forgery (CSRF) | The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request. | https://cwe.mitre.org/data/definitions/352.html | safe |
function 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/_' . $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.'));
}
}
| 0 | PHP | CWE-74 | Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') | The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/74.html | vulnerable |
private function insertComment($data) {
$comment = $this->dom->createComment($data);
$this->appendToRealParent($comment);
} | 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 get_item_permissions_check( $request ) {
$tax_obj = get_taxonomy( $this->taxonomy );
if ( ! $tax_obj || ! $this->check_is_taxonomy_allowed( $this->taxonomy ) ) {
return false;
}
if ( 'edit' === $request['context'] && ! current_user_can( 'edit_term', (int) $request['id'] ) ) {
return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit this term.' ), array( 'status' => rest_authorization_required_code() ) );
}
return true;
} | 0 | PHP | NVD-CWE-noinfo | null | null | null | vulnerable |
public function approve_toggle() {
if (empty($this->params['id'])) return;
/* 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'];
$comment = new expComment($this->params['id']);
$comment->approved = $comment->approved == 1 ? 0 : 1;
if ($comment->approved) {
$this->sendApprovalNotification($comment,$this->params);
}
$comment->save();
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 |
$retVal = preg_replace ($pattern, $replacement, $subject, $limit);
} else {
$retVal = preg_replace ($pattern, $replacement, $subject);
}
if ($throws && $retVal === null) {
throw new StringUtilException (
Yii::t('app', 'preg_replace error: '.
StringUtilException::getErrorMessage (preg_last_error ())),
StringUtilException::PREG_REPLACE_ERROR);
}
return $retVal;
} | 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 |
$stat = $this->stat($p);
if (!$stat) { // invalid links
continue;
}
if (!empty($stat['hidden']) || !$this->mimeAccepted($stat['mime'], $mimes)) {
continue;
}
$name = $stat['name'];
if ($this->doSearchCurrentQuery['excludes']) {
foreach($this->doSearchCurrentQuery['excludes'] as $exclude) {
if ($this->stripos($name, $exclude) !== false) {
continue 2;
}
}
}
if ((!$mimes || $stat['mime'] !== 'directory') && $this->stripos($name, $q) !== false) {
$stat['path'] = $this->path($stat['hash']);
if ($this->URL && !isset($stat['url'])) {
$path = str_replace($this->separator, '/', substr($p, strlen($this->root) + 1));
if ($this->encoding) {
$path = str_replace('%2F', '/', rawurlencode($this->convEncIn($path, true)));
}
$stat['url'] = $this->URL . $path;
}
$result[] = $stat;
}
if ($stat['mime'] == 'directory' && $stat['read'] && !isset($stat['alias'])) {
if (! $this->options['searchExDirReg'] || ! preg_match($this->options['searchExDirReg'], $p)) {
$result = array_merge($result, $this->doSearch($p, $q, $mimes));
}
}
}
return $result;
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
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 |
public static function returnChildrenAsJSON() {
global $db;
//$nav = section::levelTemplate(intval($_REQUEST['id'], 0));
$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
$nav = $db->selectObjects('section', 'parent=' . $id, 'rank');
//FIXME $manage_all is moot w/ cascading perms now?
$manage_all = false;
if (expPermissions::check('manage', expCore::makeLocation('navigation', '', $id))) {
$manage_all = true;
}
//FIXME recode to use foreach $key=>$value
$navcount = count($nav);
for ($i = 0; $i < $navcount; $i++) {
if ($manage_all || expPermissions::check('manage', expCore::makeLocation('navigation', '', $nav[$i]->id))) {
$nav[$i]->manage = 1;
$view = true;
} else {
$nav[$i]->manage = 0;
$view = $nav[$i]->public ? true : expPermissions::check('view', expCore::makeLocation('navigation', '', $nav[$i]->id));
}
$nav[$i]->link = expCore::makeLink(array('section' => $nav[$i]->id), '', $nav[$i]->sef_name);
if (!$view) unset($nav[$i]);
}
$nav= array_values($nav);
// $nav[$navcount - 1]->last = true;
if (count($nav)) $nav[count($nav) - 1]->last = true;
// echo expJavascript::ajaxReply(201, '', $nav);
$ar = new expAjaxReply(201, '', $nav);
$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 |
$section = new section(intval($page));
if ($section) {
// self::deleteLevel($section->id);
$section->delete();
}
}
}
| 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 |
$that->assertTrue ($event->isVisibleTo (Yii::app()->params->profile->user)); | 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 getFooohnoService()
{
return $this->services['foo*/oh-no'] = new \FooClass();
} | 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 beforeFilter(EventInterface $event)
{
parent::beforeFilter($event);
$this->Authentication->allowUnauthenticated(['index']);
} | 0 | PHP | NVD-CWE-noinfo | null | null | null | vulnerable |
function db_seq_nextval($seqname)
{
global $DatabaseType;
if ($DatabaseType == 'mysqli')
$seq = "fn_" . strtolower($seqname) . "()";
return $seq;
} | 0 | PHP | CWE-22 | Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') | The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. | https://cwe.mitre.org/data/definitions/22.html | vulnerable |
private function checkAuthenticationTag() {
if ($this->authentication_tag === $this->calculateAuthenticationTag()) {
return true;
} else {
throw new JOSE_Exception_UnexpectedAlgorithm('Invalid authentication tag');
}
} | 0 | PHP | CWE-310 | Cryptographic Issues | Weaknesses in this category are related to the design and implementation of data confidentiality and integrity. Frequently these deal with the use of encoding techniques, encryption libraries, and hashing algorithms. The weaknesses in this category could lead to a degradation of the quality data if they are not addressed. | https://cwe.mitre.org/data/definitions/310.html | vulnerable |
foreach ($allusers as $uid) {
$u = user::getUserById($uid);
expPermissions::grant($u, 'manage', $sloc);
}
| 0 | PHP | CWE-74 | Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') | The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/74.html | vulnerable |
public function __construct($exceptions = false)
{
$this->exceptions = (boolean)$exceptions;
} | 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 test($serialized) {
$ret = null;
var_dump(
fb_unserialize(
$serialized,
inout $ret,
FB_SERIALIZE_HACK_ARRAYS
)
);
var_dump($ret);
} | 1 | PHP | CWE-674 | Uncontrolled Recursion | The product does not properly control the amount of recursion which takes place, consuming excessive resources, such as allocated memory or the program stack. | https://cwe.mitre.org/data/definitions/674.html | safe |
public static function getHelpVersionId($version) {
global $db;
return $db->selectValue('help_version', 'id', 'version="'.$db->escapeString($version).'"');
} | 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 captureAuthorization() {
//eDebug($this->params,true);
$order = new order($this->params['id']);
/*eDebug($this->params);
//eDebug($order,true);*/
//eDebug($order,true);
//$billing = new billing();
//eDebug($billing, true);
//$billing->calculator = new $calcname($order->billingmethod[0]->billingcalculator_id);
$calc = $order->billingmethod[0]->billingcalculator->calculator;
$calc->config = $order->billingmethod[0]->billingcalculator->config;
//$calc = new $calc-
//eDebug($calc,true);
if (!method_exists($calc, 'delayed_capture')) {
flash('error', gt('The Billing Calculator does not support delayed capture'));
expHistory::back();
}
$result = $calc->delayed_capture($order->billingmethod[0], $this->params['capture_amt'], $order);
if (empty($result->errorCode)) {
flash('message', gt('The authorized payment was successfully captured'));
expHistory::back();
} else {
flash('error', gt('An error was encountered while capturing the authorized payment.') . '<br /><br />' . $result->message);
expHistory::back();
}
} | 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 assetExtensions()
{
return [
'jpg',
'jpeg',
'bmp',
'png',
'webp',
'gif',
'ico',
'css',
'js',
'woff',
'woff2',
'svg',
'ttf',
'eot',
'json',
'md',
'less',
'sass',
'scss',
'xml'
];
} | 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 resetKey(){
$login_user = $this->checkLogin();
$item_id = I("item_id/d");
$item = D("Item")->where("item_id = '$item_id' ")->find();
if(!$this->checkItemManage($login_user['uid'] , $item['item_id'])){
$this->sendError(10303);
return ;
}
$ret = D("ItemToken")->where("item_id = '$item_id' ")->delete();
if ($ret) {
$this->getKey();
}else{
$this->sendError(10101);
}
} | 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 |
static function description() {
return "Manage events and schedules, and optionally publish them.";
} | 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 loadConfig($config_file_path)
{
$cfg = array();
if (file_exists($config_file_path)) {
include $config_file_path;
}
return $cfg;
} | 1 | PHP | CWE-200 | Exposure of Sensitive Information to an Unauthorized Actor | The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. | https://cwe.mitre.org/data/definitions/200.html | safe |
function __construct() {
}
| 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 ($days as $value) {
$regitem[] = $value;
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
private function normalizeParameterName($name)
{
if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) {
$normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName;
if ((string) $name !== $normalizedName) {
@trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), E_USER_DEPRECATED);
}
} else {
$normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name;
}
return $normalizedName;
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
$date->delete(); // event automatically deleted if all assoc eventdates are deleted
}
expHistory::back();
} | 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 getTemplateHierarchyFlat($parent, $depth = 1) {
global $db;
$arr = array();
$kids = $db->selectObjects('section_template', 'parent=' . $parent, 'rank');
// $kids = expSorter::sort(array('array'=>$kids,'sortby'=>'rank', 'order'=>'ASC'));
for ($i = 0, $iMax = count($kids); $i < $iMax; $i++) {
$page = $kids[$i];
$page->depth = $depth;
$page->first = ($i == 0 ? 1 : 0);
$page->last = ($i == count($kids) - 1 ? 1 : 0);
$arr[] = $page;
$arr = array_merge($arr, self::getTemplateHierarchyFlat($page->id, $depth + 1));
}
return $arr;
}
| 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 testParseTags () {
$tags = 'test,test2,test3,#test4';
$this->assertEquals (Tags::parseTags ($tags), array (
'#test',
'#test2',
'#test3',
'#test4',
));
} | 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 urlOrExistingFilepath($fields)
{
if ($this->isFeedLocal($this->data)) {
$path = mb_ereg_replace("/\:\/\//", '', $this->data['Feed']['url']);
if ($this->data['Feed']['source_format'] == 'misp') {
if (!is_dir($path)) {
return 'For MISP type local feeds, please specify the containing directory.';
}
} else {
if (!file_exists($path)) {
return 'Invalid path or file not found. Make sure that the path points to an existing file that is readable and watch out for typos.';
}
}
} else {
if (!filter_var($this->data['Feed']['url'], FILTER_VALIDATE_URL)) {
return false;
}
}
return true;
} | 1 | PHP | CWE-502 | Deserialization of Untrusted Data | The application deserializes untrusted data without sufficiently verifying that the resulting data will be valid. | https://cwe.mitre.org/data/definitions/502.html | safe |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.