PluginProbe ʕ •ᴥ•ʔ
Wordfence Security – Firewall, Malware Scan, and Login Security / 6.1.3
Wordfence Security – Firewall, Malware Scan, and Login Security v6.1.3
8.2.2 8.2.1 8.2.0 3.7.1 3.7.2 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.8.8 3.8.9 3.9.1 4.0.1 4.0.2 4.0.3 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.0.9 5.1.1 5.1.2 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.2.1 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.1 5.3.10 5.3.11 5.3.12 5.3.2 5.3.3 5.3.4 5.3.5 5.3.6 5.3.7 5.3.8 5.3.9 6.0.1 6.0.10 6.0.11 6.0.12 6.0.14 6.0.15 6.0.16 6.0.17 6.0.18 6.0.19 6.0.2 6.0.20 6.0.21 6.0.22 6.0.23 6.0.24 6.0.25 6.0.3 6.0.4 6.0.5 6.0.6 6.0.7 6.0.8 6.0.9 6.1.1 6.1.10 6.1.11 6.1.12 6.1.14 6.1.15 6.1.16 6.1.17 6.1.2 6.1.3 6.1.4 6.1.5 6.1.6 6.1.7 6.1.8 6.1.9 6.2.0 6.2.1 6.2.10 6.2.2 6.2.3 6.2.4 6.2.5 6.2.6 6.2.7 6.2.8 6.2.9 6.3.0 6.3.1 6.3.10 6.3.11 6.3.12 6.3.14 6.3.15 6.3.16 6.3.17 6.3.18 6.3.19 6.3.2 6.3.20 6.3.21 6.3.22 6.3.3 6.3.4 6.3.5 6.3.6 6.3.7 6.3.8 6.3.9 7.0.1 7.0.2 7.0.3 7.0.4 7.0.5 7.1.0 7.1.1 7.1.10 7.1.11 7.1.12 7.1.14 7.1.15 7.1.16 7.1.17 7.1.18 7.1.19 7.1.2 7.1.20 7.1.3 7.1.4 7.1.5 7.1.6 7.1.7 7.1.8 7.1.9 7.10.0 7.10.1 7.10.2 7.10.3 7.10.4 7.10.5 7.10.6 7.10.7 7.11.0 7.11.1 7.11.2 7.11.3 7.11.4 7.11.5 7.11.6 7.11.7 7.2.1 7.2.2 7.2.3 7.2.4 7.2.5 7.3.1 7.3.2 7.3.3 7.3.4 7.3.5 7.3.6 7.4.0 7.4.1 7.4.10 7.4.11 7.4.12 7.4.14 7.4.2 7.4.3 trunk 7.4.4 1.1 7.4.5 1.2 7.4.6 1.3 7.4.7 1.3.1 7.4.8 1.3.2 7.4.9 1.3.3 7.5.0 1.4.2 7.5.1 1.4.3 7.5.10 1.4.4 7.5.11 1.4.5 7.5.2 1.4.6 7.5.3 1.4.7 7.5.4 1.4.8 7.5.5 1.5.1 7.5.6 1.5.2 7.5.7 1.5.3 7.5.8 1.5.4 7.5.9 1.5.5 7.6.0 1.5.6 7.6.1 2.0.1 7.6.2 2.0.2 7.7.0 2.0.3 7.7.1 2.0.5 7.8.0 2.0.6 7.8.1 2.0.7 7.8.2 2.1.0 7.9.0 2.1.1 7.9.1 2.1.2 7.9.2 2.1.3 7.9.3 2.1.4 8.0.0 2.1.5 8.0.1 3.0.2 8.0.2 3.0.3 8.0.3 3.0.4 8.0.4 3.0.5 8.0.5 3.0.6 8.1.0 3.0.7 8.1.1 3.0.8 8.1.2 3.0.9 8.1.3 3.1.0 8.1.4 3.1.1 v1.4.1 3.1.2 3.1.4 3.1.6 3.2.1 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.1 3.4.4 3.4.5 3.5.1 3.5.2 3.6.1 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.6.9
wordfence / lib / wfDiagnostic.php
wordfence / lib Last commit date
Diff 11 years ago .htaccess 14 years ago Diff.php 14 years ago GeoIP.dat 10 years ago IPTraf.php 11 years ago compat.php 10 years ago conntest.php 11 years ago cronview.php 10 years ago dashboard.php 10 years ago dbview.php 11 years ago diffResult.php 11 years ago email_genericAlert.php 10 years ago email_newIssues.php 10 years ago email_passwdChanged.php 10 years ago email_pleaseChangePasswd.php 10 years ago email_unlockRequest.php 11 years ago menuHeader.php 12 years ago menu_activity.php 10 years ago menu_blockedIPs.php 10 years ago menu_countryBlocking.php 10 years ago menu_diagnostic.php 10 years ago menu_options.php 10 years ago menu_passwd.php 10 years ago menu_rangeBlocking.php 10 years ago menu_scan.php 10 years ago menu_scanSchedule.php 10 years ago menu_sitePerf.php 11 years ago menu_sitePerfStats.php 11 years ago menu_twoFactor.php 10 years ago menu_waf.php 10 years ago menu_whois.php 11 years ago pageTitle.php 11 years ago schedWeekEntry.php 12 years ago sysinfo.php 10 years ago unknownFiles.php 11 years ago viewFullActivityLog.php 10 years ago wf503.php 10 years ago wfAPI.php 10 years ago wfAction.php 14 years ago wfActivityReport.php 10 years ago wfArray.php 13 years ago wfBrowscap.php 12 years ago wfBrowscapCache.php 10 years ago wfBulkCountries.php 13 years ago wfCache.php 10 years ago wfConfig.php 10 years ago wfCountryMap.php 13 years ago wfCrawl.php 10 years ago wfCrypt.php 11 years ago wfDB.php 10 years ago wfDiagnostic.php 10 years ago wfDict.php 14 years ago wfDirectoryIterator.php 11 years ago wfGeoIP.php 10 years ago wfHelperBin.php 11 years ago wfHelperString.php 11 years ago wfIPWhitelist.php 10 years ago wfIssues.php 10 years ago wfLockedOut.php 13 years ago wfLog.php 10 years ago wfRate.php 14 years ago wfScan.php 11 years ago wfScanEngine.php 10 years ago wfSchema.php 10 years ago wfUnlockMsg.php 11 years ago wfUpdateCheck.php 11 years ago wfUtils.php 10 years ago wfView.php 10 years ago wfViewResult.php 11 years ago wordfenceClass.php 10 years ago wordfenceConstants.php 10 years ago wordfenceHash.php 10 years ago wordfenceScanner.php 10 years ago wordfenceURLHoover.php 11 years ago
wfDiagnostic.php
246 lines
1 <?php
2
3 class wfGrant
4 {
5 public $select = false;
6 public $update = false;
7 public $insert = false;
8 public $delete = false;
9 public $alter = false;
10 public $create = false;
11 public $drop = false;
12
13 public static function get()
14 {
15 static $instance;
16 if ($instance === null) {
17 $instance = new self;
18 }
19 return $instance;
20 }
21
22 private function __construct()
23 {
24 global $wpdb;
25 $rows = $wpdb->get_results("SHOW GRANTS FOR current_user()", ARRAY_N);
26
27 foreach ($rows as $row) {
28 preg_match("/GRANT (.+) ON (.+) TO/", $row[0], $matches);
29 foreach (explode(",", $matches[1]) as $permission) {
30 $permission = str_replace(" ", "_", trim(strtolower($permission)));
31 if ($permission === 'all_privileges') {
32 foreach ($this as $key => $value) {
33 $this->$key = true;
34 }
35 break 2;
36 }
37 $this->$permission = true;
38 }
39 }
40 }
41 }
42
43 class wfDiagnostic
44 {
45 protected $minVersion = array(
46 'PHP' => '5.2.4',
47 'cURL' => '1.0',
48 );
49
50 protected $description = array(
51 'Filesystem' => array(
52 'isTmpReadable' => 'Checking if web server can read from <code>~/plugins/wordfence/tmp</code>',
53 'isTmpWritable' => 'Checking if web server can write to <code>~/plugins/wordfence/tmp</code>',
54 'testWfCache' => 'Checking if web server can write to <code>~/wp-content/wfcache</code>',
55 ),
56 'MySQL' => array(
57 'userCanDelete' => 'Checking if MySQL user has <code>DELETE</code> privilege',
58 'userCanInsert' => 'Checking if MySQL user has <code>INSERT</code> privilege',
59 'userCanSelect' => 'Checking if MySQL user has <code>SELECT</code> privilege',
60 'userCanCreate' => 'Checking if MySQL user has <code>CREATE TABLE</code> privilege',
61 'userCanAlter' => 'Checking if MySQL user has <code>ALTER TABLE</code> privilege',
62 'userCanDrop' => 'Checking if MySQL user has <code>DROP</code> privilege',
63 'userCanTruncate' => 'Checking if MySQL user has <code>TRUNCATE</code> privilege',
64 ),
65 'PHP' => array(
66 'phpVersion' => 'PHP version >= PHP 5.2.4<br><em> (<a href="https://wordpress.org/about/requirements/" target="_blank">Minimum version required by WordPress</a>)</em>',
67 'hasOpenSSL' => 'Checking for OpenSSL support',
68 'hasCurl' => 'Checking for cURL support',
69 ),
70 'Connectivity' => array(
71 'connectToServer1' => 'Connecting to Wordfence servers (http)',
72 'connectToServer2' => 'Connecting to Wordfence servers (https)',
73 ),
74 // 'Configuration' => array(
75 // 'howGetIPs' => 'How does get IPs',
76 // ),
77 );
78
79 protected $results = array();
80
81 public function __construct()
82 {
83 foreach ($this->description as $title => $tests) {
84 $this->results[$title] = array();
85 foreach ($tests as $name => $description) {
86 $result = $this->$name();
87
88 if (is_bool($result)) {
89 $result = array(
90 'test' => $result,
91 'message' => $result ? 'OK' : 'FAIL',
92 );
93 }
94
95 $result['label'] = $description;
96
97 $this->results[$title][] = $result;
98 }
99 }
100 }
101
102 public function getResults()
103 {
104 return $this->results;
105 }
106
107 public function isTmpReadable() {
108 return is_readable(WORDFENCE_PATH . 'tmp');
109 }
110
111 public function isTmpWritable() {
112 return is_writable(WORDFENCE_PATH . 'tmp');
113 }
114
115 public function userCanInsert() {
116 return wfGrant::get()->insert;
117 }
118
119 public function testWfCache() {
120 $result = wfCache::cacheDirectoryTest();
121 return array(
122 'test' => $result === false,
123 'message' => is_string($result) ? $result : 'OK'
124 );
125 }
126
127 public function userCanDelete() {
128 return wfGrant::get()->delete;
129 }
130
131 public function userCanSelect() {
132 return wfGrant::get()->select;
133 }
134
135 public function userCanCreate() {
136 return wfGrant::get()->create;
137 }
138
139 public function userCanDrop() {
140 return wfGrant::get()->drop;
141 }
142
143 public function userCanTruncate() {
144 return wfGrant::get()->drop && wfGrant::get()->delete;
145 }
146
147 public function userCanAlter() {
148 return wfGrant::get()->alter;
149 }
150
151 public function phpVersion()
152 {
153 return array(
154 'test' => version_compare(phpversion(), $this->minVersion['PHP'], '>='),
155 'message' => phpversion(),
156 );
157 }
158
159 public function hasOpenSSL() {
160 return is_callable('openssl_open');
161 }
162
163 public function hasCurl() {
164 if (!is_callable('curl_version')) {
165 return false;
166 }
167 $version = curl_version();
168 return array(
169 'test' => version_compare($version['version'], $this->minVersion['cURL'], '>='),
170 'message' => $version['version'],
171 );
172 }
173
174 public function connectToServer1() {
175 return $this->_connectToServer('http');
176 }
177
178 public function connectToServer2() {
179 return $this->_connectToServer('https');
180 }
181
182 public function _connectToServer($protocol) {
183 $cronURL = admin_url('admin-ajax.php');
184 $cronURL = preg_replace('/^(https?:\/\/)/i', '://noc1.wordfence.com/scanptest/', $cronURL);
185 $cronURL .= '?action=wordfence_doScan&isFork=0&cronKey=47e9d1fa6a675b5999999333';
186 $cronURL = $protocol . $cronURL;
187 $result = wp_remote_post($cronURL, array(
188 'timeout' => 10, //Must be less than max execution time or more than 2 HTTP children will be occupied by scan
189 'blocking' => true, //Non-blocking seems to block anyway, so we use blocking
190 // This causes cURL to throw errors in some versions since WordPress uses its own certificate bundle ('CA certificate set, but certificate verification is disabled')
191 // 'sslverify' => false,
192 'headers' => array()
193 ));
194 if( (! is_wp_error($result)) && $result['response']['code'] == 200 && strpos($result['body'], "scanptestok") !== false){
195 return true;
196 }
197
198 ob_start();
199 if(is_wp_error($result)){
200 echo "wp_remote_post() test to noc1.wordfence.com failed! Response was: " . $result->get_error_message() . "<br />\n";
201 } else {
202 echo "wp_remote_post() test to noc1.wordfence.com failed! Response was: " . $result['response']['code'] . " " . $result['response']['message'] . "<br />\n";
203 echo "This likely means that your hosting provider is blocking requests to noc1.wordfence.com or has set up a proxy that is not behaving itself.<br />\n";
204 echo "This additional info may help you diagnose the issue. The response headers we received were:<br />\n";
205 foreach($result['headers'] as $key => $value){
206 echo "$key => $value<br />\n";
207 }
208 }
209
210 return array(
211 'test' => false,
212 'message' => ob_get_clean()
213 );
214 }
215
216 public function howGetIPs()
217 {
218 $howGet = wfConfig::get('howGetIPs', false);
219 if ($howGet) {
220 if (empty($_SERVER[$howGet])) {
221 return array(
222 'test' => false,
223 'message' => 'We cannot read $_SERVER[' . $howGet . ']',
224 );
225 }
226 return array(
227 'test' => true,
228 'message' => $howGet,
229 );
230 }
231 foreach (array('HTTP_CF_CONNECTING_IP', 'HTTP_X_REAL_IP', 'HTTP_X_FORWARDED_FOR') as $test) {
232 if (!empty($_SERVER[$test])) {
233 return array(
234 'test' => false,
235 'message' => 'Should be: ' . $test
236 );
237 }
238 }
239 return array(
240 'test' => true,
241 'message' => 'REMOTE_ADDR',
242 );
243 }
244 }
245
246