akamai-threat-research / mqtt-pwn

MQTT-PWN intends to be a one-stop-shop for IoT Broker penetration-testing and security assessment operations.
GNU General Public License v3.0
370 stars 53 forks source link

mqtt FATAL: password authentication failed for user "postgres" #11

Open tanalam opened 4 years ago

tanalam commented 4 years ago

I followed following steps: kali@kali:~ /windows/MQTT/mqtt-pwn$ export MQTTPWN_DB_HOST="127.0.0.1" kali@kali:~ /windows/MQTT/mqtt-pwn$ sudo service postgresql start [sudo] password for kali: kali@kali:~ /windows/MQTT/mqtt-pwn$ pg_lsclusters Ver Cluster Port Status Owner Data directory Log file 12 main 5432 online postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log kali@kali:~/windows/MQTT/mqtt-pwn$ sudo -u postgres psql postgres could not change directory to "/home/kali/windows/MQTT/mqtt-pwn": Permission denied psql (12.4 (Debian 12.4-1), server 12.1 (Debian 12.1-2)) Type "help" for help. postgres=# \q


kali@kali:~/windows/MQTT/mqtt-pwn$ python3.7 run.py Traceback (most recent call last): File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 3065, in connect self._state.set_connection(self._connect()) File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 3761, in _connect conn = psycopg2.connect(database=self.database, self.connect_params) File "/home/kali/.local/lib/python3.7/site-packages/psycopg2/init.py", line 127, in connect conn = _connect(dsn, connection_factory=connection_factory, kwasync) psycopg2.OperationalError: FATAL: password authentication failed for user "postgres" FATAL: password authentication failed for user "postgres"

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 3127, in execute_sql cursor = self.cursor(commit) File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 3111, in cursor self.connect() File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 3068, in connect self._initialize_connection(self._state.conn) File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 2902, in exit reraise(new_type, new_type(exc_value, *exc_args), traceback) File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 185, in reraise raise value.with_traceback(tb) File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 3065, in connect self._state.set_connection(self._connect()) File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 3761, in _connect conn = psycopg2.connect(database=self.database, self.connect_params) File "/home/kali/.local/lib/python3.7/site-packages/psycopg2/init.py", line 127, in connect conn = _connect(dsn, connection_factory=connection_factory, kwasync) peewee.OperationalError: FATAL: password authentication failed for user "postgres" FATAL: password authentication failed for user "postgres"

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "run.py", line 9, in create_all_tables(db) File "/home/kali/windows/MQTT/mqtt-pwn/mqtt_pwn/database.py", line 49, in create_all_tables create_tables(db, _all_tables) File "/home/kali/windows/MQTT/mqtt-pwn/mqtt_pwn/database.py", line 41, in create_tables db.create_tables(tables) File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 3317, in create_tables model.create_table(options) File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 6644, in create_table and cls.table_exists(): File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 6634, in table_exists return cls._schema.database.table_exists(M.table.name, M.schema) File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 3295, in table_exists return table_name in self.get_tables(schema=schema) File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 3795, in get_tables cursor = self.execute_sql(query, (schema or 'public',)) File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 3136, in execute_sql self.commit() File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 2902, in exit reraise(new_type, new_type(exc_value, exc_args), traceback) File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 185, in reraise raise value.with_traceback(tb) File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 3127, in execute_sql cursor = self.cursor(commit) File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 3111, in cursor self.connect() File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 3068, in connect self._initialize_connection(self._state.conn) File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 2902, in exit reraise(new_type, new_type(exc_value, exc_args), traceback) File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 185, in reraise raise value.with_traceback(tb) File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 3065, in connect self._state.set_connection(self._connect()) File "/home/kali/.local/lib/python3.7/site-packages/peewee.py", line 3761, in _connect conn = psycopg2.connect(database=self.database, self.connect_params) File "/home/kali/.local/lib/python3.7/site-packages/psycopg2/init.py", line 127, in connect conn = _connect(dsn, connection_factory=connection_factory, kwasync) peewee.OperationalError: FATAL: password authentication failed for user "postgres" FATAL: password authentication failed for user "postgres"**

kali@kali:~/windows/MQTT/mqtt-pwn$

rapbando commented 2 years ago

You have to change DB_PASSWORDin config.py

or set METHODto trust for local connections in /etc/postgresql/(RUNNING POSTGRESQL VERSION)/main/pg_hba.conf