From 719a00e926e6187e816440e97dfc0d8ede0812b8 Mon Sep 17 00:00:00 2001 From: Trisjdc Date: Mon, 5 May 2014 16:33:30 +0100 Subject: Core/Spells: Define and implement SPELL_ATTR7_NO_PUSHBACK_ON_DAMAGE --- src/server/game/Entities/Unit/Unit.cpp | 3 ++- src/server/game/Miscellaneous/SharedDefines.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 00172face5f..7e052fd2279 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -774,7 +774,8 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam if (damagetype != NODAMAGE && damage) { - if (victim != this && victim->GetTypeId() == TYPEID_PLAYER) // does not support creature push_back + if (victim != this && victim->GetTypeId() == TYPEID_PLAYER && // does not support creature push_back + (!spellProto || !(spellProto->AttributesEx7 & SPELL_ATTR7_NO_PUSHBACK_ON_DAMAGE))) { if (damagetype != DOT) if (Spell* spell = victim->m_currentSpells[CURRENT_GENERIC_SPELL]) diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index b52e640afc7..0d917feaa64 100644 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -533,7 +533,7 @@ enum SpellAttr7 SPELL_ATTR7_IS_CHEAT_SPELL = 0x00000008, // 3 Cannot cast if caster doesn't have UnitFlag2 & UNIT_FLAG2_ALLOW_CHEAT_SPELLS SPELL_ATTR7_UNK4 = 0x00000010, // 4 Only 47883 (Soulstone Resurrection) and test spell. SPELL_ATTR7_SUMMON_PLAYER_TOTEM = 0x00000020, // 5 Only Shaman player totems. - SPELL_ATTR7_UNK6 = 0x00000040, // 6 Dark Surge, Surge of Light, Burning Breath triggers (boss spells). + SPELL_ATTR7_NO_PUSHBACK_ON_DAMAGE = 0x00000040, // 6 Does not cause spell pushback on damage SPELL_ATTR7_UNK7 = 0x00000080, // 7 66218 (Launch) spell. SPELL_ATTR7_HORDE_ONLY = 0x00000100, // 8 Teleports, mounts and other spells. SPELL_ATTR7_ALLIANCE_ONLY = 0x00000200, // 9 Teleports, mounts and other spells. -- cgit v1.2.3 From b5b64a2cdd6ccc935610b090b42d695df083eebb Mon Sep 17 00:00:00 2001 From: jackpoz Date: Mon, 26 May 2014 20:13:04 +0200 Subject: Core/NetworkIO: Adjust more packet throttling values --- src/server/game/Server/WorldSession.cpp | 36 +++++++++++++++++---------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index a784a5d636d..5d5e6afdd7b 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -1303,26 +1303,27 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co uint32 maxPacketCounterAllowed; switch (opcode) { + // These opcodes are spammed by few addons so a very high limit is required + case CMSG_QUEST_QUERY: case CMSG_MESSAGECHAT: - { - maxPacketCounterAllowed = 500; - break; - } - - case CMSG_ATTACKSTOP: case CMSG_ITEM_QUERY_SINGLE: case CMSG_ITEM_NAME_QUERY: - case CMSG_GUILD_QUERY: + case CMSG_GAMEOBJECT_QUERY: case CMSG_NAME_QUERY: case CMSG_PET_NAME_QUERY: - case CMSG_GAMEOBJECT_QUERY: case CMSG_CREATURE_QUERY: case CMSG_NPC_TEXT_QUERY: + { + maxPacketCounterAllowed = 5000; + break; + } + + case CMSG_ATTACKSTOP: + case CMSG_GUILD_QUERY: case CMSG_ARENA_TEAM_QUERY: case CMSG_TAXINODE_STATUS_QUERY: case CMSG_TAXIQUERYAVAILABLENODES: case CMSG_QUESTGIVER_QUERY_QUEST: - case CMSG_QUEST_QUERY: case CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY: case CMSG_QUERY_QUESTS_COMPLETED: case CMSG_QUEST_POI_QUERY: @@ -1340,28 +1341,30 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co case MSG_QUERY_NEXT_MAIL_TIME: case MSG_GUILD_EVENT_LOG_QUERY: case MSG_MOVE_SET_FACING: + case CMSG_INSPECT: { - maxPacketCounterAllowed = 200; + maxPacketCounterAllowed = 500; break; } case CMSG_REQUEST_PARTY_MEMBER_STATS: case CMSG_WHO: + case CMSG_SETSHEATHED: + case CMSG_CONTACT_LIST: { maxPacketCounterAllowed = 50; break; } - case CMSG_SETSHEATHED: - case CMSG_CONTACT_LIST: + case CMSG_SPELLCLICK: + case CMSG_GAMEOBJ_USE: + case CMSG_GAMEOBJ_REPORT_USE: + case MSG_RAID_TARGET_UPDATE: { - maxPacketCounterAllowed = 10; + maxPacketCounterAllowed = 20; break; } - case CMSG_GAMEOBJ_USE: - case CMSG_GAMEOBJ_REPORT_USE: - case CMSG_SPELLCLICK: case CMSG_PLAYER_LOGOUT: case CMSG_LOGOUT_REQUEST: case CMSG_LOGOUT_CANCEL: @@ -1486,7 +1489,6 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co case MSG_SET_DUNGEON_DIFFICULTY: case MSG_SET_RAID_DIFFICULTY: case MSG_RANDOM_ROLL: - case MSG_RAID_TARGET_UPDATE: case MSG_PARTY_ASSIGNMENT: case MSG_RAID_READY_CHECK: { -- cgit v1.2.3 From 0e32789cd26d15f347ddcd11f5a31abf1ba007aa Mon Sep 17 00:00:00 2001 From: Trisjdc Date: Mon, 26 May 2014 20:42:53 +0100 Subject: Core/Spells: Missing target conditions for Divine Hymn/Hymn of Hope's second effect --- src/server/scripts/Spells/spell_priest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index f96a30c903a..dea67b5222d 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -205,7 +205,7 @@ class spell_pri_divine_hymn : public SpellScriptLoader void Register() override { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pri_divine_hymn_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pri_divine_hymn_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ALLY); } }; @@ -336,7 +336,7 @@ class spell_pri_hymn_of_hope : public SpellScriptLoader void Register() override { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pri_hymn_of_hope_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pri_hymn_of_hope_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ALLY); } }; -- cgit v1.2.3 From f312b869417d5bc0ea10928284d040e04259c1d8 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Tue, 27 May 2014 21:19:19 +0200 Subject: Core/NetworkIO: Adjust more packet throttling values --- src/server/game/Server/WorldSession.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 5d5e6afdd7b..098cc6ae69f 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -1351,6 +1351,8 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co case CMSG_WHO: case CMSG_SETSHEATHED: case CMSG_CONTACT_LIST: + case CMSG_GUILD_SET_PUBLIC_NOTE: + case CMSG_GUILD_SET_OFFICER_NOTE: { maxPacketCounterAllowed = 50; break; @@ -1360,6 +1362,7 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co case CMSG_GAMEOBJ_USE: case CMSG_GAMEOBJ_REPORT_USE: case MSG_RAID_TARGET_UPDATE: + case CMSG_QUESTGIVER_COMPLETE_QUEST: { maxPacketCounterAllowed = 20; break; @@ -1419,7 +1422,6 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co case CMSG_QUESTGIVER_CANCEL: case CMSG_QUESTLOG_REMOVE_QUEST: case CMSG_QUEST_CONFIRM_ACCEPT: - case CMSG_QUESTGIVER_COMPLETE_QUEST: case CMSG_DISMISS_CRITTER: case CMSG_REPOP_REQUEST: case CMSG_PETITION_BUY: @@ -1471,8 +1473,6 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co case CMSG_GUILD_DISBAND: case CMSG_GUILD_LEADER: case CMSG_GUILD_MOTD: - case CMSG_GUILD_SET_PUBLIC_NOTE: - case CMSG_GUILD_SET_OFFICER_NOTE: case CMSG_GUILD_RANK: case CMSG_GUILD_ADD_RANK: case CMSG_GUILD_DEL_RANK: -- cgit v1.2.3 From 9f50dd3bd63ea432fb83e3fbca63002ff3525301 Mon Sep 17 00:00:00 2001 From: Trisjdc Date: Wed, 28 May 2014 21:52:01 +0100 Subject: Core/PetAI: Pin should not be interrupted if the victim has a breakable aura --- src/server/game/AI/CoreAI/PetAI.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index f0a75403c8c..7c640f9a66d 100644 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -89,7 +89,8 @@ void PetAI::UpdateAI(uint32 diff) if (me->GetVictim() && me->EnsureVictim()->IsAlive()) { // is only necessary to stop casting, the pet must not exit combat - if (me->EnsureVictim()->HasBreakableByDamageCrowdControlAura(me)) + if (!me->GetCurrentSpell(CURRENT_CHANNELED_SPELL) && // ignore channeled spells (Pin, Seduction) + me->EnsureVictim()->HasBreakableByDamageCrowdControlAura(me)) { me->InterruptNonMeleeSpells(false); return; -- cgit v1.2.3 From 1b47f3270ec0c02ececb6cf96da957aa96a739dc Mon Sep 17 00:00:00 2001 From: jackpoz Date: Thu, 29 May 2014 19:43:09 +0200 Subject: Core/NetworkIO: Adjust more packet throttling values Adjust more packet throttling values and add Player name to log to help investigate false positives. --- src/server/game/Server/WorldSession.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 098cc6ae69f..cbbeee63567 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -1252,8 +1252,9 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) co if (++packetCounter.amountCounter > maxPacketCounterAllowed) { dosTriggered = true; - TC_LOG_WARN("network", "AntiDOS: Account %u, IP: %s, flooding packet (opc: %s (0x%X), count: %u)", - Session->GetAccountId(), Session->GetRemoteAddress().c_str(), opcodeTable[p.GetOpcode()].name, p.GetOpcode(), packetCounter.amountCounter); + TC_LOG_WARN("network", "AntiDOS: Account %u, IP: %s, Character: %s, flooding packet (opc: %s (0x%X), count: %u)", + Session->GetAccountId(), Session->GetRemoteAddress().c_str(), Session->GetPlayerName().c_str(), + opcodeTable[p.GetOpcode()].name, p.GetOpcode(), packetCounter.amountCounter); } // Then check if player is sending packets not allowed @@ -1313,6 +1314,7 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co case CMSG_PET_NAME_QUERY: case CMSG_CREATURE_QUERY: case CMSG_NPC_TEXT_QUERY: + case CMSG_QUESTGIVER_STATUS_QUERY: { maxPacketCounterAllowed = 5000; break; @@ -1363,6 +1365,8 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co case CMSG_GAMEOBJ_REPORT_USE: case MSG_RAID_TARGET_UPDATE: case CMSG_QUESTGIVER_COMPLETE_QUEST: + case CMSG_PLAYER_VEHICLE_ENTER: + case CMSG_PETITION_SIGN: { maxPacketCounterAllowed = 20; break; @@ -1410,7 +1414,6 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co case CMSG_REQUEST_VEHICLE_EXIT: case CMSG_LEARN_PREVIEW_TALENTS: case CMSG_LEARN_PREVIEW_TALENTS_PET: - case CMSG_PLAYER_VEHICLE_ENTER: case CMSG_CONTROLLER_EJECT_PASSENGER: case CMSG_EQUIPMENT_SET_SAVE: case CMSG_DELETEEQUIPMENT_SET: @@ -1425,7 +1428,6 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co case CMSG_DISMISS_CRITTER: case CMSG_REPOP_REQUEST: case CMSG_PETITION_BUY: - case CMSG_PETITION_SIGN: case CMSG_TURN_IN_PETITION: case CMSG_COMPLETE_CINEMATIC: case CMSG_ITEM_REFUND: -- cgit v1.2.3 From 65917f52eaafcd157b68444f2ab084bb428e40b6 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Thu, 29 May 2014 21:11:41 +0200 Subject: CoreCore/NetworkIO: Fix disconnect when canceling character creation Remove the filter on CMSG_CHAR_ENUM added in 59b4c3492482b7536651625f0b1ed0ef87f52e79 since the same opcode is already throttled in the new improved system. DoS attacks using this opcode are still mitigated with same effect of before. Fixes #10915 --- src/server/game/Handlers/CharacterHandler.cpp | 11 +---------- src/server/game/Server/WorldSession.cpp | 1 - 2 files changed, 1 insertion(+), 11 deletions(-) (limited to 'src') diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index f4ea4971190..1dd4f10fd90 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -243,8 +243,6 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result) void WorldSession::HandleCharEnumOpcode(WorldPacket & /*recvData*/) { - AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, false); - // remove expired bans PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_EXPIRED_BANS); CharacterDatabase.Execute(stmt); @@ -681,7 +679,6 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte data << uint8(CHAR_CREATE_SUCCESS); SendPacket(&data); - AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true); std::string IP_str = GetRemoteAddress(); TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); sScriptMgr->OnPlayerCreate(&newChar); @@ -758,8 +755,6 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData) WorldPacket data(SMSG_CHAR_DELETE, 1); data << uint8(CHAR_DELETE_SUCCESS); SendPacket(&data); - - AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true); } void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData) @@ -1168,7 +1163,6 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recvData) void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult result, std::string const& newName) { - AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true); if (!result) { WorldPacket data(SMSG_CHAR_RENAME, 1); @@ -1426,8 +1420,6 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData) stmt->setUInt32(0, GUID_LOPART(guid)); // TODO: Make async with callback - // TODO 2: Allow opcode at end of callback - AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) @@ -1682,8 +1674,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) uint8 playerClass = nameData->m_class; uint8 level = nameData->m_level; - // TO Do: Make async and allow opcode on callback - AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true); + // TO Do: Make async PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_AT_LOGIN_TITLES); stmt->setUInt32(0, lowGuid); PreparedQueryResult result = CharacterDatabase.Query(stmt); diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index cbbeee63567..9f052b75386 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -569,7 +569,6 @@ void WorldSession::LogoutPlayer(bool save) m_playerLogout = false; m_playerSave = false; m_playerRecentlyLogout = true; - AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true); LogoutRequest(0); } -- cgit v1.2.3