The Steam Guard mobile app uses mostly standard TOTP:
-
The TOTP secret is named
shared_secret, and will be stored inBase64encoding. After you save, the extension will convert it toBase32. -
Steam Guard parameters:
-
Type: TOTP
-
Digits: 5
-
Period: 30 seconds
-
Algorithm: SHA-1
-
-
Steam Guard uses decimal digits and letters to display authentication codes. To make the TOTP extension show the codes in the same way, you must set the Issuer to
Steam.
We need to extract the shared_secret from Steam Guard. There are a few different ways to
obtain it, but here is one that's known to work:
-
Rooted Android device, with Steam Guard activated.
-
frida-server: Download the
frida-server-X.Y.Z-android-ARCH.xzthat matches your phone. If you don't know that your phone isarm64orx86/x86_64, it's probablyarm. There's no risk in downloading the wrong architecture, it will simply not execute if you make a mistake.Note that the latest frida version might not work with your Android version. You might need to try older versions until you find one that works.
-
adb: It's usually part ofandroid-toolsorandroid-tools-adbpackage. -
USB cable to connect your phone to your PC.
-
Extract
frida-serverfrom the.xzarchive:unxz frida-server-X.Y.Z-android-ARCH.xzExample:
unxz frida-server-16.5.9-android-arm.xz -
Save the following Python script, to a
dump.pyfile:#!/bin/env python3 import json import frida import sys package = "com.valvesoftware.android.steam.community" cmd = """ 'use strict;' if (Java.available) { Java.perform(function() { //Cipher stuff const Cipher = Java.use('javax.crypto.Cipher'); Cipher.doFinal.overload('[B').implementation = function (input) { var result = this.doFinal.overload('[B').call(this, input); send(result); } } )} """ def parse_hook(cmd_): print('[*] Parsing hook...') script = session.create_script(cmd_) script = session.create_script(cmd_) script.on('message', on_message) script.load() def on_message(message, _): try: if message: if message['type'] == 'send': result = "".join(chr(i) for i in message['payload']) print(json.dumps(json.loads(result), indent=2, ensure_ascii=False)) except Exception as e: print(e) if __name__ == '__main__': try: print('[*] Spawning', package) dev = frida.get_usb_device() pid = dev.spawn(package) session = dev.attach(pid) parse_hook(cmd) dev.resume(pid) print('') sys.stdin.read() except KeyboardInterrupt: sys.exit(0) except Exception as e: print(e)
Make it executable by running
chmod +x dump.py. -
On your phone's app settings, use "Force Stop" to completely stop the Steam app.
-
Clear Steam's app cache. DO NOT CLEAR THE STORAGE.
-
Connect your phone to your PC using the USB cable. You must enable "USB debugging" in the developer options.
-
On your PC, run
adb devicesto verify everything is working. You might need to authorize the ADB connection on the phone before it can connect successfully. -
Put the
frida-serverexecutable in your phone, by running this command:adb push frida-server-X.Y.Z-android-ARCH /data/local/tmp/Example:
adb push frida-server-16.5.9-android-arm /data/local/tmp/ -
Log into your phone as root; one of these might work:
adb root adb shellor
adb shell suYou might see a prompt on your phone to authorize root access for the adb shell. Make sure you allow root access.
-
Go to where you copied
frida-serverand execute it:cd /data/local/tmp chmod +x frida-server-X.Y.Z-android-ARCH ./frida-server-X.Y.Z-android-ARCHIf you see any error messages, this probably means this version of
frida-serveris not compatible. Go download a different version and try again. You can pressCtrl+Cto stopfrida-server. -
Run the
dump.pyscript:./dump.py -
This script will automatically launch Steam on your phone. Navigate to the Steam Guard, to generate an authentication code. It will fail to show you the authentication code, but the script will print out the
shared_secretthat you need:{ "accounts": { "12345678901234567890": { "shared_secret": "ABC123abc123ABC123abc123ABC=", "identity_secret": "...", "secret_1": "...", "serial_number": "...", "revocation_code": "...", "account_name": "...", "token_gid": "...", "steamguard_scheme": 2, "steamid": "..." } } } -
Use the
shared_secretvalue as the TOTP secret, making sure to selectBase64. -
Close the Steam app.
-
Stop the
dump.pyscript by pressingCtrl+C. -
Stop the
frida-serverby pressingCtrl+C. -
Open the Steam app again, and VERIFY that it generates the same authentication codes as the extension.
If the codes don't match, either you copied the
shared_secretincorrectly, or you didn't configure it correctly. -
Delete the
frida-serverexecutable form your phone:rm frida-server-X.Y.Z-android-ARCH