Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Shaiya > Shaiya Private Server > Shaiya PServer Guides & Releases
You last visited: Today at 12:02

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[RELEASE] Shaiya packet emcryption/decryption library

Discussion on [RELEASE] Shaiya packet emcryption/decryption library within the Shaiya PServer Guides & Releases forum part of the Shaiya Private Server category.

Reply
 
Old   #1
 
szobonya3's Avatar
 
elite*gold: 0
Join Date: Feb 2011
Posts: 5
Received Thanks: 59
[RELEASE] Shaiya packet emcryption/decryption library

Hi Everyone!

Im releasing a library for the encryption/decryption of shaiya network packets.
(The code might not be the best so bear with me.)

The handshake - some basic explanation how it works:

Client side:
  • Connect to login server
  • Receive RSA 1024 publickey
  • Generate a 1024bit random number
  • Encrypt the random number with rsa publickey
  • Send encrypted random number
  • hash the random number using sha256
  • Create a hmac(hashed random number, rsa modulus) using sha256
  • Use the first 16 bytes of hmac as the base AES key
  • Use the second 16 bytes of hmac as the base IV
  • Expand the base AES key
  • Use the first extended AES key as AES key
  • Use the base IV as the send and recieve counter


Server side:
  • Accept connection
  • Generate RSA 1024 keypair (or use pre generated)
  • Send RSA 1024 publickey
  • Receive encrypted random number
  • Decrypt the random number with rsa privatekey
  • hash the random number using sha256
  • Create a hmac(hashed random number, rsa modulus) using sha256
  • Use the first 16 bytes of hmac as the base AES key
  • Use the second 16 bytes of hmac as the base IV
  • Expand the base AES key(creates 11 keys)
  • Use the first extended AES key as AES key
  • Use the base IV as the send and recieve counter

After the handshake both the client and the server use AES 128 counter mode.

So basicly:
  • Divide the packet into 16byte or less sized chunks. (chunks smaller than 16 bytes gets padded automatically)
  • Do AES encryption/decryption with IV (send and recv packets use different IV as above)
  • Increment IV
  • Do the next chunk

More info:


The library is written in c++ and uses cryptopp (5.6.x should be fine) also the AES expanson method taken from


The library includes an example "login" server which:
  • Accepts the first and only connection
  • Initiates handshake
  • Receives and the decrypts the login packet

NOTE:
The library part (crypto.cpp, crypto.hh) should compile in windows however the poject was done on linux so no guaranties. The server.cpp (the example file uses BSD sockets, so modifications is needed on windows).

LIMITATIONS:
In the handshake process 11 aes keys are generated, however the first one is observed to be used.Its very likely that the key changes after a certain number of encrypted/decrypted chunks.
Attached Files
File Type: zip packet_encryption_library.zip (209.3 KB, 613 views)
szobonya3 is offline  
Thanks
17 Users
Old 11/23/2016, 15:21   #2
 
elite*gold: 0
Join Date: Jan 2010
Posts: 143
Received Thanks: 512
nice!
we check here

/**< Receive login packet */
ret=recv(cli_sockfd,login_packet,52,0);
if(ret!=sizeof(login_packet))
{
hError("recv error");
}

we have got lots of attacks in the past years
people could send request to ps_login directly without game client..
and coz once connected,server side will not kick you
so what if they send create 1000~2000 sockets in a short time?
so we better get a firewall to prevent people login from multiple connection of a ip
shen1l is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
[Release]C# Packet Encryption/Decryption 100% Functional
03/30/2013 - Dekaron Private Server - 22 Replies
Enjoy, (Also, I've had some references from old Enc/Dec functions and improved some) -Functions written/converted into C# language To use: Call DecryptData first, then call CryptBody, and then play around with your packets; once done simply re-encrypt it again (no need to use CryptBody again since a packet w/ 0x00 as key can be sent without problems). C# Version: public static byte CryptBody(byte PacketData, int len)
[RELEASE] Packet Encryption/Decryption Algorithm
09/19/2012 - General Gaming Releases - 5 Replies
Hey, Maybe it's useful for someone here, these are the current algorithms for encrypting / decrypting the Packets. Encrypt: void Packet::Encrypt() { if(this->size > 4) {
Shaiya Packet Encryption/Decryption
07/08/2010 - Shaiya - 5 Replies
Hey. I was trying to get this info reversing the client, but i think my skills aren't good enough for such task yet. I was wondering if somebody here could tell me how does Shaiya encrypts(for sending)/decrypts(receiving) packets. Please post also, how you found this info, cause i few like I wasted 5 days searching for the algorithm in reversing sessions. :mad:
Shaiya packet decryption
12/26/2009 - General Coding - 20 Replies
heyho! ich würde gerne für shaiya einen packet-login-bot schreiben. Sollte ich für den Bot WSA-Funktionen benutzen oder doch andere??? Mein Hauptproblem: ich hab schon versucht mit dem Packet Sniffer beim Login die Packets abzufangen, allerdings stürzt shaiya mit der injecteten Dll anschliessend immer b:( Auf diese Weise krieg ich die Packets mit WPE Pro, wo sie allerdings schon verschlüsselt sind... Meine Idee war, dass ich mir sie mit dem Packet Editor unverschlüsselt angucke und mit WPE...



All times are GMT +1. The time now is 12:03.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.