Skip to content

Commit 3185642

Browse files
committed
Bug-fix.
Changelog excerpt: - Discovered that the image chameleon attack detection could generate false positives against Mac OS X thumbnails; Fixed.
1 parent 3773ba4 commit 3185642

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

Changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ __*Why "v3.0.0" instead of "v1.0.0?"*__ Prior to phpMussel v3, the "phpMussel Co
99
[2020.07.31; Maikuolan]: Improved the way that the (generated by ...) notice, displayed at the footer of HTML pages, is rendered.
1010

1111
[2020.08.05; Maikuolan]: Addressed a potential compatibility problem with some specific kinds of symlinked installations.
12+
13+
[2020.10.01; Bug-fix; Maikuolan]: Discovered that the image chameleon attack detection could generate false positives against Mac OS X thumbnails; Fixed. *Refer [#223](https://github.com/phpMussel/phpMussel/issues/223).*

src/Loader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* License: GNU/GPLv2
99
* @see LICENSE.txt
1010
*
11-
* This file: The loader (last modified: 2020.08.05).
11+
* This file: The loader (last modified: 2020.10.01).
1212
*/
1313

1414
namespace phpMussel\Core;
@@ -83,7 +83,7 @@ class Loader
8383
/**
8484
* @var string phpMussel version number (SemVer).
8585
*/
86-
public $ScriptVersion = '3.0.0';
86+
public $ScriptVersion = '3.0.1';
8787

8888
/**
8989
* @var string phpMussel version identifier (complete notation).
@@ -220,7 +220,7 @@ public function __construct(
220220
$VendorPath = $this->buildPath(dirname($_SERVER['DOCUMENT_ROOT'] . $_SERVER['SCRIPT_NAME']) . DIRECTORY_SEPARATOR . 'vendor', false);
221221

222222
/** Eep.. Still not working. Generate exception. */
223-
if (!is_dir($VendorPath) || !is_readable($VendorPath)) {
223+
if ($VendorPath === '' || !is_dir($VendorPath) || !is_readable($VendorPath)) {
224224
throw new \Exception('Vendor directory is undefined or unreadable.');
225225
}
226226
} else {

src/Scanner.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* License: GNU/GPLv2
99
* @see LICENSE.txt
1010
*
11-
* This file: The scanner (last modified: 2020.07.20).
11+
* This file: The scanner (last modified: 2020.10.01).
1212
*/
1313

1414
namespace phpMussel\Core;
@@ -2066,6 +2066,13 @@ private function dataHandler(string $str = '', int $Depth = 0, string $OriginalF
20662066
/** Fire event: "beforeChameleonDetections". */
20672067
$this->Loader->Events->fireEvent('beforeChameleonDetections');
20682068

2069+
/** Chameleon attack bypasses for Mac OS X thumbnails and screenshots. */
2070+
$ThumbnailBypass = (
2071+
substr($OriginalFilename, 0, 2) === '._' &&
2072+
!preg_match('~[^\x00-\x1f]~', substr($str, 0, 8)) &&
2073+
substr($str, 8, 8) === 'Mac OS X'
2074+
);
2075+
20692076
/** PHP chameleon attack detection. */
20702077
if ($this->Loader->Configuration['files']['chameleon_from_php']) {
20712078
if ($this->containsMustAssert([
@@ -2147,7 +2154,7 @@ private function dataHandler(string $str = '', int $Depth = 0, string $OriginalF
21472154
}
21482155

21492156
/** Image chameleon attack detection. */
2150-
if ($this->Loader->Configuration['files']['chameleon_to_img']) {
2157+
if (!$ThumbnailBypass && $this->Loader->Configuration['files']['chameleon_to_img']) {
21512158
$Chameleon = '';
21522159
if (
21532160
(($xt === 'bmp' || $xt === 'dib') && $twocc !== '424d') ||

0 commit comments

Comments
 (0)