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 |
---|---|---|---|---|---|---|---|
private function insertElement($token, $append = true, $check = false) {
// Proprietary workaround for libxml2's limitations with tag names
if ($check) {
// Slightly modified HTML5 tag-name modification,
// removing anything that's not an ASCII letter, digit, or hyphen
$token['name'] = preg_replace('/[^a-z0-9-]/i', '', $token['name']);
// Remove leading hyphens and numbers
$token['name'] = ltrim($token['name'], '-0..9');
// In theory, this should ever be needed, but just in case
if ($token['name'] === '') $token['name'] = 'span'; // arbitrary generic choice
}
$el = $this->dom->createElement($token['name']);
foreach($token['attr'] as $attr) {
if(!$el->hasAttribute($attr['name'])) {
$el->setAttribute($attr['name'], $attr['value']);
}
}
$this->appendToRealParent($el);
$this->stack[] = $el;
return $el;
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
private function timeToNext()
{
$currentTime = microtime(true);
$nextTime = PHP_INT_MAX;
foreach ($this->delays as $time) {
if ($time < $nextTime) {
$nextTime = $time;
}
}
return max(0, $nextTime - $currentTime) * 1000000;
} | 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 getNewShopUrl(Request $request, Shop $newShop)
{
// Remove baseUrl from request url
$url = $request->getRequestUri();
$repository = $this->get(ModelManager::class)->getRepository(Shop::class);
$requestShop = $repository->getActiveShopByRequestAsArray($request);
if ($requestShop && strpos($url, $requestShop['base_url']) === 0) {
$url = substr($url, \strlen($requestShop['base_url']));
}
$baseUrl = $request->getBaseUrl();
if (strpos($url, $baseUrl . '/') === 0) {
$url = substr($url, \strlen($baseUrl));
}
$basePath = (string) $newShop->getBasePath();
if (strpos($url, $basePath) === 0) {
$url = substr($url, \strlen($basePath));
}
$host = $newShop->getHost();
$baseUrl = $newShop->getBaseUrl() ?: $request->getBasePath();
if ($request->isSecure()) {
if ($newShop->getBaseUrl()) {
$baseUrl = $newShop->getBaseUrl();
} else {
$baseUrl = $request->getBaseUrl();
}
}
$host = trim($host, '/');
$baseUrl = trim($baseUrl, '/');
if (!empty($baseUrl)) {
$baseUrl = '/' . $baseUrl;
}
$url = ltrim($url, '/');
if (!empty($url)) {
$url = '/' . $url;
}
//build full redirect url to allow host switches
return sprintf(
'%s://%s%s%s',
$request->getScheme(),
$host,
$baseUrl,
$url
);
} | 0 | PHP | CWE-601 | URL Redirection to Untrusted Site ('Open Redirect') | A web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a Redirect. This simplifies phishing attacks. | https://cwe.mitre.org/data/definitions/601.html | vulnerable |
$src = substr($ref->source, strlen($prefix)) . $section->id;
if (call_user_func(array($ref->module, 'hasContent'))) {
$oloc = expCore::makeLocation($ref->module, $ref->source);
$nloc = expCore::makeLocation($ref->module, $src);
if ($ref->module != "container") {
call_user_func(array($ref->module, 'copyContent'), $oloc, $nloc);
} else {
call_user_func(array($ref->module, 'copyContent'), $oloc, $nloc, $section->id);
}
}
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
return $fa->nameGlyph($icons, 'icon-');
}
} else {
return array();
}
}
| 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 delete() {
global $db;
if (empty($this->params['id'])) return false;
$product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']);
$product = new $product_type($this->params['id'], true, false);
//eDebug($product_type);
//eDebug($product, true);
//if (!empty($product->product_type_id)) {
//$db->delete($product_type, 'id='.$product->product_id);
//}
$db->delete('option', 'product_id=' . $product->id . " AND optiongroup_id IN (SELECT id from " . $db->prefix . "optiongroup WHERE product_id=" . $product->id . ")");
$db->delete('optiongroup', 'product_id=' . $product->id);
//die();
$db->delete('product_storeCategories', 'product_id=' . $product->id . ' AND product_type="' . $product_type . '"');
if ($product->product_type == "product") {
if ($product->hasChildren()) {
$this->deleteChildren();
}
}
$product->delete();
flash('message', gt('Product deleted successfully.'));
expHistory::back();
} | 0 | PHP | CWE-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 setParseContent($bool)
{
$this->parseContent = $bool;
} | 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 configure() {
expHistory::set('editable', $this->params);
// little bit of trickery so that that categories can have their own configs
$this->loc->src = "@globalstoresettings";
$config = new expConfig($this->loc);
$this->config = $config->config;
$pullable_modules = expModules::listInstalledControllers($this->baseclassname, $this->loc);
$views = expTemplate::get_config_templates($this, $this->loc);
$gc = new geoCountry();
$countries = $gc->find('all');
$gr = new geoRegion();
$regions = $gr->find('all');
assign_to_template(array(
'config'=>$this->config,
'pullable_modules'=>$pullable_modules,
'views'=>$views,
'countries'=>$countries,
'regions'=>$regions,
'title'=>static::displayname()
));
} | 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 toCompiled()
{
return $this->processor->processUpdate($this, []);
} | 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 accept(NodeVisitor $nodeVisitor)
{
$nodeVisitor->visitElementNode($this);
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
trigger_error('%Attr.IDPrefixLocal cannot be used unless '.
'%Attr.IDPrefix is set', E_USER_WARNING);
}
if (!$this->selector) {
$id_accumulator =& $context->get('IDAccumulator');
if (isset($id_accumulator->ids[$id])) return false;
}
// we purposely avoid using regex, hopefully this is faster
if (ctype_alpha($id)) {
$result = true;
} else {
if (!ctype_alpha(@$id[0])) return false;
$trim = trim( // primitive style of regexps, I suppose
$id,
'A..Za..z0..9:-._'
);
$result = ($trim === '');
}
$regexp = $config->get('Attr.IDBlacklistRegexp');
if ($regexp && preg_match($regexp, $id)) {
return false;
}
if (!$this->selector && $result) $id_accumulator->add($id);
// if no change was made to the ID, return the result
// else, return the new id if stripping whitespace made it
// valid, or return false.
return $result ? $id : false;
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
public static function find_by_reference($reference, $website_id=null)
{
global $DB;
global $website;
if(empty($website_id))
$website_id = $website->id;
$order_id = $DB->query_single(
'id',
'nv_orders',
'reference = '.protect($reference).' AND website = "'.$website_id.'"'
);
return $order_id;
}
| 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
public function getPurchaseOrderByJSON() {
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');
}
echo json_encode($purchase_orders);
} | 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 manage_vendors () {
expHistory::set('viewable', $this->params);
$vendor = new vendor();
$vendors = $vendor->find('all');
assign_to_template(array(
'vendors'=>$vendors
));
} | 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 |
$count += $db->dropTable($basename);
}
flash('message', gt('Deleted').' '.$count.' '.gt('unused tables').'.');
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 |
$resource = fopen((string) $request->getUri()->withFragment(''), 'r', null, $context);
$this->lastHeaders = $http_response_header;
return $resource;
}
); | 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 _renderVarInput_number($form, &$var, &$vars)
{
$value = $var->getValue($vars);
if ($var->type->getProperty('fraction')) {
$value = sprintf('%01.' . $var->type->getProperty('fraction') . 'f', $value);
}
$linfo = Horde_Nls::getLocaleInfo();
/* Only if there is a mon_decimal_point do the
* substitution. */
if (!empty($linfo['mon_decimal_point'])) {
$value = str_replace('.', $linfo['mon_decimal_point'], $value);
}
return sprintf('<input type="text" size="5" name="%s" id="%s" value="%s"%s />',
htmlspecialchars($var->getVarName()),
$this->_genID($var->getVarName(), false),
htmlspecialchars($value),
$this->_getActionScripts($form, $var)
);
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
public static function _date2timestamp( $datetime, $wtz=null ) {
if( !isset( $datetime['hour'] )) $datetime['hour'] = 0;
if( !isset( $datetime['min'] )) $datetime['min'] = 0;
if( !isset( $datetime['sec'] )) $datetime['sec'] = 0;
if( empty( $wtz ) && ( !isset( $datetime['tz'] ) || empty( $datetime['tz'] )))
return mktime( $datetime['hour'], $datetime['min'], $datetime['sec'], $datetime['month'], $datetime['day'], $datetime['year'] );
$output = $offset = 0;
if( empty( $wtz )) {
if( iCalUtilityFunctions::_isOffset( $datetime['tz'] )) {
$offset = iCalUtilityFunctions::_tz2offset( $datetime['tz'] ) * -1;
$wtz = 'UTC';
}
else
$wtz = $datetime['tz'];
}
if(( 'Z' == $wtz ) || ( 'GMT' == strtoupper( $wtz )))
$wtz = 'UTC';
try {
$strdate = sprintf( '%04d-%02d-%02d %02d:%02d:%02d', $datetime['year'], $datetime['month'], $datetime['day'], $datetime['hour'], $datetime['min'], $datetime['sec'] );
$d = new DateTime( $strdate, new DateTimeZone( $wtz ));
if( 0 != $offset ) // adjust for offset
$d->modify( $offset.' seconds' );
$output = $d->format( 'U' );
unset( $d );
}
catch( Exception $e ) {
$output = mktime( $datetime['hour'], $datetime['min'], $datetime['sec'], $datetime['month'], $datetime['day'], $datetime['year'] );
}
return $output;
}
| 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 clone(array $override_input = [], bool $history = true) {
global $DB, $CFG_GLPI;
if ($DB->isSlave()) {
return false;
}
$new_item = new static();
$input = $this->fields;
foreach ($override_input as $key => $value) {
$input[$key] = $value;
}
$input = $new_item->prepareInputForClone($input);
if (isset($input['id'])) {
$input['_oldID'] = $input['id'];
unset($input['id']);
}
unset($input['date_creation']);
unset($input['date_mod']);
if (isset($input['template_name'])) {
unset($input['template_name']);
}
if (isset($input['is_template'])) {
unset($input['is_template']);
}
$input['clone'] = true;
$newID = $new_item->add($input, [], $history);
// If the item needs post clone (recursive cloning for example)
$new_item->post_clone($this, $history);
return $newID;
} | 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() {
$this->uri = new HTMLPurifier_AttrDef_URI(true); // embedded
$this->wmode = new HTMLPurifier_AttrDef_Enum(array('window', 'opaque', 'transparent'));
} | 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 XMLRPCremoveResourceGroup($name, $type) {
global $user;
if(! in_array("groupAdmin", $user['privileges'])) {
return array('status' => 'error',
'errorcode' => 16,
'errormsg' => 'access denied for managing groups');
}
if($groupid = getResourceGroupID("$type/$name")) {
$userresources = getUserResources(array("groupAdmin"),
array("manageGroup"), 1);
if(array_key_exists($type, $userresources)) {
if(array_key_exists($groupid, $userresources[$type])) {
if(checkForGroupUsage($groupid, 'resource')) {
return array('status' => 'error',
'errorcode' => 72,
'errormsg' => 'group currently in use and cannot be removed');
}
$query = "DELETE FROM resourcegroup "
. "WHERE id = $groupid";
doQuery($query, 315);
return array('status' => 'success');
}
else
return array('status' => 'error',
'errorcode' => 75,
'errormsg' => 'access denied to specified resource group');
}
}
return array('status' => 'error',
'errorcode' => 83,
'errormsg' => 'invalid resource group name');
} | 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 addFile($filename, $conditional_ie = false, $before_statics = false)
{
$hash = md5($filename);
if (!empty($this->_files[$hash])) {
return;
}
$has_onload = $this->_eventBlacklist($filename);
$this->_files[$hash] = array(
'has_onload' => $has_onload,
'filename' => $filename,
'conditional_ie' => $conditional_ie,
'before_statics' => $before_statics
);
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
public function admin_delete($id = null)
{
if (!$this->request->is('post') && !$this->request->is('delete')) {
throw new MethodNotAllowedException(__('Action not allowed, post or delete request expected.'));
}
if (!$this->_isAdmin()) {
throw new Exception('Administrators only.');
}
$this->User->id = $id;
$conditions = array('User.id' => $id);
if (!$this->_isSiteAdmin()) {
$conditions['org_id'] = $this->Auth->user('org_id');
}
$user = $this->User->find('first', array(
'conditions' => $conditions,
'recursive' => -1
));
if (empty($user)) {
throw new NotFoundException(__('Invalid user'));
}
$fieldsDescrStr = 'User (' . $id . '): ' . $user['User']['email'];
if ($this->User->delete($id)) {
$this->User->extralog($this->Auth->user(), "delete", $fieldsDescrStr, '');
if ($this->_isRest()) {
return $this->RestResponse->saveSuccessResponse('User', 'admin_delete', $id, $this->response->type(), 'User deleted.');
} else {
$this->Flash->success(__('User deleted'));
$this->redirect(array('action' => 'index'));
}
}
$this->Flash->error(__('User was not deleted'));
$this->redirect(array('action' => 'index'));
} | 1 | PHP | CWE-269 | Improper Privilege Management | The software does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor. | https://cwe.mitre.org/data/definitions/269.html | safe |
public static function mb_encoding_aliases($encoding)
{
switch (strtoupper($encoding)) {
case 'UTF8':
case 'UTF-8':
return array('utf8');
}
return false;
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
public function getKafkaPubTool()
{
if (!$this->loadedKafkaPubTool) {
App::uses('KafkaPubTool', 'Tools');
$kafkaPubTool = new KafkaPubTool();
$rdkafkaIni = Configure::read('Plugin.Kafka_rdkafka_config');
$rdkafkaIni = mb_ereg_replace("/\:\/\//", '', $rdkafkaIni);
$kafkaConf = array();
if (!empty($rdkafkaIni)) {
$kafkaConf = parse_ini_file($rdkafkaIni);
}
$brokers = Configure::read('Plugin.Kafka_brokers');
$kafkaPubTool->initTool($brokers, $kafkaConf);
$this->loadedKafkaPubTool = $kafkaPubTool;
}
return $this->loadedKafkaPubTool;
} | 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 |
public function testHttpCacheIsSetAsATrustedProxy(array $existing, array $expected)
{
Request::setTrustedProxies($existing);
$this->setNextResponse();
$this->request('GET', '/', array('REMOTE_ADDR' => '10.0.0.1'));
$this->assertEquals($expected, Request::getTrustedProxies());
Request::setTrustedProxies(array());
} | 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 __construct()
{
# code...
self::$smtphost = Options::v('smtphost');
self::$smtpuser = Options::v('smtpuser');
self::$smtppass = Options::v('smtppass');
self::$smtpport = Options::v('smtpport');
self::$siteemail = Options::v('siteemail');
self::$sitename = Options::v('sitename');
}
| 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_userpassword() {
global $user;
if (!$user->isAdmin() && $this->params['id'] != $user->id) {
flash('error', gt('You do not have permissions to change this users password.'));
expHistory::back();
}
if (empty($this->params['id'])) {
expValidator::failAndReturnToForm(gt('You must specify the user whose password you want to change'), $this->params);
}
if (empty($this->params['new_password1'])) {
expValidator::setErrorField('new_password1');
expValidator::failAndReturnToForm(gt('You must specify a new password for this user.'), $this->params);
}
if (empty($this->params['new_password2'])) {
expValidator::setErrorField('new_password2');
expValidator::failAndReturnToForm(gt('You must confirm the password.'), $this->params);
}
$u = new user($this->params['id']);
$ret = $u->setPassword($this->params['new_password1'], $this->params['new_password2']);
if (is_string($ret)) {
expValidator::setErrorField('new_password1');
$this->params['new_password1'] = '';
$this->params['new_password2'] = '';
expValidator::failAndReturnToForm($ret, $this->params);
} else {
$u->save(true);
}
flash('message', gt('Password reset for user') . ' ' . $u->username);
expHistory::back();
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
public function make($string) {
if (strlen($string) > 2 && $string[0] == 's' && $string[1] == ':') {
$string = substr($string, 2);
$sensitive = true;
} else {
$sensitive = false;
}
$values = explode(',', $string);
return new HTMLPurifier_AttrDef_Enum($values, $sensitive);
} | 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 |
array_push($newgroupprivs, $type);
}
if(empty($newgroupprivs) || (count($newgroupprivs) == 1 &&
in_array("cascade", $newgroupprivs))) {
return array('status' => 'error',
'errorcode' => 53,
'errormsg' => 'Invalid or missing permissions list supplied');
}
updateUserOrGroupPrivs($groupid, $nodeid, $newgroupprivs, array(), "group");
return array('status' => 'success');
} | 0 | 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 | vulnerable |
public function showall_tags() {
$images = $this->image->find('all');
$used_tags = array();
foreach ($images as $image) {
foreach($image->expTag as $tag) {
if (isset($used_tags[$tag->id])) {
$used_tags[$tag->id]->count++;
} else {
$exptag = new expTag($tag->id);
$used_tags[$tag->id] = $exptag;
$used_tags[$tag->id]->count = 1;
}
}
}
assign_to_template(array(
'tags'=>$used_tags
));
} | 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 |
$validator->validateToken($token, $config, $context);
$tokens[$key] = $token; // for PHP 4
}
$context->destroy('CurrentToken');
return $tokens;
} | 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 lockTable($table,$lockType="WRITE") {
$sql = "LOCK TABLES `" . $this->prefix . "$table` $lockType";
$res = mysqli_query($this->connection, $sql);
return $res;
} | 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 parseAndTrimExport($str, $isHTML = false) { //�Death from above�? �
//echo "1<br>"; eDebug($str);
$str = str_replace("�", "’", $str);
$str = str_replace("�", "‘", $str);
$str = str_replace("�", "®", $str);
$str = str_replace("�", "-", $str);
$str = str_replace("�", "—", $str);
$str = str_replace("�", "”", $str);
$str = str_replace("�", "“", $str);
$str = str_replace("\r\n", " ", $str);
$str = str_replace("\t", " ", $str);
$str = str_replace(",", "\,", $str);
$str = str_replace("�", "¼", $str);
$str = str_replace("�", "½", $str);
$str = str_replace("�", "¾", $str);
if (!$isHTML) {
$str = str_replace('\"', """, $str);
$str = str_replace('"', """, $str);
} else {
$str = str_replace('"', '""', $str);
}
//$str = htmlspecialchars($str);
//$str = utf8_encode($str);
$str = trim(str_replace("�", "™", $str));
//echo "2<br>"; eDebug($str,die);
return $str;
} | 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 nvweb_webuser_generate_username($email)
{
global $DB;
global $website;
// generate a valid username
// try to get the left part of the email address, except if it is a common account name
$username = strtolower(substr($email, 0, strpos($email, '@'))); // left part of the email
if(!empty($username) && !in_array($username, array('info', 'admin', 'contact', 'demo', 'test')))
{
// check if the proposed username already exists,
// in that case use the full email as username
// ** if the email already exists, the subscribe process only needs to update the newsletter subscription!
$wu_id = $DB->query_single(
'id',
'nv_webusers',
' LOWER(username) = '.protect($username).'
AND website = '.$website->id
);
}
if(empty($wu_id))
{
// proposed username is valid,
// continue with the registration
}
else if(!empty($wu_id) || empty($username))
{
// a webuser with the proposed name already exists... or is empty
// try using another username -- maybe the full email address?
$username = $email;
$wu_id = $DB->query_single(
'id',
'nv_webusers',
' LOWER(username) = ' . protect($email) . '
AND website = ' . $website->id
);
if(empty($wu_id))
{
// proposed username is valid,
// continue with the registration
}
else
{
// oops, email is already used for another webuser account
// let's create a unique username and go on
$username = uniqid($username . '-');
}
}
return $username;
}
| 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 approve() {
expHistory::set('editable', $this->params);
/* The global constants can be overriden by passing appropriate params */
//sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];
// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];
// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];
// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];
if (empty($this->params['id'])) {
flash('error', gt('No ID supplied for comment to approve'));
expHistory::back();
}
$comment = new expComment($this->params['id']);
assign_to_template(array(
'comment'=>$comment
));
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
public function validate($string, $config, $context) {
$string = $this->parseCDATA($string);
if ($string === '') return false;
$length = strlen($string);
if ($length === 1) return false;
if ($string[$length - 1] !== '%') return false;
$number = substr($string, 0, $length - 1);
$number = $this->number_def->validate($number, $config, $context);
if ($number === false) return false;
return "$number%";
} | 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 sendData($data)
{
$url = $this->getEndpoint().'?'.http_build_query($data, '', '&');
$httpRequest = $this->httpClient->get($url);
$httpRequest->getCurlOptions()->set(CURLOPT_SSLVERSION, 6); // CURL_SSLVERSION_TLSv1_2 for libcurl < 7.35
$httpResponse = $httpRequest->send();
return $this->createResponse($httpResponse->getBody());
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
function manage_vendors () {
expHistory::set('viewable', $this->params);
$vendor = new vendor();
$vendors = $vendor->find('all');
assign_to_template(array(
'vendors'=>$vendors
));
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
public function hasTag ($tag, array $oldTags=null, $refresh=false) {
$oldTags = $oldTags === null ? $this->getTags ($refresh) : $oldTags;
return in_array (strtolower (Tags::normalizeTag ($tag)), array_map (function ($tag) {
return strtolower ($tag);
}, $oldTags));
} | 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 enableCurrency(TransactionCurrency $currency)
{
app('preferences')->mark();
$this->repository->enable($currency);
session()->flash('success', (string) trans('firefly.currency_is_now_enabled', ['name' => $currency->name]));
Log::channel('audit')->info(sprintf('Enabled currency %s.', $currency->code));
return redirect(route('currencies.index'));
} | 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 searchName() {
return gt("Calendar Event");
}
| 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 |
if (!is_string($val)) $this->error("value $val", 'must be a string');
}
array_pop($this->context);
} | 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 setupMemberVariables($config) {
$this->host = $config->get('URI.Host');
$base_uri = $config->get('URI.Base');
if (!is_null($base_uri)) {
$parser = new HTMLPurifier_URIParser();
$this->base = $parser->parse($base_uri);
$this->defaultScheme = $this->base->scheme;
if (is_null($this->host)) $this->host = $this->base->host;
}
if (is_null($this->defaultScheme)) $this->defaultScheme = $config->get('URI.DefaultScheme');
} | 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 convertXMLFeedSafeChar($str) {
$str = str_replace("<br>","",$str);
$str = str_replace("</br>","",$str);
$str = str_replace("<br/>","",$str);
$str = str_replace("<br />","",$str);
$str = str_replace(""",'"',$str);
$str = str_replace("'","'",$str);
$str = str_replace("’","'",$str);
$str = str_replace("‘","'",$str);
$str = str_replace("®","",$str);
$str = str_replace("�","-", $str);
$str = str_replace("�","-", $str);
$str = str_replace("�", '"', $str);
$str = str_replace("”",'"', $str);
$str = str_replace("�", '"', $str);
$str = str_replace("“",'"', $str);
$str = str_replace("\r\n"," ",$str);
$str = str_replace("�"," 1/4",$str);
$str = str_replace("¼"," 1/4", $str);
$str = str_replace("�"," 1/2",$str);
$str = str_replace("½"," 1/2",$str);
$str = str_replace("�"," 3/4",$str);
$str = str_replace("¾"," 3/4",$str);
$str = str_replace("�", "(TM)", $str);
$str = str_replace("™","(TM)", $str);
$str = str_replace("®","(R)", $str);
$str = str_replace("�","(R)",$str);
$str = str_replace("&","&",$str);
$str = str_replace(">",">",$str);
return trim($str);
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
public function copy() {
return new HTMLPurifier_DefinitionCache_Decorator_Cleanup();
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
function edit() {
global $user;
/* The global constants can be overriden by passing appropriate params */
//sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
$require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];
$require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];
$require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];
$notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];
if (empty($this->params['formtitle']))
{
if (empty($this->params['id']))
{
$formtitle = gt("Add New Note");
}
else
{
$formtitle = gt("Edit Note");
}
}
else
{
$formtitle = $this->params['formtitle'];
}
$id = empty($this->params['id']) ? null : $this->params['id'];
$simpleNote = new expSimpleNote($id);
//FIXME here is where we might sanitize the note before displaying/editing it
assign_to_template(array(
'simplenote'=>$simpleNote,
'user'=>$user,
'require_login'=>$require_login,
'require_approval'=>$require_approval,
'require_notification'=>$require_notification,
'notification_email'=>$notification_email,
'formtitle'=>$formtitle,
'content_type'=>$this->params['content_type'],
'content_id'=>$this->params['content_id'],
'tab'=>empty($this->params['tab'])?0:$this->params['tab']
));
} | 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 matchesPath($requestPath)
{
$cookiePath = $this->getPath();
// Match on exact matches or when path is the default empty "/"
if ($cookiePath === '/' || $cookiePath == $requestPath) {
return true;
}
// Ensure that the cookie-path is a prefix of the request path.
if (0 !== strpos($requestPath, $cookiePath)) {
return false;
}
// Match if the last character of the cookie-path is "/"
if (substr($cookiePath, -1, 1) === '/') {
return true;
}
// Match if the first character not included in cookie path is "/"
return substr($requestPath, strlen($cookiePath), 1) === '/';
} | 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 processModule($module) {
if (!isset($this->registeredModules[$module]) || is_object($module)) {
$this->registerModule($module);
}
$this->modules[$module] = $this->registeredModules[$module];
} | 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 allowsElement($name) {
if (!empty($this->currentNesting)) {
$parent_token = array_pop($this->currentNesting);
$this->currentNesting[] = $parent_token;
$parent = $this->htmlDefinition->info[$parent_token->name];
} else {
$parent = $this->htmlDefinition->info_parent_def;
}
if (!isset($parent->child->elements[$name]) || isset($parent->excludes[$name])) {
return false;
}
// check for exclusion
for ($i = count($this->currentNesting) - 2; $i >= 0; $i--) {
$node = $this->currentNesting[$i];
$def = $this->htmlDefinition->info[$node->name];
if (isset($def->excludes[$name])) return false;
}
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 |
function edit_section() {
global $db, $user;
$parent = new section($this->params['parent']);
if (empty($parent->id)) $parent->id = 0;
assign_to_template(array(
'haveStandalone' => ($db->countObjects('section', 'parent=-1') && $parent->id >= 0),
'parent' => $parent,
'isAdministrator' => $user->isAdmin(),
));
}
| 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 post($vars)
{
switch (SMART_URL) {
case true:
$inFold = (Options::v('permalink_use_index_php') == 'on') ? '/index.php/' : '/';
if (Options::v('multilang_enable') === 'on') {
$lang = Language::isActive();
$lang = !empty($lang) ? $lang.'/' : '';
$url = Site::$url.$inFold.$lang.self::slug($vars)."/{$vars}";
} else {
$url = Site::$url.$inFold.self::slug($vars)."/{$vars}";
}
break;
default:
if (Options::v('multilang_enable') === 'on') {
$lang = Language::isActive();
$lang = !empty($lang) ? '&lang='.$lang : '';
$url = Site::$url."/?post={$vars}{$lang}";
} else {
$url = Site::$url."/?post={$vars}";
}
break;
}
return $url;
} | 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 ac_sigleid($name, $id) {
global $cms_db, $sess;
$sess->gc( true );
$ret = true;
if( $id >= 1 ) {
$ret = false;
$cquery = sprintf("select count(*) from %s where user_id='%s' and name='%s'",
$cms_db['sessions'],
addslashes($id),
addslashes($name));
$squery = sprintf("select sid from %s where user_id='%s' and name='%s'",
$cms_db['sessions'],
addslashes($id),
addslashes($name));
$this->db->query($squery);
if ( $this->db->affected_rows() == 0
&& $this->db->query($cquery)
&& $this->db->next_record() && $this->db->f(0) == 0 ) {
// nothing found here
$ret = true;
}
}
return $ret;
} | 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 ($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 |
function edit_externalalias() {
$section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params);
if ($section->parent == -1) {
notfoundController::handle_not_found();
exit;
} // doesn't work for standalone pages
if (empty($section->id)) {
$section->public = 1;
if (!isset($section->parent)) {
// This is another precaution. The parent attribute
// should ALWAYS be set by the caller.
//FJD - if that's the case, then we should die.
notfoundController::handle_not_authorized();
exit;
//$section->parent = 0;
}
}
assign_to_template(array(
'section' => $section,
'glyphs' => self::get_glyphs(),
));
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
public function confirm()
{
$project = $this->getProject();
$action = $this->getAction($project);
$this->response->html($this->helper->layout->project('action/remove', array(
'action' => $action,
'available_events' => $this->eventManager->getAll(),
'available_actions' => $this->actionManager->getAvailableActions(),
'project' => $project,
'title' => t('Remove an 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 |
protected function decode($hash) {
if (strpos($hash, $this->id) === 0) {
// cut volume id after it was prepended in encode
$h = substr($hash, strlen($this->id));
// replace HTML safe base64 to normal
$h = base64_decode(strtr($h, '-_.', '+/='));
// TODO uncrypt hash and return path
$path = $this->uncrypt($h);
// append ROOT to path after it was cut in encode
return $this->abspathCE($path);//$this->root.($path === $this->separator ? '' : $this->separator.$path);
}
//TODO: Add return statement here
} | 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 VerifyBlockedSchedule($columns,$course_period_id,$sec,$edit=false)
{
if($course_period_id!='new')
{
$cp_det_RET= DBGet(DBQuery("SELECT * FROM course_periods WHERE course_period_id=$course_period_id"));
$cp_det_RET=$cp_det_RET[1];
$teacher=$cp_det_RET['TEACHER_ID'];
$secteacher=$cp_det_RET['SECONDARY_TEACHER_ID'];
$all_teacher=$teacher.($secteacher!=''?$secteacher:'');
} | 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 actionGetItems($term) {
X2LinkableBehavior::getItems ($term);
} | 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()
{
$task = $this->getTask();
$link_id = $this->request->getIntegerParam('link_id');
$link = $this->taskExternalLinkModel->getById($link_id);
if (empty($link)) {
throw new PageNotFoundException();
}
$this->response->html($this->template->render('task_external_link/remove', array(
'link' => $link,
'task' => $task,
)));
} | 0 | PHP | CWE-639 | Authorization Bypass Through User-Controlled Key | The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. | https://cwe.mitre.org/data/definitions/639.html | vulnerable |
public function testFirstTrustedProxyIsSetAsRemote()
{
$expectedSubRequest = Request::create('/');
$expectedSubRequest->headers->set('Surrogate-Capability', 'abc="ESI/1.0"');
$expectedSubRequest->server->set('REMOTE_ADDR', '1.1.1.1');
if (Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP)) {
$expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1'));
$expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1');
}
Request::setTrustedProxies(array('1.1.1.1'));
$strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest));
$request = Request::create('/');
$request->headers->set('Surrogate-Capability', 'abc="ESI/1.0"');
$strategy->render('/', $request);
Request::setTrustedProxies(array());
} | 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 testPinCommentAction()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/customer/1/details');
$form = $client->getCrawler()->filter('form[name=customer_comment_form]')->form();
$client->submit($form, [
'customer_comment_form' => [
'message' => 'Blah foo bar',
]
]);
$this->assertIsRedirect($client, $this->createUrl('/admin/customer/1/details'));
$client->followRedirect();
$node = $client->getCrawler()->filter('div.box#comments_box .direct-chat-text');
self::assertStringContainsString('Blah foo bar', $node->html());
$node = $client->getCrawler()->filter('div.box#comments_box .direct-chat-text a.btn.active');
self::assertEquals(0, $node->count());
$comments = $this->getEntityManager()->getRepository(CustomerComment::class)->findAll();
$id = $comments[0]->getId();
$this->request($client, '/admin/customer/' . $id . '/comment_pin');
$this->assertIsRedirect($client, $this->createUrl('/admin/customer/1/details'));
$client->followRedirect();
$node = $client->getCrawler()->filter('div.box#comments_box .box-body a.btn.active');
self::assertEquals(1, $node->count());
self::assertEquals($this->createUrl('/admin/customer/' . $id . '/comment_pin'), $node->attr('href'));
} | 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 getPLaying(){
$url = "http://api.themoviedb.org/3/movie/now_playing?api_key=".$this->apikey;
$now_playing = $this->curl($url);
return $now_playing;
}
| 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() {
//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();
} | 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 |
recyclebin::sendToRecycleBin($loc, $parent);
//FIXME if we delete the module & sectionref the module completely disappears
// if (class_exists($secref->module)) {
// $modclass = $secref->module;
// //FIXME: more module/controller glue code
// if (expModules::controllerExists($modclass)) {
// $modclass = expModules::getControllerClassName($modclass);
// $mod = new $modclass($loc->src);
// $mod->delete_instance();
// } else {
// $mod = new $modclass();
// $mod->deleteIn($loc);
// }
// }
}
// $db->delete('sectionref', 'section=' . $parent);
$db->delete('section', 'parent=' . $parent);
} | 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();
$category = $this->getCategory();
if ($this->categoryModel->remove($category['id'])) {
$this->flash->success(t('Category removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this category.'));
}
$this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])));
} | 0 | PHP | CWE-200 | Exposure of Sensitive Information to an Unauthorized Actor | The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. | https://cwe.mitre.org/data/definitions/200.html | vulnerable |
public static function mb_detect_order($encodingList = null)
{
if (null === $encodingList) {
return self::$encodingList;
}
if (!is_array($encodingList)) {
$encodingList = array_map('trim', explode(',', $encodingList));
}
$encodingList = array_map('strtoupper', $encodingList);
foreach ($encodingList as $enc) {
switch ($enc) {
default:
if (strncmp($enc, 'ISO-8859-', 9)) {
return false;
}
case 'ASCII':
case 'UTF8':
case 'UTF-8':
}
}
self::$encodingList = $encodingList;
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 remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$action = $this->actionModel->getById($this->request->getIntegerParam('action_id'));
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'])));
} | 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 validatePharUri(string $uri)
{
if ($uri === null || strlen($uri) === 0) {
return [false, "The URI must not be empty."];
}
$file = substr(substr($uri, 0, strpos($uri, ".phar") + 5), 7);
return $this->validateLocalUri($file);
} | 1 | PHP | CWE-73 | External Control of File Name or Path | The software allows user input to control or influence paths or file names that are used in filesystem operations. | https://cwe.mitre.org/data/definitions/73.html | safe |
public function __construct(array $attributes = null)
{
$rootDir = realpath(__DIR__ . "/../");
$this->setChroot(array($rootDir));
$this->setRootDir($rootDir);
$this->setTempDir(sys_get_temp_dir());
$this->setFontDir($rootDir . "/lib/fonts");
$this->setFontCache($this->getFontDir());
$ver = "";
$versionFile = realpath(__DIR__ . "/../VERSION");
if (file_exists($versionFile) && ($version = trim(file_get_contents($versionFile))) !== false && $version !== '$Format:<%h>$') {
$ver = "/$version";
}
$this->setHttpContext([
"http" => [
"follow_location" => false,
"user_agent" => "Dompdf$ver https://github.com/dompdf/dompdf"
]
]);
if (null !== $attributes) {
$this->set($attributes);
}
} | 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 |
protected function readlink($path) {
if (!($target = @readlink($path))) {
return null;
}
if (strpos($target, $this->systemRoot) !== 0) {
$target = $this->_joinPath(dirname($path), $target);
}
if (!file_exists($target)) {
return false;
}
return $target;
} | 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() {
global $GLOBALS, $data;
self::$editors =& $GLOBALS;
self::$data =& $data;
self::$url = Options::get('siteurl');
self::$domain = Options::get('sitedomain');
self::$name = Options::get('sitename');
self::$key = Options::get('sitekeywords');
self::$desc = Options::get('sitedesc');
} | 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 testProfilePages () {
$this->visitPages ($this->getPages ('^profile'));
} | 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 getErrorMessage() {
$vs_error_message = $this->opo_error_messages->get($this->opn_error_number);
if ($vs_error_message) {
return $vs_error_message;
} else {
return "Unknown error: ".$this->opn_error_number;
}
} | 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 editAlt() {
global $user;
$file = new expFile($this->params['id']);
if ($user->id==$file->poster || $user->isAdmin()) {
$file->alt = $this->params['newValue'];
$file->save();
$ar = new expAjaxReply(200, gt('Your alt was updated successfully'), $file);
} else {
$ar = new expAjaxReply(300, gt("You didn't create this file, so you can't edit it."));
}
$ar->send();
echo json_encode($file); //FIXME we exit before hitting this
} | 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() {
$r = '<div class="title gallery_div">'.$this->stack_name.'</div>';
for ($i = 0; $i < count($this->tiles_array); $i++) {
$top = rand(-5, 5);
$left = rand(-5, 5);
$img_w = $this->tiles_array[$i]->getWidth();
$extra = '';
if ($img_w < IMAGE_WIDTH) {
$extra = 'width:'.$img_w.'px;';
}
$r .= '<div class="miniature_border gallery_div" style="background-image:url(\''.$this->tiles_array[$i]->getMiniatureSrc().'\');margin-top:'.$top.'px; margin-left:'.$left.'px;'.$extra.'"></div>';
}
return $r;
} | 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 |
$f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber $v) { return $v; }; return $f(${($_ = isset($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber']) ? $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber'] : ($this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber())) && false ?: '_'}); | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
protected function getC1Service()
{
return $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C1'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C1();
} | 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 _stat($path) {
$sql = 'SELECT f.id, f.parent_id, f.name, f.size, f.mtime AS ts, f.mime, f.read, f.write, f.locked, f.hidden, f.width, f.height, IF(ch.id, 1, 0) AS dirs
FROM '.$this->tbf.' AS f
LEFT JOIN '.$this->tbf.' AS p ON p.id=f.parent_id
LEFT JOIN '.$this->tbf.' AS ch ON ch.parent_id=f.id AND ch.mime="directory"
WHERE f.id="'.$path.'"
GROUP BY f.id';
$res = $this->query($sql);
if ($res) {
$stat = $res->fetch_assoc();
if ($stat['parent_id']) {
$stat['phash'] = $this->encode($stat['parent_id']);
}
if ($stat['mime'] == 'directory') {
unset($stat['width']);
unset($stat['height']);
} else {
unset($stat['dirs']);
}
unset($stat['id']);
unset($stat['parent_id']);
return $stat;
}
return array();
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
function manage() {
global $db;
expHistory::set('manageable', $this->params);
// $classes = array();
$dir = BASE."framework/modules/ecommerce/billingcalculators";
if (is_readable($dir)) {
$dh = opendir($dir);
while (($file = readdir($dh)) !== false) {
if (is_file("$dir/$file") && substr("$dir/$file", -4) == ".php") {
include_once("$dir/$file");
$classname = substr($file, 0, -4);
$id = $db->selectValue('billingcalculator', 'id', 'calculator_name="'.$classname.'"');
if (empty($id)) {
// $calobj = null;
$calcobj = new $classname();
if ($calcobj->isSelectable() == true) {
$obj = new billingcalculator(array(
'title'=>$calcobj->name(),
// 'user_title'=>$calcobj->title,
'body'=>$calcobj->description(),
'calculator_name'=>$classname,
'enabled'=>false));
$obj->save();
}
}
}
}
}
$bcalc = new billingcalculator();
$calculators = $bcalc->find('all');
assign_to_template(array(
'calculators'=>$calculators
));
} | 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 downloadfile() {
if (empty($this->params['fileid'])) {
flash('error', gt('There was an error while trying to download your file. No File Specified.'));
expHistory::back();
}
$fd = new filedownload($this->params['fileid']);
if (empty($this->params['filenum'])) $this->params['filenum'] = 0;
if (empty($fd->expFile['downloadable'][$this->params['filenum']]->id)) {
flash('error', gt('There was an error while trying to download your file. The file you were looking for could not be found.'));
expHistory::back();
}
$fd->downloads++;
$fd->save();
// this will set the id to the id of the actual file..makes the download go right.
$this->params['id'] = $fd->expFile['downloadable'][$this->params['filenum']]->id;
parent::downloadfile();
} | 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 |
$q = self::$mysqli->query($vars) ;
if($q === false) {
user_error("Query failed: ".self::$mysqli->error."<br />\n$vars");
return false;
}
}
return $q;
} | 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 static function cat($vars) {
switch (SMART_URL) {
case true:
# code...
$url = Site::$url."/".$vars."/".Typo::slugify(Categories::name($vars));
break;
default:
# code...
$url = Site::$url."/index.php?cat={$vars}";
break;
}
return $url;
} | 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 referenceFixtures () {
return array (
'contacts' => 'Contacts',
'tags' => 'Tags',
);
} | 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 getTrack1()
{
$track1 = null;
if ($tracks = $this->getTracks()) {
$pattern = '/\%B\d{1,19}\^.{2,26}\^\d{4}\d*\?/';
if (preg_match($pattern, $tracks, $matches) === 1) {
$track1 = $matches[0];
}
}
return $track1;
} | 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 resetCounter()
{
$this->elCounter = 0;
} | 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 XMLRPCremoveImageGroupFromComputerGroup($imageGroup, $computerGroup){
$imageid = getResourceGroupID("image/$imageGroup");
$compid = getResourceGroupID("computer/$computerGroup");
if($imageid && $compid){
$tmp = getUserResources(array("imageAdmin"),
array("manageMapping"), 1);
$imagegroups = $tmp['image'];
$tmp = getUserResources(array("computerAdmin"),
array("manageMapping"), 1);
$computergroups = $tmp['computer'];
if(array_key_exists($compid, $computergroups) &&
array_key_exists($imageid, $imagegroups)){
$mapping = getResourceMapping("image", "computer",
$imageid,
$compid);
if(array_key_exists($imageid, $mapping) &&
array_key_exists($compid, $mapping[$imageid])){
$query = "DELETE FROM resourcemap "
. "WHERE resourcegroupid1 = $imageid AND "
. "resourcetypeid1 = 13 AND "
. "resourcegroupid2 = $compid AND "
. "resourcetypeid2 = 12";
doQuery($query, 101);
}
return array('status' => 'success');
} else {
return array('status' => 'error',
'errorcode' => 84,
'errormsg' => 'cannot access computer and/or image group');
}
} 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 |
private function _verify($public_key_or_secret, $expected_alg = null) {
$segments = explode('.', $this->raw);
$signature_base_string = implode('.', array($segments[0], $segments[1]));
if (!$expected_alg) {
# NOTE: might better to warn here
$expected_alg = $this->header['alg'];
}
switch ($expected_alg) {
case 'HS256':
case 'HS384':
case 'HS512':
return $this->signature === hash_hmac($this->digest(), $signature_base_string, $public_key_or_secret, true);
case 'RS256':
case 'RS384':
case 'RS512':
return $this->rsa($public_key_or_secret, RSA::SIGNATURE_PKCS1)->verify($signature_base_string, $this->signature);
case 'ES256':
case 'ES384':
case 'ES512':
throw new JOSE_Exception_UnexpectedAlgorithm('Algorithm not supported');
case 'PS256':
case 'PS384':
case 'PS512':
return $this->rsa($public_key_or_secret, RSA::SIGNATURE_PSS)->verify($signature_base_string, $this->signature);
default:
throw new JOSE_Exception_UnexpectedAlgorithm('Unknown algorithm');
}
} | 0 | PHP | CWE-200 | Exposure of Sensitive Information to an Unauthorized Actor | The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. | https://cwe.mitre.org/data/definitions/200.html | vulnerable |
public function load_by_hash($hash)
{
global $DB;
global $session;
global $events;
$ok = $DB->query('SELECT * FROM nv_webusers WHERE cookie_hash = '.protect($hash));
if($ok)
$data = $DB->result();
if(!empty($data))
{
$this->load_from_resultset($data);
// check if the user is still allowed to sign in
$blocked = 1;
if( $this->access == 0 ||
( $this->access == 2 &&
($this->access_begin==0 || $this->access_begin < time()) &&
($this->access_end==0 || $this->access_end > time())
)
)
{
$blocked = 0;
}
if($blocked==1)
return false;
$session['webuser'] = $this->id;
// maybe this function is called without initializing $events
if(method_exists($events, 'trigger'))
{
$events->trigger(
'webuser',
'sign_in',
array(
'webuser' => $this,
'by' => 'cookie'
)
);
}
}
}
| 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 testNotRemoveAuthorizationHeaderOnRedirect()
{
$mock = new MockHandler([
new Response(302, ['Location' => 'http://example.com/2']),
static function (RequestInterface $request) {
self::assertTrue($request->hasHeader('Authorization'));
return new Response(200);
}
]);
$handler = HandlerStack::create($mock);
$client = new Client(['handler' => $handler]);
$client->get('http://example.com?a=b', ['auth' => ['testuser', 'testpass']]);
} | 0 | PHP | CWE-200 | Exposure of Sensitive Information to an Unauthorized Actor | The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. | https://cwe.mitre.org/data/definitions/200.html | vulnerable |
public function validateMulti(array $credentialCandidates)
{
$lastException = null;
foreach ($credentialCandidates as $credential) {
if (false == $credential instanceof CredentialInterface) {
throw new \InvalidArgumentException('Expected CredentialInterface');
}
if (null == $credential->getPublicKey()) {
continue;
}
try {
$result = $this->validate($credential->getPublicKey());
if ($result === false) {
return;
}
return $credential;
} catch (LightSamlSecurityException $ex) {
$lastException = $ex;
}
}
if ($lastException) {
throw $lastException;
} else {
throw new LightSamlSecurityException('No public key available for signature verification');
}
} | 0 | PHP | CWE-732 | Incorrect Permission Assignment for Critical Resource | The product specifies permissions for a security-critical resource in a way that allows that resource to be read or modified by unintended actors. | https://cwe.mitre.org/data/definitions/732.html | vulnerable |
protected function copy($src, $dst, $name) {
elFinder::extendTimeLimit();
$srcStat = $this->stat($src);
$this->clearcache();
if (!empty($srcStat['thash'])) {
$target = $this->decode($srcStat['thash']);
if (!$this->inpathCE($target, $this->root)) {
return $this->setError(elFinder::ERROR_COPY, $this->path($srcStat['hash']), elFinder::ERROR_MKOUTLINK);
}
$stat = $this->stat($target);
$this->clearcache();
return $stat && $this->symlinkCE($target, $dst, $name)
? $this->joinPathCE($dst, $name)
: $this->setError(elFinder::ERROR_COPY, $this->path($srcStat['hash']));
}
if ($srcStat['mime'] === 'directory') {
$testStat = $this->stat($this->joinPathCE($dst, $name));
$this->clearcache();
if (($testStat && $testStat['mime'] != 'directory') || (! $testStat && ! $testStat = $this->mkdir($this->encode($dst), $name))) {
return $this->setError(elFinder::ERROR_COPY, $this->path($srcStat['hash']));
}
$dst = $this->decode($testStat['hash']);
foreach ($this->getScandir($src) as $stat) {
if (empty($stat['hidden'])) {
$name = $stat['name'];
$_src = $this->decode($stat['hash']);
if (! $this->copy($_src, $dst, $name)) {
$this->remove($dst, true); // fall back
return $this->setError($this->error, elFinder::ERROR_COPY, $this->_path($src));
}
}
}
$this->added[] = $testStat;
return $dst;
}
if ($this->options['copyJoin']) {
$test = $this->joinPathCE($dst, $name);
if ($testStat = $this->stat($test)) {
$this->remove($test);
}
} else {
$testStat = false;
}
if ($res = $this->convEncOut($this->_copy($this->convEncIn($src), $this->convEncIn($dst), $this->convEncIn($name)))) {
$path = is_string($res)? $res : $this->joinPathCE($dst, $name);
$this->clearcache();
$this->added[] = $this->stat($path);
return $path;
}
return $this->setError(elFinder::ERROR_COPY, $this->path($srcStat['hash']));
} | 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 html_escape_request_var($string) {
return html_escape(get_request_var($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 static function post($vars) {
switch (SMART_URL) {
case true:
# code...
$url = Site::$url."/".self::slug($vars)."/{$vars}";
break;
default:
# code...
$url = Site::$url."/index.php?post={$vars}";
break;
}
return $url;
} | 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 |
if ($v === false) unset($elements[$n]);
}
return $elements;
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
public function setup($config) {
// These definitions are not intrinsically safe: the attribute transforms
// are a vital part of ensuring safety.
$allowed = $config->get('HTML.SafeScripting');
$script = $this->addElement(
'script',
'Inline',
'Empty',
null,
array(
// While technically not required by the spec, we're forcing
// it to this value.
'type' => 'Enum#text/javascript',
'src*' => new HTMLPurifier_AttrDef_Enum(array_keys($allowed))
)
);
$script->attr_transform_pre[] =
$script->attr_transform_post[] = new HTMLPurifier_AttrTransform_ScriptRequired();
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
function db_case($array)
{
global $DatabaseType;
$counter = 0;
if ($DatabaseType == 'mysqli') {
$array_count = count($array);
$string = " CASE WHEN $array[0] =";
$counter++;
$arr_count = count($array);
for ($i = 1; $i < $arr_count; $i++) {
$value = $array[$i];
if ($value == "''" && substr($string, -1) == '=') {
$value = ' IS NULL';
$string = substr($string, 0, -1);
}
$string .= "$value";
if ($counter == ($array_count - 2) && $array_count % 2 == 0)
$string .= " ELSE ";
elseif ($counter == ($array_count - 1))
$string .= " END ";
elseif ($counter % 2 == 0)
$string .= " WHEN $array[0]=";
elseif ($counter % 2 == 1)
$string .= " THEN ";
$counter++;
}
}
return $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 |
function selectObjectBySql($sql) {
//$logFile = "C:\\xampp\\htdocs\\supserg\\tmp\\queryLog.txt";
//$lfh = fopen($logFile, 'a');
//fwrite($lfh, $sql . "\n");
//fclose($lfh);
$res = @mysqli_query($this->connection, $this->injectProof($sql));
if ($res == null)
return null;
return mysqli_fetch_object($res);
} | 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 generateTempFileData()
{
return [
'name' => md5(mt_rand()),
'tmp_name' => tempnam(sys_get_temp_dir(), ''),
'type' => 'image/jpeg',
'size' => mt_rand(1000, 10000),
'error' => '0',
];
} | 0 | PHP | CWE-330 | Use of Insufficiently Random Values | The software uses insufficiently random numbers or values in a security context that depends on unpredictable numbers. | https://cwe.mitre.org/data/definitions/330.html | vulnerable |
public function transform($attr, $config, $context) {
$src = true;
if (!isset($attr['src'])) {
if ($config->get('Core.RemoveInvalidImg')) return $attr;
$attr['src'] = $config->get('Attr.DefaultInvalidImage');
$src = false;
}
if (!isset($attr['alt'])) {
if ($src) {
$alt = $config->get('Attr.DefaultImageAlt');
if ($alt === null) {
// truncate if the alt is too long
$attr['alt'] = substr(basename($attr['src']),0,40);
} else {
$attr['alt'] = $alt;
}
} else {
$attr['alt'] = $config->get('Attr.DefaultInvalidImageAlt');
}
}
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.