Files
OpenFUT/fifa17-recon/tools/ghidra_queries/q_pack_v2_1.py
T
funman300 afdbb364ca fifa17-recon: pack opening reversed end to end, and there is no pack-inventory endpoint
A twelve-agent pass over the parts of pack opening we did not understand, run against
the live client (CardsDLL slide proven, not assumed) plus static CardsDLL. Findings
below survived an adversarial verification round that corrected several of them; where
a verifier and a finder disagreed, the verifier won.

THE HEADLINE IS A NEGATIVE, and it deletes work rather than creating it. There is no
pack-inventory endpoint in FIFA 17 and there never was. Proven three independent ways:
the 48-entry UTAS route template array at 0x18021df80, a regex for "ut/" over the whole
PE, and the 125-row client action table at 0x1802caa20, which is the complete set of
requests the client can originate. "Serve the pack inventory" comes off the backlog.
The unclaimed-pack tile and My Packs are two fields on responses we already build.

Corrections to ENDPOINT_MAP.md, both freeze-risky as written:
  * duplicateItemIdList is an array of OBJECTS (element parser 0x180138e10: itemId
    0x16d, duplicateItemId 0xeb, itemLoans 0x16f, duplicateItemLoans 0xed), not the
    int list documented at :1095 and :218. Control that this is not a misread:
    dreamSquads 0xe9 in FutMoveCard genuinely is a bare int array and parses with no
    inner object loop. We serve [], so this is a docs bug today and a live freeze the
    moment somebody implements it from the map as written.
  * FutDiscardCardServerResponse is {"items":[{"id":N}],"totalCredits":N}. There is no
    top-level id. :968-971 is wrong twice over.

packContentInfo is DECORATIVE. It is read only into a store-tile view model, and
nothing compares the declared counts against the delivered itemList, so open_pack()
does not have to honour the distribution.

The reveal is entirely CLIENT-SIDE. Walkout, tiering, colours and ordering are
arithmetic over fields we already send. Genuine outstanding server work reduces to
three items: duplicates, quick-sell credit, unopenedPacks.

Perishable intel captured: the real FIFA 17 retail pack catalogue, 41 SKUs with Origin
offer ids, recovered from the client heap as a parsed copy of data/store/storecfg.xml.
It is in no file on disk, only in a running process.

futmem/ is a standalone read-only Rust crate for this kind of work (maps, find,
strings, read). Read-only by construction: it opens /proc/<pid>/mem with File::open
and there is no code path in it that can write to another process, because a live game
session depends on that. Its own [workspace] table keeps it out of the parent
workspace. Chunked scanning overlaps by pattern_len-1 so a match spanning a chunk
boundary is still found.

utas_server.py gains FUT_PORT/FUT_LOG so a throwaway instance can be started without
bouncing the one the live client is using. Defaults unchanged (8099, /tmp/utas_server.log).
Noted for the record: this edit came from a research agent that had been told not to
touch server code. It is benign and useful, but it was out of scope.

Not committed: the doc proposes ENDPOINT_MAP.md changes as pasteable text rather than
applying them, and every proposed server change defaults off per the house rule.
Nothing in this commit changes a response the client sees.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 19:24:37 -07:00

125 lines
4.9 KiB
Python

"""VERIFY-1. Adversarial re-derivation of the pack element deserializer.
HYPOTHESES UNDER ATTACK (from D3/D5 reports):
H1 0x18013af30 parses packContentInfo (atom 0x20c) INLINE with EXACTLY five
children: 0x170,0x149,0x2c6,0x63,0x273 -> rec+0x144..+0x154.
H2 atoms 0x2e3 (start) and 0x35d (unopened) are TOP-LEVEL, not inside 0x20c.
H3 atoms 0x15c,0x26b,0x298,0x20f,0x176 have REAL arms (not SKIP).
H4 record stride 0x158, and a CMP against 0x64 caps the store at 100 packs.
H5 firstPartyStoreId (0x127) in the PACK element uses the STR getter 0x1801c7aa0
+ atoi, NOT the INT getter.
METHOD DELIBERATELY DIFFERENT FROM THE ORIGINALS: I dump the FULL RAW DISASSEMBLY
of the function (every instruction, address + mnemonic + operands) and analyse the
ladder from bytes/asm, not from the decompiler's frame locals. I also
cross-check with the decompile but the asm is primary.
CONTROL: the function must contain a call to the known SKIP primitive 0x180135ff0
and to the known INT/BOOL/STR primitives; and the FNV hasher 0x180180d00 must
disassemble to the known prologue.
"""
import traceback, sys
OUT = "/tmp/claude-1000/-home-alex-Documents-OpenFUT/8e521ca1-ca3e-4138-bb96-df1744dd1d30/scratchpad/packres/"
try:
def dump_asm(entry, path, label):
f = func(entry)
if f is None:
print("NO FUNCTION at %#x" % entry); return None
body = f.getBody()
lines = []
it = listing.getInstructions(body, True)
n = 0
while it.hasNext():
ins = it.next()
a = int(ins.getAddress().getOffset())
lines.append("%010x %-8s %s" % (a, ins.getMnemonicString(),
str(ins).split(None, 1)[1] if ' ' in str(ins) else ''))
n += 1
open(path, "w").write("\n".join(lines) + "\n")
print("[%s] %s entry=%#x instructions=%d bodysize=%#x -> %s"
% (label, f.getName(), int(f.getEntryPoint().getOffset()), n,
int(body.getNumAddresses()), path))
return lines
print("=" * 78)
print("CONTROL: FNV hasher prologue at 0x180180d00")
print("bytes:", read_bytes(0x180180d00, 16).hex())
f = func(0x180180d00)
print("ghidra fn:", f.getName() if f else None)
print()
print("=" * 78)
print("PACK ELEMENT DESERIALIZER 0x18013af30")
src = dec(0x18013af30)
open(OUT + "v1_packelem_dec.txt", "w").write(src)
print("decompile len(src) =", len(src), " lines =", src.count("\n"))
lines = dump_asm(0x18013af30, OUT + "v1_packelem.asm", "packelem")
# ---- ladder reconstruction from ASM ----
# Find every CMP/SUB against an immediate in the atom range, in address order,
# together with the following conditional jump target.
print()
print("--- ATOM LADDER (SUB/CMP against immediates, address order) ---")
f = func(0x18013af30)
it = listing.getInstructions(f.getBody(), True)
seq = []
while it.hasNext():
ins = it.next()
m = ins.getMnemonicString()
if m in ("SUB", "CMP", "ADD"):
try:
sc = ins.getScalar(1)
except Exception:
sc = None
if sc is not None:
v = int(sc.getUnsignedValue())
if 1 <= v <= 0x400:
seq.append((int(ins.getAddress().getOffset()), m, str(ins), v))
run = 0
for a, m, s, v in seq:
if m == "SUB":
run += v
elif m == "CMP":
run += v
print("%010x %-40s imm=%#x running=%#x" % (a, s, v, run))
print()
print("--- CALLS to known primitives, with address ---")
PRIM = {0x1801c79d0: "INT", 0x1801c7620: "BOOL", 0x1801c7aa0: "STR",
0x180135ff0: "SKIP", 0x1801c7f10: "NEXTTOK", 0x1801c8270: "BEGINOBJ",
0x18013fe00: "ITEMDESER", 0x1800d7af0: "clampI32", 0x1800d7b30: "clampNonNegI32",
0x1800d7b10: "toU16", 0x180138bd0: "CURRENCYELEM", 0x180139070: "FINALPRICE",
0x18013aae0: "ORIGPRICE"}
it = listing.getInstructions(f.getBody(), True)
while it.hasNext():
ins = it.next()
if ins.getMnemonicString() == "CALL":
for r in ins.getFlows():
t = int(r.getOffset())
if t in PRIM:
print("%010x CALL %-14s (%#x)" % (int(ins.getAddress().getOffset()), PRIM[t], t))
print()
print("--- STRIDE / CAP evidence: instructions between 0x18013bad0 and 0x18013bb60 ---")
a = 0x18013ad0 and 0x18013bad0
while a < 0x18013bb60:
ins = listing.getInstructionAt(addr(a))
if ins is None:
a += 1; continue
print("%010x %s" % (a, str(ins)))
a += ins.getLength()
print()
print("=" * 78)
print("PACK RECORD CTOR 0x1801342d0")
src2 = dec(0x1801342d0)
open(OUT + "v1_packctor_dec.txt", "w").write(src2)
print("len =", len(src2))
print(src2)
dump_asm(0x1801342d0, OUT + "v1_packctor.asm", "packctor")
except Exception:
traceback.print_exc()