Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/usr/local/bundle/gems/ffi-1.12.2/lib/ffi/library.rb:112: [BUG] Illegal instruction #47

Open
ghost opened this issue Nov 16, 2021 · 6 comments

Comments

@ghost
Copy link

ghost commented Nov 16, 2021

Hello,

i get this error when i start with "docker-compose up"


rails-app_1   | /usr/local/bundle/gems/ffi-1.12.2/lib/ffi/library.rb:112: [BUG] Illegal instruction at 0x00007f8cd9ddd385
rails-app_1   | ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux]
rails-app_1   | 
rails-app_1   | -- Control frame information -----------------------------------------------
rails-app_1   | c:0076 p:---- s:0443 e:000442 CFUNC  :open
rails-app_1   | c:0075 p:0022 s:0437 e:000436 BLOCK  /usr/local/bundle/gems/ffi-1.12.2/lib/ffi/library.rb:112 [FINISH]
rails-app_1   | c:0074 p:---- s:0428 e:000427 CFUNC  :each
rails-app_1   | c:0073 p:0113 s:0424 e:000423 BLOCK  /usr/local/bundle/gems/ffi-1.12.2/lib/ffi/library.rb:109 [FINISH]
rails-app_1   | c:0072 p:---- s:0417 e:000416 CFUNC  :map
rails-app_1   | c:0071 p:0069 s:0413 e:000412 METHOD /usr/local/bundle/gems/ffi-1.12.2/lib/ffi/library.rb:99
rails-app_1   | c:0070 p:0079 s:0406 e:000405 CLASS  /usr/local/bundle/gems/sassc-2.2.1/lib/sassc/native.rb:11
rails-app_1   | c:0069 p:0007 s:0402 e:000401 CLASS  /usr/local/bundle/gems/sassc-2.2.1/lib/sassc/native.rb:6
rails-app_1   | c:0068 p:0014 s:0399 e:000398 TOP    /usr/local/bundle/gems/sassc-2.2.1/lib/sassc/native.rb:5 [FINISH]
rails-app_1   | c:0067 p:---- s:0396 e:000395 CFUNC  :require

....
Could it be the same cause like here?
#sass/sassc-ruby#146

i use it on my Kali test machine

br
ckz666

@CanciuCostin
Copy link
Owner

Seems like the same error, although I'm not able to reproduce it.

Can you try to add the workaround from sass/sassc-ruby#146?
Add this under rails-app -> environment in docker-compose.yaml:

LD_LIBRARY_PATH: /lib64

Meanwhile I will also try to run it on Kali.

@ghost
Copy link
Author

ghost commented Nov 16, 2021

ok, i will recreate the dockerfile locally and try the fix

gem install sassc -- --disable-march-tune-native

@CanciuCostin
Copy link
Owner

CanciuCostin commented Nov 16, 2021 via email

@ghost
Copy link
Author

ghost commented Nov 17, 2021

this is the working Dockerfile so far..

`# syntax=docker/dockerfile:1
FROM ruby:2.6.6
RUN apt-get update -y && apt-get install -y git apt-file && apt-file update && apt-get install -y nodejs npm ca-certificates docker
RUN sh -c "echo "deb http://apt.postgresql.org/pub/repos/apt/ 'lsb_release -cs'-pgdg main" >> /etc/apt/sources.list.d/pgdg.list" && apt-get update
WORKDIR /app/android-spyware
#COPY C:\Users\User\OneDrive\Desktop\PART1\Workspaces\build\android-spyware /app/android-spyware
RUN gem install sassc -- --disable-march-tune-native
RUN git clone https://github.com/CanciuCostin/android-spyware.git .
#Run wget https://raw.githubusercontent.com/CanciuCostin/android-spyware/master/Gemfile
RUN gem install bundler:2.1.4 && bundle && npm install yarn -g && yarn install --check-files
ENTRYPOINT rails s -b 0.0.0.0 -p 80`

and the docker-compose.yml with some modifications..

version: "3.7"
services:
  rails-app:
    #image: costincanciu/android-spyware:latest
    image: climax/testrail:latest
    depends_on:
      - db
      - metasploit
    ports:
      - "80:80"
    volumes:
      - ./files:/app/android-spyware/files
      - //var/run/docker.sock://var/run/docker.sock
    entrypoint: sh -c "mkdir -p /app/android-spyware/files/payloads /app/android-spyware/files/dumps/calllogs_dumps /app/android-spyware/files/dumps/contacts_dumps /app/android-spyware/files/dumps/microphone_recs /app/android-spyware/files/dumps/pictures /app/android-spyware/files/dumps/screen_snaps /app/android-spyware/files/dumps/sms_messages_dumps /app/android-spyware/files/dumps/whatsapp | rails s -b 0.0.0.0 -p 80"
    tty: true
    environment:
      ADB_HOST: gateway.docker.internal
      #MAPS_API_KEY: YOUR KEY HERE
      #LD_LIBRARY_PATH: /lib64
      ANDROIDSPYWARE_DATABASE_HOST: db
  db:
    image: costincanciu/android-spyware-db:latest
    ports:
      - "5432:5432"
    volumes:
      - db:/var/lib/postgresql/data
    environment:
      POSTGRES_HOST_AUTH_METHOD: trust
      
  metasploit:
    container_name: kali_container
    image: costincanciu/android-spyware-msf:latest
    ports:
    - "2222:2222"
    - "3333:3333"
    - "4444:4444"
    user: root
volumes:
  db:

Now the containers are starting up and also the pg "bad connection" error is gone.

@ghost
Copy link
Author

ghost commented Nov 17, 2021

After admin login, i get this error.

rails-app_1   | ActionView::Template::Error (Missing partial admin/dashboard/_map, active_admin/page/_map, active_admin/base/_map, inherited_resources/base/_map, application/_map with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :arb, :jbuilder]}. Searched in:
rails-app_1   |   * "/app/android-spyware/app/views"
rails-app_1   |   * "/usr/local/bundle/gems/devise-4.7.1/app/views"
rails-app_1   |   * "/usr/local/bundle/gems/activeadmin-2.6.1/app/views"
rails-app_1   |   * "/usr/local/bundle/gems/kaminari-core-1.2.0/app/views"
rails-app_1   |   * "/usr/local/bundle/gems/actiontext-6.0.2.1/app/views"
rails-app_1   |   * "/usr/local/bundle/gems/actionmailbox-6.0.2.1/app/views"
rails-app_1   | ):
rails-app_1   |     1: insert_tag active_admin_application.view_factory["page"]
rails-app_1   |   
rails-app_1   | app/admin/dashboard.rb:259:in `block (5 levels) in <main>'
rails-app_1   | app/admin/dashboard.rb:258:in `block (4 levels) in <main>'
rails-app_1   | app/admin/dashboard.rb:257:in `block (3 levels) in <main>'
rails-app_1   | app/admin/dashboard.rb:256:in `block (2 levels) in <main>'

maybe it's the uncommented line in the rails-app Dockerfile?

WORKDIR /app/android-spyware
#COPY C:\Users\User\OneDrive\Desktop\PART1\Workspaces\build\android-spyware /app/android-spyware

@CanciuCostin
Copy link
Owner

Yes, you need that line.
I've updated the Dockerfile, you can try (you need to have android-spyware and Dockerfile in same dir:

ADD ./android-spyware /app/android-spyware

You have to add the workaround during build. You can also try to add this in the Dockerfile before entrypoint:

RUN bundle config --local build.sassc --disable-march-tune-native

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant