Skip to content

Implement AntiCheat System - AntiHacks:#23509

Closed
kvipka wants to merge 2 commits into
TrinityCore:3.3.5from
kvipka:AC_AntiHacks
Closed

Implement AntiCheat System - AntiHacks:#23509
kvipka wants to merge 2 commits into
TrinityCore:3.3.5from
kvipka:AC_AntiHacks

Conversation

@kvipka

@kvipka kvipka commented Jun 24, 2019

Copy link
Copy Markdown
Contributor

-ASH - AntiSpeedHack (+anti teleport hack)
-AFH - AntiFlyHack
-DoubleJump
-Wallclimb
-FakeJumper
-FakeFlyingMode

This system has been tested on some big projects with big online (project names are hidden).
Issues: No false positives

For some questions : discord -
https://discord.gg/GcJJfXG

youtube videos : https://www.youtube.com/watch?v=aZP3qm9Ql0Y&list=PLUpIDd4JDWyOOJhJRcfaVL0RaRH1Ra5Xy

Note:
This system using only mathematic operations, without additional manager as AC2, no using additional memory.

Part of code can be shorter, when PR with ACK-packet handlers will complete.

ACK 1

@kvipka

kvipka commented Jun 24, 2019

Copy link
Copy Markdown
Contributor Author

since some began to sell this code (violating copyrights), I consider such behavior to be incorrect, and I post this code for free use

@ELdoBA

ELdoBA commented Jun 24, 2019

Copy link
Copy Markdown

onsider such behavior to be incorrect, and I pos

Nice. Anyway, we all know you are a real author 😜

@FrancescoBorzi

Copy link
Copy Markdown
Contributor

@kvipka good job!

@searcas

searcas commented Jun 24, 2019

Copy link
Copy Markdown

@kvipka Unfortunately people won't be thankful for this.
Anyway respect.

@Killyana

Killyana commented Jun 24, 2019

Copy link
Copy Markdown
Contributor

We are thankful to everyone who contribute to the project, specially with this kind of PRs.

###################################################################################################
# AntiCheats.FlyHackTimer
# Description: Timer for AntiCheat FlyHack check
# Default: 3000 - 1 check in 1 second

@kvipka kvipka Jun 24, 2019

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 check in 3 second
for big projects better (1500ppl +) set 5000 (5 sec) or more

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, add this description in conf file to clarify and not miss the information ;)

@Aokromes Aokromes Jun 26, 2019

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#        Default:     3000 - 1 check in 1 second
1 check in 3 second
#        Default:     3000 - 1 check in 3 seconds

:P

@Winfidonarleyan

Copy link
Copy Markdown
Contributor

Wow, very good

Comment thread src/server/scripts/Commands/cs_misc.cpp Outdated

if (target)
{
std::string _canfly = handler->GetTrinityString(LANG_ERROR);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_canfly is initialized but then its value is replaced 1 line below

@jackpoz

jackpoz commented Jun 25, 2019

Copy link
Copy Markdown
Member

I will try to queue this PR to be merged in the test server (either by creating a new realm or waiting for the current PR in test to be merged)

@Aokromes

Copy link
Copy Markdown
Member

few cosmetic things:

anticheat:919: trailing whitespace.
LANG_GM_ANNOUNCE_AFH_CANFLYWRONG = 6618, // AntiFlyHack - flying without canfly
anticheat:1051: trailing whitespace.
unitCaster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ);
anticheat:1070: trailing whitespace.
return;
anticheat:1272: trailing whitespace.

Comment thread src/server/worldserver/worldserver.conf.dist
Comment thread src/server/game/Spells/SpellEffects.cpp Outdated
Comment thread src/server/game/Handlers/MovementHandler.cpp Outdated
Comment thread src/server/game/Handlers/MovementHandler.cpp Outdated
Comment thread src/server/game/Handlers/MovementHandler.cpp Outdated
@Kittnz

Kittnz commented Jun 25, 2019

Copy link
Copy Markdown
Contributor

When ack packet handlers are implemented we can also add teleport hacking detection

@kvipka

kvipka commented Jun 25, 2019

Copy link
Copy Markdown
Contributor Author

Teleport hack also not working, just because it usual step with wrong distance, and blocked by ASH

Comment thread src/server/worldserver/worldserver.conf.dist

void Player::Update(uint32 p_time)
{
if (!GetSession())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this skip some more stuff than what the !IsInWorld() check below skips ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an impossible condition.

if (ToUnit()->IsFalling() || IsInFlight())
return true;

if (GetTransport() || GetVehicle() || GetVehicleKit())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if we mount on vehicle and use hack, can we ignore hack check here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.We can get speed of vehicle? If yes, need to add it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can get speed of vehicle, but I'm not sure if here we can.
in WorldSession::HandleMovementOpcodes I think yes


GetPosition(x, y);

TC_LOG_INFO("anticheat", "Unit::CheckMovementInfo : SpeedHack Detected for Account id : %u, Player %s", GetSession()->GetAccountId(), GetName().c_str());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe should be:

"Player::CheckMovementInfo : ...

instead of

"Unit::CheckMovementInfo : ...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P yep, early it was in unit, and yes, need to rename

movetime = movementInfo.time;
realping = GetSession()->GetLatency();
ping = realping;
if (ping < 60)

@Riztazz Riztazz Jun 25, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use std::min instead
edit: derp ;p

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe std::max ? =)

@@ -0,0 +1,15 @@
-- Strings for ASH + AFH allerts

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, the name of the sql will be renamed, so it does not matter much, but, better not use capital letters in the file name

@Aokromes

Copy link
Copy Markdown
Member

a low level hunter on one elevator xd

Player::CheckMovementInfo : Climb-Hack detected for Account id : , Player , diffZ = 2.124893, distance = 0.000000, angle = 0.000000, Map = Kalimdor, mapId = 1, X = -5381.604492, Y = -2488.781494, Z = 49.361019

@kvipka

kvipka commented Jun 30, 2019

Copy link
Copy Markdown
Contributor Author

added check for first step on elevator for except wallclimb this false/positive

@Aokromes

Copy link
Copy Markdown
Member

plz don't push --force or we can miss sql changes.

@Aokromes

Aokromes commented Jul 1, 2019

Copy link
Copy Markdown
Member

creature 667 sometimes casts one spell on player making it to false positive
Ignore control Hack detected
plz add coords there too xd at least on log.
Player must have equiped weapon 7717, but i am unable to reproduce the log 100%

@Aokromes

Aokromes commented Jul 4, 2019

Copy link
Copy Markdown
Member

it looks hunter's feing dead is reason to this bug a lof of times.

@kvipka

kvipka commented Jul 4, 2019

Copy link
Copy Markdown
Contributor Author

@kvipka

kvipka commented Jul 4, 2019

Copy link
Copy Markdown
Contributor Author

ohh, rly my mistake.
Bad copied from repo. good catch

@Aokromes

Aokromes commented Jul 4, 2019

Copy link
Copy Markdown
Member

nope, i git apply.

@Aokromes

Aokromes commented Jul 5, 2019

Copy link
Copy Markdown
Member

still false positiving xd maybe it's the hunter feigns when it's stunned?

@kvipka

kvipka commented Jul 5, 2019

Copy link
Copy Markdown
Contributor Author

Can you add info from logs?

@Aokromes

Aokromes commented Jul 5, 2019

Copy link
Copy Markdown
Member

there is nothing more:

Player::CheckMovementInfo : Ignore control Hack detected for Account id : , Player

Maybe include a log of debufs can help?

@kvipka

kvipka commented Jul 6, 2019

Copy link
Copy Markdown
Contributor Author

i think not needed.
Can you play this trigger yourself? Sure that the problem is really a normal player? And if you can to reproduce - record a video please. Neither me nor the players - it does not come out to get a similar result.

@Aokromes

Aokromes commented Jul 6, 2019

Copy link
Copy Markdown
Member

yes, she is a normal player, i even spoke with her and told to use feign a lot of times and sometimes it was show and most no.

@kvipka

kvipka commented Jul 6, 2019

Copy link
Copy Markdown
Contributor Author

try this, i can't to check it on weekend. Strange, but it first idea

@Aokromes

Aokromes commented Jul 8, 2019

Copy link
Copy Markdown
Member

the coding standards of
Conflicting files
src/server/game/Entities/Object/Object.cpp
src/server/game/Entities/Object/Object.h
arent needed anymore

@kvipka

kvipka commented Jul 8, 2019

Copy link
Copy Markdown
Contributor Author

-ASH - AntiSpeedHack
-AFH - AntiFlyHack
-DoubleJump
-Wallclimb
-FakeJumper
-FakeFlyingMode
@ghost

ghost commented Jul 31, 2019

Copy link
Copy Markdown

@kvipka I found false positives:

--GM account
2019-07-31_14:02:29 Player::CheckMovementInfo :  SpeedHack Detected for Account id : 1, Player Test
2019-07-31_14:02:29 Player::CheckMovementInfo :  oldX = 16222.987305
2019-07-31_14:02:29 Player::CheckMovementInfo :  oldY = 16245.895508
2019-07-31_14:02:29 Player::CheckMovementInfo :  newX = 16222.822266
2019-07-31_14:02:29 Player::CheckMovementInfo :  newY = 16246.409180
2019-07-31_14:02:29 Player::CheckMovementInfo :  packetdistance = 0.539534
2019-07-31_14:02:29 Player::CheckMovementInfo :  available distance = 0.483057
2019-07-31_14:02:29 Player::CheckMovementInfo :  movetime = 1152544896.000000
2019-07-31_14:02:29 Player::CheckMovementInfo :  delay sent ptk - recieve pkt (previous) = 0.000000
2019-07-31_14:02:29 Player::CheckMovementInfo :  FullDelay = 0.000007
2019-07-31_14:02:29 Player::CheckMovementInfo :  difftime = 0.060007
2019-07-31_14:02:29 Player::CheckMovementInfo :  latency = 0
2019-07-31_14:02:29 Player::CheckMovementInfo :  ping = 60

--Player account
2019-07-31_14:07:46 Player::CheckMovementInfo :  SpeedHack Detected for Account id : 2, Player Player
2019-07-31_14:07:46 Player::CheckMovementInfo :  oldX = -703.699951
2019-07-31_14:07:46 Player::CheckMovementInfo :  oldY = 2727.541260
2019-07-31_14:07:46 Player::CheckMovementInfo :  newX = -703.277954
2019-07-31_14:07:46 Player::CheckMovementInfo :  newY = 2727.940674
2019-07-31_14:07:46 Player::CheckMovementInfo :  packetdistance = 0.581045
2019-07-31_14:07:46 Player::CheckMovementInfo :  available distance = 0.420049
2019-07-31_14:07:46 Player::CheckMovementInfo :  movetime = 1152861952.000000
2019-07-31_14:07:46 Player::CheckMovementInfo :  delay sent ptk - recieve pkt (previous) = 0.000000
2019-07-31_14:07:46 Player::CheckMovementInfo :  FullDelay = 0.000007
2019-07-31_14:07:46 Player::CheckMovementInfo :  difftime = 0.060007
2019-07-31_14:07:46 Player::CheckMovementInfo :  latency = 0
2019-07-31_14:07:46 Player::CheckMovementInfo :  ping = 60

Anticheat falsely triggered when the client started on the same machine as the server.

@jackpoz

jackpoz commented Aug 2, 2019

Copy link
Copy Markdown
Member

could you fix the merge conflicts ?

@Aokromes

Copy link
Copy Markdown
Member

if you wipe on malygos 3rd phase it false positives a lot.

@ghost

ghost commented Aug 14, 2019

Copy link
Copy Markdown

@Aokromes Strange, but there the anticheat does not give false positives for me. In general, I noticed such a problem that false positives occur completely randomly. For an example: at any movement of the character on the GM Island, the anticheat falsely reacted to my character. The funny thing is that this problem was solved by restart the server, which in principle can mean that the problem may not be in the anticheat itself.

@Shauren

Shauren commented Aug 14, 2019

Copy link
Copy Markdown
Member

@Infernales It actually can be anticheat, if the reason is something like uninitialized variable (even relog could make it behave differently) or if its related to timers (restarting resets the value for getMsTime())

@Aokromes

Copy link
Copy Markdown
Member

@Infernales you wiped there on 3rd stage?

@ghost

ghost commented Aug 14, 2019

Copy link
Copy Markdown

@Aokromes Yes.
@Shauren In fact, anything can be there, I just expressed my assumption. I also noticed that the longer the server runs, the more false positives the anticheat has.

@ghost

ghost commented Aug 14, 2019

Copy link
Copy Markdown

@kvipka Thx for update.

@Aokromes

Copy link
Copy Markdown
Member

Conflicting files
src/server/database/Database/Implementation/LoginDatabase.cpp
src/server/database/Database/Implementation/LoginDatabase.h
src/server/game/Entities/Object/Object.cpp
src/server/game/Entities/Object/Object.h
src/server/game/World/World.h

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.