code
stringlengths
14
2.05k
label
int64
0
1
programming_language
stringclasses
7 values
cwe_id
stringlengths
6
14
cwe_name
stringlengths
5
98
description
stringlengths
36
379
url
stringlengths
36
48
label_name
stringclasses
2 values
$artifact = $art_factory->getArtifactById($artifact_link->getArtifactId()); $this->artifact_links[] = new ArtifactInTypeTablePresenter( $artifact, $html_classes, $field, $this->are_links_deletable, ); }
0
PHP
CWE-862
Missing Authorization
The product does not perform an authorization check when an actor attempts to access a resource or perform an action.
https://cwe.mitre.org/data/definitions/862.html
vulnerable
$artifact = $art_factory->getArtifactById(trim($id)); $are_links_deletable = $this->areLinksDeletable( $type_presenter, $is_reverse_artifact_links, ); if (! is_null($artifact) && $artifact->getTracker()->isActive()) { $type_html .= $this->getTemplateRenderer()->renderToString( 'artifactlink-type-table-row', new ArtifactInTypeTablePresenter( $artifact, $artifact_html_classes, $this, $are_links_deletable, ) ); } }
0
PHP
CWE-862
Missing Authorization
The product does not perform an authorization check when an actor attempts to access a resource or perform an action.
https://cwe.mitre.org/data/definitions/862.html
vulnerable
function frs_show_release_popup($group_id, $name = 'release_id', $checked_val = "xzxz") { /* return a pop-up select box of releases for the project */ global $FRS_RELEASE_ID_RES,$FRS_RELEASE_NAME_RES,$Language; $release_factory = new FRSReleaseFactory(); if (! $group_id) { return $Language->getText('file_file_utils', 'g_id_err'); } else { if (! isset($FRS_RELEASE_ID_RES)) { $res = $release_factory->getFRSReleasesInfoListFromDb($group_id); $FRS_RELEASE_ID_RES = []; $FRS_RELEASE_NAME_RES = []; foreach ($res as $release) { $FRS_RELEASE_ID_RES[] = $release['release_id']; $FRS_RELEASE_NAME_RES[] = $release['package_name'] . ':' . $release['release_name']; } } return html_build_select_box_from_arrays($FRS_RELEASE_ID_RES, $FRS_RELEASE_NAME_RES, $name, $checked_val, false); } }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
foreach ($releases as $id => $name) { $select .= '<option value="' . $id . '" ' . ($id == $checked_val ? 'selected="selected"' : '') . '>' . $hp->purify($name) . '</option>';
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
$select .= '<option value="' . $id . '" ' . ($id == $checked_val ? 'selected="selected"' : '') . '>' . $hp->purify($name) . '</option>'; } $select .= '</optgroup>'; } $select .= '</select>'; return $select; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 setupHttpSocket($server = null, $timeout = false, $model = 'Server') { $params = ['compress' => true]; if (!empty($server)) { if (!empty($server[$model]['cert_file'])) { $params['ssl_cafile'] = APP . "files" . DS . "certs" . DS . $server[$model]['id'] . '.pem'; } if (!empty($server[$model]['client_cert_file'])) { $params['ssl_local_cert'] = APP . "files" . DS . "certs" . DS . $server[$model]['id'] . '_client.pem'; } if (!empty($server[$model]['self_signed'])) { $params['ssl_allow_self_signed'] = true; $params['ssl_verify_peer_name'] = false; if (!isset($server[$model]['cert_file'])) { $params['ssl_verify_peer'] = false; } } if (!empty($server[$model]['skip_proxy'])) { $params['skip_proxy'] = 1; } if (!empty($timeout)) { $params['timeout'] = $timeout; } } return $this->createHttpSocket($params); }
0
PHP
CWE-209
Generation of Error Message Containing Sensitive Information
The product generates an error message that includes sensitive information about its environment, users, or associated data.
https://cwe.mitre.org/data/definitions/209.html
vulnerable
return in_array($paramName, $paramArray); }, ARRAY_FILTER_USE_KEY); if (!empty($paramArray)) { foreach ($paramArray as $p) { if (isset($request->params['named'][$p])) { $data[$p] = str_replace(';', ':', $request->params['named'][$p]); } } } foreach ($data as &$v) { if (is_string($v)) { $v = trim($v); if (strpos($v, '||')) { $v = explode('||', $v); } } } unset($v); return $data; }
0
PHP
NVD-CWE-noinfo
null
null
null
vulnerable
foreach ($filters as $f) { if ($f === -1) { foreach ($keys as $key) { $temp['OR'][$key][] = -1; } continue; } // split the filter params into two lists, one for substring searches one for exact ones if (is_string($f) && ($f[strlen($f) - 1] === '%' || $f[0] === '%')) { foreach ($keys as $key) { if ($operator === 'NOT') { $temp[] = array($key . ' NOT LIKE' => $f); } else { $temp[] = array($key . ' LIKE' => $f); $temp[] = array($key => $f); } } } else { foreach ($keys as $key) { if ($operator === 'NOT') { $temp[$key . ' !='][] = $f; } else { $temp['OR'][$key][] = $f; } } } }
0
PHP
NVD-CWE-noinfo
null
null
null
vulnerable
} elseif ($obj_attr['object_relation'] == 'last-seen' && is_null($toPush_obj['last_seen'])) { $toPush_obj['last_seen'] = $obj_attr['value']; // replace last_seen of the object to seen of the element $toPush_obj['last_seen_overwrite'] = true; } $toPush_attr = array( 'id' => $obj_attr['id'], 'uuid' => $obj_attr['uuid'], 'content' => $obj_attr['value'], 'contentType' => $obj_attr['object_relation'], 'event_id' => $obj_attr['event_id'], 'group' => 'object_attribute', 'timestamp' => $obj_attr['timestamp'], 'attribute_type' => $obj_attr['type'], 'date_sighting' => $sightingsAttributeMap[$attr['id']] ?? [], 'is_image' => $this->__eventModel->Attribute->isImage($obj_attr), ); $toPush_obj['Attribute'][] = $toPush_attr; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
$toPush = array( 'id' => $attr['id'], 'uuid' => $attr['uuid'], 'content' => $attr['value'], 'event_id' => $attr['event_id'], 'group' => 'attribute', 'timestamp' => $attr['timestamp'], 'first_seen' => $attr['first_seen'], 'last_seen' => $attr['last_seen'], 'attribute_type' => $attr['type'], 'date_sighting' => $sightingsAttributeMap[$attr['id']] ?? [], 'is_image' => $this->__eventModel->Attribute->isImage($attr), ); $this->__json['items'][] = $toPush; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 static function getPathThisScriptNonCli() { $isCgi = Environment::isRunningOnCgiServer(); if ($isCgi && Environment::usesCgiFixPathInfo()) { return $_SERVER['SCRIPT_FILENAME']; } $cgiPath = $_SERVER['ORIG_PATH_TRANSLATED'] ?? $_SERVER['PATH_TRANSLATED'] ?? ''; if ($cgiPath && $isCgi) { return $cgiPath; } return $_SERVER['ORIG_SCRIPT_FILENAME'] ?? $_SERVER['SCRIPT_FILENAME']; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 setAbsRefPrefix() { if (!$this->absRefPrefix) { return; } $search = [ '"_assets/', '"typo3temp/', '"' . PathUtility::stripPathSitePrefix(Environment::getExtensionsPath()) . '/', '"' . PathUtility::stripPathSitePrefix(Environment::getFrameworkBasePath()) . '/', ]; $replace = [ '"' . $this->absRefPrefix . '_assets/', '"' . $this->absRefPrefix . 'typo3temp/', '"' . $this->absRefPrefix . PathUtility::stripPathSitePrefix(Environment::getExtensionsPath()) . '/', '"' . $this->absRefPrefix . PathUtility::stripPathSitePrefix(Environment::getFrameworkBasePath()) . '/', ]; // Process additional directories $directories = GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['FE']['additionalAbsRefPrefixDirectories'], true); foreach ($directories as $directory) { $search[] = '"' . $directory; $replace[] = '"' . $this->absRefPrefix . $directory; } $this->content = str_replace( $search, $replace, $this->content ); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public function __construct(SessionBackendInterface $sessionBackend, int $sessionLifetime, IpLocker $ipLocker) { $this->sessionBackend = $sessionBackend; $this->sessionLifetime = $sessionLifetime; $this->ipLocker = $ipLocker; }
0
PHP
CWE-287
Improper Authentication
When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
vulnerable
public function normalize($object, $format = null, array $context = []) { $resourceClass = $this->getObjectClass($object); if ($this->getOutputClass($resourceClass, $context)) { return parent::normalize($object, $format, $context); } if (!isset($context['cache_key'])) { $context['cache_key'] = $this->getCacheKey($format, $context); } if ($this->resourceClassResolver->isResourceClass($resourceClass)) { $resourceClass = $this->resourceClassResolver->getResourceClass($object, $context['resource_class'] ?? null); } $context = $this->initContext($resourceClass, $context); $iri = $this->iriConverter instanceof LegacyIriConverterInterface ? $this->iriConverter->getIriFromItem($object) : $this->iriConverter->getIriFromResource($object, UrlGeneratorInterface::ABS_PATH, $context['operation'] ?? null, $context); $context['iri'] = $iri; $context['api_normalize'] = true; $data = parent::normalize($object, $format, $context); if (!\is_array($data)) { return $data; } $metadata = [ '_links' => [ 'self' => [ 'href' => $iri, ], ], ]; $components = $this->getComponents($object, $format, $context); $metadata = $this->populateRelation($metadata, $object, $format, $context, $components, 'links'); $metadata = $this->populateRelation($metadata, $object, $format, $context, $components, 'embedded'); return $metadata + $data; }
0
PHP
CWE-863
Incorrect Authorization
The product 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
unset($context[$key]); } unset($context[self::EXCLUDE_FROM_CACHE_KEY]); unset($context['cache_key']); // avoid artificially different keys try { return md5($format.serialize($context)); } catch (\Exception $exception) { // The context cannot be serialized, skip the cache return false; } }
0
PHP
CWE-863
Incorrect Authorization
The product 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 fileExt($check, $exts) { $file = $check[key($check)]; if (!empty($file['name'])) { if (!is_array($exts)) { $exts = explode(',', $exts); } $ext = decodeContent($file['type'], $file['name']); if (in_array($ext, $exts)) { return true; } else { return false; } } return true; }
0
PHP
CWE-434
Unrestricted Upload of File with Dangerous Type
The product allows the attacker to upload or transfer files of dangerous types that can be automatically processed within the product's environment.
https://cwe.mitre.org/data/definitions/434.html
vulnerable
public function fileExt($check, $exts) { $file = $check[key($check)]; if (!is_array($exts)) { $exts = explode(',', $exts); } // FILES形式のチェック if (!empty($file['name'])) { $ext = decodeContent($file['type'], $file['name']); if (!in_array($ext, $exts)) { return false; } } // 更新時の文字列チェック if (is_string($file)) { $ext = pathinfo($file, PATHINFO_EXTENSION); if (!in_array($ext, $exts)) { return false; } } return true; }
0
PHP
CWE-434
Unrestricted Upload of File with Dangerous Type
The product 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 javascriptStringRemove($text) { return str_ireplace('javascript', '', $text ?? ''); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 addPnote( $pid, $newtext, $authorized = '0', $activity = '1', $title = 'Unassigned', $assigned_to = '', $datetime = '', $message_status = 'New', $background_user = "" ) { if (empty($datetime)) { $datetime = date('Y-m-d H:i:s'); } // make inactive if set as Done if ($message_status == 'Done') { $activity = 0; } $user = ($background_user != "" ? $background_user : $_SESSION['authUser']); $body = date('Y-m-d H:i') . ' (' . $user; if ($assigned_to) { $body .= " to $assigned_to"; } $body = $body . ') ' . $newtext; return sqlInsert( 'INSERT INTO pnotes (date, body, pid, user, groupname, ' . 'authorized, activity, title, assigned_to, message_status, update_by, update_date) VALUES ' . '(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW())', array($datetime, $body, $pid, $user, $_SESSION['authProvider'], $authorized, $activity, $title, $assigned_to, $message_status, $_SESSION['authUserID']) ); }
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 addPnote( $pid, $newtext, $authorized = '0', $activity = '1', $title = 'Unassigned', $assigned_to = '', $datetime = '', $message_status = 'New', $background_user = "" ) { if (empty($datetime)) { $datetime = date('Y-m-d H:i:s'); } // make inactive if set as Done if ($message_status == 'Done') { $activity = 0; } $user = ($background_user != "" ? $background_user : $_SESSION['authUser']); $body = date('Y-m-d H:i') . ' (' . $user; if ($assigned_to) { $body .= " to $assigned_to"; } $body = $body . ') ' . $newtext; return sqlInsert( 'INSERT INTO pnotes (date, body, pid, user, groupname, ' . 'authorized, activity, title, assigned_to, message_status, update_by, update_date) VALUES ' . '(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW())', array($datetime, $body, $pid, $user, $_SESSION['authProvider'], $authorized, $activity, $title, $assigned_to, $message_status, $_SESSION['authUserID']) ); }
0
PHP
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
function doOneDay($catid, $udate, $starttime, $duration, $prefcatid) { global $slots, $slotsecs, $slotstime, $slotbase, $slotcount, $input_catid; $udate = strtotime($starttime, $udate); if ($udate < $slotstime) { return; } $i = (int)($udate / $slotsecs) - $slotbase; $iend = (int)(($duration + $slotsecs - 1) / $slotsecs) + $i; if ($iend > $slotcount) { $iend = $slotcount; } if ($iend <= $i) { $iend = $i + 1; } for (; $i < $iend; ++$i) { if ($catid == 2) { // in office // If a category ID was specified when this popup was invoked, then select // only IN events with a matching preferred category or with no preferred // category; other IN events are to be treated as OUT events. if ($input_catid) { if ($prefcatid == $input_catid || !$prefcatid) { $slots[$i] |= 1; } else { $slots[$i] |= 2; } } else { $slots[$i] |= 1; } break; // ignore any positive duration for IN } elseif ($catid == 3) { // out of office $slots[$i] |= 2; break; // ignore any positive duration for OUT } else { // all other events reserve time $slots[$i] |= 4; } } }
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 doOneDay($catid, $udate, $starttime, $duration, $prefcatid) { global $slots, $slotsecs, $slotstime, $slotbase, $slotcount, $input_catid; $udate = strtotime($starttime, $udate); if ($udate < $slotstime) { return; } $i = (int)($udate / $slotsecs) - $slotbase; $iend = (int)(($duration + $slotsecs - 1) / $slotsecs) + $i; if ($iend > $slotcount) { $iend = $slotcount; } if ($iend <= $i) { $iend = $i + 1; } for (; $i < $iend; ++$i) { if ($catid == 2) { // in office // If a category ID was specified when this popup was invoked, then select // only IN events with a matching preferred category or with no preferred // category; other IN events are to be treated as OUT events. if ($input_catid) { if ($prefcatid == $input_catid || !$prefcatid) { $slots[$i] |= 1; } else { $slots[$i] |= 2; } } else { $slots[$i] |= 1; } break; // ignore any positive duration for IN } elseif ($catid == 3) { // out of office $slots[$i] |= 2; break; // ignore any positive duration for OUT } else { // all other events reserve time $slots[$i] |= 4; } } }
0
PHP
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
private function _getMyUniqueHash() { $unique = $this->getServer('REMOTE_ADDR'); $unique .= $this->getServer('HTTP_USER_AGENT'); $unique .= $this->getServer('HTTP_ACCEPT_LANGUAGE'); $unique .= C_USER; return md5($unique); }
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 _getMyUniqueHash() { $unique = $this->getServer('REMOTE_ADDR'); $unique .= $this->getServer('HTTP_USER_AGENT'); $unique .= $this->getServer('HTTP_ACCEPT_LANGUAGE'); $unique .= C_USER; return md5($unique); }
0
PHP
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
public function pingAction() { $ip = $this->getServer('REMOTE_ADDR'); $hash = $this->_getMyUniqueHash(); $user = $this->getRequest('username', 'No Username'); if ($user == 'currentol') { $onlines = $this->getModel()->getOnline(false); $this->setHeader(array('Content-Type' => 'application/json')); return json_encode($onlines); } if (IS_PORTAL) { $userid = IS_PORTAL; } else { $userid = IS_DASHBOARD; } $this->getModel()->updateOnline($hash, $ip, $user, $userid); $this->getModel()->clearOffline(); $onlines = $this->getModel()->getOnline(); $this->setHeader(array('Content-Type' => 'application/json')); return json_encode($onlines); }
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 pingAction() { $ip = $this->getServer('REMOTE_ADDR'); $hash = $this->_getMyUniqueHash(); $user = $this->getRequest('username', 'No Username'); if ($user == 'currentol') { $onlines = $this->getModel()->getOnline(false); $this->setHeader(array('Content-Type' => 'application/json')); return json_encode($onlines); } if (IS_PORTAL) { $userid = IS_PORTAL; } else { $userid = IS_DASHBOARD; } $this->getModel()->updateOnline($hash, $ip, $user, $userid); $this->getModel()->clearOffline(); $onlines = $this->getModel()->getOnline(); $this->setHeader(array('Content-Type' => 'application/json')); return json_encode($onlines); }
0
PHP
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
public function saveAction() { $username = $this->getPost('username'); $message = $this->getPost('message'); $ip = $this->getServer('REMOTE_ADDR'); $this->setCookie('username', $username, 9999 * 9999); $recipid = $this->getPost('recip_id'); if (IS_PORTAL) { $senderid = IS_PORTAL; } else { $senderid = IS_DASHBOARD; } $result = array('success' => false); if ($username && $message) { $cleanUsername = preg_replace('/^' . ADMIN_USERNAME_PREFIX . '/', '', $username); $result = array( 'success' => $this->getModel()->addMessage($cleanUsername, $message, $ip, $senderid, $recipid) ); } if ($this->_isAdmin($username)) { $this->_parseAdminCommand($message); } $this->setHeader(array('Content-Type' => 'application/json')); return json_encode($result); }
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 saveAction() { $username = $this->getPost('username'); $message = $this->getPost('message'); $ip = $this->getServer('REMOTE_ADDR'); $this->setCookie('username', $username, 9999 * 9999); $recipid = $this->getPost('recip_id'); if (IS_PORTAL) { $senderid = IS_PORTAL; } else { $senderid = IS_DASHBOARD; } $result = array('success' => false); if ($username && $message) { $cleanUsername = preg_replace('/^' . ADMIN_USERNAME_PREFIX . '/', '', $username); $result = array( 'success' => $this->getModel()->addMessage($cleanUsername, $message, $ip, $senderid, $recipid) ); } if ($this->_isAdmin($username)) { $this->_parseAdminCommand($message); } $this->setHeader(array('Content-Type' => 'application/json')); return json_encode($result); }
0
PHP
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
private function _parseAdminCommand($message) { if (str_contains($message, '/clear')) { $this->getModel()->removeMessages(); return true; } if (str_contains($message, '/online')) { $online = $this->getModel()->getOnline(false); $ipArr = array(); foreach ($online as $item) { $ipArr[] = $item->ip; } $message = 'Online: ' . implode(", ", $ipArr); $this->getModel()->addMessage('Admin Command', $message, '0.0.0.0'); return true; } }
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 _parseAdminCommand($message) { if (str_contains($message, '/clear')) { $this->getModel()->removeMessages(); return true; } if (str_contains($message, '/online')) { $online = $this->getModel()->getOnline(false); $ipArr = array(); foreach ($online as $item) { $ipArr[] = $item->ip; } $message = 'Online: ' . implode(", ", $ipArr); $this->getModel()->addMessage('Admin Command', $message, '0.0.0.0'); return true; } }
0
PHP
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
private function _isAdmin($username) { return (bool)IS_DASHBOARD; }
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 _isAdmin($username) { return (bool)IS_DASHBOARD; }
0
PHP
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
} elseif ($errmsg) { echo " <td colspan='3' class='text-danger'>$errmsg</td>\n"; } else {
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 inheritableSegments(Request $request, SegmentManagerInterface $segmentManager) { $id = $request->get('id') ?? ''; $type = $request->get('type') ?? ''; $db = \Pimcore\Db::get(); $parentIdStatement = sprintf('SELECT `%s` FROM `%s` WHERE `%s` = :value', $type === 'object' ? 'o_parentId' : 'parentId', $type.'s', $type === 'object' ? 'o_id' : 'id'); $parentId = $db->fetchOne($parentIdStatement, [ 'value' => $id ]); $segments = $segmentManager->getSegmentsForElementId($parentId, $type); $data = array_map([$this, 'dehydrateSegment'], array_filter($segments)); return $this->adminJson(['data' => array_values($data)]); }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
foreach ($segmentCollection as $group => $groupCollection) { if (!empty($groupCollection)) { usort($groupCollection, function ($left, $right) { if ($left['count'] === $right['count']) { return 0; } return ($left['count'] < $right['count']) ? 1 : -1; }); $segmentCollection[$group] = array_slice($groupCollection, 0, $limitSegmentCountPerGroup); } }
0
PHP
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
protected function formatSegmentValue(CustomerSegmentInterface $segment) { return sprintf('<span class="label label-default">%s</span>', $segment->getName()); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public function __construct(BigInteger $modulo) { //if (!$modulo->isPrime()) { // throw new \UnexpectedValueException('PrimeField requires a prime number be passed to the constructor'); //} $this->instanceID = self::$instanceCounter++; Integer::setModulo($this->instanceID, $modulo); Integer::setRecurringModuloFunction($this->instanceID, $modulo->createRecurringModuloFunction()); }
0
PHP
CWE-835
Loop with Unreachable Exit Condition ('Infinite Loop')
The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.
https://cwe.mitre.org/data/definitions/835.html
vulnerable
public function squareRoot() { static $one, $two; if (!isset($one)) { $one = new BigInteger(1); $two = new BigInteger(2); } $reduce = static::$reduce[$this->instanceID]; $p_1 = static::$modulo[$this->instanceID]->subtract($one); $q = clone $p_1; $s = BigInteger::scan1divide($q); list($pow) = $p_1->divide($two); for ($z = $one; !$z->equals(static::$modulo[$this->instanceID]); $z = $z->add($one)) { $temp = $z->powMod($pow, static::$modulo[$this->instanceID]); if ($temp->equals($p_1)) { break; } } $m = new BigInteger($s); $c = $z->powMod($q, static::$modulo[$this->instanceID]); $t = $this->value->powMod($q, static::$modulo[$this->instanceID]); list($temp) = $q->add($one)->divide($two); $r = $this->value->powMod($temp, static::$modulo[$this->instanceID]); while (!$t->equals($one)) { $i = clone $one; while (!$t->powMod($two->pow($i), static::$modulo[$this->instanceID])->equals($one)) { $i = $i->add($one); } if ($i->compare($m) >= 0) { return false; } $b = $c->powMod($two->pow($m->subtract($i)->subtract($one)), static::$modulo[$this->instanceID]); $m = $i; $c = $reduce($b->multiply($b)); $t = $reduce($t->multiply($c)); $r = $reduce($r->multiply($b)); } return new static($this->instanceID, $r); }
0
PHP
CWE-835
Loop with Unreachable Exit Condition ('Infinite Loop')
The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.
https://cwe.mitre.org/data/definitions/835.html
vulnerable
public function hash(string $password) { if ((defined('PASSWORD_ARGON2I') && $this->config->hashAlgorithm === PASSWORD_ARGON2I) || (defined('PASSWORD_ARGON2ID') && $this->config->hashAlgorithm === PASSWORD_ARGON2ID) ) { $hashOptions = [ 'memory_cost' => $this->config->hashMemoryCost, 'time_cost' => $this->config->hashTimeCost, 'threads' => $this->config->hashThreads, ]; } else { $hashOptions = [ 'cost' => $this->config->hashCost, ]; } return password_hash( base64_encode( hash('sha384', $password, true) ), $this->config->hashAlgorithm, $hashOptions ); }
0
PHP
CWE-916
Use of Password Hash With Insufficient Computational Effort
The product generates a hash for a password, but it uses a scheme that does not provide a sufficient level of computational effort that would make password cracking attacks infeasible or expensive.
https://cwe.mitre.org/data/definitions/916.html
vulnerable
Craft::t('app', 'Location') => function() use ($volume) { $loc = [Craft::t('site', $volume->name)]; if ($this->folderPath) { array_push($loc, ...ArrayHelper::filterEmptyStringsFromArray(explode('/', $this->folderPath))); } return implode(' → ', $loc); },
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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
private function getOffset(ConnectionInterface $conn) { parse_str($conn->httpRequest->getUri()->getQuery(), $arr); return (isset($arr['offset'])) ? invertSign(((int)$arr['offset'])*60) : 0; }
0
PHP
CWE-346
Origin Validation Error
The product does not properly verify that the source of data or communication is valid.
https://cwe.mitre.org/data/definitions/346.html
vulnerable
private function registerCleaner() { $this->loop->addPeriodicTimer(5, function () { foreach ($this->sessions as $sid => $session) { if ($session->countClients() == 0 && $session->registered == null) { $session->killLinker(); } if ($session->process == null) { unset($this->sessions[$sid]); } } $this->cleanupDBSessions(); $this->cleanupEncryptedPasswords(); $this->cleanupPushSubscriptions(); }); }
0
PHP
CWE-346
Origin Validation Error
The product does not properly verify that the source of data or communication is valid.
https://cwe.mitre.org/data/definitions/346.html
vulnerable
private function getHeaderSid(ConnectionInterface $conn) { return ($conn->httpRequest->hasHeader('MOVIM_SESSION_ID') && $conn->httpRequest->getHeader('MOVIM_DAEMON_KEY')[0] === $this->key) ? $conn->httpRequest->getHeader('MOVIM_SESSION_ID')[0] : null; }
0
PHP
CWE-346
Origin Validation Error
The product does not properly verify that the source of data or communication is valid.
https://cwe.mitre.org/data/definitions/346.html
vulnerable
private function cleanupEncryptedPasswords() { EncryptedPassword::where('updated_at', '<', date(MOVIM_SQL_DATE, time()-(60*60*24*7))) ->delete(); }
0
PHP
CWE-346
Origin Validation Error
The product does not properly verify that the source of data or communication is valid.
https://cwe.mitre.org/data/definitions/346.html
vulnerable
private function cleanupDBSessions() { DBSession::where('active', false) ->where('created_at', '<', date(MOVIM_SQL_DATE, time()-60)) ->delete(); }
0
PHP
CWE-346
Origin Validation Error
The product does not properly verify that the source of data or communication is valid.
https://cwe.mitre.org/data/definitions/346.html
vulnerable
private function cleanupPushSubscriptions() { PushSubscription::where('activity_at', '<', date(MOVIM_SQL_DATE, time()-(60*60*24*30))) ->delete(); }
0
PHP
CWE-346
Origin Validation Error
The product does not properly verify that the source of data or communication is valid.
https://cwe.mitre.org/data/definitions/346.html
vulnerable
public function setWebsocket($port) { echo "\n". "--- ".colorize("Server Configuration - Apache", 'purple')." ---". "\n"; echo colorize("Enable the Secure WebSocket to WebSocket tunneling", 'yellow')."\n# a2enmod proxy_wstunnel \n"; echo colorize("Add this in your configuration file (default-ssl.conf)", 'yellow')."\nProxyPass /ws/ ws://127.0.0.1:{$port}/\n"; echo "\n". "--- ".colorize("Server Configuration - nginx", 'purple')." ---". "\n"; echo colorize("Add this in your configuration file", 'yellow')."\n"; echo "location /ws/ { proxy_pass http://127.0.0.1:{$port}/; proxy_http_version 1.1; proxy_set_header Upgrade \$http_upgrade; proxy_set_header Connection \"Upgrade\"; proxy_set_header Host \$host; proxy_set_header X-Real-IP \$remote_addr; proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; proxy_redirect off; } "; echo "\n". "--- ".colorize("Server Configuration - Caddy", 'purple')." ---". "\n"; echo colorize("Add this in your configuration file", 'yellow')."\nhandle /ws/* { reverse_proxy localhost:8080 } "; }
0
PHP
CWE-346
Origin Validation Error
The product does not properly verify that the source of data or communication is valid.
https://cwe.mitre.org/data/definitions/346.html
vulnerable
public function onClose(ConnectionInterface $conn) { $sid = $this->getSid($conn); if ($sid != null && isset($this->sessions[$sid])) { $path = $this->getPath($conn); if (in_array($path, $this->single)) { if (array_key_exists($sid, $this->singlelocks) && array_key_exists($path, $this->singlelocks[$sid])) { $this->singlelocks[$sid][$path]--; if ($this->singlelocks[$sid][$path] == 0) { unset($this->singlelocks[$sid][$path]); } } } $this->sessions[$sid]->detach($this->loop, $conn); if ($this->sessions[$sid]->process == null) { unset($this->sessions[$sid]); } } gc_collect_cycles(); }
0
PHP
CWE-346
Origin Validation Error
The product does not properly verify that the source of data or communication is valid.
https://cwe.mitre.org/data/definitions/346.html
vulnerable
public function __construct($loop, $baseuri) { $this->key = \generateKey(32); $this->setWebsocket(config('daemon.port')); $this->loop = $loop; $this->baseuri = $baseuri; DBSession::whereNotNull('id')->delete(); // API_SOCKET ? if (file_exists(CACHE_PATH . 'socketapi.sock')) { unlink(CACHE_PATH . 'socketapi.sock'); } array_map('unlink', array_merge( glob(PUBLIC_CACHE_PATH . '*.css'), glob(PUBLIC_CACHE_PATH . '*.js') )); $this->registerCleaner(); // Generate Push Notification if (!file_exists(CACHE_PATH . 'vapid_keys.json')) { echo colorize("Generate and store the Push Notification VAPID keys", 'green')."\n"; $keyset = VAPID::createVapidKeys(); file_put_contents(CACHE_PATH . 'vapid_keys.json', json_encode($keyset)); } }
0
PHP
CWE-346
Origin Validation Error
The product does not properly verify that the source of data or communication is valid.
https://cwe.mitre.org/data/definitions/346.html
vulnerable
public function onOpen(ConnectionInterface $conn) { // WebSockets from the Browser $sid = $this->getSid($conn); if ($sid != null) { $path = $this->getPath($conn); if (in_array($path, $this->single)) { if (array_key_exists($sid, $this->singlelocks) && array_key_exists($path, $this->singlelocks[$sid])) { $this->singlelocks[$sid][$path]++; $conn->close(1008); } else { $this->singlelocks[$sid][$path] = 1; } } if (!array_key_exists($sid, $this->sessions)) { $language = $this->getLanguage($conn); $offset = $this->getOffset($conn); $this->sessions[$sid] = new Session( $this->loop, $sid, $this->baseuri, config('daemon.port'), $this->key, $language, $offset, config('daemon.verbose'), config('daemon.debug') ); } $this->sessions[$sid]->attach($conn); } else { // WebSocket from the internal subprocess $sid = $this->getHeaderSid($conn); if ($sid != null && isset($this->sessions[$sid])) { $this->sessions[$sid]->attachInternal($conn); $obj = new \StdClass; $obj->func = 'started'; $this->sessions[$sid]->messageOut(json_encode($obj)); } } }
0
PHP
CWE-346
Origin Validation Error
The product does not properly verify that the source of data or communication is valid.
https://cwe.mitre.org/data/definitions/346.html
vulnerable
public function prepareInputForUpdate($input) { if (isset($input["rootdn_passwd"])) { if (empty($input["rootdn_passwd"])) { unset($input["rootdn_passwd"]); } else { $input["rootdn_passwd"] = (new GLPIKey())->encrypt($input["rootdn_passwd"]); } } if (isset($input["_blank_passwd"]) && $input["_blank_passwd"]) { $input['rootdn_passwd'] = ''; } // Set attributes in lower case if (count($input)) { foreach ($input as $key => $val) { if (preg_match('/_field$/', $key)) { $input[$key] = Toolbox::strtolower($val); } } } //do not permit to override sync_field if ( $this->isSyncFieldEnabled() && isset($input['sync_field']) && $this->isSyncFieldUsed() ) { if ($input['sync_field'] == $this->fields['sync_field']) { unset($input['sync_field']); } else { Session::addMessageAfterRedirect( __('Synchronization field cannot be changed once in use.'), false, ERROR ); return false; }; } $this->checkFilesExist($input); return $input; }
0
PHP
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The product 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 checkFilesExist(&$input) { if (isset($input['tls_certfile'])) { $file = realpath($input['tls_certfile']); if (!file_exists($file)) { Session::addMessageAfterRedirect( __('TLS certificate path is incorrect'), false, ERROR ); return false; } } if (isset($input['tls_keyfile'])) { $file = realpath($input['tls_keyfile']); if (!file_exists($file)) { Session::addMessageAfterRedirect( __('TLS key file path is incorrect'), false, ERROR ); return false; } } }
0
PHP
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The product 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
$dataitemtypes = json_decode($data['itemtypes']); if (in_array($itemtype, $dataitemtypes) != false) { $id = $data['id']; } } //profiles restriction if (isset($_SESSION['glpiactiveprofile']['id'])) { $profile = new PluginFieldsProfile(); if (isset($id)) { $found = $profile->find(['profiles_id' => $_SESSION['glpiactiveprofile']['id'], 'plugin_fields_containers_id' => $id ]); $first_found = array_shift($found); if ($first_found === null || $first_found['right'] == null || $first_found['right'] == 0) { return false; } } } return $id; }
0
PHP
CWE-269
Improper Privilege Management
The product 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
vulnerable
public static function preItem(CommonDBTM $item) { //find container (if not exist, do nothing) if (isset($_REQUEST['c_id'])) { $c_id = $_REQUEST['c_id']; } else { $type = 'dom'; if (isset($_REQUEST['_plugin_fields_type'])) { $type = $_REQUEST['_plugin_fields_type']; } $subtype = ''; if ($type == 'domtab') { $subtype = $_REQUEST['_plugin_fields_subtype']; } if (false === ($c_id = self::findContainer(get_Class($item), $type, $subtype))) { // tries for 'tab' if (false === ($c_id = self::findContainer(get_Class($item)))) { return false; } } } //need to check if container is usable on this object entity $loc_c = new PluginFieldsContainer(); $loc_c->getFromDB($c_id); $entities = [$loc_c->fields['entities_id']]; if ($loc_c->fields['is_recursive']) { $entities = getSonsOf(getTableForItemType('Entity'), $loc_c->fields['entities_id']); } //workaround: when a ticket is created from readdonly profile, //it is not initialized; see https://github.com/glpi-project/glpi/issues/1438 if (!isset($item->fields) || count($item->fields) == 0) { $item->fields = $item->input; } if ($item->isEntityAssign() && !in_array($item->getEntityID(), $entities)) { return false; } if (false !== ($data = self::populateData($c_id, $item))) { if (self::validateValues($data, $item::getType(), isset($_REQUEST['massiveaction'])) === false) { return $item->input = []; } return $item->plugin_fields_data = $data; } return; }
0
PHP
CWE-269
Improper Privilege Management
The product 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
vulnerable
function plugin_order_displayConfigItem($type, $ID, $data, $num) { global $CFG_GLPI; $searchopt = &Search::getOptions($type); $table = $searchopt[$ID]["table"]; $field = $searchopt[$ID]["field"]; switch ($table.'.'.$field) { case "glpi_plugin_order_orders.is_late": $message = ""; if ($data['raw']["ITEM_".$num]) { $config = PluginOrderConfig::getConfig(); if ($config->getShouldBeDevileredColor() != '') { $message .= " style=\"background-color:".$config->getShouldBeDevileredColor().";\" "; } } return $message; } }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
public static function getMenuContent() { global $CFG_GLPI; $menu = parent::getMenuContent(); $menu['page'] = PluginOrderMenu::getSearchURL(false); $menu['links']['add'] = null; $menu['links']['search'] = null; $menu['links']['config'] = self::getFormURL(false); return $menu; }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
function getSpecificMassiveActions($checkitem = null) { $isadmin = static::canUpdate(); $actions = parent::getSpecificMassiveActions($checkitem); $sep = __CLASS__.MassiveAction::CLASS_ACTION_SEPARATOR; $actions[$sep.'generation'] = __("Generate item", "order"); $actions[$sep.'createLink'] = __("Link to an existing item", "order"); $actions[$sep.'deleteLink'] = __("Delete item link", "order"); return $actions; }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
public function transfer($ID, $entity) { global $DB; $supplier = new PluginOrderOrder_Supplier(); $reference = new PluginOrderReference(); $this->getFromDB($ID); $this->update([ "id" => $ID, "entities_id" => $entity, ]); if ($supplier->getFromDBByOrder($ID)) { $supplier->update([ "id" => $supplier->fields["id"], "entities_id" => $entity, ]); } $query = "SELECT `plugin_order_references_id` FROM `glpi_plugin_order_orders_items` WHERE `plugin_order_orders_id` = '$ID' GROUP BY plugin_order_references_id"; $result = $DB->query($query); if ($DB->numrows($result)) { while ($detail = $DB->fetchArray($result)) { $ref = $reference->transfer($detail["plugin_order_references_id"], $entity); } } }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
public function dropdownContacts($suppliers_id, $value = 0, $entity_restrict = '') { global $DB, $CFG_GLPI; $rand = mt_rand(); $entities = getEntitiesRestrictRequest("AND", "glpi_contacts", '', $entity_restrict, true); $query = "SELECT `glpi_contacts`.* FROM `glpi_contacts`,`glpi_contacts_suppliers` WHERE `glpi_contacts_suppliers`.`contacts_id` = `glpi_contacts`.`id` AND `glpi_contacts_suppliers`.`suppliers_id` = '$suppliers_id' AND `glpi_contacts`.`is_deleted` = '0' $entities ORDER BY `entities_id`, `name`"; $result = $DB->query($query); echo "<select name='contacts_id'>"; echo "<option value='0'>".Dropdown::EMPTY_VALUE."</option>"; if ($DB->numrows($result)) { $prev = -1; while ($data = $DB->fetchArray($result)) { if ($data["entities_id"] != $prev) { if ($prev >= 0) { echo "</optgroup>"; } $prev = $data["entities_id"]; echo "<optgroup label=\"".Dropdown::getDropdownName("glpi_entities", $prev)."\">"; } $output = formatUserName($data["id"], "", $data["name"], $data["firstname"]); if ($_SESSION["glpiis_ids_visible"] || empty($output)) { $output .= " (".$data["id"].")"; } echo "<option value='".$data["id"]."' ".($value == $data["id"] ? " selected " : "") ." title=\"".Html::cleanInputText($output)."\">" .substr($output, 0, $CFG_GLPI["dropdown_chars_limit"])."</option>"; } if ($prev >= 0) { echo "</optgroup>"; } }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
public function dropdownSuppliers($myname, $value = 0, $entity_restrict = '') { global $DB, $CFG_GLPI; $rand = mt_rand(); $entities = getEntitiesRestrictRequest("AND", "glpi_suppliers", '', $entity_restrict, true); $query = "SELECT `glpi_suppliers`.* FROM `glpi_suppliers` LEFT JOIN `glpi_contacts_suppliers` ON (`glpi_contacts_suppliers`.`suppliers_id` = `glpi_suppliers`.`id`) WHERE `glpi_suppliers`.`is_deleted` = '0' $entities GROUP BY `glpi_suppliers`.`id` ORDER BY `entities_id`, `name`"; $result = $DB->query($query); echo "<select name='suppliers_id' id='suppliers_id'>\n"; echo "<option value='0'>".Dropdown::EMPTY_VALUE."</option>\n"; $prev = -1; while ($data = $DB->fetchArray($result)) { if ($data["entities_id"] != $prev) { if ($prev >= 0) { echo "</optgroup>"; } $prev = $data["entities_id"]; echo "<optgroup label=\"".Dropdown::getDropdownName("glpi_entities", $prev)."\">"; } $output = $data["name"]; if ($_SESSION["glpiis_ids_visible"] || empty($output)) { $output .= " (".$data["id"].")"; } echo "<option value='".$data["id"]."' ".($value == $data["id"] ? " selected " : ""). " title=\"".Html::cleanInputText($output)."\">". substr($output, 0, $CFG_GLPI["dropdown_chars_limit"])."</option>"; }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
public function checkIfDetailExists($orders_id, $only_delivered = false) { if ($orders_id) { $detail = new PluginOrderOrder_Item(); $where = ['plugin_order_orders_id' => $orders_id]; if ($only_delivered) { $where['states_id'] = ['>', 0]; } return (countElementsInTable("glpi_plugin_order_orders_items", $where)); } else { return false; } }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
public function needValidation($ID) { if ($ID > 0 && $this->getFromDB($ID)) { return $this->isDraft() || $this->isWaitingForApproval(); } else { return false; } }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
static function showMassiveActionsSubForm(MassiveAction $ma) { global $UNINSTALL_TYPES; switch ($ma->getAction()) { case 'transfert': Entity::dropdown(); echo "&nbsp;". Html::submit(_x('button', 'Post'), ['name' => 'massiveaction']); return true; } return ""; }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids) { global $CFG_GLPI; switch ($ma->getAction()) { case "transfert": $input = $ma->getInput(); $entities_id = $input['entities_id']; foreach ($ids as $id) { if ($item->getFromDB($id)) { $item->update([ "id" => $id, "entities_id" => $entities_id, "update" => __('Update'), ]); $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK); } } return; break; } return; }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
public function getTotalQuantityByRef($orders_id, $references_id) { global $DB; $query = "SELECT COUNT(*) AS quantity FROM `".self::getTable()."` WHERE `plugin_order_orders_id` = '$orders_id' AND `plugin_order_references_id` = '$references_id' "; $result = $DB->query($query); return ($DB->result($result, 0, 'quantity')); }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
public function updateAnalyticNature($post) { global $DB; $this->getFromDB($post['item_id']); $input = $this->fields; $input['plugin_order_analyticnatures_id'] = $post['plugin_order_analyticnatures_id']; $this->update($input); }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
public function checkIFReferenceExistsInOrder($orders_id, $ref_id) { return (countElementsInTable( $this->getTable(), [ 'plugin_order_orders_id' => $orders_id, 'plugin_order_references_id' => $ref_id, ] )); }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
public function updatePrice_taxfree($post) { global $DB; $this->getFromDB($post['item_id']); $input = $this->fields; $discount = $input['discount']; $plugin_order_ordertaxes_id = $input['plugin_order_ordertaxes_id']; $input["price_taxfree"] = $post['price_taxfree']; $input["price_discounted"] = $input["price_taxfree"] - ($input["price_taxfree"] * ($discount / 100)); $tax = new PluginOrderOrderTax(); $tax->getFromDB($plugin_order_ordertaxes_id); $input["price_ati"] = $this->getPricesATI($input["price_discounted"], $tax->getRate()); $this->update($input); }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
public function checkIfSupplierInfosExists($plugin_order_orders_id) { if ($plugin_order_orders_id) { $devices = getAllDataFromTable(self::getTable(), ['plugin_order_orders_id' => $plugin_order_orders_id]); if (!empty($devices)) { return true; } else { return false; } } }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
public static function getFiles($directory, $ext) { $array_dir = []; $array_file = []; if (is_dir($directory)) { if ($dh = opendir($directory)) { while (($file = readdir($dh)) !== false) { $filename = $file; $filetype = filetype($directory. $file); $filedate = Html::convDate(date ("Y-m-d", filemtime($directory.$file))); $basename = explode('.', basename($filename)); $extension = array_pop($basename); if ($filename == ".." OR $filename == ".") { echo ""; } else { if ($filetype == 'file' && $extension == $ext) { if ($ext == PLUGIN_ORDER_SIGNATURE_EXTENSION) { $name = array_shift($basename); if (strtolower($name) == strtolower($_SESSION["glpiname"])) { $array_file[] = [$filename, $filedate, $extension]; } } else { $array_file[] = [$filename, $filedate, $extension]; } } else if ($filetype == "dir") { $array_dir[] = $filename; } } } closedir($dh); } } rsort($array_file); return $array_file; }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
public function deleteDelivery($detailID) { global $DB; $detail = new PluginOrderOrder_Item(); $detail->getFromDB($detailID); if ($detail->fields["itemtype"] == 'SoftwareLicense') { $result = $PluginOrderOrder_Item->queryRef($_POST["plugin_order_orders_id"], $detail->fields["plugin_order_references_id"], $detail->fields["price_taxfree"], $detail->fields["discount"], PluginOrderOrder::ORDER_DEVICE_DELIVRED); $nb = $DB->numrows($result); if ($nb) { for ($i = 0; $i < $nb; $i++) { $detailID = $DB->result($result, $i, 'id'); $detail->update([ "id" => $detailID, "delivery_date" => 'NULL', "states_id" => PluginOrderOrder::ORDER_DEVICE_NOT_DELIVRED, "delivery_number" => "", "plugin_order_deliverystates_id" => 0, "delivery_comment" => "", ]); } } } else { $detail->update([ "id" => $detailID, "date" => 0, "states_id" => PluginOrderOrder::ORDER_DEVICE_NOT_DELIVRED, "delivery_number" => "", "plugin_order_deliverystates_id" => 0, "delivery_comment" => "", ]); } }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
public function dropdownReceptionActions($itemtype, $plugin_order_references_id, $plugin_order_orders_id) { global $CFG_GLPI; $rand = mt_rand(); echo "<select name='receptionActions$rand' id='receptionActions$rand'>"; echo "<option value='0' selected>".Dropdown::EMPTY_VALUE."</option>"; echo "<option value='reception'>".__("Take item delivery", "order")."</option>"; echo "</select>"; $params = [ 'action' => '__VALUE__', 'itemtype' => $itemtype, 'plugin_order_references_id' => $plugin_order_references_id, 'plugin_order_orders_id' => $plugin_order_orders_id, ]; Ajax::updateItemOnSelectEvent("receptionActions$rand", "show_receptionActions$rand", Plugin::getWebDir('order')."/ajax/receptionactions.php", $params); echo "<span id='show_receptionActions$rand'>&nbsp;</span>"; }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
function getSpecificMassiveActions($checkitem = null) { $isadmin = static::canUpdate(); $actions = parent::getSpecificMassiveActions($checkitem); //remove native transfer action unset($actions[MassiveAction::class.MassiveAction::CLASS_ACTION_SEPARATOR.'add_transfer_list']); $sep = __CLASS__.MassiveAction::CLASS_ACTION_SEPARATOR; $actions[$sep.'reception'] = __("Take item delivery", "order"); $actions[$sep.'transfer_order_item'] = "<i class='fa-fw fas fa-level-up-alt'></i>" . _x('button', 'Transfer', 'order'); return $actions; }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
public static function getPerTypeJavascriptCode() { global $CFG_GLPI; $out = "<script type='text/javascript'>"; $out .= "cleanhide('modal_reference_content');"; $out .= "var order_window=new Ext.Window({ layout:'fit', width:800, height:400, closeAction:'hide', modal: true, autoScroll: true, title: \"".__("View by item type", "order")."\", autoLoad: '".Plugin::getWebDir('order')."/ajax/referencetree.php' });"; $out .= "</script>"; return $out; }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
public static function showSelector($target) { $rand = mt_rand(); Plugin::loadLang('order'); echo "<div class='center' ><span class='b'>".__("Select the wanted item type", "order") ."</span><br>"; echo "<a style='font-size:14px;' href='".$target."?reset=reset' title=\"" .__("Show all")."\">".str_replace(" ", "&nbsp;", __("Show all"))."</a></div>"; echo "<div class='left' style='width:100%'>"; echo "<script type='javascript'>"; echo "var Tree_Category_Loader$rand = new Ext.tree.TreeLoader({ dataUrl:'".Plugin::getWebDir('order')."/ajax/referencetreetypes.php' });"; echo "var Tree_Category$rand = new Ext.tree.TreePanel({ collapsible : false, animCollapse : false, border : false, id : 'tree_projectcategory$rand', el : 'tree_projectcategory$rand', autoScroll : true, animate : false, enableDD : true, containerScroll : true, height : 320, width : 770, loader : Tree_Category_Loader$rand, rootVisible : false });"; // SET the root node. echo "var Tree_Category_Root$rand = new Ext.tree.AsyncTreeNode({ text : '', draggable : false, id : '-1' // this IS the id of the startnode }); Tree_Category$rand.setRootNode(Tree_Category_Root$rand);"; // Render the tree. echo "Tree_Category$rand.render(); Tree_Category_Root$rand.expand();"; echo "</script>"; echo "<div id='tree_projectcategory$rand' ></div>"; echo "</div>"; }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
public function title() { echo "<div align='center'>"; echo self::getPerTypeJavascriptCode(); echo "<a onclick='order_window.show();' href='#modal_reference_content' title='" .__("View by item type", "order")."'>" .__("View by item type", "order")."</a>"; echo "</div>"; }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
public function getPriceByReferenceAndSupplier($plugin_order_references_id, $suppliers_id) { global $DB; $table = self::getTable(); $query = "SELECT `price_taxfree` FROM `$table` WHERE `plugin_order_references_id` = '$plugin_order_references_id' AND `suppliers_id` = '$suppliers_id' "; $result = $DB->query($query); if ($DB->numrows($result) > 0) { return $DB->result($result, 0, "price_taxfree"); } else { return 0; } }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
public function addDetails($ref_id, $itemtype, $orders_id, $quantity, $price, $discounted_price, $taxes_id) { $order = new PluginOrderOrder(); if ($quantity > 0 && $order->getFromDB($orders_id)) { for ($i = 0; $i < $quantity; $i++) { $input["plugin_order_orders_id"] = $orders_id; $input["plugin_order_ordertaxes_id"] = $taxes_id; $input["itemtype"] = $itemtype; $input["entities_id"] = $order->getEntityID(); $input["is_recursive"] = $order->isRecursive(); $input["price_taxfree"] = $price; $input["price_discounted"] = $price - ($price * ($discounted_price / 100)); $input["states_id"] = PluginOrderOrder::ORDER_DEVICE_NOT_DELIVRED; $input["price_ati"] = $this->getPricesATI($input["price_discounted"], Dropdown::getDropdownName("glpi_plugin_order_ordertaxes", $taxes_id)); $input["discount"] = $discounted_price; $this->add($input); } } }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
function plugin_version_order() { return [ 'name' => __("Orders management", "order"), 'version' => PLUGIN_ORDER_VERSION, 'author' => 'The plugin order team', 'homepage' => 'https://github.com/pluginsGLPI/order', 'license' => 'GPLv2+', 'requirements' => [ 'glpi' => [ 'min' => PLUGIN_ORDER_MIN_GLPI, 'max' => PLUGIN_ORDER_MAX_GLPI, 'dev' => true, //Required to allow 9.2-dev ] ] ]; }
0
PHP
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
protected function isMounted($strFolder) { if (!$strFolder) { return false; } if (empty($this->arrFilemounts)) { return true; } $path = $strFolder; while (\is_array($this->arrFilemounts) && substr_count($path, '/') > 0) { if (\in_array($path, $this->arrFilemounts)) { return true; } $path = \dirname($path); } return false; }
0
PHP
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The product 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 product 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
protected function validator($varInput) { foreach ($varInput as $k=>$v) { if ($k != 'unit') { $varInput[$k] = parent::validator($v); } } return $varInput; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 __set($strKey, $varValue) { switch ($strKey) { case 'maxlength': if ($varValue > 0) { $this->arrAttributes['maxlength'] = $varValue; } break; case 'mandatory': if ($varValue) { $this->arrAttributes['required'] = 'required'; } else { unset($this->arrAttributes['required']); } parent::__set($strKey, $varValue); break; case 'placeholder': $this->arrAttributes['placeholder'] = $varValue; break; case 'options': $this->arrUnits = StringUtil::deserialize($varValue); break; default: parent::__set($strKey, $varValue); break; } }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 validator($varInput) { foreach ($varInput as $k=>$v) { if ($k != 'unit') { $varInput[$k] = parent::validator($v); } } return $varInput; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 __set($strKey, $varValue) { switch ($strKey) { case 'maxlength': if ($varValue > 0) { $this->arrAttributes['maxlength'] = $varValue; } break; case 'mandatory': if ($varValue) { $this->arrAttributes['required'] = 'required'; } else { unset($this->arrAttributes['required']); } parent::__set($strKey, $varValue); break; case 'options': $this->arrUnits = StringUtil::deserialize($varValue); break; default: parent::__set($strKey, $varValue); break; } }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 validator($varInput) { foreach ($varInput as $k=>$v) { if ($k != 'unit') { $varInput[$k] = parent::validator($v); } } return $varInput; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 __set($strKey, $varValue) { switch ($strKey) { case 'maxlength': if ($varValue > 0) { $this->arrAttributes['maxlength'] = $varValue; } break; case 'options': $this->arrUnits = StringUtil::deserialize($varValue); break; default: parent::__set($strKey, $varValue); break; } }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 validator($varInput) { foreach ($varInput as $k=>$v) { if ($k != 'unit') { $varInput[$k] = parent::validator($v); } } return $varInput; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 __set($strKey, $varValue) { switch ($strKey) { case 'maxlength': if ($varValue > 0) { $this->arrAttributes['maxlength'] = $varValue; } break; case 'mandatory': if ($varValue) { $this->arrAttributes['required'] = 'required'; } else { unset($this->arrAttributes['required']); } parent::__set($strKey, $varValue); break; case 'placeholder': $this->arrAttributes['placeholder'] = $varValue; break; case 'options': $this->arrUnits = StringUtil::deserialize($varValue); break; default: parent::__set($strKey, $varValue); break; } }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 validator($varInput) { foreach ($varInput as $k=>$v) { if ($k != 'unit') { $varInput[$k] = parent::validator($v); } } return $varInput; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 __set($strKey, $varValue) { switch ($strKey) { case 'maxlength': if ($varValue > 0) { $this->arrAttributes['maxlength'] = $varValue; } break; case 'mandatory': if ($varValue) { $this->arrAttributes['required'] = 'required'; } else { unset($this->arrAttributes['required']); } parent::__set($strKey, $varValue); break; case 'options': $this->arrUnits = StringUtil::deserialize($varValue); break; default: parent::__set($strKey, $varValue); break; } }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 validator($varInput) { foreach ($varInput as $k=>$v) { if ($k != 'unit') { $varInput[$k] = parent::validator($v); } } return $varInput; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 __set($strKey, $varValue) { switch ($strKey) { case 'maxlength': if ($varValue > 0) { $this->arrAttributes['maxlength'] = $varValue; } break; case 'options': $this->arrUnits = StringUtil::deserialize($varValue); break; default: parent::__set($strKey, $varValue); break; } }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public function __construct(RestApi $jira, string $templateName, $fieldId = null) { $this->jira = $jira; $this->fields = $this->enumAllowedFields(); $this->templateConfig = Config::module('jira', 'templates'); $this->templateName = $templateName; if ($fieldId !== null) { if (! array_key_exists($fieldId, $this->fields)) { $this->fieldId = array_search($fieldId, $this->fields); } else { $this->fieldId = $fieldId; } $templateFields = $this->templateConfig->getSection($templateName)->toArray(); $this->fieldValue = $templateFields[$fieldId]; } }
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 onSuccess() { if ($this->callOnSuccess === false) { $this->getSubmitButton()->setValue($this->getElement('delete')->getButtonLabel()); return; } $templateConfig = Config::fromIni($this->config->getConfigFile()); $value = $this->getValue('template'); if ($this->templateName !== null && $value !== $this->templateName) { $template = $templateConfig->getSection($this->templateName); $templateConfig->removeSection($this->templateName); $templateConfig->setSection($value, $template); } else { $template = $templateConfig->getSection($value); $templateConfig->setSection($this->getValue('template'), $template); } $templateConfig->saveIni($templateConfig->getConfigFile()); }
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 isVisible() { // current photo album must belong to current organization if ($this->getValue('pho_id') > 0 && (int) $this->getValue('pho_org_id') !== $GLOBALS['gCurrentOrgId']) { return false; } // locked photo album could only be viewed by module administrators elseif ((int) $this->getValue('pho_locked') === 1 && !$GLOBALS['gCurrentUser']->editPhotoRight()) { return false; } return true; }
0
PHP
CWE-284
Improper Access Control
The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor.
https://cwe.mitre.org/data/definitions/284.html
vulnerable
function Validate_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; }
0
PHP
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product 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 render(&$table, $value, $row, $column, $selected = false) { global $user; $showNotes = $user->isOptionEnabled('week_notes'); $field_name = $table->getValueAt($row,$column)['control_id']; // Our text field names (and ids) are like x_y (row_column). $field = new TextField($field_name); // Disable control if the date is locked. global $lockedDays; if ($lockedDays[$column]) $field->setEnabled(false); $field->setFormName($table->getFormName()); $field->setStyle('width: 60px;'); // TODO: need to style everything properly, eventually. // Provide visual separation for new entry row. $rowToSeparate = $showNotes ? 1 : 0; if ($rowToSeparate == $row) { $field->setStyle('width: 60px; margin-bottom: 40px'); } if ($showNotes) { if (0 == $row % 2) { $field->setValue($table->getValueAt($row,$column)['duration']); // Duration for even rows. } else { $field->setValue($table->getValueAt($row,$column)['note']); // Comment for odd rows. $field->setTitle($table->getValueAt($row,$column)['note']); // Tooltip to help view the entire comment. } } else { $field->setValue($table->getValueAt($row,$column)['duration']); // $field->setTitle($table->getValueAt($row,$column)['note']); // Tooltip to see comment. TODO - value not available. } // Disable control when time entry mode is TYPE_START_FINISH and there is no value in control // because we can't supply start and finish times in week view - there are no fields for them. if (!$field->getValue() && TYPE_START_FINISH == $user->getRecordType()) { $field->setEnabled(false); } $this->setValue($field->getHtml()); return $this->toString(); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product 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 saveStatisticDecision() { if (!$this->isApiRequest()) { throw new MethodNotAllowedException(); } /** @var SystemsettingsTable $SystemsettingsTable */ $SystemsettingsTable = TableRegistry::getTableLocator()->get('Systemsettings'); try { $record = $SystemsettingsTable->getSystemsettingByKey('SYSTEM.ANONYMOUS_STATISTICS'); } catch (RecordNotFoundException $e) { if (empty($record)) { throw new \RuntimeException('Systemsetting is missing - did you executed openitcockpit-update?'); } } if ($this->request->getData('statistics.decision', null) === null) { throw new \RuntimeException('Wrong POST request'); } $record->set('value', (int)$this->request->getData('statistics.decision', 0)); if ($this->request->getData('statistics.cookie', null) !== null && $record->get('value') === 2) { $this->response = $this->response->withCookie(new Cookie( 'askAgainForHelp', 'Remind me later', new \DateTime('+16 hours'), '/' )); } $SystemsettingsTable->save($record); if ($record->hasErrors()) { $this->set('success', false); $this->set('message', __('Error while saving data')); $this->viewBuilder()->setOption('serialize', ['success', 'message']); return; } $this->set('success', true); $this->set('message', __('Record successfully saved')); $this->viewBuilder()->setOption('serialize', ['success', 'message']); }
0
PHP
CWE-614
Sensitive Cookie in HTTPS Session Without 'Secure' Attribute
The Secure attribute for sensitive cookies in HTTPS sessions is not set, which could cause the user agent to send those cookies in plaintext over an HTTP session.
https://cwe.mitre.org/data/definitions/614.html
vulnerable
public function logout() { unset($_COOKIE['BOXADMR']); $this->di['session']->delete('admin'); $this->di['logger']->info('Admin logged out'); return true; }
0
PHP
CWE-384
Session Fixation
Authenticating a user, or otherwise establishing a new user session, without invalidating any existing session identifier gives an attacker the opportunity to steal authenticated sessions.
https://cwe.mitre.org/data/definitions/384.html
vulnerable
public function logoutClient() { if ($_COOKIE) { // testing env fix setcookie('BOXCLR', '', time() - 3600, '/'); } $this->di['session']->delete('client'); $this->di['session']->delete('client_id'); $this->di['logger']->info('Logged out'); return true; }
0
PHP
CWE-384
Session Fixation
Authenticating a user, or otherwise establishing a new user session, without invalidating any existing session identifier gives an attacker the opportunity to steal authenticated sessions.
https://cwe.mitre.org/data/definitions/384.html
vulnerable