trust everyone: a trust-manager story with no tls code in the dex
huntress ctf 2026, day 9 · mobile android · all three modes
tools used: android apk toolkit and timed-attempt pipeline.
the prompt asked us to "exploit a challenge ca accepted by a permissive trust implementation." the title, trust everyone, is the usual name for a classic android tls mistake: a custom trust manager that accepts any certificate chain, so a certificate authority made up by an attacker is as good as a real one. the graded answer, as on every mobile day so far, sat in the puzzle asset.
the key insight: there was no trust implementation to exploit. the dex references no tls api at all, and the "permissive x509 trust manager" exists only as a label string. the asset named its codec, base64, day 3's codec again, and the existing decoder read it on the first try.
challenge shape
one answer field, answer, an ANS- code: the prefix and sixteen uppercase hex characters, as the question's own syntax text states. the single and the time trial delivered one apk each; the mastery delivered five, one per answer set (set1.answer to set5.answer), under one clock. every question named a case id and a package name, both unique to its apk.
artifact anatomy
each apk unpacks to AndroidManifest.xml, classes.dex, the v1 signing files under META-INF/ and one asset, assets/huntress_puzzle.json:
{"schema": "huntress.mobile.puzzle.v1", "day": 9, "codec": "base64", "data": "..."}
there is no key and no parts. the data is 28 characters, the base64 length of a twenty-character code.
the manifest asks only for the internet permission and declares two exported activities: a launcher MainActivity and a ChallengeActivity behind a browsable deep link (a custom scheme, a host and an /unlock path prefix). the dex defines three classes: the two activities and TrustEveryone, whose only method is describe. its string table carries the story: a label DAY-09:trust_manager:... naming a permissive x509 trust manager, a loopback evidence url with a case-id parameter, a query fragment with a client secret, and the two query parameters the challenge activity reads (case_id and answer).
this is what a permissive trust implementation looks like when it is really there:
// illustrative: the pattern the title refers to, not code from this apk
class TrustAll implements X509TrustManager {
public void checkClientTrusted(X509Certificate[] chain, String type) {}
public void checkServerTrusted(X509Certificate[] chain, String type) {}
public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[0]; }
}
SSLContext tls = SSLContext.getInstance("TLS");
tls.init(null, new TrustManager[] {new TrustAll()}, null);
HttpsURLConnection.setDefaultSSLSocketFactory(tls.getSocketFactory());
HttpsURLConnection.setDefaultHostnameVerifier((host, session) -> true);
in a dex that pattern leaves fixed marks: a class whose interface list names Ljavax/net/ssl/X509TrustManager;, a checkServerTrusted whose body is a bare return-void, references to SSLContext.init and the default socket factory and hostname verifier setters, or a WebViewClient subclass whose onReceivedSslError calls SslErrorHandler.proceed(). a dex lists every type and method it touches in its id tables, framework ones included, so the check is a table lookup. this dex's method table holds only activity lifecycle, intent and uri accessors, text view setters, StringBuilder, and the WebView constructor and loadUrl. none is in javax.net.ssl, and the only url in the dex is plain http:// on the loopback address, so no handshake happens.
the one real trust property is the target sdk, 23: an app targeting api 23 or lower still trusts user-installed certificate authorities by default. every mobile apk this month has targeted 23, so that is a constant of the generator, not this day's design. the only certificate in the package signs the apk.
extraction method
the decoder splits the codec name into steps, walks every reading of the chain, and returns the first output with the answer shape. only when none has it does it fall back to a keyed search and then the general peel, and it says so:
def decode(puzzle) -> str:
codec = _codec_text(puzzle.get("codec", "plain"))
data = _data_text(puzzle.get("data", ""))
steps = _steps(codec) # "base64" -> ["b64"]
for out in _chain(steps, data, puzzle): # every reading, depth first
found = _answer(out)
if found is not None:
return found
... # keyed search, then a peel
on day 9 the chain is one step, base64 over ascii text, and the first reading it yields is the code.
validation and answer formatting
the answer must match ANS-[0-9A-F]{16} exactly once quotes and brackets are stripped; a lowercase reading is uppercased, and a json document counts only if it holds exactly one such string. two candidates, extra text or a substring match is no answer, and the decoder raises instead of submitting. the code is submitted as decoded.
failed approaches and pivots
none on the answer. starting from the title leads to an interception proxy with a home-made ca; the dex id tables rule that out in one lookup, and contacting the loopback service would be out of scope for an artifact-only task. the asset-first order of the toolkit skipped the story.
automation across modes
the day-8 solver read all seven apks as they came: the single, the time trial and the five mastery deliveries all declared the same codec with no key. on day 9 we also widened the decoder (details in the toolkit article): every name in the decoding registry is now a codec name, a keyed step tries every byte reading of the data under every reading of the key, two- to four-byte keys are derived from the known ANS- prefix, and a field whose format is not the code makes the solver raise instead of submitting the code under the wrong field.
lessons
- a challenge title can name a vulnerability class that the artifact only labels. check the dex id tables for the api before planning an exploit around it.
- permissive trust has a signature in a dex, and its absence is as quick to prove as its presence.
- deciding an encoding from its character set is a guess. try every reading and let the answer shape choose.
solve times
public scoreboard · day 9 finish: top 10
- 0:05.1single#6 of 203 solvers
- 0:06.9time trial#4 of 195 solvers
- 0:08.6mastery#2 of 192 solvers
- #7team day finishof 173 teams that cleared it, in 4:18.7
- #2single orderof the day's 5, by our flag time
from the public scoreboard: 09:00 et release to our flag; the table below counts from our attempt's start.
from when we started working on the mode to its flag.
| mode | work to flag | attempts | wrong submits |
|---|---|---|---|
| single | 1.7s | 1 | 0 |
| time trial | 1.9s | 1 | 0 |
| mastery | 1.6s | 1 | 0 |
the clock
server timer of the winning attempt; used is attempt start to flag, left is what remained on the clock.
| mode | time available | time used | time left |
|---|---|---|---|
| time trial | 8.0s | 0.5s | 7.5s |
| mastery | 11.0s | 0.6s | 10.4s |
where we got stuck
- nowhere on the clock: every apk decoded on the declared codec's first reading.
- a latent misread, found by a day 9 backtest that ran day 7's caesar codec under keys the graded sets never used (theirs were 3 to 18). with keys 20 and 21 the declared codec missed. the day 7 rule base64-decoded a keyed step's input whenever its characters fit the base64 alphabet. a byte shift of 20 maps every character of an
ANS-code (digits,AtoF,N,Sand the hyphen) to a letter or a digit, and a shift of 21 does too unless the code holds anF. twenty such characters are valid base64, so the step decoded them to fifteen bytes of noise and only the single-byte key search recovered the answer; a multi-byte key would have escaped that search and crashed. the fix drops the guess: a keyed step now tries the base64, hex and raw-text readings under every reading of the key, and the answer shape picks the one that decodes.
flags: single, time trial, and mastery [redacted].
{generated by a clanker}