Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Error on "loading malleable profiles" #707

Open
1 task done
Atreus75 opened this issue Nov 17, 2023 · 1 comment
Open
1 task done

[BUG] Error on "loading malleable profiles" #707

Atreus75 opened this issue Nov 17, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Atreus75
Copy link

Atreus75 commented Nov 17, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Empire Version

5.7.3

Python Version

Python 3

Operating System

Kali Linux 2023.3

Database

MySQL

Current Behavior

I am having a weird and long error message while trying to start the Empire server on both APT and Github versions of Empire. My personal user is atreus_75 and i am already using the correct poetry enviroment:
`
┌──(empire-bc-security-fork-kzkhSqPA-py3.11)─(atreus_75㉿kali)-[~/Ferramentas/Post/Empire]

└─$ ./ps-empire server
[INFO]: Checking submodules...
[INFO]: Using mysql database.
[INFO]: Setting up database.
[INFO]: Adding default user.
[INFO]: Adding database config.
[INFO]: Generating random staging key
[INFO]: Adding default keyword obfuscation functions.
[INFO]: Adding default obfuscation config.
[INFO]: v2: Loading listener templates from: /home/atreus_75/Ferramentas/Post/Empire/empire/server/listeners/
[INFO]: v2: Loading stager templates from: /home/atreus_75/Ferramentas/Post/Empire/empire/server/stagers/
[INFO]: v2: Loading bypasses from: /home/atreus_75/Ferramentas/Post/Empire/empire/server/bypasses/
[INFO]: v2: Loading malleable profiles from: /home/atreus_75/Ferramentas/Post/Empire/empire/server/data/profiles/
Traceback (most recent call last):
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context
self.dialect.do_execute(
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute
cursor.execute(statement, parameters)
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/pymysql/cursors.py", line 153, in execute
result = self._query(query)
^^^^^^^^^^^^^^^^^^
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/pymysql/cursors.py", line 322, in _query
conn.query(q)
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/pymysql/connections.py", line 558, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/pymysql/connections.py", line 822, in _read_query_result
result.read()
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/pymysql/connections.py", line 1207, in read
self._read_result_packet(first_packet)
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/pymysql/connections.py", line 1284, in _read_result_packet
self._read_rowdata_packet()
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/pymysql/connections.py", line 1331, in _read_rowdata_packet
packet = self.connection._read_packet()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/pymysql/connections.py", line 772, in _read_packet
packet.raise_for_error()
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.DataError: (1366, "Incorrect string value: '\xEF\xBF\x82\xEF\xBE\xA0...' for column empire.profiles.data at row 1")

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

Traceback (most recent call last):
File "/home/atreus_75/Ferramentas/Post/Empire/empire.py", line 13, in
server.run(args)
File "/home/atreus_75/Ferramentas/Post/Empire/empire/server/server.py", line 177, in run
main = empire.MainMenu(args=args)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/atreus_75/Ferramentas/Post/Empire/empire/server/common/empire.py", line 79, in init
self.profilesv2 = ProfileService(self)
^^^^^^^^^^^^^^^^^^^^
File "/home/atreus_75/Ferramentas/Post/Empire/empire/server/core/profile_service.py", line 18, in init
self.load_malleable_profiles(db)
File "/home/atreus_75/Ferramentas/Post/Empire/empire/server/core/profile_service.py", line 51, in load_malleable_profiles
.first()
^^^^^^^
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/query.py", line 2748, in first
return self.limit(1)._iter().first() # type: ignore
^^^^^^^^^^^^^^^^^^^^^
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/query.py", line 2847, in _iter
result: Union[ScalarResult[_T], Result[_T]] = self.session.execute(
^^^^^^^^^^^^^^^^^^^^^
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 2308, in execute
return self._execute_internal(
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 2169, in _execute_internal
) = compile_state_cls.orm_pre_session_exec(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/context.py", line 551, in orm_pre_session_exec
session._autoflush()
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 3021, in _autoflush
raise e.with_traceback(sys.exc_info()[2])
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 3010, in _autoflush
self.flush()
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 4312, in flush
self._flush(objects)
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 4447, in _flush
with util.safe_reraise():
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/util/langhelpers.py", line 146, in exit
raise exc_value.with_traceback(exc_tb)
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 4408, in _flush
flush_context.execute()
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/unitofwork.py", line 466, in execute
rec.execute(self)
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/unitofwork.py", line 642, in execute
util.preloaded.orm_persistence.save_obj(
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/persistence.py", line 93, in save_obj
_emit_insert_statements(
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/persistence.py", line 1226, in _emit_insert_statements
result = connection.execute(
^^^^^^^^^^^^^^^^^^^
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1416, in execute
return meth(
^^^^^
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/sql/elements.py", line 516, in _execute_on_connection
return connection._execute_clauseelement(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1639, in _execute_clauseelement
ret = self._execute_context(
^^^^^^^^^^^^^^^^^^^^^^
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1848, in _execute_context
return self._exec_single_context(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1988, in _exec_single_context
self._handle_dbapi_exception(
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2343, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context
self.dialect.do_execute(
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute
cursor.execute(statement, parameters)
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/pymysql/cursors.py", line 153, in execute
result = self._query(query)
^^^^^^^^^^^^^^^^^^
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/pymysql/cursors.py", line 322, in _query
conn.query(q)
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/pymysql/connections.py", line 558, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/pymysql/connections.py", line 822, in _read_query_result
result.read()
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/pymysql/connections.py", line 1207, in read
self._read_result_packet(first_packet)
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/pymysql/connections.py", line 1284, in _read_result_packet
self._read_rowdata_packet()
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/pymysql/connections.py", line 1331, in _read_rowdata_packet
packet = self.connection._read_packet()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/pymysql/connections.py", line 772, in _read_packet
packet.raise_for_error()
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "/home/atreus_75/.cache/pypoetry/virtualenvs/empire-bc-security-fork-kzkhSqPA-py3.11/lib/python3.11/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
sqlalchemy.exc.DataError: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely)
(pymysql.err.DataError) (1366, "Incorrect string value: '\xEF\xBF\x82\xEF\xBE\xA0...' for column empire.profiles.data at row 1")
[SQL: INSERT INTO profiles (id, name, file_path, category, data, created_at, updated_at) VALUES (nextval(profile_seq), %(name)s, %(file_path)s, %(category)s, %(data)s, CONVERT_TZ(CURRENT_TIMESTAMP, @@session.time_zone, '+00:00'), CONVERT_TZ(CURRENT_TIMESTAMP, @@session.time_zone, '+00:00')) RETURNING profiles.id, profiles.created_at, profiles.updated_at]
[parameters: {'name': 'wikipedia_getonly.profile', 'file_path': '/home/atreus_75/Ferramentas/Post/Empire/empire/server/data/profiles//Normal/wikipedia_getonly.profile', 'category': 'Normal', 'data': '#\n# Wikipedia\n# \n# Author: @bluscreenofjeff\n#\n\n#set https cert info\nhttps-certificate {\n set CN "*.wikipedia.org"; #Common Name\n ... (7360 characters truncated) ... print;\n }\n }\n}\n\n#change the stager server\nhttp-stager {\n server {\n header "Content-Type" "text/html";\n }\n}\n'}]
(Background on this error at: https://sqlalche.me/e/20/9h9h)
`

Expected Behavior

I want to start the Empire server.

Steps To Reproduce

Using the Github Version

  1. Use the poetry virtualenv.
  2. Install all the dependencies and libraries.
  3. Just run ./ps-empire server.
  4. Maybe spawn a message like "try using --reset before running the server" and i do this.
  5. I receive the error message.

Anything else?

image
Thanks for the support.

@Atreus75 Atreus75 added the bug Something isn't working label Nov 17, 2023
@Atreus75 Atreus75 changed the title [BUG] Error on loading listeners [BUG] Error on "loading malleable profiles" Nov 17, 2023
vinnybod added a commit that referenced this issue Dec 4, 2023
* added option to enable mysql service

* updated changelog

* Update CHANGELOG.md

Co-authored-by: Vincent Rose <[email protected]>

* fixed || true

* Update setup/install.sh

---------

Co-authored-by: Vincent Rose <[email protected]>
@Cx01N
Copy link

Cx01N commented Jan 25, 2024

This issue should be addressed in the most recent release, let us know if it still happens on your end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants