0.12.8 • Published 3 years ago

frida-sidecar v0.12.8

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 years ago

Sidecar NPM

Sidecar is a runtime hooking tool for intercepting function calls by TypeScript annotation with ease, powered by Frida.RE.

Frida Sidecar

Image source: 1920s Raleigh Box Sidecar Outfit & ShellterProject

What is a "Sidecar" Pattern?

Segregating the functionalities of an application into a separate process can be viewed as a Sidecar pattern. The Sidecar design pattern allows you to add a number of capabilities to your application without the need of additional configuration code for 3rd party components.

As a sidecar is attached to a motorcycle, similarly in software architecture a sidecar is attached to a parent application and extends/enhances its functionalities. A Sidecar is loosely coupled with the main application.

SOURCE: Sidecar Design Pattern in your Microservices Ecosystem, Samir Behara, July 23, 2018

What is a "Hooking" Patern?

Hook: by intercepting function calls or messages or events passed between software components.
SOURCE: Hooking, Wikipedia

Features

  1. Easy to use by TypeScript decorators/annotations
    1. @Call(memory_address) for make a API for calling memory address from the binary
    2. @Hook(memory_address) for emit arguments when a memory address is being called
  2. Portable on Windows, macOS, GNU/Linux, iOS, Android, and QNX, as well as X86, Arm, Thumb, Arm64, AArch64, and Mips.
  3. Powered by Frida.RE and can extended by any agent script.

Example

Talk is cheap, show me the code.

@Sidecar('chatbox')
class ChatboxSidecar extends SidecarBody {

  @Call(0x11C9)
  @RetType('void')
  mo (
    @ParamType('pointer', 'Utf8String') content: string,
  ): Promise<string> {
    return Ret(content)
  }

  @Hook(0x11F4)
  mt (
    @ParamType('pointer', 'Utf8String') content: string,
  ) {
    return Ret(content)
  }

}

Learn more from the example directory: https://github.com/huan/sidecar/blob/main/examples

Requirements

  1. Mac: disable System Integrity Protection

Install

npm install sidecar

Usage

// tbw

Related project: FFI Adapter

I have another NPM module named ffi-adapter, which is a Foreign Function Interface Adapter Powered by Decorator & TypeScript.

FFi Adapter example:

import {
  LIBRARY,
  API,
  RETURN,
}             from 'ffi-adapter'

@LIBRARY('./libfactorial')
export class LibFactorial {
  @API() factorial (n: number): number { return RETURN(n) }
}

const lib = new LibFactorial()
console.log('factorial(5) =', lib.factorial(5))
// Output: factorial(5) = 120

Learn more about examples at https://github.com/huan/ffi-adapter/tree/master/tests/fixtures/library

Resources

Papers

  1. Assembly to Open Source Code Matching for Reverse Engineering and Malware Analysis

Dll

  1. Wikipedia: DLL injection
  2. Code Tutorial: InjectDLL

Frida

  1. TypeScript - Frida环境搭建 - windows (给IDE提供智能感知/提示)
  2. TypeScript - Example - Frida agent written in TypeScript
  3. Talk Video - Prototyping And Reverse Engineering With Frida by Jay Harris
  4. Talk Video - r2con 2017 - Intro to Frida and Dynamic Machine Code Transformations by Ole Andre
  5. Hand-crafted Frida examples
  6. Slide - 基于 FRIDA 的全平台逆向分析 - caisi.zz@alipay.com (GitHub repo)
  7. Awesome Frida
  8. How to call methods in Frida Gadget (JavaScript API iOS)
  9. Frida调用栈符号恢复
  10. Cross-platform reversing with Frida, Oleavr, NoConName December 2015
  11. Frida: JavaScript API
  12. Calling native functions with Frida, @poxyran
  13. Shellcoding an Arm64 In-Memory Reverse TCP Shell with Frida, Versprite
  14. Anatomy of a code tracer, Ole André Vadla Ravnås, Oct 24, 2014
  15. frida-boot 👢 a binary instrumentation workshop, using Frida, for beginners, @leonjza
  16. frida javascript api手册
  17. Frida 12.7 Released - CModule
  18. Getting Started with Frida: Hooking a Function and Replacing its Arguments

Unicode

  1. 字符编码笔记:ASCII,Unicode 和 UTF-8, 阮一峰,2007年10月28日

Assembler

iOS

Objective C

History

Master

0.1 (Jul 4, 2021)

First worked version, published to NPM as frida-sidecar.

0.0.1 (Jun 13, 2021)

Repo created.

Special thanks

Thanks to Quinton Ashley @quinton-ashley who is the previous owner of NPM name sidecar and he transfer this beautify name to me for publishing this project after I requested via email. Appreciate it! (Jun 29, 2021)

Author

Huan LI (李卓桓), Microsoft Regional Director, zixia@zixia.net

Profile of Huan LI (李卓桓) on StackOverflow

Copyright & License

  • Docs released under Creative Commons
  • Code released under the Apache-2.0 License
  • Code & Docs © 2021 Huan LI \zixia@zixia.net\
0.13.2

3 years ago

0.13.3

3 years ago

0.13.4

3 years ago

0.12.7

3 years ago

0.12.8

3 years ago

0.12.1

3 years ago

0.12.2

3 years ago

0.12.5

3 years ago

0.12.6

3 years ago

0.11.3

3 years ago

0.11.1

3 years ago

0.11.2

3 years ago

0.9.23

3 years ago

0.9.16

3 years ago

0.9.17

3 years ago

0.9.21

3 years ago

0.9.22

3 years ago

0.9.13

3 years ago

0.9.14

3 years ago

0.9.15

3 years ago

0.9.12

3 years ago

0.9.8

3 years ago

0.9.7

3 years ago

0.9.9

3 years ago

0.9.10

3 years ago

0.9.6

3 years ago

0.9.11

3 years ago

0.9.5

3 years ago

0.9.4

3 years ago

0.9.2

3 years ago

0.8.7

3 years ago

0.8.6

3 years ago

0.8.4

3 years ago

0.7.2

3 years ago

0.7.1

3 years ago

0.6.32

3 years ago

0.6.29

3 years ago

0.6.22

3 years ago

0.6.11

3 years ago

0.6.25

3 years ago

0.6.26

3 years ago

0.6.7

3 years ago

0.6.6

3 years ago

0.6.8

3 years ago

0.6.3

3 years ago

0.6.2

3 years ago

0.6.5

3 years ago

0.6.4

3 years ago

0.5.8

3 years ago

0.5.7

3 years ago

0.5.5

3 years ago

0.6.1

3 years ago

0.5.4

3 years ago

0.5.3

3 years ago

0.5.1

3 years ago

0.4.1

3 years ago

0.2.21

3 years ago