WordPress.org

Forums

Exploit Scanner
Hashes Generator (5 posts)

  1. mattyrob
    Member
    Posted 1 year ago #

    I was a bit bored today and given this plugin is often left a while without updated hashes when a new version of WordPress comes out I thought I'd see if I could write some PHP that parses the archive zip files and generates the hash file. This works:

    /*
    Hash file generator for WordPress Exploit Scanner
    */
    $file = 'latest.zip';
    $hashes = "<" . '?php' . "\r\n" . '$filehashes = array(' . "\r\n";
    $zip = zip_open(getcwd(). '/' . $file);
    if ( is_resource($zip) ) {
    	while ( $zip_entry = zip_read($zip) ) {
    		zip_entry_open($zip, $zip_entry, "r");
    		$file = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
    		if ( substr(zip_entry_name($zip_entry), -1, 1) !== "/" && strstr(zip_entry_name($zip_entry), 'wp-content/plugins/') === false && strstr(zip_entry_name($zip_entry), 'wp-content/themes/') === false ) {
    			list($wp, $filename) = explode('/', zip_entry_name($zip_entry), 2);
    			$hashes .= "'" .  $filename . "' => '" . md5($file) . "',\r\n";
    		}
    		zip_entry_close($zip_entry);
    	}
    	zip_close($zip);
    }
    $hashes .= ");\r\n?>";
    echo "<pre>";
    echo $hashes;
    echo "</pre>";

    http://wordpress.org/extend/plugins/exploit-scanner/

  2. mcramer
    Member
    Posted 1 year ago #

    This looks awesome. Would you be able to give some detailed instructions (for the novice) as to how to install this? I just received notification to update to WP3.6, so I'm guessing that as soon as I do that I'll be back to having 400+ false positives. By the way, have you tried this with the new WP3.6? Thanks.

  3. mattyrob
    Member
    Posted 1 year ago #

    @mcramer,

    Upload this code as a php file to your server (or better still a local machine web testing setup). Put the latest WordPress zip file in the same directory and make sure to call it latest.zip. Then load the php file into you browser. It will produce the output you'll need to save as hashes-3.6.php. I've tried it with 3.6 and it worked fine.

  4. mcramer
    Member
    Posted 1 year ago #

    @mattyrob,

    Thank you very much, however, just so you know, no novice would EVER be able to figure out those instructions.

    I copied your code into Notebook and created a file called hashesgenerator.php and uploaded that to my blog. I placed the WP ZIP in the same directors and renamed it. Your code would not run, however, so I added "<?php" as the first line and "?>" as the last line.

    Now when I go to myblog.com/hashesgenerator.php it runs but I get the error "Call to undefined function zip_open()". Turns out PHP does not enable ZIP by default (http://stackoverflow.com/a/8442610/852795) and I cannot figure out how to enable it.

    Anyway, I see that you've uploaded a copy of the WP3.6 hashes, so I'll just grab those. Thanks!

  5. mattyrob
    Member
    Posted 1 year ago #

    @mcramer,

    Thanks for the feedback - I really wouldn't expect a novice to be trying this out anyway. I just did it to see if it was possible. Turns out it was and it was reasonably easy - but there are still certain skills one must acquire before using this code. I posted it so others can use if they wish and feel able.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Exploit Scanner
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.