code
stringlengths 12
2.05k
| label
int64 0
1
| programming_language
stringclasses 9
values | cwe_id
stringlengths 6
14
| cwe_name
stringlengths 5
103
⌀ | description
stringlengths 36
1.23k
⌀ | url
stringlengths 36
48
⌀ | label_name
stringclasses 2
values |
---|---|---|---|---|---|---|---|
public static function available($username, $website_id)
{
global $DB;
// remove spaces and make username lowercase (only to compare case insensitive)
$username = trim($username);
$username = mb_strtolower($username);
$data = NULL;
if($DB->query('SELECT COUNT(*) as total
FROM nv_webusers
WHERE LOWER(username) = '.protect($username).'
AND website = '.$website_id))
{
$data = $DB->first();
}
return ($data->total <= 0);
}
| 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
function lockTable($table,$lockType="WRITE") {
$sql = "LOCK TABLES `" . $this->prefix . "$table` $lockType";
$res = mysqli_query($this->connection, $sql);
return $res;
} | 0 | PHP | CWE-74 | Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') | The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/74.html | vulnerable |
public static function getIconName($module)
{
return isset(static::$iconNames[$module])
? static::$iconNames[$module]
: strtolower(str_replace('_', '-', $module));
} | 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 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 get_language_attributes( $doctype = 'html' ) {
$attributes = array();
if ( function_exists( 'is_rtl' ) && is_rtl() )
$attributes[] = 'dir="rtl"';
if ( $lang = get_bloginfo( 'language' ) ) {
if ( get_option( 'html_type' ) == 'text/html' || $doctype == 'html' ) {
$attributes[] = 'lang="' . esc_attr( $lang ) . '"';
}
if ( get_option( 'html_type' ) != 'text/html' || $doctype == 'xhtml' ) {
$attributes[] = 'xml:lang="' . esc_attr( $lang ) . '"';
}
}
$output = implode(' ', $attributes);
/**
* Filters the language attributes for display in the html tag.
*
* @since 2.5.0
* @since 4.3.0 Added the `$doctype` parameter.
*
* @param string $output A space-separated list of language attributes.
* @param string $doctype The type of html document (xhtml|html).
*/
return apply_filters( 'language_attributes', $output, $doctype );
} | 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 upload() {
// upload the file, but don't save the record yet...
if ($this->params['resize'] != 'false') {
$maxwidth = $this->params['max_width'];
} else {
$maxwidth = null;
}
$file = expFile::fileUpload('Filedata',false,false,null,null,$maxwidth);
// since most likely this function will only get hit via flash in YUI Uploader
// and since Flash can't pass cookies, we lose the knowledge of our $user
// so we're passing the user's ID in as $_POST data. We then instantiate a new $user,
// and then assign $user->id to $file->poster so we have an audit trail for the upload
if (is_object($file)) {
$resized = !empty($file->resized) ? true : false;
$user = new user($this->params['usrid']);
$file->poster = $user->id;
$file->posted = $file->last_accessed = time();
$file->save();
if (!empty($this->params['cat'])) {
$expcat = new expCat($this->params['cat']);
$params['expCat'][0] = $expcat->id;
$file->update($params);
}
// a echo so YUI Uploader is notified of the function's completion
if ($resized) {
echo gt('File resized and then saved');
} else {
echo gt('File saved');
}
} else {
echo gt('File was NOT uploaded!');
// flash('error',gt('File was not uploaded!'));
}
} | 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 stepBack()
{
if ($this->i > -1) {
$this->i--;
}
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
$this->replaced[$cmd][$name] = $args[$key][$i] = $this->normalize($name, $opts);
}
} else {
$name = $args[$key];
$this->replaced[$cmd][$name] = $args[$key] = $this->normalize($name, $opts);
}
}
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 |
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId());
$this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']);
} | 0 | PHP | CWE-639 | Authorization Bypass Through User-Controlled Key | The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. | https://cwe.mitre.org/data/definitions/639.html | vulnerable |
public static function existConf()
{
if (file_exists(GX_PATH.'/inc/config/config.php')) {
return true;
} else {
return false;
}
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
public function getUpcoming(){
$url = "http://api.themoviedb.org/3/movie/upcoming?api_key=".$this->apikey;
$upcoming = $this->curl($url);
return $upcoming;
}
| 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 selectBillingOptions() {
} | 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 modList()
{
//$mod = '';
$handle = dir(GX_MOD);
while (false !== ($entry = $handle->read())) {
if ($entry != '.' && $entry != '..') {
$dir = GX_MOD.$entry;
if (is_dir($dir) == true) {
(file_exists($dir.'/index.php')) ? $mod[] = basename($dir) : '';
}
}
}
$handle->close();
return $mod;
} | 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 testModifyRequestKeepInstanceOfRequest()
{
$r1 = new Psr7\Request('GET', 'http://foo.com');
$r2 = Psr7\modify_request($r1, ['remove_headers' => ['non-existent']]);
$this->assertTrue($r2 instanceof Psr7\Request);
$r1 = new Psr7\ServerRequest('GET', 'http://foo.com');
$r2 = Psr7\modify_request($r1, ['remove_headers' => ['non-existent']]);
$this->assertTrue($r2 instanceof \Psr\Http\Message\ServerRequestInterface);
} | 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 show() {
// assign_to_template(array('record'=>$record,'tag'=>$tag)); //FIXME $record & $tag are undefined
} | 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-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 showall_by_author() {
expHistory::set('viewable', $this->params);
$this->params['author'] = expString::escape($this->params['author']);
$user = user::getUserByName($this->params['author']);
$page = new expPaginator(array(
'model'=>$this->basemodel_name,
'where'=>($this->aggregateWhereClause()?$this->aggregateWhereClause()." AND ":"")."poster=".$user->id,
'limit'=>isset($this->config['limit']) ? $this->config['limit'] : 10,
'order'=>'publish',
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->baseclassname,
'action'=>$this->params['action'],
'src'=>$this->loc->src,
'columns'=>array(
gt('Title')=>'title'
),
));
assign_to_template(array(
'page'=>$page,
'moduletitle'=>gt('Blogs by author').' "'.$this->params['author'].'"'
));
} | 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 breadcrumb() {
global $sectionObj;
expHistory::set('viewable', $this->params);
$id = $sectionObj->id;
$current = null;
// Show not only the location of a page in the hierarchy but also the location of a standalone page
$current = new section($id);
if ($current->parent == -1) { // standalone page
$navsections = section::levelTemplate(-1, 0);
foreach ($navsections as $section) {
if ($section->id == $id) {
$current = $section;
break;
}
}
} else {
$navsections = section::levelTemplate(0, 0);
foreach ($navsections as $section) {
if ($section->id == $id) {
$current = $section;
break;
}
}
}
assign_to_template(array(
'sections' => $navsections,
'current' => $current,
));
} | 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 sanitizeGetParams () {
//sanitize get params
$whitelist = array(
'fg', 'bgc', 'font', 'bs', 'bc', 'iframeHeight'
);
$_GET = array_intersect_key($_GET, array_flip($whitelist));
//restrict param values, alphanumeric, # for color vals, comma for tag list, . for decimals
$_GET = preg_replace('/[^a-zA-Z0-9#,.]/', '', $_GET);
return $_GET;
} | 1 | PHP | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | safe |
protected function 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 |
protected function fsock_get_contents(&$url, $timeout, $redirect_max, $ua, $outfp)
{
$connect_timeout = 3;
$connect_try = 3;
$method = 'GET';
$readsize = 4096;
$ssl = '';
$getSize = null;
$headers = '';
$arr = parse_url($url);
if (!$arr) {
// Bad request
return false;
}
if ($arr['scheme'] === 'https') {
$ssl = 'ssl://';
}
// query
$arr['query'] = isset($arr['query']) ? '?' . $arr['query'] : '';
// port
$port = isset($arr['port']) ? $arr['port'] : '';
$arr['port'] = $port ? $port : ($ssl ? 443 : 80);
$url_base = $arr['scheme'] . '://' . $arr['host'] . ($port ? (':' . $port) : ''); | 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 |
public function update()
{
$project = $this->getProject();
$tag_id = $this->request->getIntegerParam('tag_id');
$tag = $this->tagModel->getById($tag_id);
$values = $this->request->getValues();
list($valid, $errors) = $this->tagValidator->validateModification($values);
if ($tag['project_id'] != $project['id']) {
throw new AccessForbiddenException();
}
if ($valid) {
if ($this->tagModel->update($values['id'], $values['name'])) {
$this->flash->success(t('Tag updated successfully.'));
} else {
$this->flash->failure(t('Unable to update this tag.'));
}
$this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id'])));
} else {
$this->edit($values, $errors);
}
} | 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 testGetMimeTypesFromFormat($format, $mimeTypes)
{
if (null !== $format) {
$this->assertEquals($mimeTypes, Request::getMimeTypes($format));
}
} | 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()
{
$task = $this->getTask();
$comment = $this->getComment();
$this->response->html($this->template->render('comment/remove', array(
'comment' => $comment,
'task' => $task,
'title' => t('Remove a comment')
)));
} | 0 | PHP | CWE-639 | Authorization Bypass Through User-Controlled Key | The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. | https://cwe.mitre.org/data/definitions/639.html | vulnerable |
private function getSwimlane()
{
$swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id'));
if (empty($swimlane)) {
throw new PageNotFoundException();
}
return $swimlane;
} | 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 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 getSimilar($id){
$url = "http://api.themoviedb.org/3/movie/{$id}/similar?api_key=".$this->apikey;
$similar = $this->curl($url);
return $similar;
}
| 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 setItemAttributes( $attributes ) {
$this->itemAttributes = \Sanitizer::fixTagAttributes( $attributes, 'li' );
} | 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 clearLoginAttempts()
{
// If our login attempts is already at zero
// we do not need to do anything. Additionally,
// if we are suspended, we are not going to do
// anything either as clearing login attempts
// makes us unsuspended. We need to manually
// call unsuspend() in order to unsuspend.
if ($this->getLoginAttempts() == 0 or $this->is_suspended) {
return;
}
$this->attempts = 0;
$this->last_attempt_at = null;
$this->is_suspended = false;
$this->suspended_at = null;
$this->save();
} | 0 | PHP | NVD-CWE-noinfo | null | null | null | vulnerable |
protected function renderText ($field, $makeLinks, $textOnly, $encode) {
$fieldName = $field->fieldName;
$value = $this->owner->$fieldName;
if (is_string ($value)) {
$value = preg_replace("/(\<br ?\/?\>)|\n/"," ",$value);
return Yii::app()->controller->convertUrls($this->render ($value, $encode));
} else {
return '';
}
} | 1 | PHP | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | safe |
public static function local($date, $format=''){
setlocale(LC_TIME, Options::v('country_id'));
(empty($format))? $format = "%#d %B %Y %H:%M %p" : $format = $format;
$timezone = Options::v('timezone');
$date = new DateTime($date);
$date->setTimezone(new DateTimeZone($timezone));
$newdate = $date->format("Y/m/j H:i:s");
$newdate = strftime($format, strtotime($newdate));
return $newdate." ".$date->format("T");
}
| 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 isAnimationGif ($path) {
list($width, $height, $type, $attr) = getimagesize($path);
switch ($type) {
case IMAGETYPE_GIF:
break;
default:
return false;
}
$imgcnt = 0;
$fp = fopen($path, 'rb');
fread($fp, 4);
$c = fread($fp,1);
if (ord($c) != 0x39) { // GIF89a
return false;
}
while (!feof($fp)) {
do {
$c = fread($fp, 1);
} while(ord($c) != 0x21 && !feof($fp));
if (feof($fp)) {
break;
}
$c2 = fread($fp,2);
if (bin2hex($c2) == "f904") {
$imgcnt++;
}
if (feof($fp)) {
break;
}
}
if ($imgcnt > 1) {
return true;
} else {
return false;
}
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | safe |
public function __construct()
{
parent::__construct();
$this->setTagName("Document");
$this->setNodeId(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 |
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 |
static function displayname() {
return gt("e-Commerce Category Manager");
} | 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 readline(StreamInterface $stream, $maxLength = null)
{
$buffer = '';
$size = 0;
while (!$stream->eof()) {
// Using a loose equality here to match on '' and false.
if (null == ($byte = $stream->read(1))) {
return $buffer;
}
$buffer .= $byte;
// Break when a new line is found or the max length - 1 is reached
if ($byte == PHP_EOL || ++$size == $maxLength - 1) {
break;
}
}
return $buffer;
} | 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 |
$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 |
private function getTaskLink()
{
$link = $this->taskLinkModel->getById($this->request->getIntegerParam('link_id'));
if (empty($link)) {
throw new PageNotFoundException();
}
return $link;
} | 0 | PHP | CWE-639 | Authorization Bypass Through User-Controlled Key | The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. | https://cwe.mitre.org/data/definitions/639.html | vulnerable |
public function testConvertsResponsesToStrings()
{
$response = new Psr7\Response(200, [
'Baz' => 'bar',
'Qux' => 'ipsum'
], 'hello', '1.0', 'FOO');
$this->assertEquals(
"HTTP/1.0 200 FOO\r\nBaz: bar\r\nQux: ipsum\r\n\r\nhello",
Psr7\str($response)
);
} | 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 \DPL\Variables::setVarDefault( $args );
}
return \DPL\Variables::getVar( $cmd );
} | 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 |
$iloc = expUnserialize($container->internal);
if ($db->selectObject('sectionref',"module='".$iloc->mod."' AND source='".$iloc->src."'") == null) {
// There is no sectionref for this container. Populate sectionref
if ($container->external != "N;") {
$newSecRef = new stdClass();
$newSecRef->module = $iloc->mod;
$newSecRef->source = $iloc->src;
$newSecRef->internal = '';
$newSecRef->refcount = 1;
// $newSecRef->is_original = 1;
$eloc = expUnserialize($container->external);
// $section = $db->selectObject('sectionref',"module='containermodule' AND source='".$eloc->src."'");
$section = $db->selectObject('sectionref',"module='container' AND source='".$eloc->src."'");
if (!empty($section)) {
$newSecRef->section = $section->id;
$db->insertObject($newSecRef,"sectionref");
$missing_sectionrefs[] = gt("Missing sectionref for container replaced").": ".$iloc->mod." - ".$iloc->src." - PageID #".$section->id;
} else {
$db->delete('container','id="'.$container->id.'"');
$missing_sectionrefs[] = gt("Cant' find the container page for container").": ".$iloc->mod." - ".$iloc->src.' - '.gt('deleted');
}
}
}
}
assign_to_template(array(
'missing_sectionrefs'=>$missing_sectionrefs,
));
} | 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 applyedit()
{
$aPermissiontemplate = Yii::app()->request->getPost('Permissiontemplates');
$model = $this->loadModel($aPermissiontemplate['ptid']);
// XSS filter
$aPermissiontemplate['name'] = CHtml::encode($aPermissiontemplate['name']);
$aPermissiontemplate['description'] = CHtml::encode($aPermissiontemplate['description']);
$newAttributes = array_merge($model->attributes, $aPermissiontemplate);
$model->attributes = $newAttributes;
if ($model->save()) {
$success = true;
$message = gT('Role successfully saved');
} else {
$success = false;
$message = gT('Failed saving the role');
$errors = $model->getErrors();
$errorDiv = $this->renderErrors($errors);
}
return App()->getController()->renderPartial('/admin/super/_renderJson', [
"data" => [
'success' => $success,
'message' => $message,
'errors' => $errorDiv ?? ''
]
]);
} | 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 description() { return gt("Places navigation links/menus on the page."); }
| 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
function columnUpdate($table, $col, $val, $where=1) {
$res = @mysqli_query($this->connection, "UPDATE `" . $this->prefix . "$table` SET `$col`='" . $val . "' WHERE $where");
/*if ($res == null)
return array();
$objects = array();
for ($i = 0; $i < mysqli_num_rows($res); $i++)
$objects[] = mysqli_fetch_object($res);*/
//return $objects;
} | 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 |
$elements = array_flip(array('col', 'caption', 'colgroup', 'thead',
'tfoot', 'tbody', 'tr'));
} | 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 __() {
$args = func_get_args();
array_unshift($args,$_SESSION['language']);
return call_user_func_array("_translate",$args);
} | 1 | PHP | CWE-352 | Cross-Site Request Forgery (CSRF) | The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request. | https://cwe.mitre.org/data/definitions/352.html | safe |
public function addTab($array)
{
if (!$array) {
$this->setAPIResponse('error', 'no data was sent', 422);
return null;
}
$array = $this->checkKeys($this->getTableColumnsFormatted('tabs'), $array);
$array['group_id'] = ($array['group_id']) ?? $this->getDefaultGroupId();
$array['category_id'] = ($array['category_id']) ?? $this->getDefaultCategoryId();
$array['enabled'] = ($array['enabled']) ?? 0;
$array['default'] = ($array['default']) ?? 0;
$array['type'] = ($array['type']) ?? 1;
$array['order'] = ($array['order']) ?? $this->getNextTabOrder() + 1;
if (array_key_exists('name', $array)) {
$array['name'] = htmlspecialchars($array['name']);
if ($this->isTabNameTaken($array['name'])) {
$this->setAPIResponse('error', 'Tab name: ' . $array['name'] . ' is already taken', 409);
return false;
}
} else {
$this->setAPIResponse('error', 'Tab name was not supplied', 422);
return false;
}
if (!array_key_exists('url', $array) && !array_key_exists('url_local', $array)) {
$this->setAPIResponse('error', 'Tab url or url_local was not supplied', 422);
return false;
}
if (!array_key_exists('image', $array)) {
$this->setAPIResponse('error', 'Tab image was not supplied', 422);
return false;
}
$response = [
array(
'function' => 'query',
'query' => array(
'INSERT INTO [tabs]',
$array
)
),
];
$this->setAPIResponse(null, 'Tab added');
$this->setLoggerChannel('Tab Management');
$this->logger->debug('Added Tab for [' . $array['name'] . ']');
return $this->processQueries($response);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function reset($name = null) {
if ($name == null) $this->data = array();
else unset($this->data[$name]);
} | 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 update_item( $request ) {
if ( isset( $request['parent'] ) ) {
if ( ! is_taxonomy_hierarchical( $this->taxonomy ) ) {
return new WP_Error( 'rest_taxonomy_not_hierarchical', __( 'Can not set parent term, taxonomy is not hierarchical.' ), array( 'status' => 400 ) );
}
$parent = get_term( (int) $request['parent'], $this->taxonomy );
if ( ! $parent ) {
return new WP_Error( 'rest_term_invalid', __( 'Parent term does not exist.' ), array( 'status' => 400 ) );
}
}
$prepared_term = $this->prepare_item_for_database( $request );
$term = get_term( (int) $request['id'], $this->taxonomy );
// Only update the term if we haz something to update.
if ( ! empty( $prepared_term ) ) {
$update = wp_update_term( $term->term_id, $term->taxonomy, wp_slash( (array) $prepared_term ) );
if ( is_wp_error( $update ) ) {
return $update;
}
}
$term = get_term( (int) $request['id'], $this->taxonomy );
/** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php */
do_action( "rest_insert_{$this->taxonomy}", $term, $request, false );
$schema = $this->get_item_schema();
if ( ! empty( $schema['properties']['meta'] ) && isset( $request['meta'] ) ) {
$meta_update = $this->meta->update_value( $request['meta'], (int) $request['id'] );
if ( is_wp_error( $meta_update ) ) {
return $meta_update;
}
}
$fields_update = $this->update_additional_fields_for_object( $term, $request );
if ( is_wp_error( $fields_update ) ) {
return $fields_update;
}
$request->set_param( 'context', 'view' );
$response = $this->prepare_item_for_response( $term, $request );
return rest_ensure_response( $response );
} | 0 | PHP | NVD-CWE-noinfo | null | null | null | vulnerable |
foreach ($page as $pageperm) {
if (!empty($pageperm['manage'])) return true;
}
| 0 | PHP | CWE-74 | Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') | The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/74.html | vulnerable |
protected function escape($string) {
$string = HTMLPurifier_Encoder::cleanUTF8($string);
$string = htmlspecialchars($string, ENT_COMPAT, 'UTF-8');
return $string;
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
public function beforeFilter() { // TODO REMOVE
parent::beforeFilter();
$this->Security->unlockedActions = array('uploadFile', 'deleteTemporaryFile');
} | 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 offset($value)
{
$this->offset = max(0, $value);
return $this;
} | 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 |
function critere_where_dist($idb, &$boucles, $crit) {
$boucle = &$boucles[$idb];
if (isset($crit->param[0])) {
$_where = calculer_liste($crit->param[0], $idb, $boucles, $boucle->id_parent);
} else {
$_where = '@$Pile[0]["where"]';
}
if ($crit->cond) {
$_where = "(($_where) ? ($_where) : '')";
}
if ($crit->not) {
$_where = "array('NOT',$_where)";
}
$boucle->where[] = $_where;
} | 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 __construct()
{
# code...
self::$smtphost = Options::get('smtphost');
self::$smtpuser = Options::get('smtpuser');
self::$smtppass = Options::get('smtppass');
self::$smtpssl = Options::get('smtpssl');
self::$siteemail = Options::get('siteemail');
self::$sitename = Options::get('sitename');
} | 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 write($template = '')
{
if (!empty($this->script_files)) {
$this->set_env('request_token', $this->app->get_request_token());
}
$commands = $this->get_js_commands($framed);
// if all js commands go to parent window we can ignore all
// script files and skip rcube_webmail initialization (#1489792)
if ($framed) {
$this->scripts = array();
$this->script_files = array();
$this->header = '';
$this->footer = '';
}
// write all javascript commands
$this->add_script($commands, 'head_top');
// send clickjacking protection headers
$iframe = $this->framed || $this->env['framed'];
if (!headers_sent() && ($xframe = $this->app->config->get('x_frame_options', 'sameorigin'))) {
header('X-Frame-Options: ' . ($iframe && $xframe == 'deny' ? 'sameorigin' : $xframe));
} | 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 testTrustedXForwardedForHeader()
{
Request::setTrustedProxies(['10.0.0.1'], -1);
$globalState = $this->getGlobalState();
$request = Request::create('/');
$request->server->set('REMOTE_ADDR', '10.0.0.1');
$request->headers->set('X-Forwarded-For', '10.0.0.2');
$request->headers->set('X-Forwarded-Host', 'foo.bar');
$request->headers->set('X-Forwarded-Proto', 'https');
$request->headers->set('X-Forwarded-Prefix', '/admin');
$kernel = new TestSubRequestHandlerKernel(function ($request, $type, $catch) {
$this->assertSame('127.0.0.1', $request->server->get('REMOTE_ADDR'));
$this->assertSame('10.0.0.2', $request->getClientIp());
$this->assertSame('foo.bar', $request->getHttpHost());
$this->assertSame('https', $request->getScheme());
$this->assertSame('/admin', $request->getBaseUrl());
});
SubRequestHandler::handle($kernel, $request, HttpKernelInterface::MAIN_REQUEST, true);
$this->assertSame($globalState, $this->getGlobalState());
} | 1 | PHP | CWE-444 | Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling') | The product acts as an intermediary HTTP agent
(such as a proxy or firewall) in the data flow between two
entities such as a client and server, but it does not
interpret malformed HTTP requests or responses in ways that
are consistent with how the messages will be processed by
those entities that are at the ultimate destination. | https://cwe.mitre.org/data/definitions/444.html | safe |
protected function info($args) {
$files = array();
$sleep = 0;
$compare = null;
// long polling mode
if ($args['compare'] && count($args['targets']) === 1) {
$compare = intval($args['compare']);
$hash = $args['targets'][0];
if ($volume = $this->volume($hash)) {
$standby = (int)$volume->getOption('plStandby');
$_compare = false;
if (($syncCheckFunc = $volume->getOption('syncCheckFunc')) && is_callable($syncCheckFunc)) {
$_compare = call_user_func_array($syncCheckFunc, array($volume->realpath($hash), $standby, $compare, $volume, $this));
}
if ($_compare !== false) {
$compare = $_compare;
} else {
$sleep = max(1, (int)$volume->getOption('tsPlSleep'));
$limit = max(1, $standby / $sleep) + 1;
$timelimit = ini_get('max_execution_time');
do {
$timelimit && @ set_time_limit($timelimit + $sleep);
$volume->clearstatcache();
if (($info = $volume->file($hash)) != false) {
if ($info['ts'] != $compare) {
$compare = $info['ts'];
break;
}
} else {
$compare = 0;
break;
}
if (--$limit) {
sleep($sleep);
}
} while($limit);
}
}
} else {
foreach ($args['targets'] as $hash) {
if (($volume = $this->volume($hash)) != false
&& ($info = $volume->file($hash)) != false) {
$info['path'] = $volume->path($hash);
$files[] = $info;
}
}
}
$result = array('files' => $files);
if (!is_null($compare)) {
$result['compare'] = strval($compare);
}
return $result;
} | 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 toString() {
if (!$this->isValid()) return false;
return $this->n . $this->unit;
} | 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($key, $a = null) {
if ($a !== null) {
$this->triggerError("Using deprecated API: use \$config->get('$key.$a') instead", E_USER_WARNING);
$key = "$key.$a";
}
if (!$this->finalized) $this->autoFinalize();
if (!isset($this->def->info[$key])) {
// can't add % due to SimpleTest bug
$this->triggerError('Cannot retrieve value of undefined directive ' . htmlspecialchars($key),
E_USER_WARNING);
return;
}
if (isset($this->def->info[$key]->isAlias)) {
$d = $this->def->info[$key];
$this->triggerError('Cannot get value from aliased directive, use real name ' . $d->key,
E_USER_ERROR);
return;
}
if ($this->lock) {
list($ns) = explode('.', $key);
if ($ns !== $this->lock) {
$this->triggerError('Cannot get value of namespace ' . $ns . ' when lock for ' . $this->lock . ' is active, this probably indicates a Definition setup method is accessing directives that are not within its namespace', E_USER_ERROR);
return;
}
}
return $this->plist->get($key);
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
public function actionGetItems(){
$sql = 'SELECT id, name as value FROM x2_products WHERE name LIKE :qterm ORDER BY name ASC';
$command = Yii::app()->db->createCommand($sql);
$qterm = $_GET['term'].'%';
$command->bindParam(":qterm", $qterm, PDO::PARAM_STR);
$result = $command->queryAll();
echo CJSON::encode($result); exit;
} | 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 |
$attvalue = str_replace($quotchar, "", $attvalue);
switch ($attname){
case 'background':
$styledef .= "background-image: url('$trans_image_path'); ";
break;
case 'bgcolor':
$has_bgc_stl = true;
$styledef .= "background-color: $attvalue; ";
break;
case 'text':
$has_txt_stl = true;
$styledef .= "color: $attvalue; ";
break;
}
}
// Outlook defines a white bgcolor and no text color. This can lead to
// white text on a white bg with certain themes.
if ($has_bgc_stl && !$has_txt_stl) {
$styledef .= "color: $text; ";
}
if (strlen($styledef) > 0){
$divattary{"style"} = "\"$styledef\"";
}
}
return $divattary;
} | 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 fixsessions() {
global $db;
// $test = $db->sql('CHECK TABLE '.$db->prefix.'sessionticket');
$fix = $db->sql('REPAIR TABLE '.$db->prefix.'sessionticket');
flash('message', gt('Sessions Table was Repaired'));
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 |
public static function getIconName($module)
{
return isset(static::$iconNames[$module])
? static::$iconNames[$module]
: strtolower(str_replace('_', '-', $module));
} | 0 | PHP | CWE-863 | Incorrect Authorization | The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions. | https://cwe.mitre.org/data/definitions/863.html | vulnerable |
$c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
} else {
$c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
}
$entities .= '&#'.$c.';';
} | 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 testImportLineEndings() {
$csvFile = 'lineendings-contacts.csv';
// Skip verification of uploaded CSV since it will be modified
$this->prepareImport ('Contacts', $csvFile, false);
$expected = $this->stashModels ('Contacts');
$this->assertGreaterThan (0, count($expected),
'Failed to load fixture! Models were expected');
$this->beginImport();
$this->assertNoValidationErrorsPresent();
$this->assertModelsWereImported ($expected, 'Contacts');
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
$this->setType('folder');
}
// do not allow PHP and .htaccess files
if (preg_match("@\.ph(p[\d+]?|t|tml|ps|ar)$@i", $this->getFilename()) || $this->getFilename() == '.htaccess') {
$this->setFilename($this->getFilename() . '.txt');
}
if(mb_strlen($this->getFilename()) > 255) {
throw new \Exception('Filenames longer than 255 characters are not allowed');
}
if (Asset\Service::pathExists($this->getRealFullPath())) {
$duplicate = Asset::getByPath($this->getRealFullPath());
if ($duplicate instanceof Asset and $duplicate->getId() != $this->getId()) {
throw new \Exception('Duplicate full path [ ' . $this->getRealFullPath() . ' ] - cannot save asset');
}
}
$this->validatePathLength();
} | 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 testServicesPages () {
$this->visitPages ($this->getPages ('^services'));
} | 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 |
$method = $this->request->get('_method', $this->query->get('_method', 'POST'));
if (\is_string($method)) {
$this->method = strtoupper($method);
}
}
}
} | 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 addMethod($rpcName, $functionName)
{
$this->callbacks[$rpcName] = $functionName;
} | 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 create_thumbs($updir, $img, $name, $thumbnail_width, $thumbnail_height, $quality){
$arr_image_details = GetImageSize("$updir/$img");
$original_width = $arr_image_details[0];
$original_height = $arr_image_details[1];
$a = $thumbnail_width / $thumbnail_height;
$b = $original_width / $original_height;
if ($a<$b) {
$new_width = $thumbnail_width;
$new_height = intval($original_height*$new_width/$original_width);
} else {
$new_height = $thumbnail_height;
$new_width = intval($original_width*$new_height/$original_height);
}
if(($original_width <= $thumbnail_width) AND ($original_height <= $thumbnail_height)) {
$new_width = $original_width;
$new_height = $original_height;
}
if($arr_image_details[2]==1) { $imgt = "imagegif"; $imgcreatefrom = "imagecreatefromgif"; }
if($arr_image_details[2]==2) { $imgt = "imagejpeg"; $imgcreatefrom = "imagecreatefromjpeg"; }
if($arr_image_details[2]==3) { $imgt = "imagepng"; $imgcreatefrom = "imagecreatefrompng"; }
if($imgt) {
$old_image = $imgcreatefrom("$updir/$img");
$new_image = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($new_image,$old_image,0,0,0,0,$new_width,$new_height,$original_width,$original_height);
imagejpeg($new_image,"$updir/$name",$quality);
imagedestroy($new_image);
}
} | 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 |
function printXMLRPCerror($errcode) {
global $XMLRPCERRORS;
print "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?" . ">\n"; # splitting the ? and > makes vim syntax highlighting work correctly
print "<methodResponse>\n";
print "<fault>\n";
print " <value>\n";
print " <struct>\n";
print " <member>\n";
print " <name>faultString</name>\n";
print " <value>\n";
print " <string>{$XMLRPCERRORS[$errcode]}</string>\n";
print " </value>\n";
print " </member>\n";
print " <member>\n";
print " <name>faultCode</name>\n";
print " <value>\n";
print " <int>$errcode</int>\n";
print " </value>\n";
print " </member>\n";
print " </struct>\n";
print " </value>\n";
print "</fault>\n";
print "</methodResponse>\n";
} | 1 | PHP | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | safe |
public function update() {
//populate the alt tag field if the user didn't
if (empty($this->params['alt'])) $this->params['alt'] = $this->params['title'];
// call expController update to save the image
parent::update();
} | 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($varParser = null) {
$this->varParser = $varParser ? $varParser : new HTMLPurifier_VarParser_Native();
} | 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 loginForm( WebRequest $request ) { // Step 13
$out = $this->getOutput();
$username = $request->getVal('username');
$codes = SOA2Login::codes( $username );
$out->addHTML(Html::openElement('form', [ 'method' => 'POST' ]));
$out->addHTML(Html::hidden('username', $username));
$out->addHTML(Html::hidden('token', $codes['csrf'])); // Step 14
$profile = Html::element(
'a',
[
'href' => sprintf(SOA2_PROFILE_URL, urlencode($username)),
'target' => '_new'
],
wfMessage('soa2-your-profile')->plain()
);
// Step 16
$out->addHTML(Html::rawElement(
'p', [],
wfMessage('soa2-vercode-explanation')->rawParams($profile)->parse()
));
$out->addHTML(Html::rawElement('p', [], Html::element(
'code', [], $codes['code']
)));
$out->addHTML(Html::rawElement('p', [], Html::submitButton(
wfMessage('soa2-login')->plain(), []
)));
$out->addHTML(Html::closeElement('form'));
} | 0 | PHP | CWE-863 | Incorrect Authorization | The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions. | https://cwe.mitre.org/data/definitions/863.html | vulnerable |
<div class='graphWrapper' style='width:100%;' id='wrapper_<?php print $graph['local_graph_id']?>' graph_width='<?php print $graph['width'];?>' graph_height='<?php print $graph['height'];?>' title_font_size='<?php print ((read_user_setting('custom_fonts') == 'on') ? read_user_setting('title_size') : read_config_option('title_size'));?>'></div>
<?php print (read_user_setting('show_graph_title') == 'on' ? "<span class='center'>" . htmlspecialchars($graph['title_cache']) . '</span>' : '');?>
</td>
<td id='dd<?php print $graph['local_graph_id'];?>' class='noprint graphDrillDown'>
<?php graph_drilldown_icons($graph['local_graph_id']);?>
</td>
</tr>
</table>
<div>
</td>
<?php
$i++;
if (($i % $columns) == 0) {
$i = 0;
print "</tr>\n";
}
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function getDebugLevel()
{
return $this->do_debug;
} | 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 |
$rst[$key] = self::parseAndTrim($st, $unescape);
}
return $rst;
}
$str = str_replace("<br>"," ",$str);
$str = str_replace("</br>"," ",$str);
$str = str_replace("<br/>"," ",$str);
$str = str_replace("<br />"," ",$str);
$str = str_replace("\r\n"," ",$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("¾","¾",$str);
$str = str_replace("™","™", $str);
$str = trim($str);
if ($unescape) {
$str = stripcslashes($str);
} else {
$str = addslashes($str);
}
return $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 |
private function getProjectForUser($id)
{
$project = $this->project_manager->getProject($id);
$user = $this->user_manager->getCurrentUser();
ProjectAuthorization::userCanAccessProject($user, $project, new URLVerification());
return $project;
} | 0 | PHP | CWE-863 | Incorrect Authorization | The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions. | https://cwe.mitre.org/data/definitions/863.html | vulnerable |
public function listify($array) {
$sep = $this->getMessage('Item separator');
$sep_last = $this->getMessage('Item separator last');
$ret = '';
for ($i = 0, $c = count($array); $i < $c; $i++) {
if ($i == 0) {
} elseif ($i + 1 < $c) {
$ret .= $sep;
} else {
$ret .= $sep_last;
}
$ret .= $array[$i];
}
return $ret;
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | safe |
function get_show_item ($directory, $file)
{
// no relative paths are allowed in directories
if ( preg_match( "/\.\./", $directory ) )
return false;
if ( isset($file) )
{
// file name must not contain any path separators
if ( preg_match( "/[\/\\\\]/", $file ) )
return false;
// dont display own and parent directory
if ( $file == "." || $file == ".." )
return false;
// determine full path to the file
$full_path = get_abs_item( $directory, $file );
_debug("full_path: $full_path");
if ( ! str_startswith( $full_path, path_f() ) )
return false;
}
// check if user is allowed to acces shidden files
global $show_hidden;
if ( ! $show_hidden )
{
if ( $file[0] == '.' )
return false;
// no part of the path may be hidden
$directory_parts = explode( "/", $directory );
foreach ( $directory_parts as $directory_part )
{
if ( $directory_part[0] == '.' )
return false;
}
}
if (matches_noaccess_pattern($file))
return false;
return true;
} | 1 | PHP | CWE-22 | Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') | The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. | https://cwe.mitre.org/data/definitions/22.html | safe |
public function __construct(
GlyphFinder $glyph_finder,
ProjectXMLMerger $project_xml_merger,
ConsistencyChecker $consistency_checker,
TemplateDao $template_dao,
ProjectManager $project_manager,
EventDispatcherInterface $event_dispatcher,
) {
$this->template_dao = $template_dao;
$this->templates = [
AgileALMTemplate::NAME => new AgileALMTemplate($glyph_finder, $project_xml_merger, $consistency_checker),
ScrumTemplate::NAME => new ScrumTemplate($glyph_finder, $project_xml_merger, $consistency_checker),
KanbanTemplate::NAME => new KanbanTemplate($glyph_finder, $project_xml_merger, $consistency_checker),
IssuesTemplate::NAME => new IssuesTemplate($glyph_finder, $consistency_checker, $event_dispatcher),
EmptyTemplate::NAME => new EmptyTemplate($glyph_finder),
];
$this->project_manager = $project_manager;
$this->glyph_finder = $glyph_finder;
$this->external_templates = self::getExternalTemplatesByName($event_dispatcher);
} | 0 | PHP | CWE-863 | Incorrect Authorization | The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions. | https://cwe.mitre.org/data/definitions/863.html | vulnerable |
public function __invoke(Request $request, Expense $expense)
{
$this->authorize('update', $expense);
$data = json_decode($request->attachment_receipt);
if ($data) {
if ($request->type === 'edit') {
$expense->clearMediaCollection('receipts');
}
$expense->addMediaFromBase64($data->data)
->usingFileName($data->name)
->toMediaCollection('receipts');
}
return response()->json([
'success' => 'Expense receipts uploaded successfully',
], 200);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public static function parseAndTrimImport($str, $isHTML = false) { //�Death from above�? �
//echo "1<br>"; eDebug($str);
// global $db;
$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("\,", ",", $str);
$str = str_replace('""', '"', $str); //do this no matter what...in case someone added a quote in a non HTML field
if (!$isHTML) {
//if HTML, then leave the single quotes alone, otheriwse replace w/ special Char
$str = str_replace('"', """, $str);
}
$str = str_replace("�", "¼", $str);
$str = str_replace("�", "½", $str);
$str = str_replace("�", "¾", $str);
//$str = htmlspecialchars($str);
//$str = utf8_encode($str);
// if (DB_ENGINE=='mysqli') {
// $str = @mysqli_real_escape_string($db->connection,trim(str_replace("�", "™", $str)));
// } elseif(DB_ENGINE=='mysql') {
// $str = @mysql_real_escape_string(trim(str_replace("�", "™", $str)),$db->connection);
// } else {
// $str = trim(str_replace("�", "™", $str));
// }
$str = @expString::escape(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 |
public static function commented( string $username, string $code ) {
$username = strtolower($username);
// Step 20, 21
$comments = file_get_contents(sprintf(SOA2_COMMENTS_API, $username, rand()));
$matches = [];
preg_match_all(SOA2_COMMENTS_REGEX, $comments, $matches, PREG_PATTERN_ORDER);
for ($i = 0; $i < count($matches[0]); ++$i) {
if (strtolower($matches[1][$i]) != $username) continue;
if (hash_equals($code, $matches[2][$i])) return true; // Step 22
}
return false;
} | 0 | PHP | NVD-CWE-noinfo | null | null | null | vulnerable |
foreach($fields as $field)
{
if(substr($key, 0, strlen($field.'-'))==$field.'-')
$this->dictionary[substr($key, strlen($field.'-'))][$field] = $value;
}
| 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 |
$json_response = ['status' => 'error', 'message' => $e->getMessage()]; | 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 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(),
));
} | 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 event()
{
$project = $this->getProject();
$values = $this->request->getValues();
$values['project_id'] = $project['id'];
if (empty($values['action_name'])) {
return $this->create();
}
return $this->response->html($this->template->render('action_creation/event', array(
'values' => $values,
'project' => $project,
'available_actions' => $this->actionManager->getAvailableActions(),
'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 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 |
$va[] = [$k2 => $m[$v2]];
| 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($this->params);
} else {
notfoundController::handle_not_found();
exit;
}
if (!empty($section->id)) {
$check_id = $section->id;
} else {
$check_id = $section->parent;
}
if (expPermissions::check('manage', expCore::makeLocation('navigation', '', $check_id))) {
if (empty($section->id)) {
$section->active = 1;
$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(),
));
} else { // User does not have permission to manage sections. Throw a 403
notfoundController::handle_not_authorized();
}
}
| 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 checkPermissions($permission,$location) {
global $exponent_permissions_r, $router;
// only applies to the 'manage' method
if (empty($location->src) && empty($location->int) && (!empty($router->params['action']) && $router->params['action'] == 'manage') || strpos($router->current_url, 'action=manage') !== false) {
if (!empty($exponent_permissions_r['navigation'])) foreach ($exponent_permissions_r['navigation'] as $page) {
foreach ($page as $pageperm) {
if (!empty($pageperm['manage'])) return true;
}
}
}
return false;
}
| 0 | PHP | CWE-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 |
$contents = ['form' => tep_draw_form('currencies', 'currencies.php', 'page=' . $_GET['page'] . (isset($cInfo) ? '&cID=' . $cInfo->currencies_id : '') . '&action=insert')]; | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
print_r($single_error);
}
echo '</pre>';
} | 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 |
protected function getItemsInHand($hashes, $dir = null) {
static $totalSize = 0;
if (is_null($dir)) {
$totalSize = 0;
if (! $tmpDir = $this->getTempPath()) {
return false;
}
$dir = tempnam($tmpDir, 'elf');
if (!unlink($dir) || !mkdir($dir, 0700, true)) {
return false;
}
register_shutdown_function(array($this, 'rmdirRecursive'), $dir);
}
$res = true;
$files = array();
foreach ($hashes as $hash) {
if (($file = $this->file($hash)) == false) {
continue;
}
if (!$file['read']) {
continue;
}
$name = $file['name'];
// for call from search results
if (isset($files[$name])) {
$name = preg_replace('/^(.*?)(\..*)?$/', '$1_'.$files[$name]++.'$2', $name);
} else {
$files[$name] = 1;
}
$target = $dir.DIRECTORY_SEPARATOR.$name;
if ($file['mime'] === 'directory') {
$chashes = array();
$_files = $this->scandir($hash);
foreach($_files as $_file) {
if ($file['read']) {
$chashes[] = $_file['hash'];
}
}
if (($res = mkdir($target, 0700, true)) && $chashes) {
$res = $this->getItemsInHand($chashes, $target);
}
if (!$res) {
break;
}
!empty($file['ts']) && touch($target, $file['ts']);
} else {
$path = $this->decode($hash);
if ($fp = $this->fopenCE($path)) {
if ($tfp = fopen($target, 'wb')) {
$totalSize += stream_copy_to_stream($fp, $tfp);
fclose($tfp);
}
!empty($file['ts']) && touch($target, $file['ts']);
$this->fcloseCE($fp, $path);
}
if ($this->options['maxArcFilesSize'] > 0 && $this->options['maxArcFilesSize'] < $totalSize) {
$res = $this->setError(elFinder::ERROR_ARC_MAXSIZE);
}
}
}
return $res? $dir : 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 |
function XMLRPCremoveUserGroupPriv($name, $affiliation, $nodeid, $permissions){
require_once(".ht-inc/privileges.php");
global $user;
if(! checkUserHasPriv("userGrant", $user['id'], $nodeid)){
return array('status' => 'error',
'errorcode' => 53,
'errormsg' => 'Unable to remove group privileges on this node');
}
$validate = array('name' => $name,
'affiliation' => $affiliation);
$rc = validateAPIgroupInput($validate, 1);
if($rc['status'] == 'error')
return $rc;
$groupid = $rc['id'];
$groupname = "$name@$affiliation";
$perms = explode(':', $permissions);
$usertypes = getTypes('users');
array_push($usertypes["users"], "block");
array_push($usertypes["users"], "cascade");
$cascadePrivs = getNodeCascadePriviliges($nodeid, "usergroups");
$removegroupprivs = array();
if(array_key_exists($groupname, $cascadePrivs['usergroups'])){
foreach($perms as $permission){
if(in_array($permission, $cascadePrivs['usergroups'][$groupname]['privs'])){
array_push($removegroupprivs, $permission);
}
}
$diff = array_diff($cascadePrivs['usergroups'][$groupname], $removegroupprivs);
if(count($diff) == 1 && in_array("cascade", $diff)){
array_push($removegroupprivs, "cascade");
}
}
if(empty($removegroupprivs)){
return array('status' => 'error',
'errorcode' => 53,
'errormsg' => 'Invalid or missing permissions list supplied');
}
updateUserOrGroupPrivs($groupid, $nodeid, array(), $removegroupprivs, "group");
return array('status' => 'success');
} | 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 view() {
$params = func_get_args();
$content = '';
$filename = urldecode(join('/', $params));
// Sanitize filename for securtiy
// We don't allow backlinks
if (strpos($filename, '..') !== false) {
/*
if (Plugin::isEnabled('statistics_api')) {
$user = null;
if (AuthUser::isLoggedIn())
$user = AuthUser::getUserName();
$ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : ($_SERVER['REMOTE_ADDR']);
$event = array('event_type' => 'hack_attempt', // simple event type identifier
'description' => __('A possible hack attempt was detected.'), // translatable description
'ipaddress' => $ip,
'username' => $user);
Observer::notify('stats_file_manager_hack_attempt', $event);
}
*/
}
$filename = str_replace('..', '', $filename);
// Clean up nicely
$filename = str_replace('//', '', $filename);
// We don't allow leading slashes
$filename = preg_replace('/^\//', '', $filename);
// Check if file had URL_SUFFIX - if so, append it to filename
$filename .= (isset($_GET['has_url_suffix']) && $_GET['has_url_suffix']==='1') ? URL_SUFFIX : '';
$file = FILES_DIR . '/' . $filename;
if (!$this->_isImage($file) && file_exists($file)) {
$content = file_get_contents($file);
}
$this->display('file_manager/views/view', array(
'csrf_token' => SecureToken::generateToken(BASE_URL.'plugin/file_manager/save/'.$filename),
'is_image' => $this->_isImage($file),
'filename' => $filename,
'content' => $content
));
} | 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 |
function insertCommandCategorieInDB(){
global $pearDB;
if (testCommandCategorieExistence($_POST["category_name"])){
$DBRESULT = $pearDB->query("INSERT INTO `command_categories` (`category_name` , `category_alias`, `category_order`) VALUES ('".$pearDB->escape($_POST["category_name"])."', '".$pearDB->escape($_POST["category_alias"])."', '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 |
$db->insertObject($obj, 'expeAlerts_subscribers');
}
$count = count($this->params['ealerts']);
if ($count > 0) {
flash('message', gt("Your subscriptions have been updated. You are now subscriber to")." ".$count.' '.gt('E-Alerts.'));
} else {
flash('error', gt("You have been unsubscribed from all E-Alerts."));
}
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.