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] Can't create database 'empire' #740

Open
1 task done
cmitcho opened this issue Aug 12, 2024 · 4 comments
Open
1 task done

[BUG] Can't create database 'empire' #740

cmitcho opened this issue Aug 12, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@cmitcho
Copy link

cmitcho commented Aug 12, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Empire Version

5.4.2

Python Version

3.11.9

Operating System

Kali

Database

MySQL

Current Behavior

After updating Kali today (August 12th, 2024), I received an exception when attempting to start Empire:

┌──(kali㉿kali)-[~]
└─$ sudo powershell-empire server
Create mysql database empire
ERROR 1007 (HY000) at line 1: Can't create database 'empire'; database exists

Expected Behavior

Empire should check for the empire databases, and if created, skip database creation and move on to starting Empire.

Steps To Reproduce

  1. sudo powershell-empire server
  2. See exception

Anything else?

After reviewing source code for the initial powershell-empire command, there is a referenced sql command that is required to be installed. After installing, everything works as expected:

┌──(kali㉿kali)-[~]
└─$ vi /usr/bin/powershell-empire
..
..
#!/bin/sh

set -e

# Check if running as root
if [ `id -u` -ne 0 ]; then
   echo "Error: $0 must be run as root" 1>&2
   exit 1
fi

systemctl start mysql

# Check if the MySQL database empire exists.
# If the DB does not exist, it will create the DB, the DB user and the
# user password.
if ! mysqlshow "empire" > /dev/null 2>&1; then                                         <--- This guy right here

From here, I installed mysqlshow, and was able to move forward:

┌──(kali㉿kali)-[~]
└─$ mysqlshow
Command 'mysqlshow' not found, but can be installed with:
sudo apt install mariadb-client-compat
Do you want to install it? (N/y)y
sudo apt install mariadb-client-compat
Installing:
  mariadb-client-compat

Summary:
  Upgrading: 0, Installing: 1, Removing: 0, Not Upgrading: 0
  Download size: 27.0 kB
  Space needed: 103 kB / 13.3 GB available

Get:1 http://kali.download/kali kali-rolling/main amd64 mariadb-client-compat all 1:11.4.2-4 [27.0 kB]
Fetched 27.0 kB in 0s (344 kB/s)
Selecting previously unselected package mariadb-client-compat.
(Reading database ... 154113 files and directories currently installed.)
Preparing to unpack .../mariadb-client-compat_1%3a11.4.2-4_all.deb ...
Unpacking mariadb-client-compat (1:11.4.2-4) ...
Setting up mariadb-client-compat (1:11.4.2-4) ...

┌──(kali㉿kali)-[~]
└─$ sudo mysqlshow "empire"
Database: empire
+---------------------------+
|          Tables           |
+---------------------------+
..
..
REDACTED


┌──(kali㉿kali)-[~]
└─$ sudo powershell-empire server
[INFO]: Checking submodules...
[INFO]: No .git directory found. Skipping submodule check.
[INFO]: v2: Loading listener templates from: /usr/share/powershell-empire/empire/server/listeners/

@cmitcho cmitcho added the bug Something isn't working label Aug 12, 2024
@Cx01N
Copy link

Cx01N commented Aug 12, 2024

Looks like there is an issue with Kali’s repo. Can you try the GitHub install method?

@cmitcho
Copy link
Author

cmitcho commented Aug 12, 2024

I should have mentioned, this happened today during an apt update -y && apt upgrade -y. Not a new install, this instance of Empire on Kali has been running since April. I am not sure if a new install would do this.

@cmitcho
Copy link
Author

cmitcho commented Aug 15, 2024

I tested this on a new install of Empire on Ubuntu 22.04. Anyone else coming across this should know the fix is to install the mariadb-client-compat package to resolve this problem.

spac3gh0st00 pushed a commit to spac3gh0st00/Empire that referenced this issue Sep 6, 2024
@Cx01N
Copy link

Cx01N commented Sep 9, 2024

I tested this on a new install of Empire on Ubuntu 22.04. Anyone else coming across this should know the fix is to install the mariadb-client-compat package to resolve this problem.

Thanks for the recommendation. Ill double check the install script is doing this correctly.

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

2 participants