Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: HMAC Alert #1172

Closed
STRATZ-Ken opened this issue Jan 7, 2023 · 3 comments
Closed

[Bug]: HMAC Alert #1172

STRATZ-Ken opened this issue Jan 7, 2023 · 3 comments

Comments

@STRATZ-Ken
Copy link

STRATZ-Ken commented Jan 7, 2023

What did you expect to happen?

Login to complete successfully.

Instead of that, what actually happened?

Got a new stack trace error. Been using the same code for about 5 years now. Just upgraded from .Net 5 to 6.

2023-01-06 20:51:37.6663||DEBUG|X.X|[SteamKitDebug] - 0caaf55cc87c45cb9245822c8e8fe73d/TcpConnection: Unexpected exception propogated back to NetLoop: System.IO.IOException: Unable to decrypt incoming packet
 ---> System.Security.Cryptography.CryptographicException: NetFilterEncryption was unable to decrypt packet: HMAC from server did not match computed HMAC.
   at SteamKit2.CryptoHelper.SymmetricDecryptHMACIV(Byte[] input, Byte[] key, Byte[] hmacSecret) in C:\Git\Core\SteamKit2\src\SteamKit2\SteamKit2\Util\CryptoHelper.cs:line 352
   at SteamKit2.NetFilterEncryptionWithHMAC.ProcessIncoming(Byte[] data) in C:\Git\Core\SteamKit2\src\SteamKit2\SteamKit2\Networking\Steam3\NetFilterEncryptionWithHMAC.cs:line 33
   --- End of inner exception stack trace ---
   at SteamKit2.NetFilterEncryptionWithHMAC.ProcessIncoming(Byte[] data) in C:\Git\Core\SteamKit2\src\SteamKit2\SteamKit2\Networking\Steam3\NetFilterEncryptionWithHMAC.cs:line 40
   at SteamKit2.EnvelopeEncryptedConnection.OnNetMsgReceived(Object sender, NetMsgEventArgs e) in C:\Git\Core\SteamKit2\src\SteamKit2\SteamKit2\Networking\Steam3\EnvelopeEncryptedConnection.cs:line 74
   at SteamKit2.TcpConnection.NetLoop() in C:\Git\Core\SteamKit2\src\SteamKit2\SteamKit2\Networking\Steam3\TcpConnection.cs:line 301

Which operating system are you running on?

Windows

Which .NET Runtime are you running on?

.NET Core or .NET 5 or higher.

Version

.Net 6

Relevant log output

2023-01-06 20:51:35.5940||DEBUG|CaptainJackSteamKit.CaptainJackSteam|[SteamKitDebug] - ServerList: Resolving server list
2023-01-06 20:51:35.5940||DEBUG|CaptainJackSteamKit.CaptainJackSteam|[SteamKitDebug] - ServerList: Server list provider had no entries, will query SteamDirectory
2023-01-06 20:51:35.6422||DEBUG|CaptainJackSteamKit.CaptainJackSteam|Connecting to Steam at
2023-01-06 20:51:36.1713||DEBUG|CaptainJackSteamKit.CaptainJackSteam|[SteamKitDebug] - ServerList: Resolved 200 servers
2023-01-06 20:51:36.1713||DEBUG|CaptainJackSteamKit.CaptainJackSteam|[SteamKitDebug] - ServerList: Next server candidate: 162.254.192.87:27017 (Tcp)
2023-01-06 20:51:36.2264||DEBUG|CaptainJackSteamKit.CaptainJackSteam|[SteamKitDebug] - 0caaf55cc87c45cb9245822c8e8fe73d/TcpConnection: Connected to 162.254.192.87:27017
2023-01-06 20:51:36.2762||DEBUG|CaptainJackSteamKit.CaptainJackSteam|[SteamKitDebug] - 0caaf55cc87c45cb9245822c8e8fe73d/EnvelopeEncryptedConnection: Got encryption request. Universe: Public Protocol ver: 1
2023-01-06 20:51:36.3329||DEBUG|CaptainJackSteamKit.CaptainJackSteam|[SteamKitDebug] - 0caaf55cc87c45cb9245822c8e8fe73d/EnvelopeEncryptedConnection: Encryption result: OK
2023-01-06 20:51:36.3329||DEBUG|CaptainJackSteamKit.CaptainJackSteam|Connected to Steam!
2023-01-06 20:51:37.6369||DEBUG|CaptainJackSteamKit.CaptainJackSteam|[SteamKitDebug] - 0caaf55cc87c45cb9245822c8e8fe73d/NetFilterEncryptionWithHMAC: Unable to decrypt incoming packet: NetFilterEncryption was unable to decrypt packet: HMAC from server did not match computed HMAC.
2023-01-06 20:51:37.6663||DEBUG|CaptainJackSteamKit.CaptainJackSteam|[SteamKitDebug] - 0caaf55cc87c45cb9245822c8e8fe73d/TcpConnection: Unexpected exception propogated back to NetLoop: System.IO.IOException: Unable to decrypt incoming packet

Example Code

Log.Debug("Logging in to " + username + " " + password);
var details = new SteamUser.LogOnDetails()
{
Username = username,
Password = password
};

      _steamUser.LogOn(details);

Additional Information

This just started about 3 days ago. I thought it went away, but it just came back again.

@STRATZ-Ken STRATZ-Ken added the bug label Jan 7, 2023
@yaakov-h
Copy link
Member

yaakov-h commented Jan 7, 2023

What version of SteamKit2 are you running? This sounds like an issue we fixed over a year ago in #1006.

@STRATZ-Ken
Copy link
Author

You may be right. I am using an older version. I built a version on top of yours to allow proxies for connection via a param into the connect method. Will try to upgrade and report back.

@STRATZ-Ken
Copy link
Author

Correct. Upgrading solved this.

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

No branches or pull requests

2 participants