metasploit-framework
metasploit-framework copied to clipboard
msfdb issue
I have been doing tests with the command msfdb init, reinit, delete, start, etc... and when I execute msfdb to activate the storage of the scans that I do with smfconsole in a database right after the message at the beginning "creating initial database schema" points out a bug:
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/pg-1.4.3/lib/pg/connection.rb:602: [BUG] Segmentation fault at 0x0000000000000000 ruby 3.0.4p208 (2022-04-12 revision 3fa771dded) [x86_64-linux-gnu]
Then it shows a lot of information "Control frame information" and finally an error in /usr/bin/msfdb line 67 33177 aborted bundle exec rake db:migrate > /dev/null
I've restarted the postgresql service and tried to access msfconsole, but I can't do it with a connected database, although it does allow me to access msfconsole without connecting it.
Hi!
This issue has been left open with no activity for a while now.
We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 30 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.
Hi again!
It’s been 60 days since anything happened on this issue, so we are going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error please feel free to reopen this issue or create a new one if you need anything else.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.
I am getting below error while running comment msfconsole :
msfconsole -v
Framework Version: 6.2.33-dev
====
msfconsole
/usr/share/metasploit-framework/vendor/bundle/ruby/3.1.0/gems/pg-1.4.5/lib/pg/connection.rb:626: [BUG] Segmentation fault at 0x00000000
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [i386-linux-gnu]
Can someone help here. Thanks in Advance.
Assigning this to myself to investigate, will see if we can reproduce this on our end.
Been unable to replicate this with Ruby 3.1.2 (same version you are running) and pg 1.4.5. Here is the output from my tests:
~/git/metasploit-framework │ master *1 !1 ?10 bundle list | grep -i pg ✔ │ 16s │ 3.1.2 Ruby │ 04:53:55 PM
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
* pg (1.4.5)
~/git/metasploit-framework │ master *1 !1 ?10 ruby --version ✔ │ 3.1.2 Ruby │ 04:54:03 PM
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
~/git/metasploit-framework │ master *1 !1 ?10 ./msfdb stop ✔ │ 3.1.2 Ruby │ 04:54:11 PM
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
Clearing http web data service credentials in msfconsole
Running the 'stop' command for the database:
~/git/metasploit-framework │ master *1 !1 ?10 ./msfdb reinit ✔ │ 17s │ 3.1.2 Ruby │ 04:54:35 PM
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
[?] Would you like to reinit the webservice? (Not Required) [no]: no
[?] Would you like to delete your existing data and configurations? []: yes
Clearing http web data service credentials in msfconsole
Running the 'reinit' command for the database:
MSF web service is no longer running
Deleting all data at /home/gwillcox/.msf4/db
Creating database at /home/gwillcox/.msf4/db
Starting database at /home/gwillcox/.msf4/db...success
Creating database users
Writing client authentication configuration file /home/gwillcox/.msf4/.local/etc/postgresql/14/msf/pg_hba.conf
Creating initial database schema
Database initialization successful
~/git/metasploit-framework │ master *1 !1 ?10 ./msfdb status ✔ │ 22s │ 3.1.2 Ruby │ 04:55:05 PM
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
====================================================================
Running the 'status' command for the database:
Database started
====================================================================
====================================================================
Running the 'status' command for the webservice:
MSF web service is not running: no PID file found at /home/gwillcox/.msf4/msf-ws.pid
====================================================================
~/git/metasploit-framework │ master *1 !1 ?10 ./msfconsole ✔ │ 4s │ 3.1.2 Ruby │ 04:55:17 PM
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
.,,. .
.\$$$$$L..,,==aaccaacc%#s$b. d8, d8P
d8P #$$$$$$$$$$$$$$$$$$$$$$$$$$$b. `BP d888888p
d888888P '7$$$$\""""''^^`` .7$$$|D*"'``` ?88'
d8bd8b.d8p d8888b ?88' d888b8b _.os#$|8*"` d8P ?8b 88P
88P`?P'?P d8b_,dP 88P d8P' ?88 .oaS###S*"` d8P d8888b $whi?88b 88b
d88 d8 ?8 88b 88b 88b ,88b .osS$$$$*" ?88,.d88b, d88 d8P' ?88 88P `?8b
d88' d88b 8b`?8888P'`?8b`?88P'.aS$$$$Q*"` `?88' ?88 ?88 88b d88 d88
.a#$$$$$$"` 88b d8P 88b`?8888P'
,s$$$$$$$"` 888888P' 88n _.,,,ass;:
.a$$$$$$$P` d88P' .,.ass%#S$$$$$$$$$$$$$$'
.a$###$$$P` _.,,-aqsc#SS$$$$$$$$$$$$$$$$$$$$$$$$$$'
,a$$###$$P` _.,-ass#S$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$####SSSS'
.a$$$$$$$$$$SSS$$$$$$$$$$$$$$$$$$$$$$$$$$$$SS##==--""''^^/$$$$$$'
_______________________________________________________________ ,&$$$$$$'_____
ll&&$$$$'
.;;lll&&&&'
...;;lllll&'
......;;;llll;;;....
` ......;;;;... . .
=[ metasploit v6.2.36-dev-c4d9206d9c ]
+ -- --=[ 2277 exploits - 1192 auxiliary - 408 post ]
+ -- --=[ 951 payloads - 45 encoders - 11 nops ]
+ -- --=[ 9 evasion ]
Metasploit tip: Display the Framework log using the
log command, learn more with help log
Metasploit Documentation: https://docs.metasploit.com/
msf6 > db_status
[*] Connected to msf. Connection type: postgresql.
msf6 > hosts
Hosts
=====
address mac name os_name os_flavor os_sp purpose info comments
------- --- ---- ------- --------- ----- ------- ---- --------
msf6 > version
Framework: 6.2.36-dev-c4d9206d9c
Console : 6.2.36-dev-c4d9206d9c
msf6 >
Please provide more information on steps taken in order for us to be able to replicate this issue, otherwise we will have to close this down due to being unable to reproduce the issue.
$ sudo msfdb reinit [i] Database already started [+] Dropping databases 'msf' [+] Dropping databases 'msf_test' [+] Dropping database user 'msf' [+] Deleting configuration file /usr/share/metasploit-framework/config/database.yml [+] Stopping database [+] Starting database [+] Creating database user 'msf' [+] Creating databases 'msf' [+] Creating databases 'msf_test' [+] Creating configuration file '/usr/share/metasploit-framework/config/database.yml' [+] Creating initial database schema /usr/share/metasploit-framework/vendor/bundle/ruby/3.1.0/gems/pg-1.4.5/lib/pg/connection.rb:626: [BUG] Segmentation fault at 0x0000000000000000 ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux-gnu]
This happened after running: apt-get update apt-get install metasploit-framework msfdb reinit
I've since removed ruby, postgresql, and metsploit-framework and run 'apt-get install metasploit-framework'
I get the same error when running msfconsole or trying to reinit msfdb
msfconsole -n launches without a problem.
msfdb status indicates all is well:
$ sudo msfdb status
[sudo] password for xoltar89:
● postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; preset: disabled)
Active: active (exited) since Thu 2023-02-02 14:43:39 CST; 5min ago
Process: 4999 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 4999 (code=exited, status=0/SUCCESS)
CPU: 1ms
Feb 02 14:43:39 XPS-DT1 systemd[1]: Starting PostgreSQL RDBMS... Feb 02 14:43:39 XPS-DT1 systemd[1]: Finished PostgreSQL RDBMS.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME postgres 4964 postgres 5u IPv6 39348 0t0 TCP localhost:5432 (LISTEN) postgres 4964 postgres 6u IPv4 39349 0t0 TCP localhost:5432 (LISTEN)
UID PID PPID C STIME TTY STAT TIME CMD postgres 4964 1 0 14:43 ? Ss 0:00 /usr/lib/postgresql/13/bin/postgres -D /var/lib/postgresql/13/main -c config_file=/etc/postgresql/13/main/postgresql.conf
[+] Detected configuration file (/usr/share/metasploit-framework/config/database.yml)
From within the console:
msf6 > db_status [-] No database driver installed. msf6 > db_connect [-] No database driver installed.
Hi!
This issue has been left open with no activity for a while now.
We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 30 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.
Thank you very much [xoltar89], You resolved my issue. msfconsole -n launches without a problem.
[github-actions], thanks for reminding me. Yes, please close this ticket.
Warm Regards,
Hi!
This issue has been left open with no activity for a while now.
We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 30 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.
Hi again!
It’s been 60 days since anything happened on this issue, so we are going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error please feel free to reopen this issue or create a new one if you need anything else.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.