fix(frida): keep ptrace seize guidance from overclaiming

The remediation for a refused ptrace seize said injection was unavailable
whatever the target. Frida's reason carries no errno, so REA cannot tell a
host that lacks PTRACE_SEIZE, such as PRoot-Distro, from a ptrace permission
policy that refused only the selected process. Sending the second case to
another host would be wrong.

Word the remediation as two possibilities. If other targets fail the same
way, run REA on a host with native ptrace support or use a remote Frida
server. Otherwise check the ptrace permissions that apply to this target. The
regression test now asserts the conditional wording and that the host-wide
claim is gone.

Refs #9103

Signed-off-by: Deepak Jain <deepujain@gmail.com>
This commit is contained in:
Deepak Jain authored and Ysopwnable committed 2026-11-21 21:24:01 +01:00
1 parent 317f90e023
commit 2337ebe130
2 files changed
+6 -3

No files matched your search

@@ -419,6 +419,8 @@ describe("FridaInstrumentationManager", () => {
});
expect(projected.remediation.action).toContain("PTRACE_SEIZE");
expect(projected.remediation.action).toContain("PRoot");
expect(projected.remediation.action).toContain("this target alone");
expect(projected.remediation.action).not.toContain("whatever the target");
expect(projected.remediation.action).not.toContain(
"Choose another analysis or target",
);
+4 -3
View File
@@ -1619,8 +1619,9 @@ const sanitizeError = (
/**
* Frida reports a refused ptrace seize with this prefix. Only that request
* is recognized: the reason carries no errno, so it does not identify the
* environment, and discovery can succeed where injection is refused.
* is recognized: the reason carries no errno, so it does not say whether the
* host lacks ptrace support or permissions refused this target, and discovery
* can succeed where injection is refused.
*/
const PTRACE_SEIZE_REFUSAL = /^Unable to perform ptrace seize\b/i;
@@ -1645,7 +1646,7 @@ const providerFailureGuidance = (
userMessage:
"Frida could not start tracing the target because its ptrace seize request was refused.",
remediationAction:
"Injection is unavailable here whatever the target: the operating system refused Frida's PTRACE_SEIZE request (see details.reason). Emulated environments such as PRoot-Distro on Android do not implement it, although device and process discovery still succeed, and restrictive ptrace policies can also refuse it. Run REA on a host with native ptrace support, or select a Frida server running on one with the remote options, then retry.",
"The operating system refused Frida's PTRACE_SEIZE request (see details.reason). Either the host does not implement it, as emulated environments such as PRoot-Distro on Android do, so no target can be injected although device and process discovery still succeed, or ptrace permissions refused this target alone. If other targets fail the same way, run REA on a host with native ptrace support, or select a Frida server running on one with the remote options. Otherwise check the ptrace permissions that apply to this target. Then retry.",
};
return {};
};