View Issue Details

IDProjectCategoryView StatusLast Update
0007343Kali LinuxKali Package Bugpublic2021-10-12 13:06
Reportercohst Assigned Tosbrun  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version2021.3 
Summary0007343: After Update to version 4.1.0 or 4.1.2 Powershell Empire does not start any more
Description

After apt-get update & apt-get dist-upgrade from today Powershell Empire does not start any more, after being upgraded to version 4.1.2:

┌──(cohst@kali-linux)-[~]
└─$ sudo powershell-empire server
[sudo] password for cohst:
[*] Loading default config
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context
self.dialect.do_execute(
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 609, in do_execute
cursor.execute(statement, parameters)
sqlite3.OperationalError: no such column: agents.host_id

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/share/powershell-empire/empire.py", line 12, in <module>
server.run(args)
File "/usr/share/powershell-empire/empire/server/server.py", line 2356, in run
main = empire.MainMenu(args=args)
File "/usr/share/powershell-empire/empire/server/common/empire.py", line 91, in init
self.agents = agents.Agents(self, args=args)
File "/usr/share/powershell-empire/empire/server/common/agents.py", line 111, in init
dbAgents = self.get_agents_db()
File "/usr/share/powershell-empire/empire/server/common/agents.py", line 443, in get_agents_db
results = Session().query(models.Agent).all()
File "/usr/lib/python3/dist-packages/sqlalchemy/orm/query.py", line 3373, in all
return list(self)
File "/usr/lib/python3/dist-packages/sqlalchemy/orm/query.py", line 3535, in iter
return self._execute_and_instances(context)
File "/usr/lib/python3/dist-packages/sqlalchemy/orm/query.py", line 3560, in _execute_and_instances
result = conn.execute(querycontext.statement, self._params)
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1011, in execute
return meth(self, multiparams, params)
File "/usr/lib/python3/dist-packages/sqlalchemy/sql/elements.py", line 298, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1124, in _execute_clauseelement
ret = self._execute_context(
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1316, in _execute_context
self._handle_dbapi_exception(
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1510, in _handle_dbapiexception
util.raise
(
File "/usr/lib/python3/dist-packages/sqlalchemy/util/compat.py", line 182, in raise_
raise exception
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context
self.dialect.do_execute(
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 609, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such column: agents.host_id
[SQL: SELECT agents.id AS agents_id, agents.name AS agents_name, agents.host_id AS agents_host_id, agents.listener AS agents_listener, agents.session_id AS agents_session_id, agents.language AS agents_language, agents.language_version AS agents_language_version, agents.delay AS agents_delay, agents.jitter AS agents_jitter, agents.external_ip AS agents_external_ip, agents.internal_ip AS agents_internal_ip, agents.username AS agents_username, agents.high_integrity AS agents_high_integrity, agents.process_name AS agents_process_name, agents.process_id AS agents_process_id, agents.hostname AS agents_hostname, agents.os_details AS agents_os_details, agents.session_key AS agents_session_key, agents.nonce AS agents_nonce, agents.checkin_time AS agents_checkin_time, agents.lastseen_time AS agents_lastseen_time, agents.parent AS agents_parent, agents.children AS agents_children, agents.servers AS agents_servers, agents.profile AS agents_profile, agents.functions AS agents_functions, agents.kill_date AS agents_kill_date, agents.working_hours AS agents_working_hours, agents.lost_limit AS agents_lost_limit, agents.notes AS agents_notes, agents.architecture AS agents_architecture, agents.killed AS agents_killed, hosts_1.id AS hosts_1_id, hosts_1.name AS hosts_1_name, hosts_1.internal_ip AS hosts_1_internal_ip
FROM agents LEFT OUTER JOIN hosts AS hosts_1 ON hosts_1.id = agents.host_id]
(Background on this error at: http://sqlalche.me/e/13/e3q8)

┌──(cohst@kali-linux)-[~]
└─$

Steps To Reproduce

Update via the normal repos

Attached Files
error powershell-empire 2021.JPG (182,445 bytes)   
error powershell-empire 2021.JPG (182,445 bytes)   

Activities

arnaudr

arnaudr

2021-09-30 07:54

manager   ~0015246

Works for me on an up-to-date Kali Rolling machine:

<pre>
─$ sudo powershell-empire server
[] Loading default config
[
] Setting up database.
[] Adding default user.
[
] Adding database config.
[] Generating random staging key
[
] Adding default bypasses.
[] Adding default keyword obfuscation functions.
[
] Loading stagers from: /usr/share/powershell-empire/empire/server/stagers/
[] Loading modules from: /usr/share/powershell-empire/empire/server/modules/
[
] Loading listeners from: /usr/share/powershell-empire/empire/server/listeners/
[] Loading malleable profiles from: /usr/share/powershell-empire/empire/server/data/profiles
[
] Searching for plugins at /usr/share/powershell-empire/empire/server/plugins
[] Plugin csharpserver found.
[
] Initializing plugin...
[] Doing custom initialization...
[
] Loading Empire C# server plugin
[] Registering plugin with menu...
[
] Empire starting up...
[] Starting Empire RESTful API on 0.0.0.0:1337
[
] Starting Empire SocketIO on 0.0.0.0:5000
[] Testing APIs
[+] Empire RESTful API successfully started
[+] Empire SocketIO successfully started
[
] Cleaning up test user
Server >
</pre>

What are you versions of powershell-empire and sqlalchemy? Please run:

<pre>
dpkg -l | grep -E '(python3-sqlalchemy |powershell-empire)' | awk '{print $1 " " $2 " " $3}'
</pre>

This is what I have on my machine:

<pre>
└─$ dpkg -l | grep -E '(python3-sqlalchemy |powershell-empire)' | awk '{print $1 " " $2 " " $3}'
ii powershell-empire 4.1.3-0kali1
ii python3-sqlalchemy 1.3.22+ds1-1
</pre>

cohst

cohst

2021-09-30 18:03

reporter   ~0015255

I have completely the same versions of powershell-empire and sqlalchemy as you.... but I got the following:

┌──(cohst@kali-linux)-[~]
└─$ sudo powershell-empire server
[sudo] password for cohst:
[*] Loading default config
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context
self.dialect.do_execute(
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 609, in do_execute
cursor.execute(statement, parameters)
sqlite3.OperationalError: no such column: agents.host_id

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/share/powershell-empire/empire.py", line 12, in <module>
server.run(args)
File "/usr/share/powershell-empire/empire/server/server.py", line 2356, in run
main = empire.MainMenu(args=args)
File "/usr/share/powershell-empire/empire/server/common/empire.py", line 91, in init
self.agents = agents.Agents(self, args=args)
File "/usr/share/powershell-empire/empire/server/common/agents.py", line 111, in init
dbAgents = self.get_agents_db()
File "/usr/share/powershell-empire/empire/server/common/agents.py", line 443, in get_agents_db
results = Session().query(models.Agent).all()
File "/usr/lib/python3/dist-packages/sqlalchemy/orm/query.py", line 3373, in all
return list(self)
File "/usr/lib/python3/dist-packages/sqlalchemy/orm/query.py", line 3535, in iter
return self._execute_and_instances(context)
File "/usr/lib/python3/dist-packages/sqlalchemy/orm/query.py", line 3560, in _execute_and_instances
result = conn.execute(querycontext.statement, self._params)
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1011, in execute
return meth(self, multiparams, params)
File "/usr/lib/python3/dist-packages/sqlalchemy/sql/elements.py", line 298, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1124, in _execute_clauseelement
ret = self._execute_context(
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1316, in _execute_context
self._handle_dbapi_exception(
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1510, in _handle_dbapiexception
util.raise
(
File "/usr/lib/python3/dist-packages/sqlalchemy/util/compat.py", line 182, in raise_
raise exception
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context
self.dialect.do_execute(
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 609, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such column: agents.host_id
[SQL: SELECT agents.id AS agents_id, agents.name AS agents_name, agents.host_id AS agents_host_id, agents.listener AS agents_listener, agents.session_id AS agents_session_id, agents.language AS agents_language, agents.language_version AS agents_language_version, agents.delay AS agents_delay, agents.jitter AS agents_jitter, agents.external_ip AS agents_external_ip, agents.internal_ip AS agents_internal_ip, agents.username AS agents_username, agents.high_integrity AS agents_high_integrity, agents.process_name AS agents_process_name, agents.process_id AS agents_process_id, agents.hostname AS agents_hostname, agents.os_details AS agents_os_details, agents.session_key AS agents_session_key, agents.nonce AS agents_nonce, agents.checkin_time AS agents_checkin_time, agents.lastseen_time AS agents_lastseen_time, agents.parent AS agents_parent, agents.children AS agents_children, agents.servers AS agents_servers, agents.profile AS agents_profile, agents.functions AS agents_functions, agents.kill_date AS agents_kill_date, agents.working_hours AS agents_working_hours, agents.lost_limit AS agents_lost_limit, agents.notes AS agents_notes, agents.architecture AS agents_architecture, agents.killed AS agents_killed, hosts_1.id AS hosts_1_id, hosts_1.name AS hosts_1_name, hosts_1.internal_ip AS hosts_1_internal_ip
FROM agents LEFT OUTER JOIN hosts AS hosts_1 ON hosts_1.id = agents.host_id]
(Background on this error at: http://sqlalche.me/e/13/e3q8)

┌──(cohst@kali-linux)-[~]
└─$ dpkg -l | grep -E '(python3-sqlalchemy |powershell-empire)' | awk '{print $1 " " $2 " " $3}' 1 ⨯
ii powershell-empire 4.1.3-0kali1
ii python3-sqlalchemy 1.3.22+ds1-1

┌──(cohst@kali-linux)-[~]
└─$

sbrun

sbrun

2021-10-12 12:47

manager   ~0015282

you need to run
sudo powershell-empire server --reset

Upstream changed the sqlite3 DB structure between version 4.0 and 4.1
I didn't notice this change so I did not automate the "reset" when installing the new package version. I will fix that in the package.

sbrun

sbrun

2021-10-12 13:06

manager   ~0015283

upgrade from version 4.0 improved in version 4.1.3-0kali2

Issue History

Date Modified Username Field Change
2021-09-24 17:58 cohst New Issue
2021-09-24 17:58 cohst File Added: error powershell-empire 2021.JPG
2021-09-29 10:06 sbrun Assigned To => sbrun
2021-09-29 10:06 sbrun Status new => assigned
2021-09-30 07:54 arnaudr Note Added: 0015246
2021-09-30 18:03 cohst Note Added: 0015255
2021-10-12 12:47 sbrun Note Added: 0015282
2021-10-12 13:06 sbrun Status assigned => resolved
2021-10-12 13:06 sbrun Resolution open => fixed
2021-10-12 13:06 sbrun Note Added: 0015283