Fix push sync vehicle syncer hijack#4887
Fix push sync vehicle syncer hijack#4887Zephkek wants to merge 1 commit intomultitheftauto:masterfrom
Conversation
7b1c34a to
45d6c5e
Compare
| if (pVehicle->GetSyncer() != pPlayer && pVehicle->GetTimeSinceLastPush() >= MIN_PUSH_ANTISPAM_RATE && | ||
|
|
||
| CPlayer* pSyncer = pVehicle->GetSyncer(); | ||
| const bool bCanClaimSync = !pSyncer || (!IsSyncerPersistent() && pPlayer->GetContactElement() == pVehicle); |
There was a problem hiding this comment.
Is this the server side equivalent of this check?
mtasa-blue/Client/mods/deathmatch/logic/CClientGame.cpp
Lines 4710 to 4713 in 6c54a2d
qaisjp
left a comment
There was a problem hiding this comment.
This affects sync when the player ped is "pushing" a vehicle, by walking into it.
pPlayer->GetContactElement() == pVehicle is the main change here.
This could in theory cause 1.5s of desync for a player vehicle, if the "contact" packet arrives after the vehicle push packet.
If that happens, the server will reject the syncer change and the client will stop sending syncer packets for ~1.5s (because of the anti-span check client side)
This seems OK given that:
- if there are other players in the vicinity, the other players will have their own simulation of the push
- the player doing the pushing is likely pushing for more than 1.5s, so the next push packet is likely to succeed
- if the player is pushing a vehicle carefully (where packets being lost for 1.5s would be bad), they have likely already set foot in the vehicle before
That said, is this change strictly necessary, given that we have the iVehicleContactSyncRadius check?
|
Question for you @Zephkek! |
|
@qaisjp Thanks for the review, to answer your question yes I believe this check is necessary because the radius check alone doesn't prevent a cheating client from hijacking sync (default 30 units which is about 4 car lengths). This PR fixes the ability to forge or unintended push packet from a player who is near a vehicle but not actually pushing it so radius alone passes that. So the two checks aren't redundant the contact check is what specifically prevents syncer hijack and it's only enforced when there's already a syncer to take over from so the no-syncer "first one to nudge it" remains unchanged as intended. |
Also about the 1.5s desync concern, in theory yes client can lose 1.5s of push sync packets if the contact element update arrives after the first push packet but that window is bounded by exactly the case where it least matters:
|
Summary
Prevent vehicle push sync from replacing an existing unoccupied vehicle syncer.
Conditions for whether a player can claim syncer of a vehicle:
Motivation
Pushsync accepted a nearby client's vehicle ID and could call
OverrideSyncereven when another player already owned sync. This let forged pushsync packets hijack vehicle sync authority.Test plan
Checklist