Anti DC Hack solution

Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    Account Upgraded | Title Enabled! juajua123 is offline
    MemberRank
    Aug 2010 Join Date
    203Posts

    Anti DC Hack solution

    Hi everyone, i guess some of you know about the DC Hack, its a hack that disconnects all the players around the character, sending some packets to the server. My question is, is there a way to prevent it?, i mean a way to ignore/block the packets sent by the "hacker". And i dont mean a clientside anticheat like anticheats who detect running procceses or injection into the main, i mean server-side protection. Has anybody done it already?.


  2. #2
    Legend MuIsBest is offline
    LegendRank
    Dec 2006 Join Date
    NorwayLocation
    2,144Posts

    Re: Anti DC Hack solution

    I will leave this thread open even though you're seeking help. It might help out the Mu community in a good way.

    Regards,
    MuIsBest

  3. #3
    I'm The Freakin' Archmage Bakuya is offline
    MemberRank
    Dec 2007 Join Date
    RomaniaLocation
    295Posts

    Re: Anti DC Hack solution

    what season are you playing?

  4. #4
    NN - Nord & Noob mauka is offline
    MemberRank
    Jul 2004 Join Date
    1,728Posts

    Re: Anti DC Hack solution

    Mirraseq allready posted OS one of several solution of this trouble.
    Use search!

  5. #5

    Re: Anti DC Hack solution

    There's .dll that blocks wpe pro xD
    Posted via Mobile Device

  6. #6
    Don't be a hater 1Word is offline
    MemberRank
    Jan 2006 Join Date
    At homeLocation
    1,779Posts

    Re: Anti DC Hack solution

    By encrypting packets this can be achieved.

  7. #7
    Kingdom of Shadows [RCZ]ShadowKing is offline
    MemberRank
    Jul 2007 Join Date
    1,644Posts

    Re: Anti DC Hack solution

    limit animations per second in gameserver function CGActionRecv

  8. #8
    Account Upgraded | Title Enabled! juajua123 is offline
    MemberRank
    Aug 2010 Join Date
    203Posts

    Re: Anti DC Hack solution

    From Mirraseq source, here is what i've done, is .18 GS

    Main.cpp

    Code:
    FunctionHook((DWORD)&CGActionRecv,0x040641A); // CGActionRecv hook offset {JMP 0044A760}
    Player.h

    Code:
    struct PMSG_ACTION
    {
    	PBMSG_HEAD h;
    	BYTE Dir;	// 3
    	BYTE ActionNumber;	// 4
    	BYTE iTargetIndexH;	// 5
    	BYTE iTargetIndexL;	// 6
    };
    
    struct AddObj
    {
    	int AnimTick;
    	int AnimCnt;
    };
    
    #define off_LogAddTD 0x0635992C
    #define off_objtable 0x0660F078
    #define off_CGActionRecv 0x0044A760
    
    #define OBJ_MAX 4000
    void CGActionRecv(PMSG_ACTION * lpMsg, int aIndex);
    Player.cpp

    Code:
    void CGActionRecv(PMSG_ACTION * lpMsg, int aIndex)
    {
    	DWORD dwObj = off_objtable;
            AddObj *AddTab;
    	AddTab = (AddObj*)malloc(OBJ_MAX * sizeof(AddObj));
    	if (aIndex > OBJ_MAX)
    		return;
    		
    	>>>>if (AddTab[aIndex].AnimTick == 0)<<<< Unhandled exception error if i comment out "if (aIndex > OBJ_MAX)
    		return;"
    	{
    		AddTab[aIndex].AnimTick = GetTickCount();
    		AddTab[aIndex].AnimCnt = 0;
    		CloseClient(aIndex);
    	}
    	else
    	{
    		int tick = GetTickCount();
    		if (tick - AddTab[aIndex].AnimTick >= 1000)
    		{
    			AddTab[aIndex].AnimTick = tick;
    			AddTab[aIndex].AnimCnt = 0;
    			CloseClient(aIndex);
    		}
    		else
    		{
    			AddTab[aIndex].AnimCnt += 1;
    			if (AddTab[aIndex].AnimCnt >= 10)
    			{
    				Log.Add("[ANTI-HACK][MoveProto][%s][%s] Too many actions (DC Hack).", (LPVOID)(dwObj + 0x68), (LPVOID)(dwObj + 0x73));
    				AddTab[aIndex].AnimTick = 0;
    				AddTab[aIndex].AnimCnt = 0;
    				CloseClient(aIndex);
    				return;
    			}
    		}
    	}
    	
    	CGActionRecvFunc(lpMsg, aIndex); // pCGActionRecvFunc CGActionRecvFunc = (pCGActionRecvFunc) 0x044A760;
    }






    IT compiles just fine, thing is, when i get in the game the function is well hooked, but, if i comment out "if (aIndex > OBJ_MAX)" so that it goes to "(AddTab[aIndex].AnimTick == 0", GS crashes in the marked line, under "unhandled exception error". I think AddTab is not working properly, any ideas?

  9. #9
    Kingdom of Shadows [RCZ]ShadowKing is offline
    MemberRank
    Jul 2007 Join Date
    1,644Posts

    Re: Anti DC Hack solution

    Its obvious why it crash, it reach invalid pointer because aIndex goes over the limit of AddTab. If you define AddTab like
    Code:
    short AddTab[255];
    you will not be able to access AddTab[256] because its not allocated in declaration. By the way I have no idea why would you delete the line you marked. And this line
    Code:
    AddTab = (AddObj*)malloc(OBJ_MAX * sizeof(AddObj));
    you need to free the memory used for allocating AddTab once you're done with it else there will be what's called memory leak. A global preallocated instance of AddTab would be better.

    .h
    Code:
    struct PMSG_ACTION
    {
         PBMSG_HEAD h;
         BYTE Dir;    // 3
         BYTE ActionNumber;    // 4
         BYTE iTargetIndexH;    // 5
         BYTE iTargetIndexL;    // 6 
    };  
    
    struct AddObj 
    {
         int AnimTick;
         int AnimCnt; 
    };
    
    #define off_LogAddTD 0x0635992C 
    #define off_objtable 0x0660F078 
    #define off_CGActionRecv 0x0044A760  
    #define OBJ_MAX 4000
    
    
    void CGActionRecv(PMSG_ACTION * lpMsg, int aIndex);
    .cpp
    Code:
    AddObj AddTab[OBJ_MAX];
    
    void CGActionRecv(PMSG_ACTION * lpMsg, int aIndex) 
    {
         DWORD dwObj = off_objtable;
         if (aIndex > OBJ_MAX)         return;
         if (AddTab[aIndex].AnimTick == 0)
         {
             AddTab[aIndex].AnimTick = GetTickCount();
             AddTab[aIndex].AnimCnt = 0;
             CloseClient(aIndex);
         }
         else
         {
             int tick = GetTickCount();
             if (tick - AddTab[aIndex].AnimTick >= 1000)
             {
                 AddTab[aIndex].AnimTick = tick;
                 AddTab[aIndex].AnimCnt = 0;
                 CloseClient(aIndex);
             }
             else
             {
                 AddTab[aIndex].AnimCnt += 1;
                 if (AddTab[aIndex].AnimCnt >= 10)
                 {
                     Log.Add("[ANTI-HACK][MoveProto][%s][%s] Too many actions (DC Hack).", (LPVOID)(dwObj + 0x68), (LPVOID)(dwObj + 0x73));
                     AddTab[aIndex].AnimTick = 0;
                     AddTab[aIndex].AnimCnt = 0;
                     CloseClient(aIndex);
                     return;
                 }
             }
         }
              CGActionRecvFunc(lpMsg, aIndex); // pCGActionRecvFunc CGActionRecvFunc = (pCGActionRecvFunc) 0x044A760; 
    }
    Somewhere before starting using the AddTab clean it like
    Code:
    memset(&AddTab, 0x00, sizeof(AddTab));

  10. #10
    Account Upgraded | Title Enabled! juajua123 is offline
    MemberRank
    Aug 2010 Join Date
    203Posts

    Re: Anti DC Hack solution

    Ok, i done it, but why is it always returning in this part of the code?

    Code:
    if (aIndex > OBJ_MAX) 
    		 Log.Add("[DBG] return > aIndex > OBJ_MAX");
    			 >return;
    Why is that happening, if im a valid player inside of the game?

    Is this okay?, i mean the memset location.

    Code:
    void CGActionRecv(PMSG_ACTION * lpMsg, int aIndex) 
    {
         memset(&AddTab, 0x00, sizeof(AddTab)); 
         DWORD dwObj = off_objtable;
         if (aIndex > OBJ_MAX) 
    	Log.Add("[DBG] return > aIndex > OBJ_MAX");
    	return;
         ...........
    }
    If i comment the "return;" there it shows "unhandled exception error" under this line
    " AddTab[aIndex].AnimCnt += 1;"

    Thanks for answering this noob questions.
    Last edited by juajua123; 02-04-12 at 09:10 PM.

  11. #11
    Kingdom of Shadows [RCZ]ShadowKing is offline
    MemberRank
    Jul 2007 Join Date
    1,644Posts

    Re: Anti DC Hack solution

    You need to set OBJ_MAX value for your gameserver, if you don't know to search it with olly then set OBJ_MAX to something like 10000 or bigger just to be sure.

    Memset is not good located, put it before you do the hook like
    memset(...);
    Hook(...);

  12. #12
    Account Upgraded | Title Enabled! juajua123 is offline
    MemberRank
    Aug 2010 Join Date
    203Posts

    Re: Anti DC Hack solution

    I have OBJ_MAX already set to 7400 wich is MAX in GS .18, but its still returning in the "if (aIndex > OBJ_MAX) return;", if i comment out that line it works perfectly.

  13. #13
    Kingdom of Shadows [RCZ]ShadowKing is offline
    MemberRank
    Jul 2007 Join Date
    1,644Posts

    Re: Anti DC Hack solution

    Make this
    Code:
    Log.Add("[DBG] return > aIndex > OBJ_MAX");
    to
    Code:
    Log.Add("[DBG] return > aIndex > OBJ_MAX %d", aIndex);
    And tell me what value return.

  14. #14
    Account Upgraded | Title Enabled! juajua123 is offline
    MemberRank
    Aug 2010 Join Date
    203Posts

    Re: Anti DC Hack solution

    I get 6400 as index, im the only player in the server.

  15. #15
    Kingdom of Shadows [RCZ]ShadowKing is offline
    MemberRank
    Jul 2007 Join Date
    1,644Posts

    Re: Anti DC Hack solution

    You're sure you defined like
    Code:
    #define OBJ_MAX 7400
    ?
    I see no other reason why it return at that line.
    If you delete the line it may happen to crash if player index is bigger than AddTab size.



Page 1 of 2 12 LastLast

Advertisement