Skip to content

Instantly share code, notes, and snippets.

@Asenar
Created July 5, 2016 15:14
Show Gist options
  • Save Asenar/b0e66f3d951c9d606d9987ffa7064989 to your computer and use it in GitHub Desktop.
Save Asenar/b0e66f3d951c9d606d9987ffa7064989 to your computer and use it in GitHub Desktop.
wordpress security hack for allowing theme/plugin/images uploads but not core upgrade (with different file owner permissions check)
commit 670110b (HEAD, virageadroite)
Author: Michaël Marinetti <[email protected]>
Date: 12 minutes ago
Add: security wp-content
diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php
index 078a369..d11c9f3 100644
--- a/wp-admin/includes/file.php
+++ b/wp-admin/includes/file.php
@@ -976,7 +976,8 @@ function get_filesystem_method( $args = array(), $context = false, $allow_relaxe
// Attempt to determine the file owner of the WordPress files, and that of newly created files
$wp_file_owner = $temp_file_owner = false;
if ( function_exists('fileowner') ) {
- $wp_file_owner = @fileowner( __FILE__ );
+ //$wp_file_owner = @fileowner( __FILE__ );
+ $wp_file_owner = @fileowner( $context ); // CHANGED FOR ALLOWING ONLY wp-content writings
$temp_file_owner = @fileowner( $temp_file_name );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment