frida-sidecar v0.12.8
Sidecar
Sidecar is a runtime hooking tool for intercepting function calls by TypeScript annotation with ease, powered by Frida.RE.
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
- Easy to use by TypeScript decorators/annotations
@Call(memory_address)
for make a API for calling memory address from the binary@Hook(memory_address)
for emit arguments when a memory address is being called
- Portable on Windows, macOS, GNU/Linux, iOS, Android, and QNX, as well as X86, Arm, Thumb, Arm64, AArch64, and Mips.
- 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
- 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
Dll
Frida
- TypeScript - Frida环境搭建 - windows (给IDE提供智能感知/提示)
- TypeScript - Example - Frida agent written in TypeScript
- Talk Video - Prototyping And Reverse Engineering With Frida by Jay Harris
- Talk Video - r2con 2017 - Intro to Frida and Dynamic Machine Code Transformations by Ole Andre
- Hand-crafted Frida examples
- Slide - 基于 FRIDA 的全平台逆向分析 - caisi.zz@alipay.com (GitHub repo)
- Awesome Frida
- How to call methods in Frida Gadget (JavaScript API iOS)
- Frida调用栈符号恢复
- Cross-platform reversing with Frida, Oleavr, NoConName December 2015
- Frida: JavaScript API
- Calling native functions with Frida, @poxyran
- Shellcoding an Arm64 In-Memory Reverse TCP Shell with Frida, Versprite
- Anatomy of a code tracer, Ole André Vadla Ravnås, Oct 24, 2014
- frida-boot 👢 a binary instrumentation workshop, using Frida, for beginners, @leonjza
- frida javascript api手册
- Frida 12.7 Released - CModule
- Getting Started with Frida: Hooking a Function and Replacing its Arguments
Unicode
Assembler
- Online x86 / x64 Assembler and Disassembler (
0xf
is not valid, use0x0f
instead) - 易语言汇编代码转置入代码开源
- The 32 bit x86 C Calling Convention
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
Copyright & License
- Docs released under Creative Commons
- Code released under the Apache-2.0 License
- Code & Docs © 2021 Huan LI \zixia@zixia.net\
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago