Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 21:47

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

Advertisement



Odd packet decryption problem

Discussion on Odd packet decryption problem within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
InsomniacPro's Avatar
 
elite*gold: 0
Join Date: Feb 2014
Posts: 397
Received Thanks: 205
Odd packet decryption problem

So, I have pre-5018 Encryption/Decryption. I get past the account server, and the message server receives 1052. Decrypts it perfectly fine. Then I send 1004 with "NEW_ROLE" since no character is currently in the database. Once I attempt to create a character, the server decrypts that packet wrong. I change the decrypt keys using the following method after 1052 is received.

And here's my decrypt method.

I cannot seem to find the reason for the packets being decrypted incorrectly. Any ideas, or experience with this same issue? Resetting the key counter does not work btw.
InsomniacPro is offline  
Old 04/17/2014, 15:45   #2


 
CptSky's Avatar
 
elite*gold: 0
Join Date: Jan 2008
Posts: 1,434
Received Thanks: 1,147
Code:
        /// <summary>
        /// Generates a key (Key) to use for the algorithm and reset the encrypt counter.
        /// In Conquer Online: A = Token, B = AccountUID
        /// </summary>
        public void GenerateKey(Int32 A, Int32 B)
        {
            Kernel.assert(BufIV != null);
 
            if (BufKey != null)
                Kernel.free(BufKey);

            BufKey = (Byte*)Kernel.malloc(COSAC_KEY);
            Int16 K = COSAC_KEY / 2;

            UInt32 tmp1 = (UInt32)(((A + B) ^ 0x4321) ^ A);
            UInt32 tmp2 = tmp1 * tmp1;

            Byte* tmpKey1 = (Byte*)&tmp1;
            Byte* tmpKey2 = (Byte*)&tmp2;
            for (Int16 i = 0; i < K; i++)
            {
                BufKey[i + 0] = (Byte)(BufIV[i + 0] ^ tmpKey1[(i % 4)]);
                BufKey[i + K] = (Byte)(BufIV[i + K] ^ tmpKey2[(i % 4)]);
            }
            EncryptCounter = 0;
        }
Yours seems wrong. You don't reset the counter. And maybe you're interverting the parameters ?
CptSky is offline  
Thanks
1 User
Old 04/17/2014, 18:12   #3
 
InsomniacPro's Avatar
 
elite*gold: 0
Join Date: Feb 2014
Posts: 397
Received Thanks: 205
Quote:
Originally Posted by CptSky View Post
Code:
        /// <summary>
        /// Generates a key (Key) to use for the algorithm and reset the encrypt counter.
        /// In Conquer Online: A = Token, B = AccountUID
        /// </summary>
        public void GenerateKey(Int32 A, Int32 B)
        {
            Kernel.assert(BufIV != null);
 
            if (BufKey != null)
                Kernel.free(BufKey);

            BufKey = (Byte*)Kernel.malloc(COSAC_KEY);
            Int16 K = COSAC_KEY / 2;

            //UInt32 tmp1 = 0;
            //tmp1 = (UInt32)(A + B);

            //Byte* tmpKey1 = (Byte*)&tmp1;
            //((Int16*)tmpKey1)[0] ^= 0x4321;

            //for (SByte i = 0; i < 4; i++)
            //    tmpKey1[3 - i] ^= (Byte)(A >> (24 - (8 * i)));

            UInt32 tmp1 = (UInt32)(((A + B) ^ 0x4321) ^ A);
            UInt32 tmp2 = tmp1 * tmp1;

            Byte* tmpKey1 = (Byte*)&tmp1;
            Byte* tmpKey2 = (Byte*)&tmp2;
            for (Int16 i = 0; i < K; i++)
            {
                BufKey[i + 0] = (Byte)(BufIV[i + 0] ^ tmpKey1[(i % 4)]);
                BufKey[i + K] = (Byte)(BufIV[i + K] ^ tmpKey2[(i % 4)]);
            }
            EncryptCounter = 0;
        }
Yours seems wrong. You don't reset the counter. And maybe you're interverting the parameters ?
I don't see how resetting the encrypt counter would do anything, considering its my decrypting that isn't working properly. And I used my same method in my prior source, and it worked perfectly.
InsomniacPro is offline  
Old 04/17/2014, 18:17   #4


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,125
Received Thanks: 2,518
They are exactly the same methods, his is just neater. He also said he's tried resetting the counters.
Korvacs is offline  
Thanks
1 User
Old 04/17/2014, 18:29   #5


 
CptSky's Avatar
 
elite*gold: 0
Join Date: Jan 2008
Posts: 1,434
Received Thanks: 1,147
Quote:
Originally Posted by InsomniacPro View Post
I don't see how resetting the encrypt counter would do anything, considering its my decrypting that isn't working properly. And I used my same method in my prior source, and it worked perfectly.
Yeah, just don't forget it As I said, it's probably the arguments which are wrong. Maybe you don't extract them from the packet correctly or you interverted them.

Oh, and I'm not sure if it works with Int32 for tmps. I think you'll overflow them and won't get the appropriate bytes. Like if tmp1 * tmp1 > 2 G, it will be trimmed to 2 G when casting... So, it won't be the same bytes.

Quote:
Originally Posted by Korvacs View Post
They are exactly the same methods, his is just neater. He also said he's tried resetting the counters.
Missed the part where he said he tried to reset the counters.
CptSky is offline  
Thanks
1 User
Old 04/17/2014, 18:41   #6


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,125
Received Thanks: 2,518
The Int32's aren't an issue its the same encryption used in the CUOSP source I wrote.
Korvacs is offline  
Thanks
1 User
Old 04/17/2014, 19:31   #7
 
InsomniacPro's Avatar
 
elite*gold: 0
Join Date: Feb 2014
Posts: 397
Received Thanks: 205
Well, I had the parameters switched. That's what was causing the issue. Thanks to all.
InsomniacPro is offline  
Reply


Similar Threads Similar Threads
Packet decryption problem
12/20/2011 - CO2 Private Server - 4 Replies
So I tried downgrading the Albetros source to 5017 and posted this issue in that thread but since I don't know how many people actually check that thread, I'll post it here as well. The problem is as follows: The gameserver only handles the first packet properly, in other words packet 1052 is handled ok (correct sizes, type w/e) but then when it receives the next packet, it has these weird huge sizes and wacky IDs such as the charcreation packet becoming ID 34669 instead of 1001. pro...
Packet Decryption
01/27/2008 - WoW Exploits, Hacks, Tools & Macros - 9 Replies
Packet Decryption: BYTE *DecryptPacket&#40;BYTE *Packet, DWORD len&#41; { BYTE KeyIndex, curKey, lastByte; DWORD i; KeyIndex = *&#40;CryptInfo + 0x115&#41;; lastByte = 0;
Packet Decryption
07/10/2006 - Conquer Online 2 - 3 Replies
My Other Thread Died (*sigh* And I Still Can't Decrypt The First Server -> Client Packet) Heres What I Posted About It There: http://www.elitepvpers.com/forum/index.php?...f=53 &t=25033&s= But For Now, Becuase Im Not Tottally Selfish, Heres The Vb6 Solution To Decrypting The First Client -> Server Packet It Currently Has: *Encrypt Packets *Decrypt Packets
Packet decryption problem..
06/02/2006 - Conquer Online 2 - 2 Replies
In Lowfyr's packet decryption guide, first step to get key3/key4 1.) Add key 1 with key 2 205C48F4 + 0044A62E = 20A0EF22 What do I do when key1+key2 is more than 4 bytes? Discard the first byte? Just as an example, I have gotten this from the server.. key1 363504E3 key2 D9007F2D add them together = 10F358410 do I just discard the 1 and end up with 0F358410?



All times are GMT +2. The time now is 21:47.


Powered by vBulletin®
Copyright ©2000 - 2024, 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 ©2024 elitepvpers All Rights Reserved.