Skip to content

Frequently Asked Questions

Spencer McIntyre edited this page Aug 26, 2019 · 23 revisions

I'm getting a 404 / error page on the server

If a 404 / "Page Not Found" message is being shown when a landing page is being viewed or tested this is most likely either due to the server's require_id or vhost_directories setting, or an error within the template file.

The require_id setting is enabled by default and prevents users from requesting landing pages without a valid id associated with a non-expired campaign.

The vhost_directories setting is disabled by default and changes the web root directory to be a subdirectory under the configured web_root where the subdirectory's name is a server hostname. See the wiki section on Configuring The Web Root for more information.

These issues can be verified by checking the server log for the message "WARNING denying request due to lack of a valid id". When this message is present, the issue is likely the require_id setting. If this message is not present, the issue is likely an issue with the configured web root directory.

The following options are available for fixing the lack of a valid ID:

  1. Recommended: Users can send themselves a test email utilizing the jinja HTML reference of <a href="{{ url.webserver }}">click me</a>to provide yourself and targets an ID to access the page.
  • Afterwards the visit can be deleted from the campaign from the client
  1. Users can check that the page is being served using the "Verify URL" button in the client
  2. Users can disable the require_id setting on the server and restart it

The King Phisher service will need to be restarted for the new settings to take affect.

What are the default credentials

There are no default credentials for King Phisher. The credentials that the client UI prompts for are the credentials to an account on the King Phisher server. Use an account that you would use to SSH into the server. This account must have the necessary privileges to use SSH and forward TCP ports. For example, if the King Phisher server is running on Kali, the default credentials would be the same as those of Kali (root / toor). For more information see, the page on Server Authentication.

King Phisher Client Fails To Connect

The King Phisher client will fail to connect to the server with a common error message stating "Failed To Connect To The King Phisher RPC Service" when it can not initialize an RPC connection. This is most often due to the King Phisher service not running on the server. King Phisher runs it's own server and it needs to be running in order for the client to connect.

To fix this error, please ensure that the server is properly installed and running on the target server. The King Phisher client can not use another HTTP server such as Apache or NGINX.

King Phisher Server is failing to start

To trouble shoot King Phisher server errors, start the King Phisher server with verbose logging and look for error messages that correspond to a section below.

Database authentication failure

If the King Phisher server fails to start with the a stack trace that has FATAL: password authentication failed for user "king_phisher" it is because the PostgreSQL username and password in the configuration file is incorrect. Update the server configuration file to the correct password for the database user and restart the king-phisher service.

To change the password for a PostgreSQL user please refer to the PostgreSQL Documentation.

Then edit the server_config.yml file's database: line to look something similar to.

database: postgresql://username:yourreallylongstrongpasswordhere@localhost/king_phisher

Sample journalctl -u king-phisher failure to start from incorrect database username and password.

python3[xxxx]: File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/engine/default.py", line 385, in connect
python3[xxxx]: return self.dbapi.connect(cargs, *cparams)
python3[xxxx]: File "/usr/local/lib/python3.5/dist-packages/psycopg2/init.py", line 164, in connect
python3[xxxx]: conn = _connect(dsn, connection_factory=connection_factory, async=async)
python3[xxxx]: sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) FATAL: password authentication failed for user "king_phisher"
python3[xxxx]: FATAL: password authentication failed for user "king_phisher"
systemd[1]: king-phisher.service: Daemon never wrote its PID file. Failing.
systemd[1]: Failed to start King Phisher Server.
systemd[1]: king-phisher.service: Unit entered failed state.
systemd[1]: king-phisher.service: Failed with result 'resources'.

Socket bind failure

If the King Phisher server fails to start with an error message regarding sockets then it is likely an issue with another application already running on the port that King Phisher is configured to use (this is 80 by default). Use the netstat command to identify the service that is already using the port, then stop and disable it. Once nothing is using the port, the King Phisher server should successfully bind to the configured port.

Instances where this issue occur are often due to apache running on the system.

Example socket error messages:

CRITICAL failed to bind server to address (socket error #98)
CRITICAL socket error #98 (Address already in use)

ImportError: No module named Error when starting King-Phisher

If you are getting this issue, a Python package did not install correctly with pipenv. To reinstall python packages through pipenv for King Phisher use one of the following commands from the king-phisher directory:

  • Regular: sudo ./KingPhisher --env-install
  • Verbose: sudo ./KingPhisher --env-install --env-verbose
    • Added in v1.15

How do I generate verbose logging output

Both the client and the server will log output to the console when started from the command line with the "-L DEBUG" flag. When starting the server, it is also recommended to specify the "-f" flag to keep the process in the foreground. It is also important that no other instance of the King Phisher server are running, if they are the new instance will fail to start. Stop other instances with sudo systemctl stop king-phisher before starting a new instance from the command line.

Starting the King Phisher server with debugging output: sudo ./KingPhisherServer -f -L DEBUG server_config.yml

Starting the King Phisher client with debugging output: ./KingPhisher -L DEBUG