rapid7 / metasploit-framework

Metasploit Framework
https://www.metasploit.com/
Other
34.29k stars 14.01k forks source link

NoMethodError undefined method add_static' error in native_spoofer Module #19591

Open AhmadShykh opened 1 month ago

AhmadShykh commented 1 month ago

Steps to reproduce

How'd you do it?

  1. Running this on kali-linux-2024.3-virtualbox-amd64
  2. Write sudo msfconsole on terminal
  3. Do search native_spoof
  4. Then use 0
  5. Then set the STATIC_ENTRIES accordingly set STATIC_ENTRIES 1.2.3.4 example.com
  6. then write run and press enter

Expected behavior

[*] Auxiliary module running as background job 2.

Current behavior

msf6 auxiliary(spoof/dns/native_spoofer) > run [] Auxiliary module running as background job 3. msf6 auxiliary(spoof/dns/native_spoofer) > [-] Auxiliary failed: NoMethodError undefined method add_static' for #<Rex::Proto::DNS::Cache:0x00007f1b1afb7c00 @records={}, @lock=#, @monitor_thread=#<Thread:0x00007f1b1afb55b8 /usr/share/metasploit-framework/lib/msf/core/thread_manager.rb:98 run>> [-] Call stack: [-] /usr/share/metasploit-framework/lib/msf/core/exploit/remote/dns/server.rb:59:in block (2 levels) in add_static_hosts' [-] /usr/share/metasploit-framework/lib/msf/core/exploit/remote/dns/server.rb:57:in each' [-] /usr/share/metasploit-framework/lib/msf/core/exploit/remote/dns/server.rb:57:in block in add_static_hosts' [-] /usr/share/metasploit-framework/lib/msf/core/exploit/remote/dns/server.rb:54:in each' [-] /usr/share/metasploit-framework/lib/msf/core/exploit/remote/dns/server.rb:54:in add_static_hosts' [-] /usr/share/metasploit-framework/lib/msf/core/exploit/remote/dns/server.rb:125:in start_service' [-] /usr/share/metasploit-framework/modules/auxiliary/spoof/dns/native_spoofer.rb:60:in run' [] Server stopped.

Metasploit version

Gmsf6 > version Framework: 6.4.34-dev- Console : 6.4.34-dev-

Module/Datastore

The following global/module datastore, and database setup was configured before the issue occurred:

Collapse ``` [framework/core] loglevel=3 [framework/ui/console] ActiveModule=auxiliary/spoof/dns/native_spoofer [spoof/dns/native_spoofer] STATIC_ENTRIES=1.2.3.4 example.com WORKSPACE= VERBOSE=false INTERFACE= FILTER=dst port 53 SNAPLEN=65535 TIMEOUT=500 SECRET=1297303073 GATEWAY_PROBE_HOST=8.8.8.8 GATEWAY_PROBE_PORT= RPORT=53 CPORT= CHOST= SSL=false SSLServerNameIndication= SSLVersion=Auto SSLVerifyMode=PEER SSLCipher= Proxies= ConnectTimeout=10 TCP::max_send_size=0 TCP::send_delay=0 DOMAIN= NS= SEARCHLIST= THREADS=1 DnsClientDefaultNS=8.8.8.8 8.8.4.4 DnsClientRetry=2 DnsClientRetryInterval=2 DnsClientReportARecords=true DnsClientRVLExistingOnly=true DnsClientTcpDns=false DnsClientResolvconf=/dev/null SRVHOST=127.0.2.2 SRVPORT=53 ListenerBindAddress= ListenerBindPort= ListenerComm= DISABLE_RESOLVER=false DISABLE_NS_CACHE=false DnsServerUdp=true DnsServerTcp=false ```

Database Configuration

The database contains the following information:

Collapse ``` Session Type: Connected to msf. Connection type: postgresql. ``` | ID | Hosts | Vulnerabilities | Notes | Services | |-:|-:|-:|-:|-:| | 1 **(Current)** | 0 | 0 | 0 | 0 | | **Total (1)** | **0** | **0** | **0** | **0** |

Framework Configuration

The features are configured as follows:

Collapse | name | enabled | |-:|-:| | wrapped_tables | true | | fully_interactive_shells | false | | manager_commands | false | | datastore_fallbacks | true | | metasploit_payload_warnings | true | | defer_module_loads | false | | smb_session_type | true | | postgresql_session_type | true | | mysql_session_type | true | | mssql_session_type | true | | ldap_session_type | false | | show_successful_logins | false | | dns | true | | hierarchical_search_table | true |

History

The following commands were ran during the session and before this issue occurred:

Collapse ``` 67 version 68 set loglevel 3 69 search native_spoof 70 use 0 71 set STATIC_ENTRIES 1.2.3.4 example.com 72 run 73 debug ```

Framework Errors

The following framework errors occurred before the issue occurred:

Collapse ``` [10/26/2024 07:44:23] [e(0)] core: Auxiliary failed - NoMethodError undefined method `split' for nil:NilClass [10/26/2024 08:04:56] [e(0)] core: Auxiliary failed - NoMethodError undefined method `split' for nil:NilClass [10/26/2024 08:11:06] [e(0)] core: Auxiliary failed - NoMethodError undefined method `split' for nil:NilClass [10/26/2024 08:12:56] [e(0)] core: Auxiliary failed - NoMethodError undefined method `split' for nil:NilClass [10/26/2024 08:13:14] [e(0)] core: Auxiliary failed - RuntimeError eth0: You don't have permission to perform this capture on that device (socket: Operation not permitted) [10/26/2024 08:13:51] [e(0)] core: Auxiliary failed - RuntimeError eth0: You don't have permission to perform this capture on that device (socket: Operation not permitted) [10/26/2024 08:33:04] [e(0)] core: Failed to connect to the database: No database YAML file [10/26/2024 08:33:15] [e(0)] core: Failed to connect to the database: No database YAML file [10/26/2024 13:31:59] [e(0)] core: Auxiliary failed - RuntimeError eth0: You don't have permission to capture on that device (socket: Operation not permitted) [10/26/2024 15:57:53] [e(0)] core: Auxiliary failed - NoMethodError undefined method `add_static' for #, @monitor_thread=#> Call stack: /opt/metasploit-framework/embedded/framework/lib/msf/core/exploit/remote/dns/server.rb:59:in `block (2 levels) in add_static_hosts' /opt/metasploit-framework/embedded/framework/lib/msf/core/exploit/remote/dns/server.rb:57:in `each' /opt/metasploit-framework/embedded/framework/lib/msf/core/exploit/remote/dns/server.rb:57:in `block in add_static_hosts' /opt/metasploit-framework/embedded/framework/lib/msf/core/exploit/remote/dns/server.rb:54:in `each' /opt/metasploit-framework/embedded/framework/lib/msf/core/exploit/remote/dns/server.rb:54:in `add_static_hosts' /opt/metasploit-framework/embedded/framework/lib/msf/core/exploit/remote/dns/server.rb:125:in `start_service' /opt/metasploit-framework/embedded/framework/modules/auxiliary/spoof/dns/native_spoofer.rb:60:in `run' /opt/metasploit-framework/embedded/framework/lib/msf/base/simple/auxiliary.rb:179:in `job_run_proc' /opt/metasploit-framework/embedded/framework/lib/msf/base/simple/auxiliary.rb:79:in `block in run_simple' /opt/metasploit-framework/embedded/framework/lib/rex/job.rb:49:in `block in start' /opt/metasploit-framework/embedded/framework/lib/rex/thread_factory.rb:22:in `block in spawn' /opt/metasploit-framework/embedded/framework/lib/msf/core/thread_manager.rb:105:in `block in spawn' ```

Web Service Errors

The following web service errors occurred before the issue occurred:

Collapse ``` msf-ws.log does not exist. ```

Framework Logs

The following framework logs were recorded before the issue occurred:

Collapse ``` [10/26/2024 04:37:58] [e(0)] core: Failed to connect to the database: No database YAML file [10/26/2024 04:38:07] [e(0)] core: Failed to open history file: /home/kali/.msf4/history with error: No such file or directory @ rb_sysopen - /home/kali/.msf4/history [10/26/2024 04:47:49] [e(0)] core: Failed to connect to the database: No database YAML file [10/26/2024 05:06:03] [e(0)] core: Module auxiliary/spoof/dns/dns_spoof not found, and no loading errors found. If you're using a custom module refer to our wiki: https://docs.metasploit.com/docs/using-metasploit/intermediate/running-private-modules.html [10/26/2024 05:43:45] [e(0)] core: Failed to connect to the database: No database YAML file [10/26/2024 05:47:27] [e(0)] core: Failed to connect to the database: No database YAML file [10/26/2024 07:44:23] [e(0)] core: Auxiliary failed - NoMethodError undefined method `split' for nil:NilClass [10/26/2024 08:04:56] [e(0)] core: Auxiliary failed - NoMethodError undefined method `split' for nil:NilClass [10/26/2024 08:11:06] [e(0)] core: Auxiliary failed - NoMethodError undefined method `split' for nil:NilClass [10/26/2024 08:12:56] [e(0)] core: Auxiliary failed - NoMethodError undefined method `split' for nil:NilClass [10/26/2024 08:13:14] [e(0)] core: Auxiliary failed - RuntimeError eth0: You don't have permission to perform this capture on that device (socket: Operation not permitted) [10/26/2024 08:13:51] [e(0)] core: Auxiliary failed - RuntimeError eth0: You don't have permission to perform this capture on that device (socket: Operation not permitted) [10/26/2024 08:33:04] [e(0)] core: Failed to connect to the database: No database YAML file [10/26/2024 08:33:15] [e(0)] core: Failed to connect to the database: No database YAML file [10/26/2024 13:31:59] [e(0)] core: Auxiliary failed - RuntimeError eth0: You don't have permission to capture on that device (socket: Operation not permitted) [10/26/2024 15:57:34] [i(2)] core: Reloading auxiliary module spoof/dns/native_spoofer. Ambiguous module warnings are safe to ignore [10/26/2024 15:57:53] [e(0)] core: Auxiliary failed - NoMethodError undefined method `add_static' for #, @monitor_thread=#> Call stack: /opt/metasploit-framework/embedded/framework/lib/msf/core/exploit/remote/dns/server.rb:59:in `block (2 levels) in add_static_hosts' /opt/metasploit-framework/embedded/framework/lib/msf/core/exploit/remote/dns/server.rb:57:in `each' /opt/metasploit-framework/embedded/framework/lib/msf/core/exploit/remote/dns/server.rb:57:in `block in add_static_hosts' /opt/metasploit-framework/embedded/framework/lib/msf/core/exploit/remote/dns/server.rb:54:in `each' /opt/metasploit-framework/embedded/framework/lib/msf/core/exploit/remote/dns/server.rb:54:in `add_static_hosts' /opt/metasploit-framework/embedded/framework/lib/msf/core/exploit/remote/dns/server.rb:125:in `start_service' /opt/metasploit-framework/embedded/framework/modules/auxiliary/spoof/dns/native_spoofer.rb:60:in `run' /opt/metasploit-framework/embedded/framework/lib/msf/base/simple/auxiliary.rb:179:in `job_run_proc' /opt/metasploit-framework/embedded/framework/lib/msf/base/simple/auxiliary.rb:79:in `block in run_simple' /opt/metasploit-framework/embedded/framework/lib/rex/job.rb:49:in `block in start' /opt/metasploit-framework/embedded/framework/lib/rex/thread_factory.rb:22:in `block in spawn' /opt/metasploit-framework/embedded/framework/lib/msf/core/thread_manager.rb:105:in `block in spawn' ```

Web Service Logs

The following web service logs were recorded before the issue occurred:

Collapse ``` msf-ws.log does not exist. ```

Version/Install

The versions and install method of your Metasploit setup:

Collapse ``` Framework: 6.4.34-dev- Ruby: ruby 3.2.5 (2024-07-26 revision 31d0f1a2e7) [x86_64-linux] OpenSSL: OpenSSL 1.1.1t 7 Feb 2023 Install Root: /opt/metasploit-framework/embedded/framework Session Type: Connected to msf. Connection type: postgresql. Install Method: Omnibus Installer ```
github-actions[bot] commented 3 days ago

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.