For now, I tried a few quick experiments:
What I tested, and the useful boundaries it exposed
I took the specific checks in your Ghost Search v4.0 post as a starting point and tested the Tor HTTP transport in PianoTorHttpPlugin.java. I compiled the pinned Java plugin with minimal Capacitor stubs, exercised it through a local mock SOCKS5/HTTP server, repeated the tests in a separate CPU-only Colab environment, and inspected the published v4.0.0 APK with JADX. This was not an Android security audit, and the tests did not contact live onion services.
Positive control: a redirect from an allowed v3 .onion address to a clearnet destination was rejected. Three boundaries need attention: an already percent-encoded URL was encoded again; incomplete HTTP responses could return successfully; and 307/308 redirects rewrote POST to GET. These are repeatable observations from specific code paths and fixtures, not evidence of Tor leakage, broken anonymity, or behavior across all Android devices.
| Test |
Observation |
Evidence boundary |
.onion to clearnet redirect |
Rejected before following the new destination |
JVM fixture; matching guard appears in APK decompilation |
Already-encoded query, q=a%20b |
Request target became q=a%2520b |
JVM replay on two pinned source snapshots; corresponding construction visible in APK |
Content-Length: 100, body short, then EOF |
Returned 200 with short |
JVM replay; full APK completion path not yet established |
Chunked body missing final 0 chunk |
Returned 200 with available body |
JVM replay; full APK completion path not yet established |
| 307/308 redirect after POST |
Next request used GET |
JVM replay; related APK redirect logic inspected |
Coexisting Content-Length and Transfer-Encoding |
One split-response fixture ended with Truncated chunk body |
An error in this case, not proof of request smuggling |
The snapshots were the v4.0.0 commit and one main commit, not whatever main may contain later. The v4.0.0 release APK fetched in Colab was 1,852,694 bytes and matched SHA-256 3a05ef72a069fd45bfcbf0417a06652d3c6de3fbe9622e256caf90e9620d29a1. That identifies the inspected artifact; it is not an independent reproducible build. JADX recovered the target plugin among 1,262 Java files, with four reported decompilation errors. The recovered excerpts support some source-to-APK comparisons, not a complete APK execution trace.
A small default route
For a low-cost regression pass, keep the destination-blocking case as a positive control, then check:
- Request-target preservation: a query containing a space or non-ASCII character, as generated by the real JS engine adapter, should arrive at the mock server with the intended encoding after exactly one logical encoding step.
- Response completion: declared-length premature EOF and missing chunk terminators should be distinguishable from fully received
200 responses, rather than becoming ordinary search results.
- Redirect policy: 303 can switch to GET as appropriate, while 307/308 should preserve method semantics only where forwarding the original body is authorized. A cross-host redirect may need a stricter policy than an ordinary browser.
- Registry provenance: keep structurally valid onion addresses distinct from operator-verified canonical addresses before using the latter as a phishing/spoofing trust anchor.
All four begin with local fixtures, without live onion traffic. If a newer commit behaves differently, keep the fixed-source result as regression history.
1. URL encoding: preserve the caller's request target
The observed transformation
The transport constructs an ASCII request target from a parsed URL, using a multi-component URI constructor. In the source-derived JVM test, already-escaped input was escaped again:
Input query Captured request target
q=cat /search?q=cat
q=a%20b /search?q=a%2520b
q=%E6%97%A5 /search?q=%25E6%2597%25A5
q=%2520 /search?q=%252520
q=café /search?q=caf%C3%A9
The Japanese-character example distinguishes one UTF-8 encoding pass from re-escaping %. An intentionally escaped percent such as %2520 is valid; the question is whether the transport unexpectedly adds another layer.
The search adapters use encodeURIComponent() for query values. Java’s official URI documentation says its multi-argument constructors quote %, while the single-string constructor preserves valid existing escapes. Passing an encoded value back through new URI(..., path, query, ...) is therefore a cross-layer contract mismatch, not a Java defect. The corresponding construction also appears in the APK’s decompiled plugin, but I did not observe an Android UI search’s actual request line.
Why this may affect search results
On a single URL-decoding pass, a%2520b means the literal text a%20b, not a b. Double decoding might mask that for some engines, so user-visible impact depends on the engine and real UI-to-native path. This can resemble a retrieval or ranking problem; checking request bytes first avoids revisiting search-quality work unnecessarily.
A focused local test can cover cat, a b, 日, a&b, literal %, an encoded path slash, and an invalid percent escape. Record three separate values: the original user input, the complete URL produced by JS, and the exact request line received after the mock SOCKS handshake. Then decode the captured query once and compare it with the caller’s intent. No live onion lookup is needed.
Possible interface contracts
There are at least two coherent options:
- JS owns URL encoding: JS sends a complete valid URL; Java validates protocol and v3-onion authority and preserves its raw path/query when constructing the HTTP request target.
- Java owns URL encoding: JS passes structured, unescaped components; Java encodes once and sends the result.
The JS-owned option may require fewer changes, but it still needs scheme/host checks, safe request-line construction, and malformed-input rejection. Using getRawQuery() alone will not help if another component constructor re-quotes %. Assert the actual transmitted bytes.
A practical test matrix:
| Input |
Main question |
q=cat |
Does plain ASCII remain unchanged? |
q=a%20b, q=%E6%97%A5 |
Are pre-existing escapes preserved? |
q=100%25, q=a%26b |
Is a literal percent or embedded ampersand still one query value? |
q=a+b |
Are + and space semantics defined, rather than silently conflated? |
/a%2Fb?q=x |
Does an escaped path separator remain a path component? |
q=%ZZ, encoded CR/LF |
Is malformed or dangerous input safely rejected rather than turned into HTTP headers? |
For a branch-style interpretation:
Captured request target preserves intended escapes?
Yes: check actual engine decoding and search behavior separately.
No: identify whether JS supplied an already-encoded URL.
If yes, fix the single-owner encoding boundary and add a regression.
If another runtime path bypasses the tested serializer, narrow scope.
2. HTTP response completeness: make partial data distinguishable from success
Two small premature-end cases
A local mock SOCKS5 endpoint returned controlled HTTP/1.1 bytes. These two cases are especially informative:
HTTP/1.1 200 OK
Content-Length: 100
Connection: close
short
After the body short, the server closed the connection, far short of the advertised 100 bytes. The source-level test nevertheless produced OK:200:short.
The second fixture used chunked framing:
HTTP/1.1 200 OK\r\n
Transfer-Encoding: chunked\r\n
\r\n
5\r\n
hello\r\n
[EOF here; no 0\r\n\r\n terminal chunk]
The source-level output was again OK:200:hello. The control with a properly terminated chunked body also returned OK:200:hello, which shows why checking only the result text would miss the distinction. Both fixed source snapshots and the Colab replay reproduced these cases. These were not instrumented tests of the running APK, and the saved JADX excerpt does not prove the complete response-framing path in the release binary.
A 200 OK status and decodable body do not prove message completion. RFC 9112 Section 6.3 defines body-length framing; Section 8 covers incomplete messages. With a valid Content-Length, the indicated octets must arrive. A chunked response must include its terminating zero-sized chunk and trailer termination. EOF or timeout is not a substitute for those conditions.
Three completion rules, not one generic EOF rule
A compact implementation approach is to decide the applicable framing mode after parsing and validating the headers, then keep its completion state explicit:
| Framing mode |
Completion criterion |
Premature EOF |
Valid Content-Length: N |
Exactly N message-body octets received |
Incomplete/error |
Valid final Transfer-Encoding: chunked |
All chunks, terminal zero chunk, and trailer termination parsed |
Incomplete/error |
| Legitimate close-delimited response |
Connection closes after body where no other length rule applies |
Normal completion under that framing mode |
This is a fixture-level table, not a complete HTTP parser specification: HEAD, 1xx/204/304, CONNECT and framing precedence require separate treatment where supported. The essential distinction is a valid end under the selected framing versus an unexpected transport end.
The tested Java reader tracks contentLength and isChunked but can parse buffered bytes after premature EOF, and some timeout paths also proceed after partial data. A narrow improvement is to retain explicit completion state and reject unfinished framed bodies before returning ordinary search content.
The related CL/TE test has a different result
For one split response containing both Content-Length and Transfer-Encoding, the harness raised Truncated chunk body: an error, not a successful parse. This fixture is not evidence of request smuggling or generalized fail-open behavior. RFC 9112 still gives useful precedence and rejection rules for broader coverage; this client-side test does not establish a server/intermediary exploit.
Useful later regression cases include conflicting lengths, malformed chunk sizes, incomplete trailers, varying read segmentation, and a body that hits MAX_BODY before completing. The size cap must not turn an unfinished framed response into success. These are follow-ups, not results established by the two reproduced EOF fixtures.
Distinguish failure from an empty search
The user-visible consequence is conditional. If a partial HTML document parses as a few results, the UI may treat missing results as poor engine coverage. If it parses nothing, a transport failure may look like a legitimate empty search. Neither inference is supported merely by the response status. A cleaner boundary would pass a typed success/error to the search layer, where the UI can distinguish a completed search with no matches from an incomplete HTTP fetch.
Possible outcomes of a local regression:
Complete framed response: success with expected body.
Premature EOF, fixed length: incomplete-response error.
Premature EOF, chunked: incomplete-response error.
Valid close-delimited body: success under documented conditions.
Body cap reached before message complete: bounded-size error, not 200.
Read timeout before completion: timeout/incomplete error, not 200.
3. Redirects, method preservation, cookies, and destination authorization
The local result
The same small SOCKS5 fixture returned redirects after a POST. The next request was captured directly:
303 after POST: POST /submit, then GET /follow
307 after POST: POST /submit, then GET /follow
308 after POST: POST /submit, then GET /follow
The 303 result can be expected for a browser-style redirect. However, RFC 9110, Section 15.4.8 and Section 15.4.9 define 307 and 308 as method-preserving redirects. The fixed Java implementation sets the method to GET and clears the POST body after a followed redirect without distinguishing those statuses. Related logic was visible in the released APK’s targeted JADX excerpt. Whether any current search-engine CAPTCHA flow depends on a 307/308 POST is a separate, still-unverified question.
I would avoid treating “make every redirect automatically forward the original POST” as the full fix. There are two distinct decisions:
- HTTP method semantics: does the redirect status require or permit rewriting POST to GET?
- Request authorization: is it appropriate to send the original POST body, query parameters, and cookies to the new destination?
In Ghost’s privacy model, the second question may legitimately be stricter than a generic HTTP library. The correct behavior can be to reject a cross-host POST redirect rather than either silently rewriting it or automatically resubmitting potentially sensitive data to another onion service.
A minimal policy matrix
| Case |
Candidate behavior |
What the test should establish |
| Same-origin 303 after POST |
Switch to GET according to chosen semantics |
Body not resent accidentally |
| Same-origin 307/308 after POST |
Preserve POST and body, if supported |
Method and bytes retained |
| Cross-origin 307/308 after POST |
Reject or require explicit authorization |
No silent disclosure to a new host |
.onion to clearnet redirect |
Reject before connecting |
No second socket to the forbidden destination |
| Relative redirect within an allowed onion |
Resolve then revalidate target |
No bypass via URL resolution |
| Redirect chain beyond the configured hop limit |
Report a defined redirect error |
No indefinite retry or silent empty result |
The 301/302 compatibility policy should likewise be explicit. Relative locations and encoded query values should pass the same destination and request-target validation on every hop.
Cookie separation and origin changes
The Java plugin has a cookie jar keyed by host. That is a relevant starting protection, but the interesting evidence is at the actual redirect boundary: does a cookie received from engine A appear on a request to engine B? A local fixture can set distinguishable cookies on the first response, issue a same-host redirect followed by a cross-host redirect, and capture the Cookie header on each request. It should also observe the final purge boundary between searches, rather than assuming that a per-host map alone proves a full search-session lifetime.
A useful positive control
The clearnet redirect case is worth reporting alongside the anomalies. My local test saw an explicit Blocked redirect outside v3 .onion domain failure, not a second successful HTTP request. The source validates an initial URL before connecting and the resolved redirect destination before the next fetch. The APK excerpt includes the same rejection string. This is evidence supporting that particular fail-closed destination path. It is not a complete leak test covering every API, WebView navigation route, or Orbot configuration.
Native call.reject(...) and a visible UI error are separate observations: the JS layer may catch, retry, or aggregate a failure. A controlled redirect with both native and UI logging would settle the explicit error versus empty result question.
4. Canonical onion provenance and the threat model
Valid address is not verified operator
I independently checked the thirteen labels in the CANONICAL_ONION_REGISTRY against the Tor v3 address encoding rule. All thirteen passed the format, version-byte, and checksum checks in that small Python test. The Tor specification explains how these addresses encode an Ed25519 public key, checksum, and version. That is meaningful evidence of a well-formed address. It does not prove that the address is operated by Ahmia, TorDex, Torch, or another named search provider.
This distinction is particularly important because a registry used by detectOnionSpoof gives registered addresses a stronger semantic status than a normal list of search candidates. In a changing onion ecosystem, an address copied from a mirror directory may be syntactically valid and even reachable while the operator attribution remains uncertain. The lookup’s existence, current reachability, claimed brand, and first-party ownership proof should be four separate fields.
A useful provenance ladder, from stronger to weaker evidence, might be:
- A service operator’s authenticated official website, signed release/document, or maintained upstream repository explicitly names the onion address; an Onion-Location declaration can help where available.
- A dated, operator-controlled channel explicitly links the address to the service, with a credible continuity trail.
- Multiple independent public directories agree on an address, but there is no identified first-party confirmation.
- A mirror list or community mention provides an address without sufficient provenance.
- The address only passes the cryptographic format test, or appears in an old artifact without an owner claim.
Operators can rotate keys, go offline, or maintain multiple endpoints. Missing Onion-Location is not evidence of fraud. These categories preserve an evidence trail; they are not absolute trust scores.
In the checked sources, Ahmia has stronger first-party confirmation. A TorDex-branded site matched another registry entry, but that alone did not independently establish the operator’s identity. The remaining entries should not be presented as independently owner-verified by the checksum test. The author’s request for D1 provenance remains substantially open. I would rather leave an entry marked INCONCLUSIVE than promote a plausible directory address to a phishing-protection anchor without a trail.
One practical design separation
The registry might benefit from separating two use cases:
- A discovery/coverage list, where a currently useful but not fully attributed endpoint may still be queried under a suitable caution and availability policy.
- A first-party-supported canonical list, which is allowed to say that a different address might be impersonating an identified provider.
This avoids the undesirable choice between discarding useful search coverage and silently turning weak provenance into a strong security label. A small record can make the boundary reviewable:
engine_id: <stable local identifier>
onion_address: <56-character v3 address>
format_valid: PASS | FAIL
owner_evidence: FIRST_PARTY | MULTI_SOURCE | DIRECTORY_ONLY | UNKNOWN
provenance_url: <source naming this exact address>
checked_at: <UTC date>
status: CANONICAL | DISCOVERY_ONLY | RETIRED | INCONCLUSIVE
Keep old entries dated and evidence links retrievable when keys rotate. Vanity-prefix resemblance is a heuristic, not proof of impersonation.
The threat-model document and independent review
The forum post and REVIEW.md point to docs/GHOST_V4_SECURITY_ARCHITECTURE.md. I could not retrieve that path from the pinned v4.0.0 revision or the sampled main snapshot, and a later check of the public main path also returned 404. That is a documentation-location observation, not a conclusion that the model never existed or that the architecture is unsupported. The document may have moved, been stored elsewhere, or been published later. An updated direct link, or the relevant text committed alongside the release evidence, would remove a practical blocker for outside reviewers.
Once available, I would look for a few explicit assumptions and failure boundaries rather than trying to judge the model as a whole:
- The app needs Orbot to be running and reachable on a designated SOCKS endpoint. What is the failure behavior when Orbot is absent, restarting, on a different port, or deliberately configured to listen beyond loopback?
- The app’s VPN gate, its local SOCKS connection, and the actual Tor routing are related but distinct observables. Which one is sufficient to allow a query, and how is a stale or ambiguous state handled?
- Per-search SOCKS authentication can provide a circuit-isolation input; it does not erase correlations in timing, query text, sizes, or engine selection when the same query is sent to multiple services.
- The Tor-only search transport does not automatically prove that every embedded WebView navigation, other Android component, or external link follows that same transport path.
- RAM-only application state, WebView storage behavior, screenshot prevention, backup settings, screen-off cleanup, and panic wipe are separate claims with separate observation methods.
The post already recognizes the correlation introduced by parallel queries and stable engine selection. This is a coverage-versus-metadata trade-off, not a newly demonstrated Tor leak.
Minimal decision branch
Address passes v3 checksum?
No: reject or mark invalid format.
Yes: look for a first-party attribution source.
Verified: eligible for the canonical/anti-spoof trust anchor.
Unverified but useful: discovery list, with provenance status.
Contradictory or changed: suspend the canonical label and re-check.
Threat-model assumption externally testable?
Yes: attach environment and an expected failure case.
No: document the limitation and avoid a stronger guarantee.
This supplies useful review work without asking the maintainer to prove every negative proposition before a forum reply can proceed.
5. Build reproducibility, Android evidence, and what the probe cannot settle
What the APK check establishes
The matching APK SHA-256 establishes which release was inspected, not that a second builder reproduced it. The R1 question in REVIEW.md concerns an independent build from source and comparison under a documented toolchain. See F-Droid reproducible-build guidance.
Lockfile pinning helps; toolchains, JDK/Gradle, timestamps, signing, packaging, and comparison procedures also matter. A documented independent build would answer a different question from the downloaded-APK hash. This HTTP probe need not expand into that build project.
The targeted JADX run is useful in a different way. It ties some Java source observations to an identifiable release binary. It produced 1,262 Java source files and four decompilation errors; the target plugin was among the recovered files. In particular, the URI reconstruction and 307/308 POST-to-GET behavior have corroborating source and decompiled-code evidence. The fixed-length/chunked completion behavior was reproduced in source-level execution, but the saved binary excerpts were not a complete trace of that path. I would not silently upgrade it to an APK-runtime observation.
What needs an actual Android environment
The author’s device matrix covers lifecycle, system services, and ROM behaviors that this JVM test cannot reach. A later staged test could use:
| Area |
Cheapest useful observation |
Remaining limit |
FLAG_SECURE and Recents |
Capture attempt on one different Android API/device |
No universal guarantee across all ROMs |
| Orbot absent/restarting |
Search blocked, visibly classified, no fallback |
Needs actual network/transport observation for stronger claims |
| VPN interface detection |
Record observed interface/transport status on alternate ROM |
Interface naming is environment-specific |
| Panic wipe |
Inspect app/WebView directories before and after controlled exit/wipe |
Abrupt termination and forensic recovery remain separate |
| Logcat canary |
Fixed query with timestamped log collection |
A zero-match log is not proof of zero possible leakage |
| New release rebuild |
Independent build with pinned toolchain and artifact comparison |
Release hash alone cannot establish this |
OWASP’s WebViews guidance distinguishes browser storage surfaces. Calling a purge routine, observing cleared directories, and demonstrating behavior after abrupt termination are different levels of evidence. For RAM-only claims, record the component and termination mode actually tested.
One testing trap: non-root PCAPdroid uses Android VPNService, so it can conflict with an Orbot VPN-mode setup. A capture that changes the VPN arrangement may no longer test the original routing. Record whether capture used root mode, an external observer, or a separate proxy, and whether Orbot remained in the intended configuration.
A bounded interpretation
My results cover local socket protocol handling and selected APK implementation evidence. They do not verify device storage cleanup, screenshot defenses, actual Orbot routing, network-level anonymity, or the full F-Droid build path. Keeping those as separately named checks is useful even when a future device test passes.
6. How to keep the results reusable
A compact evidence receipt makes it possible to distinguish a later fix from a test-environment difference:
Check: HTTP_CL_PREMATURE_EOF
Source: Ghost v4.0.0, a8accb197b5136fb70773a88c8d20fe5d0b2245f
Runner: Java transport + local SOCKS5/HTTP mock
Input: 200; Content-Length: 100; body "short"; then EOF
Expected: incomplete-response error
Observed: OK:200:short
Replicated: source-level JVM test and CPU Colab
APK: download hash matched; full completion path not checked
Android device: not tested
A URL case should retain the full JS-built URL and the captured HTTP request line. A redirect case should retain the source and destination hosts, status, original and final method/body, cookie headers, and number of attempted socket connections. A registry case should retain the first-party URL and verification date. Small receipts like these preserve the result even if a later version fixes it.
The main references are the pinned v4.0.0 source, transport plugin, and review checklist. For independently maintained contracts, see the Java URI API, RFC 9112, RFC 9110, Tor onion-address specification, and F-Droid reproducible builds. Standards support the expected semantics; pinned code and captured fixtures support claims about Ghost. They are different kinds of evidence.
The practical takeaway: keep the successful clearnet-redirect control; give JS/native URL encoding one clear owner; distinguish incomplete framed responses from successful search results; apply both method semantics and destination policy to 307/308; and separate valid onion-address syntax from verified operator provenance. These are small, testable improvements compatible with the Tor-only design, not conclusions about Android-wide anonymity or reproducible builds. A newer implementation or device trace can change the finding without making the regression fixture less useful.