Metasploit gives out of memory error every time a command is run

5,036

Ran: ps aux --sort -rss which showed me what was causing the issue. Though it's annoying that the VM is listed as a single process, since that is accounting for over 90% of CPU usage.

Share:
5,036

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    After running search name:SSH at from the Metasploit console, the console closed itself down. Now, whenever I attempt to run even the most basic commands in Metasploit I get an out of memory error, as here:

    RHOST 95.138.166.176
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/core_ext/kernel/agnostics.rb:7:in ``': Cannot allocate memory - stty 4500:5:bf:8a3b:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0 (Errno::ENOMEM)
        from /usr/share/metasploit-framework/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/core_ext/kernel/agnostics.rb:7:in ``'
        from /usr/share/metasploit-framework/vendor/bundle/ruby/2.2.0/gems/rb-readline-r7-0.5.2.0/lib/rbreadline.rb:7069:in `block in rl_deprep_terminal'
        from /usr/share/metasploit-framework/vendor/bundle/ruby/2.2.0/gems/rb-readline-r7-0.5.2.0/lib/rbreadline.rb:6912:in `retry_if_interrupted'
        from /usr/share/metasploit-framework/vendor/bundle/ruby/2.2.0/gems/rb-readline-r7-0.5.2.0/lib/rbreadline.rb:7068:in `rl_deprep_terminal'
        from /usr/share/metasploit-framework/vendor/bundle/ruby/2.2.0/gems/rb-readline-r7-0.5.2.0/lib/rbreadline.rb:1512:in `rl_cleanup_after_signal'
        from /usr/share/metasploit-framework/lib/rex/ui/text/input/readline.rb:134:in `rescue in readline_with_output'
        from /usr/share/metasploit-framework/lib/rex/ui/text/input/readline.rb:131:in `readline_with_output'
        from /usr/share/metasploit-framework/lib/rex/ui/text/input/readline.rb:86:in `pgets'
        from /usr/share/metasploit-framework/lib/rex/ui/text/shell.rb:187:in `run'
        from /usr/share/metasploit-framework/lib/metasploit/framework/command/console.rb:48:in `start'
        from /usr/share/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in `start'
        from /usr/bin/msfconsole:48:in `<main>'
    

    free -h outputs the following:

              total        used        free      shared  buff/cache   available
    Mem:           2.0G        1.7G         42M         15M        222M        228M
    Swap:          1.3G        1.3G        164K
    

    But how do I further break this down to see exactly what it is that's using all this memory? I only have four terminal windows and a browser open at present, and closing tabs in the browser window doesn't seem to improve things any.