gfxgfx
 
Please login or register.

Login with username, password and session length
 
gfx gfx
gfx
76793 Posts in 13502 Topics by 1651 Members - Latest Member: Arnold99 November 24, 2024, 11:23:50 am
*
gfx*gfx
gfx
WinMX World :: Forum  |  Technical  |  Protocol Discussion  |  TCP Encryption
gfx
gfxgfx
 

Author Topic: TCP Encryption  (Read 13084 times)

0 Members and 2 Guests are viewing this topic.

KM

  • Guest
TCP Encryption
« on: May 02, 2005, 05:14:07 pm »
WinMX uses Encryption for primary/secondary and chat connections. The same encryption is used for all protocols.

I could go in to loads of detail about exactly how each bit works, but I cant be bothered (plus its extremely complicated, and I barely understand it) so instead i'll give you a basic overview of it, followed by some example code for one possible implimentation of it.

This can be broken down in to 2 seperate stages:

The first thing you do is negotiate the encryption, during this stage you also set up the connection type so the server knows what type of client you are.
The second stage is once the encryption keys have been set, all communication from that point on is encrypted 1 byte at a time.

Negotiation

First the client connects to the server using a standard TCP connection.

Upon recieving the connection the server sends back a single byte containing 0x31 (or the ascii charecter "1") this basicly identifies that you have in fact connected to a WinMX compatible server.

The client then replies to this by sending up a crypt key, this is a 16 byte chunk of data which contains 2 encryption keys and a connection type. Although the server only cares about the connection type.

The server replies to this with a crypt key of the appropriate type (eg secondary server if the client sent a secondary client) which also contains 2 encryption keys.

The client should then extract these 2 encryption keys from the servers response (as well as checking the response is the right type - although thats not overly important) one key is the key for encrypting the data being sent, and the other is the key for decrypting the data recieved.

Communication

Once the server has given the client a key to use all data past here is encrypted. The encryption basicly consists of encrypting 1 byte of data using that key - this produces a new key which is then used to encrypt the next byte and so on.

From here on you can get away with just dealing with the data correctly for whichever protocol you are using - and just have encryption and decryption done transparently when the data is sent and recieved.

Connection Types

When a crypt key is sent it contains a message type as well as the encryption keys. The message types are:

0x0050 - Primary Client
0x0051 - Primary Server
0x0052 - Secondary Client
0x0053 - Secondary Server
0x0054 - Peer Cache
0x0057 - Chat Client
0x0058 - Chat Server

I'm not sure if any of the others are used - however the gap in the numbering indicates they may be.

How to encrypt/decrypt/deal with the keys/etc

Rather than try and explain the process (which to be honest I have trouble remembering half of the time because its so complicated) here is some (non-ANSI) C source code for you to try and follow:

Thanks to Nushi@2Sn for this.

Code: [Select]
char FCTable[] =
{
     0x00, 0xCA, 0x48, 0x4D, 0xC8, 0x5D, 0x5C, 0x29, 0xB6, 0x30, 0x0E, 0x5A, 0x70, 0xCB, 0x09, 0xD7,0xF2, 0xA0, 0x31, 0x10, 0x2F, 0x5D, 0x4F, 0x94, 0xE6, 0xCF, 0xA2, 0xF1, 0xE8, 0x20, 0xB0, 0x47,0x72, 0x57, 0x77, 0xEC, 0x4E, 0x7D, 0x4E, 0x19, 0x1E, 0x43, 0x1F, 0x6B, 0x05, 0x7C, 0x2E, 0xFE,0xD1, 0xAF, 0xE7, 0x0E, 0x13, 0x71, 0x71, 0x48, 0x31, 0x2F, 0xF2, 0x4F, 0x31, 0x28, 0xBB, 0xC0,0x90, 0x22, 0x1E, 0x1E, 0x46, 0x45, 0xF5, 0xCC, 0x37, 0x4F, 0xDC, 0x5E, 0x4C, 0x30, 0x69, 0x37,0xC2, 0x65, 0x99, 0xD8, 0xE9, 0x2B, 0xDD, 0x8B, 0x7A, 0xDF, 0x38, 0x69, 0x4E, 0xC2, 0xFB, 0xC8,0xA3, 0x79, 0xF2, 0x2E, 0x66, 0xE8, 0x2C, 0xAE, 0xE1, 0x80, 0xE8, 0xFC, 0x1B, 0x9C, 0xCA, 0xF8,0x8D, 0x9D, 0x28, 0x05, 0x34, 0xCC, 0xB3, 0xA1, 0x2E, 0x72, 0xF8, 0x80, 0x63, 0x3C, 0x9A, 0x75,0x61, 0xB5, 0xB8, 0xB1, 0x91, 0x32, 0x3E, 0x20, 0x75, 0x89, 0xC1, 0xFA, 0xB1, 0xAA, 0x17, 0xF9,0xC9, 0xF0, 0xDF, 0xD5, 0x6B, 0xDE, 0xCE, 0x84, 0xA9, 0xFD, 0x81, 0xD4, 0x28, 0x59, 0xCB, 0x91,0x94, 0x52, 0x7B, 0x4D, 0x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E Work[12];
     BYTE Crypt[12];
     int i, j;
     memcpy(Crypt, pSrc, 12);
     memcpy(pDst, pSrc + 12, 120);
     for(i=0 ; i < 10 ; i++)
     {
          memcpy(Work, pSrc + 12 + i * 12, 12);
          pDst[i * 12 + 0] -= Crypt[0];
          pDst[i * 12 + 1] -= Crypt[1];
          pDst[i * 12 + 2] ^= Crypt[2];
          pDst[i * 12 + 3] -= Crypt[3];
          pDst[i * 12 + 4] ^= Crypt[4];
          pDst[i * 12 + 5] ^= Crypt[5];
          pDst[i * 12 + 6] ^= Crypt[6];
          pDst[i * 12 + 7] -= Crypt[7];
          pDst[i * 12 + 8] ^= Crypt[8];
          pDst[i * 12 + 9] -= Crypt[9];
          pDst[i * 12 + 10] -= Crypt[10];
          pDst[i * 12 + 11] ^= Crypt[11];
          for (j=0 ; j < 12 ; j++) Crypt[j] = FCTable[Work[j] * 12 + j];
     }
}
void CreateCryptKeyID(const WORD wID, BYTE *pBlock)
{
     int i;
     for(i=0 ; i < 16 ; i++)pBlock[i] = rand() % 255;
     pBlock[4] = pBlock[15] ^ pBlock[13] ^ pBlock[5] ^ pBlock[2];
     pBlock[9] = (pBlock[14] ^ pBlock[8] ^ pBlock[1]) + wID;
     pBlock[11] = (pBlock[12] ^ pBlock[10] ^ pBlock[7] ^ pBlock[6] ^ pBlock[3] ^ pBlock[0]) + (wID >> 7);
     for(i=0 ; i < 105 ; i++)
     {
          BYTE K = (i)? pBlock[(i - 1) & 0x0F] : 0x57;
          if(i % 5)pBlock[i & 0x0F] += K;
          else pBlock[i & 0x0F] ^= K;
     }
}
const WORD GetCryptKeyID(const BYTE *pBlock)
{
     BYTE kb[16];
     int i;
     memcpy(kb, pBlock, 16);
     for(i=104 ; i >= 0 ; i--)
     {
          BYTE b = (i)? kb[(i - 1) & 0x0F] : 0x57;
          if(i % 5)kb[i & 0x0F] -= b;
          else kb[i & 0x0F] ^= b;
     }
     BYTE KeyID = (BYTE)(kb[9] - (kb[14] ^ kb[8] ^ kb[1]));
     if(kb[4] != (kb[15] ^ kb[13] ^ kb[5] ^ kb[2]) || (kb[12] ^ kb[10] ^ kb[7] ^ kb[6] ^ kb[3] ^ kb[0]) != (BYTE)(kb[11]-(KeyID >> 7))) return 0xFFFF;
     return KeyID;
}
inline const BYTE Decrypt1(const BYTE s, BYTE* ckey)
{
     register BYTE r;
     switch(ckey[2] & 0x03)
     {
          case 0:
          r = MXTCPTable_2[ckey[1] ^ s];
          break;
          case 1:
          r = MXTCPTable_6[ckey[1] ^ s];
          break;
          case 2:
          r = ckey[0] ^ MXTCPTable_0[s];
          break;
          case 3:
          r = ckey[3] ^ MXTCPTable_6[s];
          break;
     }
     ckey[0] += ckey[1];
     ckey[1] ^= ckey[3];
     ckey[2] += MXTCPTable_4[s];
     ckey[3] ^= ckey[2];
     ckey[1]++;
     ckey[2]++;
     ckey[3]++;
     return r;
}
inline const BYTE Encrypt1(const BYTE s, BYTE* ckey)
{
     register BYTE r;
     switch(ckey[2] & 0x03)
     {
          case 0:
          r = ckey[1] ^ MXTCPTable_3[s];
          break;
          case 1:
          r = ckey[1] ^ MXTCPTable_7[s];
          break;
          case 2:
          r = MXTCPTable_1[ckey[0] ^ s];
          break;
          case 3:
          r = MXTCPTable_7[ckey[3] ^ s];
          break;
     }
     ckey[0] += ckey[1];
     ckey[1] ^= ckey[3];
     ckey[2] += MXTCPTable_4[r];
     ckey[3] ^= ckey[2];
     ckey[1]++;
     ckey[2]++;
     ckey[3]++;
     return r;
}
const DWORD DecryptMXTCP(BYTE *pBuf, const int iLen, const DWORD dwKey)
{
     register DWORD dwRef = dwKey;
     int i;
     for(i=0 ; i < iLen ; i++) pBuf[i] = Decrypt1(pBuf[i], (BYTE *)&dwRef);
     return dwRef;
}
const DWORD EncryptMXTCP(BYTE *pBuf, const int iLen, const DWORD dwKey)
{
     register DWORD dwRef = dwKey;
     int i;
     for(i=0 ; i < iLen ; i++) pBuf[i] = Encrypt1(pBuf[i], (BYTE *)&dwRef);
     return dwRef;
}

const WORD GetCryptKey(const BYTE *pBlock, DWORD *pUpKey, DWORD *pDwKey)
{
     const WORD wKeyID = GetCryptKeyID(pBlock);
     BOOL bUPlus, bDPlus;
     BYTE bUK0, bUK1, bUK2, bUK3, bUD;
     BYTE bDK0, bDK1, bDK2, bDK3, bDD;
     DWORD dwUPKey = 0;
     DWORD dwDWKey = 0;
     switch(wKeyID)
     {
          case 0x0050 :
          case 0x0051 :
          bUK0 = 2;
          bUK1 = 5;
          bUK2 = 9;
          bUK3 = 11;
          bUD = 0x68;
          bUPlus = FALSE;
          // SV PR
          bDK0 = 4;
          bDK1 = 12;
          bDK2 = 10;
          bDK3 = 7;
          bDD = 0x67;
          bDPlus = FALSE;
          // SV PR
          break;
          case 0x0052 :
          case 0x0053 :
          bUK0 = 7;
          bUK1 = 3;
          bUK2 = 9;
          bUK3 = 5;
          bUD = 0x54;
          bUPlus = TRUE;
          // SV SE
          bDK0 = 2;
          bDK1 = 8;
          bDK2 = 13;
          bDK3 = 6;
          bDD = 0x55;
          bDPlus = TRUE;
          // SV SE
          break;
          case 0x0057 :
          case 0x0058 :
          bUK0 = 7;
          bUK1 = 3;
          bUK2 = 9;
          bUK3 = 5;
          bUD = 0x22;
          bUPlus = FALSE;
          // SV CH
          bDK0 = 2;
          bDK1 = 8;
          bDK2 = 13;
          bDK3 = 6;
          bDD = 0x7A;
          bDPlus = TRUE;
          break;
          default :
          return wKeyID;
     }
     dwUPKey = pBlock[bUK3];
     dwUPKey <<= 8;
     dwUPKey |= pBlock[bUK2];
     dwUPKey <<= 8;
     dwUPKey |= pBlock[bUK1];
     dwUPKey <<= 8;
     dwUPKey |= (BYTE)((bUPlus)? (pBlock[bUK0] + bUD) : (pBlock[bUK0] - bUD));
     dwDWKey = pBlock[bDK3];
     dwDWKey <<= 8;
     dwDWKey |= pBlock[bDK2];
     dwDWKey <<= 8;
     dwDWKey |= pBlock[bDK1];
     dwDWKey <<= 8;
     dwDWKey |= (BYTE)((bDPlus)? (pBlock[bDK0] + bDD) : (pBlock[bDK0] - bDD));
     if(wKeyID == 0x0051 || wKeyID == 0x0053 || wKeyID == 0x0058)
     {
          *pUpKey = dwDWKey;
          *pDwKey = dwUPKey;
     }
     else
     {
          *pUpKey = dwUPKey;
          *pDwKey = dwDWKey;
     }
     return wKeyID;
}

Offline ñòóKýçrÕôK

  • my name is nooks, and I approve this message
  • MX Hosts
  • *****
  • Dream BIG, Live BIGGER!!
Re: TCP Encryption
« Reply #1 on: April 20, 2006, 07:06:46 pm »
 :shock: uuummm O......K..  :?
When you wake up each morning always try to remember tomorrow is never your option, it's God's. Love like you want to. Live like you aren't afraid. And ALWAYS try to remember that even if it seems personal it's never as important as something you may have forgotten to do today.

WinMXWorld.com Help_AE182F4EBABE - For WinMX help or help on other pc related matters.
WinMXWorld.com Cafe_AE182F4ECAFE - For great chat.

Offline Ace

  • Forum Member
  • *****
  • Every new creation is the sum of old and new.
Re: TCP Encryption
« Reply #2 on: April 22, 2006, 01:43:29 pm »
lol just for you nookie in layman terms
 have a read here to explain bit better  so you can understand bit better

http://www.tcpipguide.com/free/t_PPPCompressionControlProtocolCCPandCompressionAlgo.htm

KM

  • Guest
Re: TCP Encryption
« Reply #3 on: April 22, 2006, 04:49:40 pm »
* KM wonders what PPP has to do with winmx communications...

Offline Scyre

  • Forum Member
  • <Insert nothing here.>
Re: TCP Encryption
« Reply #4 on: June 26, 2006, 03:29:57 am »
Ok, There are a few questions I have...

First, is this the initial communication between the peer cache and client,  or the client and the primary it gets sent to?

Second, if this is for both, then does the client use the same crypt keys for the primary that it did for the peer cache, or does it need to set up for using new crypt keys when it connects to the primary that the peer cache sends it to?

Third, can you send me a dollar?

Thanks, and Be Good!
Scyre
A cat will almost always blink when hit with a hammer.

KM

  • Guest
Re: TCP Encryption
« Reply #5 on: June 26, 2006, 03:45:33 am »
1. i have no idea what you mean - are you asking if winmx connects to a primary, then connects to the peer cache? that would erm, well... the peer cache is to locate the primary...

2. every connection and every communication is completely separate and completely unrelated to any other communication (except for the obvious of course like a file transfer connection is obviously related to data sent back and forth between the primaries to negotiate that connection), just join a chat room whilst not connected to any primary to see that they are unrelated, everything is separate within winmx - makes it much simpler to deal with one thing without worrying about everything else

3. no, unfortunately they don't make 0.000001p coins so i am unable to do so

Offline Zénar

  • Forum Member
  • *****
  • Born again christian since 2010!
Re: TCP Encryption
« Reply #6 on: November 08, 2006, 01:13:19 am »
In the top, we have void DecryptFrontCode(const BYTE *pSrc, BYTE *pDst) but can I have the void EncryptFrontCode please?

I want to use that for one of my program  :wink:
[John 14:6] Jesus told him, "I am the way, the truth, and the life. No one can come to the Father except through me."
[Jean 14:6] Jésus lui dit: Je suis le chemin, la vérité, et la vie. Nul ne vient au Père que par moi.

KM

  • Guest
Re: TCP Encryption
« Reply #7 on: November 08, 2006, 04:25:43 am »
erm, that encryption is only used for secondary cache communications

Offline Zénar

  • Forum Member
  • *****
  • Born again christian since 2010!
Re: TCP Encryption
« Reply #8 on: November 08, 2006, 05:21:44 pm »
I wanted to create a cache server to test how the connection is made between secondary and the server.

For the login, I must send (I've found that in the forum):
 nickname (string) + linetype (byte) + reserved (byte) + port number (2 bytes)

I just don't know where I put the character 0x00 to create the login packet for secondary...

By the ways, what is reserved?
[John 14:6] Jesus told him, "I am the way, the truth, and the life. No one can come to the Father except through me."
[Jean 14:6] Jésus lui dit: Je suis le chemin, la vérité, et la vie. Nul ne vient au Père que par moi.

Sharky

  • Guest
Re: TCP Encryption
« Reply #9 on: November 19, 2006, 08:43:08 am »
after the nickname, it's a string and strings are usually (not always) null terminated.

Sharky

  • Guest
Re: TCP Encryption
« Reply #10 on: November 19, 2006, 08:46:25 am »
nickname + 0x00 + linetype(byte) + reserved(byte) + port number(2 bytes)

^ 0x00(NULL) usually indicates the end of the nickname.

Offline Zénar

  • Forum Member
  • *****
  • Born again christian since 2010!
Re: TCP Encryption
« Reply #11 on: November 19, 2006, 03:19:03 pm »
Yep I've found it!  :D
[John 14:6] Jesus told him, "I am the way, the truth, and the life. No one can come to the Father except through me."
[Jean 14:6] Jésus lui dit: Je suis le chemin, la vérité, et la vie. Nul ne vient au Père que par moi.

Offline saturnx311

  • Forum Member
Re: TCP Encryption
« Reply #12 on: January 07, 2009, 05:29:56 am »
A cat will almost always blink when hit with a hammer.

What the eff is this about? Are you sick or something?

Cats are one of God's most noble creatures. Certainly higher that the poster of such a signature as this one.

)Sorry, off topic I know, but I couldn't let this pass.

WinMX is awesome; the latest patch helped me solve a frustrating router issue.
To whoever is responsible, thank you.

A cat hater will almost always blink when hit with a fist.

Offline GhostShip

  • Ret. WinMX Special Forces
  • WMW Team
  • *****
Re: TCP Encryption
« Reply #13 on: January 07, 2009, 07:05:55 pm »
The signature seems to be Scyres brand of humour, our apologies if it offends, I,m sure Scyre is a cat lover also and was not contemplating any real life activity of the sort nor encouraging it.

btw Happy new year Saturnx311

Offline wonderer

  • MX Hosts
  • *****
  • ***
Re: TCP Encryption
« Reply #14 on: January 07, 2009, 10:44:02 pm »
That cat must have recovered from that hit by now.....
That post is over a year old

Offline achilles

  • Core
  • *****
Re: TCP Encryption
« Reply #15 on: January 24, 2011, 01:47:08 am »
How many bits is the encryption for communication between clients for the file transfer protocol?
I'm a Hardware, and Cyber Security Guy.

Offline GhostShip

  • Ret. WinMX Special Forces
  • WMW Team
  • *****
Re: TCP Encryption
« Reply #16 on: January 24, 2011, 03:19:57 am »
Thats a pretty easy one Achilles, none is the answer your seeking as WinMX was constructed prior to ISP deep packet inspection technology and that single part of the the client is unencrypted, its basically a variant of the OpenNap/Napster routine with encrypted management control that delivers a small part of security but not enough for my comfort.


Offline achilles

  • Core
  • *****
Re: TCP Encryption
« Reply #17 on: January 24, 2011, 03:31:12 am »
Thanks for the answer GhostShip! I thought the traffic was encrypted.  That would be a very nice addition to add to the new client when possible.
I'm a Hardware, and Cyber Security Guy.

WinMX World :: Forum  |  Technical  |  Protocol Discussion  |  TCP Encryption
 

gfxgfx
gfx
©2005-2024 WinMXWorld.com. All Rights Reserved.
SMF 2.0.19 | SMF © 2021, Simple Machines | Terms and Policies
Page created in 0.011 seconds with 25 queries.
Helios Multi © Bloc
gfx
Powered by MySQL Powered by PHP Valid XHTML 1.0! Valid CSS!