This is a part 2 of the guide WPSCAN and quick wordpress security. It guides reader on how to fix Directory listing in Wordpress. Read part 1 here WPSCAN and quick wordpress security โ Part 1
Table of Contents
Run WPSCAN
WPSCAN shows I have Directory listing enabled.
root@kali:~# wpscan --url www.blackmoreops.com _______________________________________________________________ ย ย ย ย ย ย ย __ย ย ย ย ย ย ย ย ย _______ย ย _____ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย \ \ย ย ย ย ย ย ย / /ย __ \ / ____|ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย \ \ย /\ย / /| |__) | (___ย ย ___ย __ _ _ __ ย ย ย ย ย ย ย ย ย ย \ \/ย \/ / |ย ___/ \___ \ / __|/ _` | '_ \ ย ย ย ย ย ย ย ย ย ย \ย /\ย /ย | |ย ย ย ย ____) | (__| (_| | | | | ย ย ย ย ย ย ย ย ย ย ย \/ย \/ย ย |_|ย ย ย |_____/ \___|\__,_|_| |_| ย ย ย ย ย ย ย WordPress Security Scanner by the WPScan Team ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย Version v2.2 ย ย ย ย Sponsored by the RandomStorm Open Source Initiative ย @_WPScan_, @ethicalpentest3r, @erwan_lr, @gbrindisi, @_FireFart_ _______________________________________________________________ | URL: http://www.blackmoreops.com/ | Started: Sun Nov 24 14:53:26 2013 [+] robots.txt available under: 'http://www.blackmoreops.com/robots.txt' [!] The WordPress 'http://www.blackmoreops.com/readme.html' file exists [+] Interesting header: SERVER: LiteSpeed [+] Interesting header: X-POWERED-BY: PHP/5.3.25 [+] Interesting header: X-W3TC-MINIFY: On [+] XML-RPC Interface available under: http://www.blackmoreops.com/xmlrpc.php [+] WordPress version 3.7.1 identified from meta generator [+] Enumerating plugins from passive detection ... ย |ย 2 plugins found: ย | Name: google-analyticator ย | Location: http://www.blackmoreops.com/wp-content/plugins/google-analyticator/ ย | Directory listing enabled: Yes ย | Name: jetpack ย | Location: http://www.blackmoreops.com/wp-content/plugins/jetpack/ ย | Directory listing enabled: Yes [+] Finished: Sun Nov 24 14:54:50 2013 [+] Memory used: 2.742 MB [+] Elapsed time: 00:01:23 Exiting! root@kali:~#
So how to fix this?
Fixing Directory Listing:
Option 1:
This is the easiest method of all. Add the following line to the .htaccess
file that lives at rootโฆ
Options -Indexes
This will automatically turn off indexing for ALL folders/subfolders
sitewide. If you add that line to a .htaccess
file in wp-contents it will disable indexing not only for that folder but for the folders below it and so forth.
Options 2:
Add the following line to the .htaccess
file that lives at rootโฆ
IndexIgnore *
The *
matches all files in the directory. What is the difference between the two? Method b allows you to restrict only a subset of files from being viewed. For example, letโs say for some reason you want the directory content to be viewable but block image files. You would do thisโฆ
IndexIgnore *.gif *.png *.jpg
Thats should do it.
Letโs put it to the test..
Testing:
Do another wpscan
root@kali:~# root@kali:~# wpscan --url www.blackmoreops.com _______________________________________________________________ __ย ย ย ย ย ย ย ย ย _______ย ย _____ \ \ย ย ย ย ย ย ย / /ย __ \ / ____| \ \ย /\ย / /| |__) | (___ย ย ___ย __ _ _ __ \ \/ย \/ / |ย ___/ \___ \ / __|/ _` | '_ \ \ย /\ย /ย | |ย ย ย ย ____) | (__| (_| | | | | \/ย \/ย ย |_|ย ย ย |_____/ \___|\__,_|_| |_| WordPress Security Scanner by the WPScan Team Version v2.2 Sponsored by the RandomStorm Open Source Initiative @_WPScan_, @ethicalpentest3r, @erwan_lr, @gbrindisi, @_FireFart_ _______________________________________________________________ | URL: http://www.blackmoreops.com/ | Started: Sun Nov 24 15:19:30 2013 [+] robots.txt available under: 'http://www.blackmoreops.com/robots.txt' [!] The WordPress 'http://www.blackmoreops.com/readme.html' file exists [+] Interesting header: SERVER: LiteSpeed [+] Interesting header: X-POWERED-BY: PHP/5.3.25 [+] Interesting header: X-W3TC-MINIFY: On [+] XML-RPC Interface available under: http://www.blackmoreops.com/xmlrpc.php [+] WordPress version 3.7.1 identified from meta generator [+] Enumerating plugins from passive detection ... |ย 2 plugins found: | Name: google-analyticator | Location: http://www.blackmoreops.com/wp-content/plugins/google-analyticator/ | Name: jetpack | Location: http://www.blackmoreops.com/wp-content/plugins/jetpack/ [+] Finished: Sun Nov 24 15:21:18 2013 [+] Memory used: 2.734 MB [+] Elapsed time: 00:01:47 Exiting! root@kali:~#
Nice, worked like a charm, no more Directory listing enabled warning. Donโt forget to read part of this guide WPSCAN and quick wordpress security โ Part 1.