king-phisher: Unable to login to client

Issue Description

Unable to login to KingPhisher: Login failed: An unknown error occurred.

Reproduction Steps

  1. Start King Phisher
  2. Do something to trigger the crash

Environment Details

Host OS: Kali 2018.4 KingPhisher Version: 1.11.0

Error Details / Stack Trace

DEBUG    king phisher version: 1.11.0 python version: 3.6.6
INFO     listening on 0.0.0.0:80
INFO     serving files has been enabled
INFO     initializing database connection with driver postgresql
DEBUG    postgresql-setup was not found
INFO     postgresql service is not running, starting it now via systemctl
polux@kali ~> DEBUG    postgresql service successfully started via systemctl
polux@kali ~> sysDEBUG    current database schema version: 8 (latest)
DEBUG    connected to postgresql database: king_phisher
INFO     restored 0 valid sessions and skipped 0 expired sessions from the database
DEBUG    use pam service 'sshd' for authentication
DEBUG    forked an authenticating process with pid: 2339
INFO     the job manager has been started
INFO     adding new job with id: 63d3746f-2680-4710-a21f-b017a1a67d1f and callback function: ping_all
DEBUG    web socket manager worker running in tid: 0x7fad990cb700
INFO     including 4 custom http headers
INFO     server running in process: 2275 main tid: 0x7fada15b6740
INFO     dropped privileges to the king-phisher account
DEBUG    executing job with id: 63d3746f-2680-4710-a21f-b017a1a67d1f and callback function: ping_all
polux@kali ~> DEBUG    executing job with id: 63d3746f-2680-4710-a21f-b017a1a67d1f and callback function: ping_all
DEBUG    127.0.0.1 tid: 0x7fad988ca700 running http request handler
DEBUG    calling RPC method rpc_version()
INFO     127.0.0.1 "RPC /version HTTP/1.1" 200 -
DEBUG    127.0.0.1 tid: 0x7fad988ca700 running http request handler
DEBUG    sent request with sequence number 0 and action 'authenticate'
DEBUG    received request with sequence number 0 and action 'authenticate'
DEBUG    pam returned code: 0 reason: 'Success' for user root after 0.05 seconds
DEBUG    sent response with sequence number 0
DEBUG    received response with sequence number 0
INFO     user root has successfully authenticated
INFO     successful login request from 127.0.0.1 for user root
INFO     127.0.0.1 "RPC /login HTTP/1.1" 200 -
DEBUG    127.0.0.1 tid: 0x7fad988ca700 running http request handler
INFO     127.0.0.1 "GET /_/ws/events/json HTTP/1.1" 101 -
INFO     web socket has been connected
DEBUG    127.0.0.1 tid: 0x7fad90966700 running http request handler
DEBUG    calling RPC method rpc_version()
INFO     127.0.0.1 "RPC /version HTTP/1.1" 200 -
DEBUG    127.0.0.1 tid: 0x7fad90966700 running http request handler
DEBUG    checking authentication for user root with cached password hash
INFO     invalidated 1 previously existing session for user 1
INFO     successful login request from 127.0.0.1 for user root
INFO     127.0.0.1 "RPC /login HTTP/1.1" 200 -
DEBUG    127.0.0.1 tid: 0x7fad90966700 running http request handler
INFO     127.0.0.1 "GET /_/ws/events/json HTTP/1.1" 101 -
INFO     web socket has been connected
DEBUG    executing job with id: 63d3746f-2680-4710-a21f-b017a1a67d1f and callback function: ping_all
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    executing job with id: 63d3746f-2680-4710-a21f-b017a1a67d1f and callback function: ping_all
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    executing job with id: 63d3746f-2680-4710-a21f-b017a1a67d1f and callback function: ping_all
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    executing job with id: 63d3746f-2680-4710-a21f-b017a1a67d1f and callback function: ping_all
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    executing job with id: 63d3746f-2680-4710-a21f-b017a1a67d1f and callback function: ping_all
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    executing job with id: 63d3746f-2680-4710-a21f-b017a1a67d1f and callback function: ping_all
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    executing job with id: 63d3746f-2680-4710-a21f-b017a1a67d1f and callback function: ping_all
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    executing job with id: 63d3746f-2680-4710-a21f-b017a1a67d1f and callback function: ping_all
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    executing job with id: 63d3746f-2680-4710-a21f-b017a1a67d1f and callback function: ping_all
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    executing job with id: 63d3746f-2680-4710-a21f-b017a1a67d1f and callback function: ping_all
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    127.0.0.1 tid: 0x7fad87fff700 running http request handler
INFO     127.0.0.1 "RPC /ping HTTP/1.1" 401 -
DEBUG    127.0.0.1 tid: 0x7fad87fff700 running http request handler
DEBUG    calling RPC method rpc_ping()
INFO     127.0.0.1 "RPC /ping HTTP/1.1" 200 -
DEBUG    executing job with id: 63d3746f-2680-4710-a21f-b017a1a67d1f and callback function: ping_all
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    executing job with id: 63d3746f-2680-4710-a21f-b017a1a67d1f and callback function: ping_all
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    127.0.0.1 tid: 0x7fad87fff700 running http request handler
DEBUG    calling RPC method rpc_version()
INFO     127.0.0.1 "RPC /version HTTP/1.1" 200 -
DEBUG    127.0.0.1 tid: 0x7fad87fff700 running http request handler
DEBUG    checking authentication for user root with cached password hash
INFO     invalidated 1 previously existing session for user 1
INFO     successful login request from 127.0.0.1 for user root
INFO     127.0.0.1 "RPC /login HTTP/1.1" 200 -
DEBUG    127.0.0.1 tid: 0x7fad87fff700 running http request handler
INFO     127.0.0.1 "GET /_/ws/events/json HTTP/1.1" 101 -
INFO     web socket has been connected
DEBUG    executing job with id: 63d3746f-2680-4710-a21f-b017a1a67d1f and callback function: ping_all
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    received message (len: 16 opcode: 0x0a fin: True)
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    processing pong (opcode: 0x0a) message
DEBUG    executing job with id: 63d3746f-2680-4710-a21f-b017a1a67d1f and callback function: ping_all

-------------------------------------------

Client log:

ERROR    failed to connect to the server event socket
ERROR    failed to connect the server event socket
ERROR    failed to connect to the server event socket
ERROR    failed to connect the server event socket
ERROR    error uid: 0538de99-0b4a-4038-b61f-27a66e4f9341 an unhandled exception was thrown
Traceback (most recent call last):
  File "/usr/share/king-phisher/king_phisher/client/client_rpc.py", line 421, in ping
    return self.call('ping')
  File "/usr/lib/python3/dist-packages/advancedhttpserver.py", line 601, in call
    raise RPCError(resp.reason, resp.status)
advancedhttpserver.RPCError: the server responded with 401 'Unauthorized'
ERROR    failed to connect to the server event socket
ERROR    failed to connect the server event socket

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 33 (3 by maintainers)

Most upvoted comments

@zeroSteiner It’s working now!

Here are some logs if it helps:

polux@kali /o/king-phisher> ./KingPhisher -v KingPhisher Version: 1.12.0 (rev: a311f02f3e39)

polux@kali /o/king-phisher> sudo ./KingPhisherServer -L DEBUG server_config.yml [sudo] password for polux: DEBUG target diretory: /opt/king-phisher INFO checking for the pipenv environment DEBUG pipenv path: ‘/usr/local/bin/pipenv’ DEBUG pipenv Pipfile: /opt/king-phisher/Pipfile Loading .env environment variables… DEBUG king phisher version: 1.12.0 (rev: a311f02f3e39) python version: 3.6.7 INFO listening on 0.0.0.0:80 INFO serving files has been enabled INFO initializing database connection with driver postgresql DEBUG postgresql-setup was not found INFO postgresql service is not running, starting it now via systemctl polux@kali /o/king-phisher> DEBUG postgresql service successfully started via systemctl DEBUG current database schema version: 8 (latest) DEBUG connected to postgresql database: king_phisher INFO restored 0 valid sessions and skipped 0 expired sessions from the database DEBUG use pam service ‘sshd’ for authentication DEBUG forked an authenticating process with pid: 2374 INFO the job manager has been started INFO adding new job with id: c6298a4e-f973-4e88-99f3-7de10c545dcc and callback function: _maintenance INFO adding new job with id: 2e0a5864-72d6-47a9-968f-174a1deea123 and callback function: ping_all DEBUG web socket manager worker running in tid: 0x7fb93398e700 INFO including 4 custom http headers INFO server running in process: 2312 main tid: 0x7fb939b84740 INFO dropped privileges to the king-phisher account DEBUG executing job with id: c6298a4e-f973-4e88-99f3-7de10c545dcc and callback function: maintenance DEBUG running periodic maintenance tasks DEBUG executing job with id: 2e0a5864-72d6-47a9-968f-174a1deea123 and callback function: ping_all DEBUG 127.0.0.1:55818 tid: 0x7fb93318d700 running http request handler DEBUG calling RPC method rpc_version() INFO 127.0.0.1 “RPC /version HTTP/1.1” 200 - DEBUG 127.0.0.1:55822 tid: 0x7fb93318d700 running http request handler DEBUG sent request with sequence number 0 and action ‘authenticate’ DEBUG received request with sequence number 0 and action ‘authenticate’ DEBUG pam returned code: 0 reason: ‘Success’ for user polux after 0.06 seconds DEBUG sent response with sequence number 0 DEBUG received response with sequence number 0 INFO user polux has successfully authenticated INFO successful login request from 127.0.0.1 for user polux INFO 127.0.0.1 “RPC /login HTTP/1.1” 200 - DEBUG 127.0.0.1:55826 tid: 0x7fb93318d700 running http request handler INFO 127.0.0.1 "GET //ws/events/json HTTP/1.1" 101 - INFO web socket has been connected DEBUG 127.0.0.1:55830 tid: 0x7fb93298c700 running http request handler INFO 127.0.0.1 “RPC /graphql HTTP/1.1” 200 - DEBUG 127.0.0.1:55834 tid: 0x7fb93298c700 running http request handler INFO 127.0.0.1 “RPC /config/get HTTP/1.1” 200 - DEBUG 127.0.0.1:55838 tid: 0x7fb93298c700 running http request handler INFO 127.0.0.1 “RPC /graphql HTTP/1.1” 200 - DEBUG executing job with id: 2e0a5864-72d6-47a9-968f-174a1deea123 and callback function: ping_all DEBUG received message (len: 16 opcode: 0x0a fin: True) DEBUG processing pong (opcode: 0x0a) message DEBUG 127.0.0.1:55842 tid: 0x7fb93298c700 running http request handler INFO 127.0.0.1 “RPC /graphql HTTP/1.1” 200 - DEBUG 127.0.0.1:55846 tid: 0x7fb93298c700 running http request handler INFO 127.0.0.1 “RPC /graphql HTTP/1.1” 200 - DEBUG 127.0.0.1:55850 tid: 0x7fb93298c700 running http request handler INFO 127.0.0.1 “RPC /graphql HTTP/1.1” 200 - DEBUG 127.0.0.1:55854 tid: 0x7fb93298c700 running http request handler DEBUG calling RPC method rpc_campaign_new(‘423’, description=None) INFO 127.0.0.1 “RPC /campaign/new HTTP/1.1” 200 - DEBUG 127.0.0.1:55858 tid: 0x7fb93298c700 running http request handler INFO 127.0.0.1 “RPC /db/table/set HTTP/1.1” 200 - DEBUG 127.0.0.1:55862 tid: 0x7fb93298c700 running http request handler DEBUG calling RPC method rpc_campaign_alerts_is_subscribed(1) INFO 127.0.0.1 “RPC /campaign/alerts/is_subscribed HTTP/1.1” 200 - DEBUG 127.0.0.1:55866 tid: 0x7fb93298c700 running http request handler INFO 127.0.0.1 “RPC /graphql HTTP/1.1” 200 - DEBUG 127.0.0.1:55870 tid: 0x7fb93298c700 running http request handler INFO 127.0.0.1 “RPC /graphql HTTP/1.1” 200 - DEBUG 127.0.0.1:55874 tid: 0x7fb93298c700 running http request handler INFO 127.0.0.1 “RPC /graphql HTTP/1.1” 200 - DEBUG 127.0.0.1:55878 tid: 0x7fb93298c700 running http request handler INFO 127.0.0.1 “RPC /graphql HTTP/1.1” 200 - DEBUG 127.0.0.1:55882 tid: 0x7fb93298c700 running http request handler INFO 127.0.0.1 “RPC /graphql HTTP/1.1” 200 - DEBUG 127.0.0.1:55886 tid: 0x7fb93298c700 running http request handler INFO 127.0.0.1 “RPC /graphql HTTP/1.1” 200 - DEBUG 127.0.0.1:55890 tid: 0x7fb93298c700 running http request handler INFO 127.0.0.1 “RPC /graphql HTTP/1.1” 200 - DEBUG 127.0.0.1:55894 tid: 0x7fb93298c700 running http request handler INFO 127.0.0.1 “RPC /graphql HTTP/1.1” 200 - DEBUG 127.0.0.1:55898 tid: 0x7fb93298c700 running http request handler INFO 127.0.0.1 “RPC /graphql HTTP/1.1” 200 - DEBUG 127.0.0.1:55902 tid: 0x7fb93298c700 running http request handler INFO 127.0.0.1 “RPC /graphql HTTP/1.1” 200 - DEBUG 127.0.0.1:55906 tid: 0x7fb93298c700 running http request handler INFO 127.0.0.1 “RPC /graphql HTTP/1.1” 200 - DEBUG 127.0.0.1:55910 tid: 0x7fb93298c700 running http request handler DEBUG calling RPC method rpc_events_subscribe(‘db-messages’, attributes=[‘id’, ‘campaign_id’], event_types=[‘deleted’, ‘inserted’, ‘updated’]) INFO 127.0.0.1 “RPC /events/subscribe HTTP/1.1” 200 - DEBUG 127.0.0.1:55914 tid: 0x7fb93298c700 running http request handler INFO 127.0.0.1 “RPC /graphql HTTP/1.1” 200 - DEBUG 127.0.0.1:55918 tid: 0x7fb93298c700 running http request handler DEBUG calling RPC method rpc_events_subscribe(‘db-visits’, attributes=[‘id’, ‘campaign_id’], event_types=[‘deleted’, ‘inserted’, ‘updated’]) INFO 127.0.0.1 “RPC /events/subscribe HTTP/1.1” 200 - DEBUG 127.0.0.1:55922 tid: 0x7fb93208b700 running http request handler DEBUG calling RPC method rpc_events_subscribe(‘db-credentials’, attributes=[‘id’, ‘campaign_id’], event_types=[‘deleted’, ‘inserted’, ‘updated’]) INFO 127.0.0.1 “RPC /events/subscribe HTTP/1.1” 200 - DEBUG 127.0.0.1:55926 tid: 0x7fb93208b700 running http request handler INFO 127.0.0.1 “RPC /graphql HTTP/1.1” 200 - DEBUG 127.0.0.1:55930 tid: 0x7fb93208b700 running http request handler INFO 127.0.0.1 “RPC /graphql HTTP/1.1” 200 -

Thank you for your help!