DEV Community

Brisbane Web Developer
Brisbane Web Developer

Posted on • Updated on

Check vulnerabilities for WordPress in your local network with Docker and WPScan


I was having a look at tools to check the vulnerabilities for WordPress and found this one called WPScan.

I tried to test it out with its Docker Image and a WordPress website, but because the website is in my local network, WPScan could not have resolved the hostname:

Scan Aborted: The url supplied '' seems to be down (Couldn't resolve host name)
Enter fullscreen mode Exit fullscreen mode

So I created a shell script to make the container use my custom /etc/resolv.conf so that it resolves the IP Address via my own DNS Cache Server (dnsmasq) which provides the network information in my local network ( = The IP Addres for can be referred as ).

About WPScan

I think WPScan is not the tool to check if your WordPress has a malicious file. It is a tool to prevent such a situation.


  • Docker
  • Internet
  • You being enable to apply what this post says to suit to your situation


Install Docker

If you do not want to use Docker, WPScan provids the command version as well so that you can stop reading this and then go with the command instead.

Add this script to your Linux Server

  • I included some requiresments so that you cannot just run it by pasting this script.

  • This script downloads the Docker Image if your Docker does not have it. So don't freak out in case you just ran the script without understadning what it does.

  • You amend the script to suit to your situation. For instance, you may want to refer /etc/resolv.conf in your server instead.


hasDocker=$(which docker)
if [ -z "$hasDocker" ];
  echo "You must install Docker"

hasWpScan=$(docker images | egrep "^wpscanteam/wpscan")
if [ -z "$hasWpScan" ];
  echo "Downloading the image for WPScan"
  docker pull wpscanteam/wpscan

base_dir=$(dirname "${BASH_SOURCE[0]}")
if [ ! -f "$resolv" ];
  echo "Directory $base_dir must have the file \"resolv.conf\""
  echo 'Example of "resolv.conf"'
  echo '( is your DNS Cache Server having the relationships between host-ip for your private network)'
  echo '(You do not need to use this script if it is because that is the default)'
  echo "=========="
  cat <<EOT
domain local
search local

exec docker \
run \
--rm \
-it \
-v $resolv:/etc/resolv.conf:ro \
wpscanteam/wpscan \
--disable-tls-checks \
Enter fullscreen mode Exit fullscreen mode
chmod +x /somewhere/wpscan
Enter fullscreen mode Exit fullscreen mode

Add another file to your Linux Server

If your DNS Server is, you do not need to do anything in this post because the default value of nameserver is in the Docker Image.

If that is not your case and you want to keep going, create another file /somewhere/resolv.conf (It can be created with ln -s /etc/resolv.conf if that suites to your situation). /somewhere/wpscan expects this file to be in the same directory so you may want to amend the script if you do not like that.

The file needs to look like this:

domain local
search local
Enter fullscreen mode Exit fullscreen mode is the IP Address for the DNS Server you want to use. The DNS Server must be able to return the IP Address for your WordPress website like from the URL like https://my-wordpress-in-my-local-network.local/. So you change the value to suit to your situation.

Run your WordPress

If not running. In my case, it needs to be running with Docker Container so I need to run docker-compose up.

Run the script

/somewhere/wpscan \
--api-token exampleKckgfg0bkS5t5nEXAMPLE12kuIkJ5Example \
--url https://my-test-wordpress.thank-you-for-reading.local/
Enter fullscreen mode Exit fullscreen mode

Related Post

Top comments (0)