peass-ng/PEASS-ng · error · RuntimeError

Something falied reading PEASS script from #{url_peass}

Error message

Something falied reading PEASS script from #{url_peass}

What it means

After reading the local PEASS file, the module raises this error if the content is shorter than 500 characters, indicating the file read did not yield the real PEASS script (note the typo 'falied' in the message). This catches empty, placeholder, or wrong files.

Source

Thrown at metasploit/peass.rb:289

      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')

    return {
      "encrypted" => encrypted,

View on GitHub (pinned to 53fb989abc)

Solutions

  1. Run 'wc -c <file>' to check its size and re-download the genuine PEASS release file
  2. Verify the file content with 'head' — if it is HTML, the original download failed; fetch again from the official release
  3. Re-copy the correct linpeas.sh / winPEASany_ofs.exe to the path in CUSTOM_URL
  4. Alternatively unset CUSTOM_URL and let the module download from the official GitHub URL

Example fix

# before
set CUSTOM_URL /tmp/linpeas.sh  # 320-byte HTML error page
# after
wget https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas.sh -O /tmp/linpeas.sh
set CUSTOM_URL /tmp/linpeas.sh
Defensive patterns

Strategy: validation

Validate before calling

raise ArgumentError, 'file too small to be PEASS' if File.size(path) < 500

Try / catch

begin
  content = File.read(path)
  raise 'truncated/placeholder file' if content.length < 500
rescue StandardError => e
  print_error("Bad PEASS file: #{e.message}")
end

Prevention

When it happens

Trigger: File.exist? passes but File.read returns a tiny file: an empty stub, an HTML error page saved as linpeas.sh, a partially downloaded/truncated file, or a symlink to a nearly empty target.

Common situations: 'wget' on the attack box saved a 404 page to linpeas.sh; file was created with touch but never populated; disk full during download truncated the file; copied a link instead of the file.

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/c3d2c06b12cb0f2e. Report an issue: GitHub.