Merge branch 'thh-rce'
* thh-rce: Fix RCE vulnerability on Windows. Add missing active content check for renaming.
This commit is contained in:
@ -1,6 +1,9 @@
|
||||
Version 2.4-alpha1 ()
|
||||
------------------------------------------------------------------------
|
||||
|
||||
* Security: Fix RCE on Windows.
|
||||
Thanks to Junyu Zhang <rgdz.eye@gmail.com>!
|
||||
|
||||
* Fix: ML: Fixed filename generation when renaming and added
|
||||
some error messages on rename failures.
|
||||
|
||||
|
@ -2027,6 +2027,7 @@ function serendipity_uploadSecure($var, $strip_paths = true, $append_slash = fal
|
||||
|
||||
$var = str_replace(' ', '_', $var);
|
||||
$var = preg_replace('@[^0-9a-z\._/-]@i', '', $var);
|
||||
$var = preg_replace('@\.+$@i', '', $var); # remove trailing dots
|
||||
if ($strip_paths) {
|
||||
$var = preg_replace('@(\.+[/\\\\]+)@', '/', $var);
|
||||
}
|
||||
@ -2261,6 +2262,10 @@ function serendipity_renameFile($id, $newName, $path = null) {
|
||||
|
||||
$newPath = $imgBase . $path . $newName . (empty($File['extension']) ? '' : '.' . $File['extension']);
|
||||
|
||||
if (serendipity_isActiveFile($newName) || serendipity_isActiveFile($newPath)) {
|
||||
return sprintf('<span class="msg_error"><span class="icon-attention-circled" aria-hidden="true"></span> ' . ERROR_FILE_FORBIDDEN . "</span>\n", $newName);
|
||||
}
|
||||
|
||||
if (file_exists($newPath)) {
|
||||
return sprintf('<span class="msg_error"><span class="icon-attention-circled" aria-hidden="true"></span> ' . ERROR_FILE_EXISTS . "</span>\n", $newName);
|
||||
}
|
||||
|
Reference in New Issue
Block a user