ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!
Tutorials, Guides, Ebooks, etc.

How Steam Actually Identifies a User

Submitted by Manfruity at 54 minutes ago


How Steam Actually Identifies a User
34 Views
Manfruity's Avatar'
Manfruity
Offline
#1
[ Hidden Content! ]

How Steam Actually Identifies a User
I'll explain how Steam identifies a user, and why HWID bans are real.
 
Chapter 1. Collecting the computer name
 
As you know, going to "Account details" and selecting the "Security & Devices" tab shows the name of your device and other devices — but how does that happen?

Security & Devices:
 
For that we need the structure of the client's authorisation message. Let's look at it using the protobuf dumps on GitHub.

CMsgClientLogon structure:
 
CMsgClientLogon contains the machine_name field — that's exactly where the user's hostname (PC name) is passed, and it also contains machine_id (we'll come back to that later).

I started the analysis with steamclient64.dll, since that's where the main logic lives. Valve doesn't encrypt their modules (except the VAC ones), and since they hide nothing, I decided to look through the imports/exports — and found exactly 2 imports from tier0_s64.dll: GetLocalHostname and BGetLocalFQDN.

Imports found (steamclient64.dll):
 
BGetLocalFQDN is called only once, when attempting to establish a connection (as far as I understand), while GetLocalHostname is called 10 times (in steamclient64.dll).

What does GetLocalHostname do in tier0_s?
It calls GetComputerNameExW with the format "ComputerNamePhysicalDnsHostname", converts the result to UTF-8 via WideCharToMultiByte and puts it into byte_13F0F1840, which returns the result; on error it returns "<unable to get local hostname>". The function is exported from tier0_s64.dll, and steamclient64.dll is what uses it.

GetLocalHostname (tier0_s64.dll):
 
Chapter 2. Collecting the HWID (unique PC identifier)
 
Now let's look in more detail at how Steam actually collects the HWID.
We know Steam has a Hardware Survey, and in the "Help" tab there's a "System Information" section — clicking it shows information about the computer's hardware (CPU, AVX feature support, client info, graphics card). All those fields are shown openly, but there are fields "MAC Address hash" and "Disk serial number hash" that are provided as hashes and are exactly the unique values.

Searching in steamclient64.dll, I found that when the SteamEngine object is initialised (right at startup), there's a constructor for the "m_MachineIDInfo" field, as well as an overwrite of m_MachineIDInfoThread by the "FillMachineInfoThread" table. Let's go into that table and see what's there.

Screenshot of the pseudo-initialisation of SteamEngine (steamclient64.dll):
 
The FillMachineIDInfoThread table contains the following methods:
Init object (?Init@CThread@@MEAA_NXZ)
Constructor of the main thread (sub_138976C20) — that's what we NEED!
and others that aren't really relevant to us.

Table:
 
We go into sub_138976C20 and see this:

Pseudo sub_138976C20 (steamclient64.dll):
 
The variable v3 = the object into which the machine ID is written, as we remember from the SteamEngine initialisation. It seems IDA's decompiler glitched a bit here:
 
Code:
*(_QWORD *)a1->gap_0000 = &CSteamEngine::`vftable';
sub_138E629E0 receives exactly v3 — let's go into that function, and we see we've got to what we need:

Pseudo sub_138E629E0 (steamclient64.dll):
 
Let me get straight to the point:
The call sub_139133890 = its own implementation of something like memset? (but that doesn't matter).
It's followed immediately by a call to sub_1388DADF0 (the most interesting one).

Pseudo sub_1388DADF0 (collector 1, steamclient64.dll):
 
This function (sub_1388DADF0) opens the registry at "SOFTWARE\\Microsoft\\Cryptography" and gets the value "MachineGuid" from it — that is, it collects the user's GUID.

What happens next in FillMachineIDInfoThread?
Next, the call sub_138E0D100 generates SHA1.

SHA1 generation function (steamclient64.dll):
 
Judging by everything, the signature is roughly this:
 
Code:
void sub_138E0D100(const void* input, unsigned int len, unsigned char* out);
After that, the FIRST value obtained — the GUID — is assembled in the function sub_138E0ECC0.
 
[Image: ?u=https%3A%2F%2Ffulla.market%2Fdata%2Fg...wid-10.jpg]
 
The called function sub_138D04B90 equals KeyValues::FindKey from the Source SDK, and sub_138D06230 is KeyValues::SetString.

Pseudo KeyValues::FindKey (steamclient64.dll):
Pseudo KeyValues::SetString (steamclient64.dll):
 
That is, sub_138E0ECC0 takes the m_MachineIDInfo object, finds it using KeyValues::FindKey or creates it, with "BB3" as the key, and writes into it the passed string in the form of the SHA1 hash of the GUID obtained earlier.

We return to FillMachineThread and see these calls next:

Two more function calls in FillMachineThread:
 
Let's look at the first function (sub_138E62C90) first.

Pseudo sub_138E62C90 (collector 2, steamclient64.dll):
 
This function enumerates all network devices, and for each PCI device pulls its NetCfgInstanceId from the registry (the unique adapter GUID that Windows assigns on installation).

So what does the 3rd collector (sub_138E62F60) do?
It gets the adapter GUID using WMI queries, filtering out virtual adapters; if the flag a2 is passed into the function, it collects only devices connected via PCI.

Pseudo sub_138E62F60 (collector 3):
 
But why are there two calls?
Those two obtained values are hashed into SHA1 in a single call and it expects to get 16 bytes back.

Pseudo FillMachineThread:
 
We've already looked at the signature of the SHA1 generation function, and we understand that the 2nd argument = length.

Then exactly the same thing happens as above, except now the key is FF2.
 
[Image: ?u=https%3A%2F%2Ffulla.market%2Fdata%2Fg...wid-17.jpg]
 
Moving on to the next and last call (sub_138E61910):

Call sub_138E61910 (steamclient64.dll, FillMachineIDThread):
 
The function sub_138E61910 (collector 4) uses all the same WMI queries, but now it takes the manufacturer and the disk serial number together.

Pseudo sub_138E61910 (steamclient64.dll):
 
The output is ManufacturerSerialNumber without separators.

And then everything as usual: the result of this function is hashed the same way, except now the key is "3B3".

Pseudo of the generation call and KeyValues:
 
At the end of the FillMachine function there's also a call that creates another record with the key "333", but as far as I understand it leads nowhere and is a stub.

What we have now:
GUID + BB3 + MAC + FF2 + ManufacturerDiskSerial + 3B3.

But what happens to this data afterwards?
And here we return to the SteamEngine initialisation, where we're interested in the constructor function "sub_138E0D8D0".
 
[Image: ?u=https%3A%2F%2Ffulla.market%2Fdata%2Fg...wid-22.jpg]
[Image: ?u=https%3A%2F%2Ffulla.market%2Fdata%2Fg...wid-23.jpg]
 
This function allocates memory for a KeyValues and creates it with the name "MessageObject" (that's where the keys "BB3" and others will be added).
At the end it saves the pointer and switches the vtable to CMachineIDInfo.

How is all of this sent to the server?
The answer is simple: it's sent when attempting authorisation (Authentication.BeginAuthSessionViaCredentials).
As a result we have the following data:
login, encrypted_password, rsa, rememberme, pcname, machineID

Using the Steam protobuf dumper and entering random data in the login window, I got the following dump:
 
[Image: ?u=https%3A%2F%2Ffulla.market%2Fdata%2Fg...wid-24.jpg]
[Image: ?u=https%3A%2F%2Ffulla.market%2Fdata%2Fg...wid-25.jpg]
 
When serialised the format is completely different:
 
Code:
MessageObject\0BB3\0GUID\0FF2\0MAC\03B3\0MANUFACTURERDISKSERIAL
Also, steamui.dll registers the Auth.GetMachineID parameter, which it calls during the authorisation process.

Pseudo (steamui.dll):
 
Note that the hostname (PC name) is also used for generating the QR code. I'd also like to point out that all the unique parameters are collected together in order to track the user with 99% accuracy.

What else about HWID?
That's all for now — the VAC modules don't currently work, and Steam has no other HWID collections (only one voluntary one). Most likely Deadlock/Dota2 use exactly this HWID.

Conclusion — Steam obtains the HWID right when steamclient64.dll is loaded, during the initialisation process, stores that value in KeyValues, and then uses it during authorisation.

How would you implement a spoofer?
You can simply hook the collector functions / fill functions; we can return any bytes, since what's obtained is sent to the server hashed. For early loading you can use a callback on LdrDllNotification and inject the spoofer DLL as soon as the Steam process appears. If you hook and substitute it, the MAC/disk serials in the "System Information" tab will change as well (so we're back to it).

While working on this I learned that sending machineID also exists in the steam-user library (which finally confirms the article's accuracy): node-steam-user, components/09-logon.js

Bonus:
 

 
Not ratedThis leak has not been rated yet, be careful when downloading.
[Image: signature.webp]
0
Reply


Messages In This Thread
How Steam Actually Identifies a User - by Manfruity - 54 minutes ago


Users browsing this thread: PeterPark123, 7 Guest(s)