Fix for BZ 213985

This commit is contained in:
John Berninger 2006-12-03 18:27:22 +00:00
commit b3452f6d8f
2 changed files with 53 additions and 1 deletions

49
wordpress-bz213985.patch Normal file
View file

@ -0,0 +1,49 @@
diff -ruN wp-204/wp-content/plugins/wp-db-backup.php wp-205/wp-content/plugins/wp-db-backup.php
--- wp-204/wp-content/plugins/wp-db-backup.php 2006-07-26 18:56:56.000000000 -0400
+++ wp-205/wp-content/plugins/wp-db-backup.php 2006-09-25 14:51:54.000000000 -0400
@@ -4,7 +4,7 @@
Plugin URI: http://www.skippy.net/blog/plugins/
Description: On-demand backup of your WordPress database.
Author: Scott Merrill
-Version: 1.7
+Version: 1.8
Author URI: http://www.skippy.net/
Much of this was modified from Mark Ghosh's One Click Backup, which
@@ -69,7 +69,8 @@
$via = isset($_GET['via']) ? $_GET['via'] : 'http';
$this->backup_file = $_GET['backup'];
-
+ $this->validate_file($this->backup_file);
+
switch($via) {
case 'smtp':
case 'email':
@@ -95,6 +96,7 @@
}
if (isset($_GET['fragment'] )) {
list($table, $segment, $filename) = explode(':', $_GET['fragment']);
+ $this->validate_file($filename);
$this->backup_fragment($table, $segment, $filename);
}
@@ -881,6 +883,18 @@
return;
} // wp_cron_db_backup
+
+ function validate_file($file) {
+ if (false !== strpos($file, '..'))
+ die(__("Cheatin' uh ?"));
+
+ if (false !== strpos($file, './'))
+ die(__("Cheatin' uh ?"));
+
+ if (':' == substr($file, 1, 1))
+ die(__("Cheatin' uh ?"));
+ }
+
}
function wpdbBackup_init() {

View file

@ -3,7 +3,7 @@ URL: http://www.wordpress.org
Name: wordpress
Version: 2.0.4
Group: Applications/Publishing
Release: 2%{?dist}
Release: 3%{?dist}
License: GPL
# Source0 with name-version does not work for web retrieval,
# latest.tar.gz does not work for build
@ -74,6 +74,9 @@ rm -rf ${RPM_BUILD_ROOT}
%dir %{_sysconfdir}/wordpress
%changelog
* Sun Dec 3 2006 John Berninger <jwb at redhat dot com> - 2.0.4-3
- Remove mysql-server dependency
* Sun Dec 3 2006 John Berninger <jwb at redhat dot com> - 2.0.4-2
- Fix wp-db-backup.php vuln in BZ 213985