Takopi Class  /  Recap

Session 12

Still on CapCut, carrying session 11 forward. Session 11 mapped the GIS hand-off that mints the token, today the question is whether that modern flow can be downgraded to an older, weaker Google flow, and the two reusable patterns that fell out of reading how the OAuth link is built and where the token is actually minted.

Summary of findings

From section 01, Where session 11 left us, and today's question

continue · the GIS mint

Session 11 read the GIS credential flow down to the backend endpoint that eats the token, passport/web/auth/login, and parked three tracks. Today picks up the third, downgrade the OAuth to an older flow and test that path. The question is whether CapCut's login can be made to run a weaker Google grant than the GIS button it shows, and whether that grant hands the token back somewhere softer.

  1. 02The login bundle still has a legacy Google builder that uses the implicit grantTarget: the login JS on www.capcut.comInfoRead, not fired yet
  2. 03The callback page only writes to localStorage. A second popup mints the session.Target: the passport popup on www.capcut.comInfoRead in the bundle
  3. 04Mint before the redirect is the safe shape. Redirect before the mint can be weak.Target: none, a method noteNotePattern to carry
  4. 05A server-built link hides its parameters. A DOM-built link shows them.Target: none, a method noteNotePattern to carry
  5. 06The safe flow leaks only if two conditions hold. One condition is in hand.Target: the CapCut login, flow 1Not ratedOne of two conditions proven
  6. 07The next= value reaches an external host through a two-step redirectTarget: www.capcut.com, /passport/web/web_login/LowConfirmed on the error branch
  • Low Proven on the target. The source rates it low as tested. The success branch decides the final severity.
  • Not rated Plan or lead. It is not proven on the target.
  • Info Groundwork. No security effect is claimed.
  • Note A method or a lesson. Not a test result.

Scope

Session

Asset www.capcut.com IdP Google OAuth Goal downgrade the OAuth flow Date 2026-11-22
Live requests
/passport/web/web_login/ and /passport/web/web_login_success
Code read
The login JS bundle, the legacy builder and the passport popup
Google
accounts.google.com/o/oauth2/v2/auth

Where each test ran

  • Read only: sections 02 and 03 read the login bundle
  • Method notes: sections 04 and 05 teach two patterns
  • Plan only: section 06 names two conditions
  • Live on the target: section 07 fired the passport flow, error branch, headless Chrome
  • Not started: the success branch and the token+code leak, see Open items

Findings

Each card is one result. The number is the section number of the original brief. Long code is in Evidence.

02Inforead · found · downgrade candidate, in the JS

The legacy implicit flow is still in the login bundle

Target

The login JS on www.capcut.com. The legacy Google builder sits next to GIS.

Impact
The implicit grant hands the access token and id_token back through the browser URL fragment to /third-party-callback, a bigger surface than a server-side code exchange. It is reachable only because the old builder is still in the bundle, and the redirect_uri is built from location.origin. Firing it and testing what the callback accepts is the non-happy path, still todo.
Steps

Reading the login JS, a legacy builder is still shipped alongside GIS. Reconstructed from the bundle, it builds a Google authorize URL by hand with response_type: "token id_token", the implicit grant, not GIS and not a code flow. That is the downgrade: the app only shows the GIS button, but the old implicit builder is still reachable in the same code.

Evidence
FieldValue
client_id87571557143-buc0jlq1ncffscght599nhlgl1u977cr.apps.googleusercontent.com (the Login client)
response_typetoken id_token, implicit, the token and id_token come back in the URL fragment
redirect_urilocation.origin + /third-party-callback
result sinklocalStorage['__thirdPartyCallbackResult__'], written by the callback page
Status

Open. The builder is read, not fired. Firing it is still to do.

03Inforead · trace · where the session is actually minted

The callback does not mint, the passport popup does

Target

The passport popup passport/web/web_login and the exchange endpoint /lv/v1/user/web/login/third_callback on www.capcut.com.

Impact

The source gives no impact for this section. It marks next= and use_local_host=1 for later tests.

Steps

The /third-party-callback page does not exchange anything on its own, it only writes the result into localStorage. The session mint is a second popup, to passport/web/web_login, whose next= points at the real exchange endpoint /lv/v1/user/web/login/third_callback. Reconstructed from the minified bundle:

  • Two legs, the Google authorize leg mints the token to /third-party-callback, the passport leg trades it for a CapCut session at third_callback, server-side
  • next= is the attacker-interesting parameter, it is a callback URL assembled in the DOM and URL-encoded into the popup, test it for callback substitution and open redirect once fired
  • use_local_host=1 echoes the session 09 isInapp shape, a client-set flag riding into a server flow, note it and come back to it
Evidence

The popup code is long. It is in the evidence section.

Status

Traced. Section 07 fired the next= test. The use_local_host=1 test is still open.

04Notenote · a pattern for any OAuth target

Two shapes of OAuth flow

Target

No target. This is a method note.

Impact
The legacy downgrade we found lands in flow 1, so the downgrade on its own does not hand over the token. The lead is only real if the mint can be pushed to after a redirect we influence, which is why the next step is firing the implicit builder and watching exactly when and where the token is turned into a CapCut session.
Steps

A pattern to carry to any OAuth target, and it comes down to one thing, whether the token is minted before or after the redirect back to the app.

Flow 1, mint before the redirect, safe
  • client → data in token → Google → code → mint → redirect
  • The token is already minted by the time the browser is redirected back, the code never sits in a stage you can reach and re-point
  • Nothing attacker-reachable between the grant and the session, this is the shape the legacy CapCut login runs [UNCLEAR IN SOURCE]
Flow 2, redirect before the mint, might be vulnerable
  • client → data in token → Google → code → redirect → mint
  • The code comes back through the browser first and is minted afterwards, so there is a stage where the code and its callback target pass through somewhere you can read and maybe influence
  • This is where redirect_uri substitution, code injection and callback swaps live, the mint is only as safe as the redirect that feeds it
Evidence

The source gives no request or code for this section. It is a pattern note.

Status

Noted. The next step is to fire the implicit builder from section 02.

06Not ratedmodeled · plan · one condition already in hand

When the safe flow still leaks, two conditions

Target

The CapCut login, flow 1 from section 04.

Impact
Flow 1 leaks only if both hold, and condition 2 is already in hand. The remaining lever is the non-happy-path response that returns token+code, chain it to the server-side open redirect and the safe flow hands its artifact to an external host. Nothing is chained end to end yet, condition 1 is still to be proven.
Steps

Section 04 put the legacy CapCut login in flow 1, mint before redirect, the safe shape. Safe is not the same as unreachable. Flow 1 turns exploitable when two conditions line up at once, and one of them is already proven below.

Condition 1, a non-happy path that hands back the artifact
  • Force response_type=token+code instead of the plain code the flow normally asks for
  • The server answers 200 with an error, not the usual redirect, and the token and code ride back in that response, the branch nobody meant to carry them
  • This is the lever still to run, it is what exposes something worth stealing in a flow that otherwise mints out of reach
Condition 2, a server-side open redirect
  • A redirect the server emits in a Location header, not a client-side one, so it fires before any page script and before a URL fragment would be dropped
  • Achieved, the two-step next= redirect in the next section lands on an external host from the server side
  • This is the exfil channel, it carries whatever condition 1 exposes off to a host you control
Evidence

The source gives no request for condition 1. The proof of condition 2 is in section 07.

Status

Open. Condition 2 is proven. Condition 1 is not proven. Nothing is chained end to end.

07Lowtested live · confirmed · error branch, headless Chrome

The next= lead pays off, a two-step open redirect

Target

/passport/web/web_login/ and /passport/web/web_login_success on www.capcut.com, with no cookies.

Impact
Impact as tested is a plain redirect on the error branch, standalone that is low. What decides severity is the success branch, a valid Google code plus a forged state still redirecting to the payload and what it appends to it, which needs one real Google login on a test account and is not run yet.
Steps

Firing the passport flow from section 03 and watching next= turned the lead into a real open redirect. It is a two-step shape, one request reflects your value into the OAuth state, a second request reads that state and redirects on it, and the host allowlist on the second step is bypassable.

Flow chart 1How does the next value reach an external host?
Attacker Server next copied lift state check slips Send link with next Return 302 to Google Replay state in step 2 Redirect to external host 1 2 3 4
  • Start or end
  • Action
  • Attack path
  • Step number
  1. attacker link, step 1GET /passport/web/web_login/?...&next=PAYLOADthe value of next is copied into state verbatim, step 1 validates nothing
  2. 302 out to GoogleLocation: accounts.google.com/...&state=<blob that embeds next>drop the Google hop, lift the state straight out of the response header
  3. replay, step 2GET /passport/web/web_login_success?state=<blob>step 2 is the allowlist that should pin the host to capcut.com, and it is the one that slips
  4. 302 to an external hostLocation: https://example.com/
Evidence

The values that land off-site, all driven through the real two-step flow with no cookies, headless Chrome 157 confirmed on each.

Vector, the next valueBrowser lands on
https:\\example.comhttps://example.com/
https:\/example.comhttps://example.com/
https:\\[email protected]/https://example.com/
http:example.comhttp://example.com/
http:\example.comhttp://example.com/

Two families, one root cause. The check only runs its host rule when it already sees a // authority, so anything without one walks past it and the browser fills in the rest.

  • The backslash family, https:\\ and https:\/, the browser normalises \ to / so it navigates to a // authority, but the validator saw backslashes and no //, so its host rule never fired, and with [email protected] the part after the @ is the real host
  • The schemeless-authority family, http:example.com and http:\example.com, a bare scheme:opaque with no // is still an absolute URL to the browser, and jumping from the https page to http lands you off-origin
The state is unsigned, so the proof is a single cookieless link on www.capcut.com. It is md5(msgpack)[k:k+8] + base64url(msgpack) with k the first hex digit of that md5, forgeable offline, step 2 accepted states built by hand. Blocked correctly, every foreign host with a real //, the plain \@ delimiter trick on its own, and javascript: or data: which browsers do not follow from a 302.
Status

Confirmed. The error branch redirects to an external host. The success branch is not run yet.

Evidence

This section has the long code. Click an item to open it. Use Copy to copy a code block.

E1The legacy builderread · legacyGoogleLogin, reconstructed from the bundle

Evidence for section 02.

js
function rnd(len = 20){
  return crypto.getRandomValues(new Uint8Array(len))
    .reduce((acc, b) => acc + b.toString(16).padStart(2, "0"), "");
}

function legacyGoogleLogin(clientId){
  const state = rnd(), nonce = rnd();
  const p = new URLSearchParams({
    response_type: "token id_token",            // implicit, NOT GIS, NOT code
    client_id:     clientId,                    // 87571557143-buc0...977cr  (Login)
    redirect_uri:  location.origin + "/third-party-callback",
    scope: "openid https://www.googleapis.com/auth/userinfo.profile "
         + "https://www.googleapis.com/auth/userinfo.email",
    prompt: "select_account", nonce, state
  });
  const url = "https://accounts.google.com/o/oauth2/v2/auth?" + p;
  window.open(url, "", "fullscreen=1,width=800,...");   // popup
  // then waits for /third-party-callback to write
  //   localStorage['__thirdPartyCallbackResult__']
}
E2The passport popupread · reconstructed from the minified bundle, section 03

Evidence for section 03.

js
const tl = `${location.origin}/passport/web/web_login/`;
const tf = tn?.redirectUrlGetter
         ? tn.redirectUrlGetter(location.origin)
         : `${location.origin}/lv/v1/user/web/login/third_callback`;
// tf may gain ?invite_code=... and a trailing flag before it is used

window.open(
    `${tl}?account_sdk_source=web`
  + `&aid=${aid ?? APP_ID}`
  + `&next=${encodeURIComponent(tf)}`
  + `&platform_app_id=${platformAppId}`
  + `&use_local_host=1`
  + `&action=${loginOnly ? "login_only" : "undefined"}`
  + `&scopes=${scopes ?? "email"}`,
  "", `fullscreen=1,width=...,height=...`
);
08

Open items

Session track list

The full plan for the CapCut work, in order. Downgrade is done, the OAuth flow test is where we are now, the rest are queued for next session. Nothing is marked done until it is actually proven.

  • Downgrade OAuthdone
    • client-id 87571557143-buc0jlq1ncffscght599nhlgl1u977cr.apps.googleusercontent.com, the Login client
    • the flow is client → Google → code → mint at /third-party-callback
    • to reach it, log out, open settings, click the profile, that lands on the legacy OAuth
  • OAuth flow testhere
    • the data rides in state, next is reflected into it and the second step redirects on it
    • two-step open redirect confirmed on the error branch, section 07
    • still open, the success branch and the response_type=token+code leak chained to the redirect, section 06
  • OAuth for Facebook, Apple and the rest
  • GIS token mint
  • Facebook token mint
  • There is a second Facebook path
  • Feature in the DOM
  • API from the JS files, IDOR
  • DOM bugs from the JS files
  • Bucket brute
  • Non-happy path

Other open tests

  • From section 02, impactFire the legacy builder. Test what the callback accepts. Read the section 02 impact.
  • From section 03, stepsTest next= for callback substitution. Test use_local_host=1. Read the list in section 03.
  • From section 06, condition 1Run the response_type=token+code request. Chain it to the redirect from section 07.
  • From section 07, impactRun the success branch with one real Google login on a test account. Read the section 07 impact.