XenForo 2.2.17 tam versiya
XenForo 2.2.17 təhlükəsizlik yeniləməsi yayımlandı.
XenForo, mümkün olan bir təhlükəsizlik boşluğunun qarşısını almaq məqsədilə XenForo 2.2.17 versiyasını yayımladı. Buna görə də XenForo 2.2.x istifadə edən bütün müştərilərə sistemi 2.2.17 versiyasına yeniləmələri tövsiyə olunur.
1. Yamaya (patch) manuel şəkildə tətbiq etmək
Bu halda düzəlişi tətbiq etmək, müəyyən bir faylın içində olan tək bir funksiyanın dəyişdirilməsini tələb edir. Bunun üçün src/XF/App.php faylını tapın və həmin funksiyanın başlanğıc hissəsini müəyyən edin.
PHP
1public function getDynamicRedirect($fallbackUrl = null, $useReferrer = true)Aşağıdakı funksiyanı tapın:
PHP
12 return $fallbackUrl;
}Aşağıdaki kod ilə dəyişdirin:
PHP
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152public function getDynamicRedirect($fallbackUrl = null, $useReferrer = true)
{
if ($fallbackUrl === null)
{
$fallbackUrl = $this->router()->buildLink('index');
}
$request = $this->request();
$fallbackUrl = $request->convertToAbsoluteUri($fallbackUrl);
$redirect = $request->filter('_xfRedirect', 'str');
if (!$redirect && $useReferrer)
{
$redirect = $request->getServer('HTTP_X_AJAX_REFERER')
?: $request->getReferrer();
}
if (!$redirect || !preg_match('/./su', $redirect))
{
// no redirect provided
return $fallbackUrl;
}
if (
strpos($redirect, "\n") !== false ||
strpos($redirect, "\r") !== false ||
strpos($redirect, '@') !== false
)
{
// redirect contained newlines or user/pass
return $fallbackUrl;
}
$fullRedirect = $request->convertToAbsoluteUri($redirect);
$redirectParts = @parse_url($fullRedirect);
$redirectHost = $redirectParts['host'] ?? null;
if (!$redirectHost)
{
// no redirect host
return $fallbackUrl;
}
$requestParts = @parse_url($request->getFullBasePath());
$requestHost = $requestParts['host'] ?? null;
if ($redirectHost !== $requestHost)
{
// redirect host did not match request host
return $fallbackUrl;
}
return $fullRedirect;
}2. Yamaya avtomatik olaraq tətbiq etmək
DIFF
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141Index: src/XF/App.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/XF/App.php b/src/XF/App.php
--- a/src/XF/App.php (revision 7f4538e8ad4a572dcff3e0416b56906ec84a53eb)
+++ b/src/XF/App.php (revision 5a8b3ebd97eae9bc82d4f6aac5f17012d27b0043)
@@ -2305,50 +2305,85 @@
return '__' . $hash;
}
+ /**
+ * @param string|null $fallbackUrl
+ * @param bool $useReferrer
+ *
+ * @return string
+ */
public function getDynamicRedirect($fallbackUrl = null, $useReferrer = true)
{
+ if ($fallbackUrl === null)
+ {
+ $fallbackUrl = $this->router()->buildLink('index');
+ }
+
$request = $this->request();
+ $fallbackUrl = $request->convertToAbsoluteUri($fallbackUrl);
$redirect = $request->filter('_xfRedirect', 'str');
if (!$redirect && $useReferrer)
{
- $redirect = $request->getServer('HTTP_X_AJAX_REFERER');
- if (!$redirect)
- {
- $redirect = $request->getReferrer();
- }
+ $redirect = $request->getServer('HTTP_X_AJAX_REFERER')
+ ?: $request->getReferrer();
+ }
+
+ if (!$redirect || !preg_match('/./su', $redirect))
+ {
+ // no redirect provided
+ return $fallbackUrl;
}
- if ($redirect && preg_match('/./su', $redirect))
+ if (
+ strpos($redirect, "\n") !== false ||
+ strpos($redirect, "\r") !== false ||
+ strpos($redirect, '@') !== false
+ )
{
- if (strpos($redirect, "\n") === false && strpos($redirect, "\r") === false)
- {
- $fullBasePath = $request->getFullBasePath();
+ // redirect contained newlines or user/pass
+ return $fallbackUrl;
+ }
- $fullRedirect = $request->convertToAbsoluteUri($redirect);
- $redirectParts = @parse_url($fullRedirect);
- if ($redirectParts && !empty($redirectParts['host']))
- {
- $pageParts = @parse_url($fullBasePath);
+ $fullRedirect = $request->convertToAbsoluteUri($redirect);
+ $redirectParts = @parse_url($fullRedirect);
+ $redirectHost = $redirectParts['host'] ?? null;
+ if (!$redirectHost)
+ {
+ // no redirect host
+ return $fallbackUrl;
+ }
- if ($pageParts && !empty($pageParts['host']) && $pageParts['host'] == $redirectParts['host'])
- {
- return $fullRedirect;
- }
- }
- }
- }
+ $requestParts = @parse_url($request->getFullBasePath());
+ $requestHost = $requestParts['host'] ?? null;
+ if ($redirectHost !== $requestHost)
+ {
+ // redirect host did not match request host
+ return $fallbackUrl;
+ }
+
+ return $fullRedirect;
+ }
- if ($fallbackUrl === null)
+ /**
+ * @param string $notUrl
+ * @param string|null $fallbackUrl
+ * @param bool $useReferrer
+ *
+ * @return string
+ */
+ public function getDynamicRedirectIfNot(
+ $notUrl,
+ $fallbackUrl = null,
+ $useReferrer = true
+ )
+ {
+ if ($fallbackUrl === false)
{
$fallbackUrl = $this->router()->buildLink('index');
}
- return $fallbackUrl;
- }
- public function getDynamicRedirectIfNot($notUrl, $fallbackUrl = null, $useReferrer = true)
- {
$request = $this->request();
+ $fallbackUrl = $request->convertToAbsoluteUri($fallbackUrl);
$redirect = $this->getDynamicRedirect($fallbackUrl, $useReferrer);
$notUrl = $request->convertToAbsoluteUri($notUrl);
@@ -2356,17 +2391,10 @@
if (strpos($redirect, $notUrl) === 0)
{
// the URL we can't redirect to is at the start
- if ($fallbackUrl === false)
- {
- $fallbackUrl = $this->router()->buildLink('index');
- }
+ return $fallbackUrl;
+ }
- return $request->convertToAbsoluteUri($fallbackUrl);
- }
- else
- {
- return $redirect;
- }
+ return $redirect;
}
public function applyExternalDataUrl($externalPath, $canonical = false)
2.2.17
Cari Versiya
Qiymətlər
Rəy bildirə bilmək üçün əvvəlcə bu resursu endirməlisiniz.
Hələ rəy yoxdur
Bu resursa rəy bildirən ilk şəxs olun.