Frida HTTP Module
raw JSON →Frida-http is a module designed to provide Node.js-compatible `http` and `https` client functionality within Frida's GumJS runtime environment. Version 3.0.0 is the current stable release, tightly integrated into the broader Frida ecosystem, with its release cadence generally aligning with major Frida framework updates. This module is primarily used by `frida-compile` to enable the use of standard Node.js HTTP client patterns within injected Frida agents, allowing developers to make network requests from the context of the target process. It differentiates itself by enabling network communication in an environment (Frida's instrumented process) where direct Node.js `http` APIs would otherwise be unavailable, serving as a critical component for dynamic analysis and reverse engineering tasks requiring outbound network communication from the target process.
Common errors
error Error: Module not found: 'frida-http' ↓
frida-compile to bundle your agent script. Ensure frida-http is specified as a dependency in your agent's package.json (if applicable) or explicitly included in the frida-compile input files, and compile with ES Module target. error TypeError: require is not a function ↓
import syntax: import { http } from 'frida-http';. Ensure your frida-compile configuration supports ES Modules output. error HTTP request error: getaddrinfo EAI_AGAIN example.com ↓
error HTTP request error: unable to verify the first certificate ↓
/system/etc/security/cacerts/. Warnings
breaking With Frida 17.0.0, runtime bridges like `frida-http` are no longer implicitly bundled within Frida's GumJS runtime. Agents relying on these modules must now be explicitly compiled using `frida-compile` (or similar bundler) to include these dependencies, and should use ES Module (ESM) syntax. This requires adjusting agent build processes. ↓
gotcha Network requests initiated via `frida-http` execute within the network context of the *target process*, not the host machine where your Frida client (Node.js/Python) is running. This means any host-level network configurations (proxies, VPNs, custom DNS, system-wide CA certificates) will not automatically apply to requests made by the injected agent. ↓
gotcha When developing Frida agents with TypeScript, ensuring that `frida-http` is correctly bundled and transpiled for the target environment can be challenging. Incorrect `tsconfig.json` settings or an outdated `frida-compile` setup can lead to module resolution failures or syntax errors in the injected script. ↓
Install
npm install frida-http yarn add frida-http pnpm add frida-http Imports
- http wrong
const http = require('frida-http');correctimport { http } from 'frida-http'; - https wrong
const https = require('frida-https');correctimport { https } from 'frida-https'; - IncomingMessage
import { IncomingMessage } from 'frida-http';
Quickstart
import { http, IncomingMessage, ClientRequest } from 'frida-http';
import { https } from 'frida-https'; // Assuming frida-https also exists for SSL/TLS
rpc.exports = {
/**
* Makes an HTTP or HTTPS GET request from the injected Frida agent.
* The response body (truncated) and status are sent back to the host.
* @param {string} url The URL to fetch.
* @param {boolean} useHttps Whether to use HTTPS (requires frida-https).
*/
fetchUrl(url: string, useHttps: boolean = false): void {
const client = useHttps ? https : http;
const req: ClientRequest = client.get(url, (res: IncomingMessage) => {
let data = '';
res.setEncoding('utf8');
res.on('data', (chunk: string) => {
data += chunk;
});
res.on('end', () => {
const truncatedBody = data.length > 200 ? data.substring(0, 200) + '...' : data;
send({
type: 'response',
url: url,
statusCode: res.statusCode,
headers: res.headers,
body: truncatedBody,
});
});
});
req.on('error', (e: Error) => {
send({
type: 'error',
url: url,
message: e.message,
});
});
req.end();
console.log(`[Frida Agent] Attempted to fetch: ${url}`);
},
};
console.log('[Frida Agent] Frida-HTTP agent initialized. Call rpc.exports.fetchUrl(url, useHttps) from host.');