- C 86.1%
- Logos 6.8%
- Python 6.5%
- Shell 0.5%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
- src/Tweak.x: log the Madrid loginDelegates result on the iMessage path (status, byte count, reply keys, which of auth-token/profile-id/self-handle are present). Values are never logged. - docs/COMPATIBILITY.md: new section with the measured device evidence from a real iPod touch 4G on iOS 5.1.1 — iCloud sign-in works through Settings, imagent completes GSA and receives a Madrid token with handles, iMessage and FaceTime activation still fail at Apple (Registration Status 5) with the network, TLS and device certificate (valid to 2029) all ruled out, and the AAFix tweak interaction that blocked Settings sign-in. - CHANGELOG.md: same, as an entry under the unreleased section. |
||
| docs | ||
| layout/DEBIAN | ||
| scripts | ||
| src | ||
| tests | ||
| tools/gsatest | ||
| .gitignore | ||
| CHANGELOG.md | ||
| control | ||
| GSAPort-safe.plist | ||
| GSAPort.plist | ||
| LICENSE | ||
| Makefile | ||
| NOTICE | ||
| README.md | ||
GSAPort
GSAPort is a jailbreak tweak for old iOS. It installs an NSURLProtocol
subclass (GSAPortProtocol) into a few system processes, catches the Apple ID
sign-in requests those processes send, and re-implements the sign-in on top of
Apple's GrandSlam Authentication (GSA) protocol: SRP-6a over the 2048-bit
RFC 5054 group, SHA-256, a PBKDF2-derived password, and anisette headers from a
provider you configure. The SRP encoding follows Apple's corecrypto
(SRP6a_HASH, no username in x, 256-byte padding, raw salt), as AltSign
does.
When the GSA exchange succeeds, the tweak takes the tokens it received (the PET and the MobileMe auth token) and substitutes them into the legacy request the old process wanted to send. The process finishes signing in without knowing that the protocol underneath it changed.
GSAPort adds no new account type and patches no binaries. It sits between the caller and the network.
Anisette — the header set that proves a request came from a real Apple device —
comes in two flavours. The default, v3, provisions an identity for this
device through the provider's /v3 endpoints and Apple's machine-provisioning
service, stores it privately, and reuses it. The legacy v1 fetch, a plain
GET for a ready-made header set, remains as the fallback for providers
without those endpoints. Apple accepted the provisioned v3 identity at GSA
complete where the old shared v1 one was refused at init; see
docs/COMPATIBILITY.md.
Status
Canonical source: src/Tweak.x plus the anisette module (src/GSAAnisetteV3.h, src/GSAAnisetteV3.m, src/GSAWebSocket.h, src/GSAWebSocket.m) is the complete compilable source. The 2.0 decompiled tree is reference-only; see docs/SOURCE_OF_TRUTH.md.
- Source: builds on the maintainer's host with Theos, the iPhoneOS 7.0
SDK and
ldid, targeting armv7. Built packages are inpackages/, namedcom.podpod123.gsaport_2.3.1-<revision>+debug_iphoneos-arm.deb. - Anisette: v3 is the default when the provider supports it, and v1 stays
as the fallback. With the previous shared v1 identity Apple answered
-36607("Unable to sign you in. Try again later") or-80045at GSAinit; with a freshly provisioned v3 identity the same account reachedcompletewithec 0,hsc 409(2FA) andM2verified. That evidence comes from the independent reference client that proved the protocol, not from the tweak. - Two-factor: an
auofsecondaryAuthnow drives Apple's SMS challenge (GET /authfor the number list,PUT /auth/verify/phoneto ask for the text,/auth/verify/phone/securitycodeto check the code);trustedDeviceSecondaryAuth, or anhscof409with noau, drives the trusted-device push andGsService2/validate. In the reference runs a push plus aGsService2/validatethat answered HTTP 200 withec 0still produced another409on the next sign-in, three times over, while the SMS code produced acompletewith no second-factor challenge and a PET. That is reference-client evidence as well: an end-to-end sign-in through Settings on a device is still pending. - Device behaviour: not verified by this repository snapshot. A full v3 sign-in through the tweak has not been verified end to end on a device. Nothing here claims that a sign-in succeeds on real hardware or against today's Apple servers.
- Upstream: GSAPort 2.3 reports iOS 6 and 7 working and iOS 8 failing.
- Apple side: a working build and a working SRP exchange do not guarantee a working sign-in. See What "working" means.
Scope
GSAPort targets iOS 5.0 through 7.x. Inside that range the picture is:
| iOS | Support |
|---|---|
| 5.0 – 5.1.1 | Deployment target and allowed by the package metadata; not separately confirmed |
| 6.x | Reported working by upstream; not re-verified here |
| 7.x | Reported working by upstream; the SDK this tree builds against |
| 8.0 and later | Not supported. The affected code paths use NSURLSession, which NSURLProtocol interception does not reach the same way |
The package declares firmware (>= 5.0) and firmware (<< 8.0), depends on
mobilesubstrate, and is built for armv7 only. There is no arm64 slice and
no rootless variant.
Repository layout
| Path | What it is |
|---|---|
src/Tweak.x |
The tweak: GSAPortProtocol, the SRP-6a implementation, anisette mode selection, endpoint handlers. Upstream 2.3 source. Compiled. |
src/GSAAnisetteV3.h, src/GSAWebSocket.h |
Frozen interfaces: tweak ↔ anisette module, and anisette module ↔ WebSocket client. |
src/GSAAnisetteV3.m, src/GSAWebSocket.m |
v3 anisette client: /v3 probing, provisioning over a TLS WebSocket, get_headers, resync and the on-disk identity. The legacy v1 GET stays in src/Tweak.x. Compiled. |
src/polyfill.x |
Subscripting polyfill for pre-iOS 6 runtimes. Compiled. MIT, © 2025 Preloading. |
src/SubscriptCompat.h |
Declarations the polyfill needs at compile time. Compiled. |
src/openssl/ |
OpenSSL 1.1.1w headers and an armv7-only libcrypto.a static archive. libssl.a was unused and removed. |
src/decompiled/GSAPort-2.0/ |
Decompiled 2.0 reference (helpers/, protocol/, runtime/, srp/). Not compiled, not packaged. |
docs/2.0-decompiled.md |
Companion notes for the 2.0 reference, owned by the reconstruction effort. |
tools/gsatest/ |
On-device test harness (not packaged): anisette, reset-anisette, login, code, probe, logs. |
tests/ |
Offline Python unit tests, including static checks on the sources and the docs. |
scripts/ |
Build and device-install wrappers. |
layout/DEBIAN/postinst |
Kills accountsd, gamed and imagent after install. |
Makefile, control, GSAPort.plist |
Theos build, package metadata, substrate filter. |
2.3 and 2.0
The Makefile builds src/Tweak.x and src/polyfill.x. That is the 2.3 line:
the maintained upstream release, complete enough to compile, and the only
source in this tree that produces an installable tweak.
src/decompiled/GSAPort-2.0/ is a separate artefact: a 2.0 binary
decompiled back into readable C/Objective-C and split by area. It is kept for
interoperability and archaeology, so that 2.3 behaviour can be compared
against the older release and so the protocol work is not lost if the original
binary disappears. It does not compile as a tweak, is not referenced by the
Makefile, and is not part of the package. Treat it as documentation.
Build
Requirements: macOS or Linux with a working Theos install, an iPhoneOS 7.0
SDK, and ldid on PATH. This tree is known to build on the maintainer's
host with those three pieces; it has not been built on other configurations.
THEOS=/path/to/theos scripts/build.sh
scripts/build.sh wraps the Theos build, strips modern code signatures,
renames the iOS 5 constructor pointers and repacks the package; use it rather
than a bare make package for an iOS 5 install. The maintainer's host runs it
with the pinned toolchain:
nix shell nixpkgs#ldid nixpkgs#dpkg -c env THEOS=/tmp/theos scripts/build.sh
The package lands in packages/ as:
packages/com.podpod123.gsaport_2.3.1-<revision>+debug_iphoneos-arm.deb
Theos increments <revision> on every build, so the exact filename changes
from build to build: earlier verified runs produced 2.3-11+debug and later
revisions, and the current 2.3.1 series has built through 2.3.1-8+debug.
Use the glob
packages/com.podpod123.gsaport_2.3.1-*_iphoneos-arm.deb in scripts.
SDK 7.0 is the tested SDK. SDK_VERSION=9.3 is accepted but unverified; see
docs/BUILDING.md for SDK, ldid and troubleshooting
details.
Configuration
Upstream 2.3 hard-coded the author's anisette proxy and a private shared secret. Both are removed from this tree. You must point the tweak at an anisette provider yourself, in:
/var/mobile/Library/Preferences/com.podpod123.gsaport.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AnisetteURL</key>
<string>https://your-anisette-endpoint/</string>
<key>AnisetteMode</key>
<string>auto</string>
<key>AnisetteKey</key>
<string>only-if-your-provider-needs-it</string>
</dict>
</plist>
Replace https://your-anisette-endpoint/ with your provider's endpoint, and
drop AnisetteKey entirely if your provider does not use the signed scheme.
| Key | Type | Meaning |
|---|---|---|
AnisetteURL |
string, required | Full HTTPS endpoint; must start with https://. For v3 it needs the /v3/client_info, /v3/provisioning_session (WebSocket) and /v3/get_headers endpoints; without them, or in v1 mode, it is requested with X-Device-Uuid and must return a JSON object of header name to string value. |
AnisetteMode |
string, optional | auto (default), v3 or v1; case-insensitive and trimmed. auto uses v3 when the provider answers the v3 probe, otherwise the v1 GET; v3 and v1 force a mode. An unknown value is logged and treated as auto. |
AnisetteKey |
string, optional | Only for the 2.3 signed pk / podkey scheme, and only on the v1 GET. Never compiled in; read from this file at runtime. |
DebugLog |
boolean, optional | Default NO. When YES, the tweak appends a debug log to /var/mobile/Library/Logs/GSAPort-debug.log (mode 0600). No secret, identifier or full URL is written either way; see Security and privacy. |
If AnisetteURL is missing, not a string, or does not start with https://,
authentication fails: the tweak logs a message and sends no credential
anywhere. Returned header values containing CR or LF are dropped, as are
non-string keys and values.
There is no downgrade inside one attempt. If v3 is selected and provisioning
or get_headers fails — including a partial header answer that lacks any of
the seven values the sign-in needs — the sign-in stops with the alert
"Anisette v3 failed (domain code)": mixing a v1 header set into a v3
session would present two device identities to Apple, and would hide the real
fault. The fallback happens on the next attempt, when the v3 probe answers no,
or immediately with AnisetteMode set to v1. A first v3 provisioning runs
once per device/provider pair and is then reused.
The keys are read when a sign-in starts (AnisetteMode is resolved once and
held for 60 seconds, so an edit is honoured within a minute without a respring).
Restarting the daemons is only needed after installing a new dylib:
killall -9 accountsd gamed imagent
AnisetteKey is a shared secret. Anyone who can read the preferences file can
read it; keep the file at mode 0600 and owned by mobile.
The tweak touches these paths, all owned by mobile:
| Path | When | Contents |
|---|---|---|
/var/mobile/Library/Preferences/com.podpod123.gsaport.plist |
you create it | The preferences above. |
/var/mobile/Library/Preferences/com.podpod123.gsaport.anisette.plist |
after the first v3 fetch | The provisioned anisette identity: the 16-byte identifier and adi_pb, tied to the provider URL. Mode 0600. Sensitive: it is what Apple sees as this device. A com.podpod123.gsaport.anisette.lock beside it serialises provisioning between processes. Delete it to provision afresh. |
/var/mobile/Library/Preferences/com.podpod123.gsaport.2fa.plist |
while a two-factor code is pending | A v2 record: DSID, GsIdmsToken, the password-derived key P, the challenge sp / salt / iteration count, a timestamp, and which second factor is pending (mode = sms or trusted, plus the chosen phoneId when it is sms). Expires after 600 seconds. Mode 0600. |
/var/mobile/Library/Logs/GSAPort-last-error.txt |
when a user-facing error is raised | The message shown in the alert. Mode 0600. |
/var/mobile/Library/Logs/GSAPort-debug.log |
only with DebugLog = YES |
Debug trace. Mode 0600. Deleted at load when the preference is off. |
The /tmp/GSAPort-debug.log and /tmp/GSAPort-last-error.txt files belong to
older builds. This version never writes them and deletes them when the tweak
loads.
Installation
scripts/install-device.sh copies and installs the package over SSH. It is
environment-driven and never hardcodes credentials:
| Variable | Default | Meaning |
|---|---|---|
GSAPORT_DEVICE_HOST |
required | Device hostname or IP |
GSAPORT_DEVICE_USER |
root |
SSH user |
GSAPORT_DEVICE_PORT |
22 |
SSH port |
GSAPORT_DEVICE_PASSWORD |
unset | Optional; passed via sshpass -e, never on the command line |
GSAPORT_PACKAGE |
unset | Optional explicit package path; otherwise the built package is used |
GSAPORT_DEVICE_HOST=192.0.2.10 scripts/install-device.sh
By hand, the package is an ordinary Debian package: copy it to the device,
dpkg -i it, then respring. The post-install script kills accountsd,
gamed and imagent so they reload the tweak.
Security and privacy
Read this before installing.
- The tweak runs inside processes that see your Apple ID password in memory, and it rewrites the login traffic those processes send. Only install it on a jailbroken device you control.
- Your anisette provider is trusted infrastructure. In v1 it receives the
device UUID and returns headers that Apple accepts as proof the request came
from an Apple device. In v3 it handles the provisioning conversation and the
get_headerscalls and sees the identity it hands out; Apple's machine-provisioning endpoints are contacted by the tweak directly. Use only an HTTPS provider you run or genuinely trust. - The v3 anisette identity is device-identifying state. The file above
holds the 16-byte identifier and
adi_pb, is mode0600and owned bymobile, and — like the 2FA entry — is readable by any process running asmobile. It cannot sign in on its own, but copying it to another device lets that device present the same identity to Apple. Delete the file, or callGSAAnisetteV3Reset(), to replace it. - The tweak does not pin TLS certificates. It relies on the system trust store
and on
NSURLConnection/ CFStream defaults; the v3 provisioning socket validates the certificate chain with the provider's host name as the peer name, which is the same policy, not a stricter one. - Debug logging is off by default, and no log is written to carry secrets
or identifiers. Set the optional
DebugLogpreference toYESto append to/var/mobile/Library/Logs/GSAPort-debug.log(mode0600, opened withO_NOFOLLOW); with the preference unset orNO, the file is deleted when the tweak loads. No line carries the username, the password or its length, the device UUID, a token, a response body, or a full URL with its query string — host and path only.NSLoglines follow the same rules and are always sent to the device log, and the interception check logs nothing at all. GSA status codes, Appleec/hscvalues andNSErrors are still logged — an error only as its domain and code, never its description, which can contain a full URL. In aggregate they still describe which accounts you tried and when, so treat the log as private and do not paste it into an issue tracker unredacted. Apple's ownemtext is shown in the alert and written to the0600last-error file; it is user-facing prose, not a secret, and it is not copied into the debug log. - Known limitation: while a two-factor code is pending, the tweak keeps a
password-derived key, not your password, in
/var/mobile/Library/Preferences/com.podpod123.gsaport.2fa.plist(mode0600, shared by all hooked processes). The entry holds the DSID,GsIdmsToken, thespvariant, salt and iteration count, andP, the 32-byte PBKDF2 output that SRP consumes as the password.Pcannot be turned back into the typed password, and the password itself is never written. Be honest about whatPis, though: it is password-equivalent for this account's GSA sign-in. Anyone who can read the file while the entry is live can run the SRP exchange as you, and with the DSID andGsIdmsTokensitting next to it can validate a code too. That window is bounded: entries expire after 600 seconds (ten minutes) and are pruned on load and before use, as are entries dated more than 60 seconds in the future. The entry is removed only after the resumed sign-in passesM2and the negotiation proof without a new 2FA challenge, or when the code check fails for a reason other than a wrong code (an SMS status other than 400/401/403, or an Appleecother than-21669). The file is mode0600, but it is readable by any process running asmobile— which is every app on the device — so a compromised app can read it inside that window. Older builds stored the password in plaintext; this one discards such a legacy entry the first time it loads and rewrites or removes the file. - Other tokens (PET, MobileMe token) are not written to disk or the keychain
by the tweak; they live in memory and in the requests it substitutes. The
exception is the 2FA pending entry, which holds
GsIdmsTokenand the DSID for up to ten minutes, as described above. - Two-factor is driven from the tweak, in two branches. An
au = trustedDeviceSecondaryAuthreply — or anhscof409that names no secondary-auth mode — triggers Apple's trusted-device push, and the code the push produces is checked withGsService2/validate. Anau = secondaryAuthreply is the SMS factor: the tweak reads which numbers Apple will text (GET /auth), asks for a message (PUT /auth/verify/phone), checks the code with/auth/verify/phone/securitycode, and then continues the sign-in with the stored key. The tweak cannot receive the text message itself — it goes to the phone number on the account — so the code has to be typed in by hand. After the first attempt, enter only the 6-digit verification code in the password field. Do not enter your password plus the code. Neither the phone numbers Apple lists nor the code are logged, stored or sent anywhere except Apple: the debug log records the count of numbers, the id the tweak picked, HTTP statuses and Appleecvalues. - Stated limits: the 6-digit ambiguity is still there — while a pending
entry exists for a username, a submitted value of exactly six digits is
treated as a code, so a password that happens to be six digits cannot be used
to start over until the entry expires (ten minutes) or a code is accepted. A
request for an SMS that gets no HTTP answer, or a status of
400or above, stores no pending state and answers401with "Could not request an SMS code from Apple (HTTP n)", so the retry starts from the password. The pending file is still only per-process locked, not across processes.
What "working" means
A green build, a reachable anisette provider and a completed SRP exchange prove that the transport and the cryptography ran. They do not prove that Apple accepted the sign-in. Transport can work while Apple still rejects the authentication for account or 2FA reasons.
Apple can reject authentication for reasons that have nothing to do with this tweak:
- the account is locked, disabled, or has a changed terms-of-service gate;
- the account's second factor is a push no trusted device shows, or an SMS to a number you cannot reach (the tweak cannot receive a text message itself);
- rate limiting after repeated attempts;
- server-side removal of the legacy endpoints this tweak depends on.
If the logs show a clean GSA exchange and the device still refuses to sign in, the remaining cause is usually on the account side.
Tests
The test suite is offline and uses only the Python standard library. It does not contact Apple, SideStore or the device.
python3 -m unittest discover -s tests -v
python3 -m unittest tests.test_static is the documentation gate: it reads
the README and the docs in this tree and fails when a required topic
disappears.
The tests cover the SRP group and pin corecrypto-compatible vectors,
including leading-zero salt, A, B and S edge cases, plus static checks
on the source: protocol markers, expected endpoints, configuration keys, the
absence of embedded credentials, and the v3 anisette interface and state-file
handling (tests/test_anisette_v3.py). They are unit tests, not an integration
test against Apple.
Provenance and licensing
| Component | Origin | Licence |
|---|---|---|
src/Tweak.x |
GSAPort 2.3 by Pod <pod@podpod123.com> |
No licence grant in the upstream distribution; copyright remains with the author. See NOTICE. |
src/polyfill.x |
Preloading, 2025 | MIT |
src/openssl/ |
OpenSSL 1.1.1w, rebuilt ARM-only | OpenSSL License + SSLeay License |
src/GSAAnisetteV3.h, src/GSAAnisetteV3.m, src/GSAWebSocket.m |
This repository | MIT (see LICENSE) |
tools/gsatest/ |
This repository | MIT (see LICENSE) |
src/decompiled/GSAPort-2.0/ |
Reconstruction effort | Reference only; see NOTICE |
| Makefile, scripts, tests, docs, packaging | This repository | MIT (see LICENSE) |
The MIT licence in LICENSE covers only the material authored for this
repository. It does not relicense the upstream tweak source, the upstream
packaging metadata, the decompiled reference, or OpenSSL; those terms are in
NOTICE.
Upstream discloses partial AI assistance in writing the tweak, and states that
the SRP code derives from pysrp. This
tree has since changed its encoding to match corecrypto; see
docs/ARCHITECTURE.md. The
protocol information came from a public
gist.
The anisette server lineage is
anisette-v3-server. The OpenSSL
headers and archive were originally contributed by electimon; the vendored
libcrypto.a has since been rebuilt ARM-only because the old Thumb archive
crashed on a Cortex-A8 device (see
src/openssl/README.md).
Apple, Apple ID, iCloud, Game Center, Find My and related marks are trademarks of Apple Inc. This project is not affiliated with, endorsed by, or supported by Apple.
Documentation
- docs/ARCHITECTURE.md — interception, request flow, SRP-6a as implemented, anisette, 2FA state, known security limitations.
- docs/SOURCE_OF_TRUTH.md — canonical source and the 2.0 reference split.
- docs/BUILDING.md — toolchain, SDK caveats, packaging, scripts, troubleshooting.
- docs/COMPATIBILITY.md — version matrix, processes, known failure modes.
- CHANGELOG.md — what changed in this tree.