Skip to content

Instantly share code, notes, and snippets.

@p0358
Last active March 15, 2023 19:53
Show Gist options
  • Save p0358/cd1e8daa94e984b62d268b6976f4a5eb to your computer and use it in GitHub Desktop.
Save p0358/cd1e8daa94e984b62d268b6976f4a5eb to your computer and use it in GitHub Desktop.

[WIP] Origin 9.x restoration

This gist documents my research into booting up that old EA Origin client and having it working again. It is incomplete and I currently give up for now, and this gist serves as a bit of info dump in case someone (like me) wants to pick this up again in the future.

Old origin urls

Legacy channel

Those were supported for a short moment after the new Origin 10.x (OriginX) was already out. They didn't include the social features/chat anymore.

Latest version is 9.13.1.35109, however it seems all they did in that update is to brick the app and just display a message for people to update to the new app. It seems the previous version 9.13.1.26771 did not have that.

All known download links of the legacy channel:

Old live channel

Last version in there was 9.12.2.69376 ( https://origin-a.akamaihd.net/Origin-Client-Download/origin/live/OriginUpdate_9_12_2_60376.zip ).

Installation

As the installers are a bit of hit or miss, the most reliable way to test things out seems to be to unpack the update zip into Origin's installation. Then wipe out Origin folder from %appdata%, %localappdata%, and C:\ProgramData, as files from newer Origin will interfere (incompatible web cache from newer Origin will crash older Origin).

Then before starting up Origin, you need to create EACore.ini file at the installation directory with contents:

[Bootstrap]
EnableUpdating=false

Alternatively you can use /noUpdate.

Another useful option to note during testing is /StartOffline, but note that you cannot "login offline" if you didn't already login online at least once and have cached some of your account information locally.

API Differences

It seems that the login URL has changed a bit between the Origin versions.

  • in 9.12 it'd have this format: https://accounts.ea.com/connect/auth?client_id=ORIGIN_PC&response_type=code id_token&redirect_uri=qrc:///html/login_successful.html&display=origin_client&locale=en_US&nonce=0000&pc_machine_id=00000000000000000000
  • in 9.13: https://accounts.ea.com/connect/auth?client_id=ORIGIN_PC&response_type=code id_token&redirect_uri=qrc:///html/login_successful.html&display=originX/login&locale=en_US&nonce=0000&pclegacy=1&pc_machine_id=00000000000000000000
  • in current Origin: https://accounts.ea.com/connect/auth?client_id=ORIGIN_PC&response_type=code%20id_token&redirect_uri=qrc:///html/login_successful.html&display=originX/login&locale=en_US&nonce=0000&pc_sign=ey...ik

As we can see msot parameters are the same, including redirect_uri.

The display needs to be adjusted to originX/login, otherwise it will fail, which the legacy client was doing already. However the missing property is the new pc_sign, which the current client uses to generate and sign an unique PC machine ID (by func Origin::Services::PlatformService::getMachineId in OriginClient.dll). Old parameter pc_machine_id is gone on the other hand. The legacy client has used pclegacy=1 to support the old client despite these changes, however backend support for this was removed when legacy client was sunsetted.

You can successfully use the PHP script below to change these parameters below, injecting captured pc_sign param from your latest Origin client, and it will work:

// origin_redir.php
<?php

$params = $_GET;

$params['display'] = 'originX/login';
$params['pc_sign'] = '...';
$params['nonce'] = '1501';

header('Location: https://accounts.ea.com' . $_SERVER['PATH_INFO'] . '?' . http_build_query($params));

then in C:\ProgramData\Origin\local.xml use key <Setting key="ConnectPortalBaseUrl" value="https://.../origin_redir.php" type="10"/>.

This will cause the Origin login to pop up (instead of failing and falling back to offline login at https://signin.ea.com/p/pc/offline (PS: it doesn't work, and new page is at https://signin.ea.com/p/originX/offline)).

After login you get redirected to location: qrc:/html/login_successful.html#code=QUOxA...&id_token=eYJ.... Also cookies are set with Set-Cookie.

The Origin client is then supposed to read this and make a request to POST https://accounts.ea.com/connect/token. And that's where the old client currently fails, and where I gave up for now.

Post body is supposed to be:

grant_type=authorization_code&code=QUOx...&client_id=ORIGIN_PC&client_secret=UIY...&redirect_uri=qrc:///html/login_successful.html

The log lines are as follows:


  86     Mar 15 04:52:41.568 Event     Origin::Client::LoginViewController::loginUrl                               5440      LoginViewController: loginUrl - getOfflineUrl=false global connection state =true
  87     Mar 15 04:52:41.568 Event     Origin::Client::LoginViewController::loginUrl                               5440      Logging in online
  88     Mar 15 04:52:41.568 Event     Origin::Client::LoginViewController::loadLoginPage                          5440      loadLoginPage[https://.../origin_redir.php/connect/auth]
  89     Mar 15 04:52:41.568 Event     Origin::Client::LoginViewController::validateOfflineWebApplicationCache     5440      Web application cache path: C:/Users/XXXXXXXXXXXXXXXXXX/AppData/Local/Origin/Origin
  90     Mar 15 04:52:41.584 Event     Origin::Client::LoginViewController::show                                   5440      Show login window
  91     Mar 15 04:52:41.599 Event     Origin::Client::LoginViewController::closeLoginWindow                       5440      Closing login window.
  92     Mar 15 04:52:42.881 Event     Origin::Client::LoginViewController::onUrlChanged                           5440      onUrlChanged: url = [https://signin.ea.com/p/originX/login]
  93     Mar 15 04:52:42.974 Event     Origin::Client::PageErrorDetector::networkRequestFinished                   5440      Load Error 3 (HTTP status 0) for host: www.google-analytics.com
  94     Mar 15 04:52:50.483 Event     Origin::Client::LoginViewController::onUrlChanged                           5440      onUrlChanged: url = [https://signin.ea.com/p/originX/login]
  95     Mar 15 04:52:51.177 Event     Origin::Client::LoginViewController::onUrlChanged                           5440      onUrlChanged: url = [qrc:///html/login_successful.html]
  96     Mar 15 04:52:51.177 Event     Origin::Client::AuthenticationJsHelper::onLoginSuccess                      5440      Successfully logged in: ONLINE
  97     Mar 15 04:52:51.193 Event     Origin::Services::Session::LoginRegistrationSession::extractCid             5440      Logging in as invisible? = false
  98     Mar 15 04:52:51.193 Event     Origin::Services::Session::LoginRegistrationSession::retrieveTokens         5440      Initial token retrieval
**99     Mar 15 04:52:51.271 Error     Origin::Services::Session::LoginRegistrationSession::onTokensRetrievedError 5440       Tokens Retrieved Error: -1
**100    Mar 15 04:52:51.271 Error     Origin::Services::Session::LoginRegistrationSession::onTokensRetrievedError 5440       Tokens Retrieved HTTP status code: 302
**101    Mar 15 04:52:51.271 Error     Origin::Services::Session::LoginRegistrationSession::attemptOfflineLogin    5440      Attempting Offline login after REST request failed: -1:9
**102    Mar 15 04:52:51.271 Warning   Origin::Services::Session::LoginRegistrationSession::attemptLoginViaOfflineCache 5440      Primary offline key was empty.
**103    Mar 15 04:52:51.271 Error     Origin::Services::Session::LoginRegistrationSession::attemptLoginViaOfflineCache 5440      empty id  
**104    Mar 15 04:52:51.271 Error     Origin::Services::Session::retrieveOfflineLoginInfo                         5440      canonical user empty

Currently it's unclear where it fails and if it even issues /connect/token request at all or just fails reading previous response. Annoyingly Origin 9.x does not want to use a system proxy unlike OriginX and I didn't find a good way to sniff stuff yet. Except maybe trying to override endpoints, which I didn't do yet.

Other useful things

<Setting key="DisableMotd" value="true" type="1"/> if you get bothered by MOTDs if they're not dismissable.

One of the below might be useful, the first line was taken from OriginX client:

<Setting key="OfflineLoginUrl" type="10" value="https://signin.ea.com/p/originX/offline?client_id=ORIGIN_PC&amp;response_type=code id_token&amp;redirect_uri=qrc:///html/login_successful.html&amp;display=originX/login&amp;locale=en_US&amp;nonce=19111&amp;host=https://accounts.ea.com"/>
<Setting key="OfflineLoginUrl" type="10" value="https://signin.ea.com/p/pc/offline"/>

This does NOT work sadly: <Setting key="OverrideOSVersion" value="6.0.9200" type="10"/>. That's why you need to disable updates, as they'll want to install Origin 10.5.x and will fail at doing that.

Also useful logs are at: C:\ProgramData\Origin\Logs.

Next problem: expired signatures of Origin.exe and OriginClient.dll

Origin.exe and OriginClientService.exe explicitly verify codesign signatures of Origin.exe and OriginClient.dll. Problem: they're expired, so they fail this verification. Solution: need to do some binary patches to them.

For OriginClientService.exe ver. 9.13.1.26771 at raw file offset 0x38DE0 change bytes to: B0 01 C3 (mov al,1; ret;).

For Origin.exe ver. 9.13.1.35109 at raw file offset 0x2C500 change bytes to: B0 01 C3 (from 55 8B EC).

Yes I used newer Origin.exe because I patched it in that latest bricked version and then was too lazy to re-do it on the older one.

Relevant log lines in case someone needs to redo the patches quickly on another version:

Bootstrapper_Log

0:	[Mar 15 04:36:30] Event	LogFile: C:\ProgramData\Origin\Logs\Bootstrapper_Log
1:	[Mar 15 04:36:30] Event	03/15/19 04:36:30
2:	[Mar 15 04:36:30] Event	Version: 9.13.1.35109
3:	[Mar 15 04:36:30] Event	"C:\ProgramFiles(x86)\Origin\Origin.exe"
4:	[Mar 15 04:36:30] Event	Got the single instance mutex
5:	[Mar 15 04:36:30] Event	Waiting for update thread to finish
6:	[Mar 15 04:36:30] Event	shouldUpdate = false
7:	[Mar 15 04:36:30] Event	doUpdates completed
8:	[Mar 15 04:36:36] Error	File signature verification error. - C:\Program Files (x86)\Origin\Origin.exe
9:	[Mar 15 04:36:36] Error	Problem found in executable signature.
10:	[Mar 15 04:36:36] Error	File signature verification error. - C:\Program Files (x86)\Origin\OriginClient.dll
11:	[Mar 15 04:36:36] Error	Problem found in dll signature.
12:	[Mar 15 04:36:36] Error	OriginClient.dll Signature invalid
13:	[Mar 15 04:36:37] Event	releaseAndExitProcess called

OriginClientService_Log


  0      Mar 15 04:46:12.740 Event     Origin::Services::Logger::Init                                              5628      Logfile: C:\ProgramData/Origin/Logs/OriginClientService_Log
  1      Mar 15 04:46:12.740 Event     Origin::Services::Logger::Init                                              5628      Local time: Wed Mar 15 05:46:12 2023
  2      Mar 15 04:46:12.740 Debug     Origin::Services::LoggerFilter::DumpCommandLineToLog                        5628      debug header="Cmdline Param" cmdLine=""
  3      Mar 15 04:46:12.740 Event     Origin::Services::LoggerFilter::DumpCommandLineToLog                        5628      Cmdline Param:  
  4      Mar 15 04:46:12.740 Event     main                                                                        5628      Origin Client Service: Running as service.
  5      Mar 15 04:46:12.740 Event     main                                                                        5628      OS Version: 6.2
  6      Mar 15 04:46:12.740 Event     main                                                                        5628      Origin Client Service starting up...
  7      Mar 15 04:46:12.740 Event     ServiceMain                                                                 2524      ServiceMain Startup
  8      Mar 15 04:46:12.740 Event     ServiceMain                                                                 2524      Service Running
  9      Mar 15 04:46:12.740 Event     ServiceWorkerThread                                                         5132      Service Control Monitor Thread Started
  10     Mar 15 04:46:12.740 Event     ServiceQtThread                                                             5848      Qt Event Thread Started
  11     Mar 15 04:46:12.755 Event     ServiceQtThread                                                             5848      EscalationServiceWin Starting...
  12     Mar 15 04:46:12.755 Event     Origin::Escalation::IPCServer::IPCServer                                    5848      LocalSocket listening on pipe: OriginClientService
  13     Mar 15 04:46:13.161 Event     Origin::Escalation::IEscalationService::IEscalationService                  5848      Found escalation args.
  14     Mar 15 04:46:13.161 Event     Origin::Escalation::IEscalationService::IEscalationService                  5848      Successfully determined caller process ID: 2484
**15     Mar 15 04:46:14.099 Error     Origin::Escalation::EscalationServiceWin::verifyEmbeddedSignature           5848      Failed to verify embedded signature for file [C:\Program Files (x86)\Origin\Origin.exe]: File was not signed [last error: 2148204800].
**16     Mar 15 04:46:14.099 Error     Origin::Escalation::EscalationServiceWin::validateCaller                    5848      Failed to verify embedded signature or cert for process path: C:\Program Files (x86)\Origin\Origin.exe
**17     Mar 15 04:46:14.099 Error     Origin::Escalation::IEscalationService::validatePipeClient                  5848      Command received from invalid caller, shutting down for safety.  ValidateCaller Result = 4
**18     Mar 15 04:46:14.099 Error     Origin::Escalation::IEscalationService::onIPCServer_clientValidationFailed  5848      Shutting down Escalation Service due to IPC server failure.
  19     Mar 15 04:46:14.099 Event     Origin::Escalation::IEscalationService::~IEscalationService                 5848      Escalation service shutdown.
  20     Mar 15 04:46:14.771 Event     ServiceWorkerThread                                                         5132      Qt Thread event loop exited.
  21     Mar 15 04:46:14.771 Event     ServiceMain                                                                 2524      Service Control Monitor Thread finished, shutting down...
  22     Mar 15 04:46:14.771 Event     ServiceMain                                                                 2524      Service stopped

TODO

Figure some way of sniffing packets, probably by replacing the URIs/domains to base services, either by local.xml or EACore.ini (if it has &SETTINGS_ then it's xml, if it mentions "Bootstrapper" then likely the ini), to see if the request or parsing of /connect/auth response fails.

Also some code for generating some acceptable &pc_sign= parameter would need to be figured out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment