peass-ng/PEASS-ng · error · RuntimeError

PEASS local file (#{url_peass}) does not exist!

Error message

PEASS local file (#{url_peass}) does not exist!

What it means

When CUSTOM_URL does not contain http:// or https://, the module treats it as a local filesystem path and raises this error unless the file exists. It fails fast before attempting File.read on a missing path.

Source

Thrown at metasploit/peass.rb:287

    # If no URL is set, use the default one
    if datastore['CUSTOM_URL'] != ""
      url_peass = datastore['CUSTOM_URL']
    else
      url_peass = datastore['WINPEASS'].to_s.strip.downcase == 'true' ? "https://github.com/peass-ng/PEASS-ng/releases/latest/download/winPEASany_ofs.exe" : "https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas.sh"
    end
    # If URL is set, check if it is a valid URL or local file
    if url_peass.include?("http://") || url_peass.include?("https://")
      target = URI.parse url_peass
      raise 'Invalid URL' unless target.scheme =~ /https?/
      raise 'Invalid URL' if target.host.to_s.eql? ''
      
      res = fetch(target)
      peass_script = res.body

      raise "Something failed downloading PEASS script from #{url_peass}" if peass_script.length < 500

    else
      raise "PEASS local file (#{url_peass}) does not exist!" unless ::File.exist?(url_peass)        
      peass_script = File.read(url_peass)
      raise "Something falied reading PEASS script from #{url_peass}" if peass_script.length < 500
    end

    return peass_script
  end

  def aes_enc_peass(peass_script)
    # Encrypt the PEASS script with AES (CBC Mode)
    key = datastore["PASSWORD"]
    iv = OpenSSL::Cipher::Cipher.new('aes-256-cbc').random_iv
    
    c = OpenSSL::Cipher.new('aes-256-cbc').encrypt
    c.iv = iv
    c.key = key
    encrypted = c.update(peass_script) + c.final
    encrypted = [encrypted].pack('m')

View on GitHub (pinned to 53fb989abc)

Solutions

  1. Verify the path with 'ls -l /path/to/file' on the host running Metasploit and correct CUSTOM_URL
  2. Use an absolute path, not a relative one (relative paths resolve against the msfconsole working directory)
  3. Upload/copy the PEASS script to the expected location before running the module
  4. If you meant to download it, use a full http(s):// URL in CUSTOM_URL instead

Example fix

# before
set CUSTOM_URL /tmp/linpeas.sh   # file is actually elsewhere
# after
set CUSTOM_URL /opt/peass/linpeas.sh
Defensive patterns

Strategy: validation

Validate before calling

raise ArgumentError, "PEASS file #{path} does not exist" unless File.exist?(path)

Try / catch

begin
  peass_script = load_peass
rescue RuntimeError => e
  print_error(e.message)
end

Prevention

When it happens

Trigger: CUSTOM_URL is set to a relative or absolute path like '/tmp/peass.sh' that does not exist on the machine running Metasploit; typo in the filename; file was deleted or never staged; wrong path separator.

Common situations: Operator stages linpeas.sh on their attack box but sets a path valid on a different host; typo like /tmp/linpeas.sh.txt; file downloaded to a different directory; running msf from a container where the host path is not mounted.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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