Issues (207)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

extras/gwiki.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
use Xmf\Request;
4
5
/**
6
 * wiki page anywhere - call it anything, put it anywhere
7
 *
8
 * @copyright  Copyright © 2013 geekwright, LLC. All rights reserved.
9
 * @license    gwiki/docs/license.txt  GNU General Public License (GPL)
10
 * @since      1.0
11
 * @author     Richard Griffith <[email protected]>
12
 * @package    gwiki
13
 */
14
15
// ******************************************************************
16
// adjust these next few lines to reflect your installation
17
include __DIR__ . '/../../../mainfile.php';
18
$dir     = 'gwiki';  // wiki module directory
19
$pagevar = 'page'; // what is our page variable name?
20
21
// $_GET variables we use
22
$page      = Request::getString($pagevar, null, 'GET');
23
$highlight = Request::getString('query', null, 'GET');
24
25
// build a URL template to point wiki links to this script
26
$script = (!empty($_SERVER['HTTPS']))
27
    ? 'https://' . $_SERVER['SERVER_NAME'] . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
28
    : 'http://' . $_SERVER['SERVER_NAME'] . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
29
$ourWikiLinkURL = $script . '?' . $pagevar . '=%s';
30
31
// normally, adjustments to the remaining code are not required
32
// ******************************************************************
33
34
/**
35
 * @param $string
36
 *
37
 * @return string
38
 */
39 View Code Duplication
function cleaner($string)
40
{
41
    $string = stripcslashes($string);
42
    $string = html_entity_decode($string);
43
    $string = strip_tags($string); // DANGER -- kills wiki text
44
    $string = trim($string);
45
    $string = stripslashes($string);
46
47
    return $string;
48
}
49
50
/**
51
 * @param $var
52
 *
53
 * @return array|string
54
 */
55 View Code Duplication
function prepOut(&$var)
0 ignored issues
show
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
56
{
57
    if (is_array($var)) {
58
        foreach ($var as $i => $v) {
59
            $var[$i] = prepOut($v);
60
        }
61
    } else {
62
        if (is_string($var)) {
63
            $var = htmlspecialchars($var);
64
        }
65
    }
66
67
    return $var;
68
}
69
70
/**
71
 * @param        $name
72
 * @param string $domain
73
 * @param null   $language
74
 */
75 View Code Duplication
function loadLanguage($name, $domain = '', $language = null)
76
{
77
    global $xoopsConfig;
78
    if (!@include_once XOOPS_ROOT_PATH . "/modules/{$domain}/language/" . $xoopsConfig['language'] . "/{$name}.php") {
79
        include_once XOOPS_ROOT_PATH . "/modules/{$domain}/language/english/{$name}.php";
80
    }
81
}
82
83
// Access module configs from outside module:
84
$moduleHelper = Xmf\Module\Helper::getHelper($dir);
85
86
loadLanguage('main', $dir);
87
loadLanguage('modinfo', $dir);
88
include_once XOOPS_ROOT_PATH . '/modules/' . $dir . '/class/GwikiPage.php';
89
90
$wikiPage = new GwikiPage;
91
$wikiPage->setRecentCount($moduleHelper->getConfig('number_recent', 10));
92
$wikiPage->setWikiLinkURL($ourWikiLinkURL);
93
94
if (empty($page)) {
95
    $page = $wikiPage->wikiHomePage;
96
}
97
98
// if we get a naked or external prefix, try and do something useful
99
$pfx = $wikiPage->getPrefix($page);
100 View Code Duplication
if ($pfx && $pfx['defined']) {
101
    $page = $pfx['actual_page'];
102
    if ($pfx['prefix_is_external']) {
103
        header("Location: {$pfx['actual_page']}");
104
        exit;
105
    }
106
}
107
108
$pageX       = $wikiPage->getPage($page);
109
$attachments = $wikiPage->getAttachments($page);
110
$mayEdit     = $wikiPage->checkEdit();
111
112
if ($pageX) {
113
    $pageX['body']         = $wikiPage->renderPage($wikiPage->body);
114
    $pageX['author']       = $wikiPage->getUserName($wikiPage->uid);
115
    $pageX['revisiontime'] = date($wikiPage->dateFormat, $pageX['lastmodified']);
116
    $pageX['mayEdit']      = $mayEdit;
117
    $pageX['pageFound']    = true;
118
    if (!empty($highlight)) {
119
        $pageX['body'] = $wikiPage->highlightWords($highlight);
120
    }
121
} else {
122
    $pageX                 = array();
123
    $pageX['keyword']      = $page;
124
    $pageX['title']        = _MD_GWIKI_NOEDIT_NOTFOUND_TITLE;
125
    $pageX['body']         = _MD_GWIKI_NOEDIT_NOTFOUND_BODY;
126
    $pageX['author']       = '';
127
    $pageX['revisiontime'] = '';
128
    $pageX['mayEdit']      = $mayEdit;
129
    $pageX['pageFound']    = false;
130
}
131
132
$pageX['moddir']  = $dir;
133
$pageX['modpath'] = XOOPS_ROOT_PATH . '/modules/' . $dir;
134
$pageX['modurl']  = XOOPS_URL . '/modules/' . $dir;
135
if (!empty($attachments)) {
136
    $pageX['attachments'] = prepOut($attachments);
137
}
138
139
$GLOBALS['xoopsOption']['template_main'] = $wikiPage->getTemplateName(); // 'gwiki_view.tpl';
140
include XOOPS_ROOT_PATH . '/header.php';
141
142
$pageX['title'] = prepOut($pageX['title']);
143
$xoopsTpl->assign('gwiki', $pageX);
144
145
$xoTheme->addStylesheet(XOOPS_URL . '/modules/' . $dir . '/assets/css/module.css');
146 View Code Duplication
if ($pageX['pageFound']) {
147
    $xoTheme->addMeta('meta', 'keywords', htmlspecialchars($pageX['meta_keywords'], ENT_QUOTES, null, false));
148
    $xoTheme->addMeta('meta', 'description', htmlspecialchars($pageX['meta_description'], ENT_QUOTES, null, false));
149
}
150
$title = $pageX['title'];
151
$xoopsTpl->assign('xoops_pagetitle', $title);
152
153
include XOOPS_ROOT_PATH . '/footer.php';
154