Giter Site home page Giter Site logo

nccgroup / house Goto Github PK

View Code? Open in Web Editor NEW
1.3K 45.0 216.0 14 MB

A runtime mobile application analysis toolkit with a Web GUI, powered by Frida, written in Python.

Home Page: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/june/house-a-mobile-analysis-platform-built-on-frida/

License: MIT License

Python 33.25% JavaScript 43.18% CSS 2.95% HTML 20.62%
frida mobile pentest-tool android

house's Introduction

                  ___ ___
                 /   |   \  ____  __ __  ______ ____
                /    ~    \/  _ \|  |  \/  ___// __ \
                \    Y    (  <_> )  |  /\___ \  ___/
                 \___|_  / \____/|____//____  >\___  >
                       \/      House        \/     \/
                
                    Dynamic Mobile Analysis Tool
                    Contact: [email protected]

House: A runtime mobile application analysis toolkit with a Web GUI, powered by Frida, written in Python. It is designed for helping assess mobile applications by implementing dynamic function hooking and intercepting and intended to make Frida script writing as simple as possible.

TL;DR

git clone https://github.com/nccgroup/house
cd house
pip3 install -r requirements.txt
pip3 install pipenv
pipenv --python=/usr/bin/python3 install
pipenv --python=/usr/bin/python3 shell
python3 app.py <PORT>

# or:
mkvirtualenv --python=/usr/local/bin/python3 house
workon house
pip install -r requirements.txt
python app.py <PORT>

# or: (only for Mac OS)
git clone https://github.com/nccgroup/house
cd house
pip3 install -r requirements.txt
pip3 install pipenv
pipenv --python=/usr/local/bin/python3 install
pipenv --python=/usr/local/bin/python3 shell
python3 app.py <PORT>

By default, House binds to http://127.0.0.1:8000.

To get an overview of House capabilities, you can visit user's manual for details.

News

  • Added dynamic dex/jar hooking, House now can hook functions in dynamically loaded dex/jar files hook.gif
  • Added Mini Script option for Hooks hook.gif
  • ClassLoader Enum

Note: Make sure to update your Frida version to >= 12.8.3 for /dex/jar function hooking

Example Usage

In this section, a small example is provided to illustrate basic usage of House. The demo case is performed against a small testing android application: com.ha0k3.overloads.

Start

  • Make sure an Android device is plugged in over USB and Frida server is running on the device. Check the Frida server is successfully spawned using the following command: frida-ps -U.

  • Start the House application by running app.py : python app.py <PORT>.

  • Open a browser and navigate to http://127.0.0.1:PORT.

  • Observe the device information is displayed on the page, if not, click the Refresh button or restart the application and Frida server. start.gif

Monitor

  • Dynamically generating hook script from templates based on the config file, monitor key operations including FILEIO, IPC, etc.

monitor.png

  • It is experimental at this point, If you find more functions needed to be hooked, feel free to let me know or file a PR.

Preload & Sideload

  • House now support sideload. It supports stetho side loading at this point; which makes it easier for us to examine the UI; storage; etc. sideload_stetho.png
  • It is experimental at this point, but more functionalities such as SSLStrip will be added under this tab.

Enumeration

  • Enumerate all loaded classes: enum_load.gif
  • Enumerate all classes in the Dex file: enum_dex.gif
  • Enumerates all methods within a given class enum_method1.gif enum_method2.gif
  • History Scripts management enum_history_script.gif

Multiple Function Tracing

  • Scripts rendering and Function Tracing hook.gif

  • Hooks for functions in dynamically loaded dex/jar files hook.gif

  • Mini Script option hook.gif

  • History Scripts management hook_history_script.gif

Function intercepting

  • Via House, researchers can dynamically change the arguments being passed to the target functions and forward it. int1.gif

  • Sometimes House cannot perfectly parse argument informations. For example, an arguments can be with special type. In the example app, it implemented isLit function that takes customized object as its argument. To tackle those situations, a simple "REPL" is provided by House. Security researchers can dynamically type in Frida script in the REPL and modify the function behaviors. int2.gif

  • Several REPL functions were provided by House to make the testing easier:

    • inspectObject(obj) uses java.lang.reflect to inspect fields information within an object.
    • setRetval(ret) takes a parameter and will try to cast it to the correct return type using the original return value's constructor.
    • getStackTrace() will print the stack trace.
    • More REPL functions will be added in the future.

    int3.gif

Note: For constructor method hooking/intercept, input $init as method name.

FAQ

Prerequisite:

To make House work; you would need:

  1. A rooted android device with frida-server running plugged in your computer, use only one USB device is recommended.
  2. Local frida-python version matches frida-server's.

Cannot get device? Does not work?

Also please try to restart both the frida server and House, if still not working, please file an issue.

Time out error?

Often occues when there are multiple USB devices connected, try to restart the target application.

Frida error?

House has been tested using Frida version 12.8.6; there might be some issues with some other versions, also make sure frida-python matches frida-server's version. If still not working, try to run the generated frida scripts manually to see if it works.

Acknowledgements

Special thanks to following open-source projects for inspirations on House:

  1. Frida, the great instrumentation toolkit that making all of these possible.
  2. Objection, an inspiration and guide in building part of the Frida templating scripts of House.
  3. Inspeckage, an inspiration on the Monitor functionality of House.
  4. 0xdea/frida-scripts - a great Frida scripts arsenal.

Contact

If you have more questions about House, or want to help extending it, feel free to contact:

@haoOnBeat

Or send an email to: Hao Ke

house's People

Contributors

empty-jack avatar ga-ryo avatar h4ok3 avatar mirouse avatar mklarz avatar swarupsro 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  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  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  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  avatar  avatar  avatar  avatar  avatar  avatar

house's Issues

Classes won't load

Keep getting message "[+] Updating intercept_conf with {"classname": "", "packagename": "com.ha0k3.overloads", "methodname": "", "overloadIndex": 0}" and nothing happens.
Recorded screencap: https://streamable.com/w85wa

Server not Starting

When I run command:
python3 app.py 8000
I get the following error:
Traceback (most recent call last):
File "/Users/uh/Downloads/house/app.py", line 23, in
from houseGlobal import house_global, app, socketio, random_token
File "/Users/uh/Downloads/house/houseGlobal.py", line 23, in
from flask import Flask
ModuleNotFoundError: No module named 'flask'

OS:
Same on MAC and Kali.
Thank you for help.

Method calling

This is not a bug, but more of a feature I was thinking would be useful to House. Perhaps you could implement a way to invoke methods without the necessity of them being hooked prior. Would be a nice addition. :)

Hooks on a dynamic loaded class works, sometimes not

I am using malicious sample Android/Alien dc215663af92d41f40f36088ec1b850b81092ea94a4a061a9ce88178daee965a.
I want to hook in class mgcmudrfccmnwasmkd.qalnmoqsc.oygfoqispqmmjqqkuij.gjavovxatuj, which is dynamically loaded, a method private String a(String arg5).
I use:

  • Start panel: an Android emulator, via USB, and package name msqqqwokejyfwim.bzsotef.ftonpdptfkkfhcjxkrr
  • Hook panel: I specify the class and method name. I managed to get it to work without specifying anything more! (did not need to specify overload type nor dynamic path).

Sometimes it works.
See below.
house-decrypted
This is good.
But sometimes (often) it does not work.
The most common error I get is [!] Process not found, trying to spawn it...
Some other times I get [!]Error: Error: java.lang.ClassNotFoundException: Didn&#x27;t find class &quot;msqqqwokejyfwim.bzsotef.ftonpdptfkkfhcjxkrr.gjavovxatuj&quot; on path: DexPathList[[zip file &quot;/data/user/0/msqqqwokejyfwim.bzsotef.ftonpdptfkkfhcjxkrr/app_DynamicOptDex/jeSk.json&quot;],nativeLibraryDirectories=[, /system/lib64, /vendor/lib64]]
Note that the path /data/user/0/msqqqwokejyfwim.bzsotef.ftonpdptfkkfhcjxkrr/app_DynamicOptDex/jeSk.json corresponds to the dynamically loaded dex (unpacked).
Sometimes I get "nothing". Nothing happens.

I am unsure if this is a bug, or if I am doing something wrong, but I'd be grateful to have a solution that works 100% all the time :)

Make the UI more user-friendly

It would be great if House can implementing following features for its UI:

  1. Auto-complete! Make the input filed auto-complete; since House already does enumeration, it would be nice if House can store the enum result and implement the auto-complete using drop-downs.

  2. Make the UI design more reasonable: it would be nice if the UI can look more smooth and interactive, eg. The editors or some DIVs can be drag-able or resize-able; some informative information(such as detailed hook messages) can be toggled or minimized.

PFs are greatly appreciated and lets make open-source project better :)

Frida- Failed To spawned; need gadget to attach on jailed android.

I tried to connect my rooted emulator but get this error:

[!]load_script Exception: need Gadget to attach on jailed Android; its default location is: C:\Users\XXX\AppData\Local\Microsoft\Windows\INetCache\frida\gadget-android-arm64.so

What should I do? Please help.

App shelling?

I may be an idiot (has happened before), but is there a way to launch app instead of attach using house? I need to perform hooks as soon as the app is loaded. Thanks in advance.

New Logo Proposal

Good day, I am a graphics designer and i have a new logo design for your project. Please reply on this issue if you want to see it.

how install windows 10

"pipenv --python=/usr/bin/python3 install" cmd not run my windows 10
C:\Users\gsudi\house>pipenv --python=/usr/bin/python3 install
'pipenv' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\gsudi\AppData\Roaming\Python\Python39\Scripts>pipenv --python=/usr/bin/python3 install
Usage: pipenv [OPTIONS] COMMAND [ARGS]...
Try 'pipenv -h' for help.

Error: Invalid value for '--python': Expected Python at path /usr/bin/python3 does not exist

solve my problem

how to use the native hooking?

Sorry for not a bug, but I can't quite figure out the native hooking:

{"classname":"libc.so","methodname":"recvfrom"}
{"classname":"libc.so","methodname":"open"}

seems to load fine but neither get hit. I can see them hit in frida-trace however. Happy to write up some docs on it so figured file as a bug for record rather than emailing.

load_script Exception: need Gadget to attach on jailed Android

I tried to connect my rooted phone but get this error:

[!]load_script Exception: need Gadget to attach on jailed Android; its default location is: C:\Users\XXX\AppData\Local\Microsoft\Windows\INetCache\frida\gadget-android-arm64.so

What should I do?

Remote device support

I'm not sure if it's by design but House doesn't support remote device (via TCP) yet.

My case was that I had to connect to a phone with Frida server listening on an internal IP address. It may sound weird but the phone was shared for testing and it's not USB connected to my laptop, so I had to modify some codes for a quick workaround:

  1. To register the remote device in device manager: house_global.device_manager.add_remote_device('[Phone_IP]')
    (I just hardcoded the IP). I added this in houseSock.py.

  2. To get the device: replace house_global.device = frida.get_usb_device() with house_global.device = house_global.device_manager.enumerate_devices()[-1] (Yes hardcoding again).

There's definitely a better way to implement this. I just wonder if there's any future plan on supporting the remote devices?

Warnings on generated script to hook a method

In the Hooks tab, I enter:

  • a classname
  • a method name
  • an overload type.

Then, I add the entry and generate the script. The generated script has a few warnings. For example:

  • missing semi colons at the end of some lines
  • already defined variables. e.g. below c_gjavovxatuj_hook_a_hook is defined twice.
var c_gjavovxatuj_hook_a_hook = null
var cell = {}
	
var c_gjavovxatuj_hook_a_hook = eval("c_gjavovxatuj_hook.a.overload('java.lang.String')")

Keep getting [!]load_script Exception Error.

Device : LGE Nexus 5X.
Frida Server version: 11.0.13 android arm64.
Device OS: Android 8.1.0 Rooted.

Frida Server is running and Fridump & Frida-ps work like a charm.

House recognizes the device but the package does not get loaded in the House Browser UI.

Android Emulator is not detected

when I start the tool it stays on waiting for device and Package.
I looked into the code you are using the firda-python and get USB device function to get the plugged in USB devices
and this should work for android emulator but I can not see my device.
any idea why?
Bildschirmfoto 2020-12-14 um 14 43 12

miss monitor_conf.json

Traceback (most recent call last):
File "app.py", line 191, in
main()
File "app.py", line 168, in main
with open('./config/monitor_conf.json','r') as f:
FileNotFoundError: [Errno 2] No such file or directory: './config/monitor_conf.json'

Connection issues with VM

Environment

OS and Version: Ubuntu 20.0.4.2 LTS
Python Version: Python 3.8.5
Genymotionvm: Android API 25, Android 7.1

Explanation of the Issue

House connection timeout when used with Genymotion VM.

Steps to Reproduce the issue

  1. Downloading and installing House, making sure the requirements are correct
  2. Start House

Stack trace

`Error on request:
Traceback (most recent call last):
File "/home/appanalyse/.local/share/virtualenvs/house-C-9l96Nc/lib/python3.8/site-packages/werkzeug/serving.py", line 319, 
in run_wsgi execute(self.server.app) 
File "/home/appanalyse/.local/share/virtualenvs/house-C-9l96Nc/lib/python3.8/site-packages/werkzeug/serving.py", line 308, 
in execute application_iter = app(environ, start_response)  
File "/home/appanalyse/.local/share/virtualenvs/house-C-9l96Nc/lib/python3.8/site-packages/flask/app.py", line 2463, in call
return self.wsgi_app(environ, start_response)
File "/home/appanalyse/.local/share/virtualenvs/house-C-9l96Nc/lib/python3.8/site-packages/flask_socketio/init.py", line 45, in 
call return super(_SocketIOMiddleware, self).call(environ,
File "/home/appanalyse/.local/share/virtualenvs/house-C-9l96Nc/lib/python3.8/site-packages/engineio/middleware.py", line 
60, in call return self.engineio_app.handle_request(environ, start_response)
File "/home/appanalyse/.local/share/virtualenvs/house-C-9l96Nc/lib/python3.8/site-packages/socketio/server.py", line 563, in 
handle_request return self.eio.handle_request(environ, start_response)
File "/home/appanalyse/.local/share/virtualenvs/house-C-9l96Nc/lib/python3.8/site-packages/engineio/server.py", line 416, in 
handle_request socket = self._get_socket(sid)
File "/home/appanalyse/.local/share/virtualenvs/house-C-9l96Nc/lib/python3.8/site-packages/engineio/server.py", line 609, in 
_get_socket raise KeyError('Session is disconnected')
KeyError: 'Session is disconnected'`

Possible Solution

install frida 12.8.3, aswell as frida-server 12.8.3 in the VM.

Further testing is being done right now, but it looks like this fixes the issues.

This Issue looks similiar to: miguelgrinberg/Flask-SocketIO#248 but the solution consists of downgrading Frida instead of Flask-SocketIO, so I am unsure if everything is fixed.
Also the Flask-SocketIO-Issue used python2, but apart from that it looks pretty similiar.

Here is a screenshot with the bug present (it's stuck waiting for device & package):

house_bug

Here is a screenshot with the bug fixed:
house_fixed

Unsupported version of the Socket.IO or Engine.IO protocols error

I'm not able to see the device connected to the USD port. frida-ps -U works and lists the processes.

When the app starts I see the following:


  ___ ___
 /   |   \  ____  __ __  ______ ____
/    ~    \/  _ \|  |  \/  ___// __ \
\    Y    (  <_> )  |  /\___ \  ___/
 \___|_  / \____/|____//____  >\___  >
       \/      House        \/     \/

    Dynamic Mobile Analysis Tool
    Contact: [email protected]

Communications will happen over USB, make sure have your android device plugged in.

[+] House running at http://127.0.0.1:5000
 * Serving Flask app "houseGlobal" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
The client is using an unsupported version of the Socket.IO or Engine.IO protocols (further occurrences of this error will be logged with level INFO)

Hook all methods with the given class.

Hi, how I can hook all methods with the given class.
And how I can enum if a class have multiple methods with same name but different type a() ; a(android.content.Context); a(java.lang.String,boolean)
Thanks.

Server is not starting

Hello,
i installed the tool and fire it up using the command
python app.py 1337 using PIPENV and than the server returns blank screen.

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.