Skip to content

FIX: Unexpected behavior with mp_forcerespawn#653

Merged
wopox1337 merged 7 commits intorehlds:masterfrom
FEDERICOMB96:Unexpected-behavior-with-mp_forcerespawn-leading-to-a-possible-exploit
Dec 17, 2022
Merged

FIX: Unexpected behavior with mp_forcerespawn#653
wopox1337 merged 7 commits intorehlds:masterfrom
FEDERICOMB96:Unexpected-behavior-with-mp_forcerespawn-leading-to-a-possible-exploit

Conversation

@FEDERICOMB96
Copy link
Contributor

Basically there is an exploit (or bug?) where depending on mp_forcerespawn if his value is higher to 0 and lower than 1, when you respawn you have a brief window to change your team, if you succesfully manage to change your team between the mp_forcerespawn value and WITHOUT closing the change appearance menu, you won't die due to "m_fNextSuicideTime", that will trigger the change team but without actually changing your skin model, you will keep the enemy one but the team change will success.

Thanks @metita for helping me with this

Basically there is an exploit (or bug?) where depending on mp_forcerespawn if his value is higher to 0 and lower than 1, when you respawn you have a brief window to change your team, if you succesfully manage to change your team between the mp_forcerespawn value and WITHOUT closing the change appearance menu, you won't die due to "m_fNextSuicideTime", that will trigger the change team but without actually changing your skin model, you will keep the enemy one but the team change will success.

Thanks https://github.com/metita for helping me with this

Co-Authored-By: metita <[email protected]>
@wopox1337 wopox1337 added the Type: 🐞 bug An error that needs fixing. label Oct 14, 2021
@wopox1337
Copy link
Member

wopox1337 commented Dec 16, 2022

@FEDERICOMB96 @metita I confirm that there is a problem
It was possible to change the command without dying because of m_fNextSuicideTime.

bandicam.2022-11-25.01-51-11-257.mp4

As soon as the suicide was performed, it is spawned, then if you suddenly change the command, ClientKill() will not work, because m_fNextSuicideTime will not allow.

Conclusion:

If ClientKill() was called by GameDLL code (not by the game client, via "kill") - it should work without delay.
Engine (HLDS) calls ClientKill() (pfnClientKill) only in one case - when the player client sends "kill" and only then, here it needs the client's spam protection.

Solution

Everywhere in the ReGameDLL where ClientKill() is called, it is necessary to set m_fNextSuicideTime = 0.0f before calling it.

Thank you for finding the problem.

Copy link
Member

@wopox1337 wopox1337 left a comment

Choose a reason for hiding this comment

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

@wopox1337 wopox1337 changed the title Unexpected behavior with mp_forcerespawn leading to a possible exploit FIX: Unexpected behavior with mp_forcerespawn Dec 17, 2022
@wopox1337 wopox1337 self-assigned this Dec 17, 2022
@wopox1337 wopox1337 added Priority: 🕒 low Low priority tasks that can be postponed for the future. Status: ✅ done The issue done and closed. labels Dec 17, 2022
@wopox1337 wopox1337 merged commit 1c68cb0 into rehlds:master Dec 17, 2022
yohimik pushed a commit to yohimik/ReGameDLL_CS that referenced this pull request Jun 5, 2025
* Unexpected behavior with mp_forcerespawn leading to a possible exploit

Basically there is an exploit (or bug?) where depending on mp_forcerespawn if his value is higher to 0 and lower than 1, when you respawn you have a brief window to change your team, if you succesfully manage to change your team between the mp_forcerespawn value and WITHOUT closing the change appearance menu, you won't die due to "m_fNextSuicideTime", that will trigger the change team but without actually changing your skin model, you will keep the enemy one but the team change will success.

Thanks https://github.com/metita for helping me with this

Co-Authored-By: metita <[email protected]>

* Revert "Unexpected behavior with mp_forcerespawn leading to a possible exploit"

This reverts commit 73d1c16.

* fix: nullify `m_fNextSuicideTime` before call `ClientKill()`

* ClientKill: refactoring

* add forgotten if-statement

* remove macros

Co-authored-by: metita <[email protected]>
Co-authored-by: Sergey Shorokhov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: 🕒 low Low priority tasks that can be postponed for the future. Status: ✅ done The issue done and closed. Type: 🐞 bug An error that needs fixing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants