SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > 0.3.7 RC Scripting

 
 
Thread Tools Display Modes
Old 10/07/2015, 08:29 PM   #1
Emre__
Big Clucker
 
Join Date: Jun 2011
Posts: 89
Reputation: 0
Default [SOLUTION] Invalid shot data for player(id). Offset out of bounds

Hello everybody,

I was recently having this error on my server_log.txt file and lost some players because they were crashing out of the game when this error happens. This error is not being randomly generated or a malfunctioning on SAMP server. It's because some guy is attacking your server with a script that is can be found easily on any samp hack forums.

Let's describe how this attack works. As you know PAWN language is based on 32-bit language so any data, string, float or integer can not be bigger then 32 bits. When 32 bit is fully used in this case our maximum number in bits is 1111111111111111111111111111111 which is equals to 2147483647. This also applies to floats.

So attacker sends a bullet shot data to server with random float offsets which is around 2147483647 or bigger. When the offset position is bigger then this number SAMP Server can not process the data normally so sends malformed data to user and that makes client crash not server.

To prevent this you can use this simple solution: When a offset is bigger then 2 billion and 147 million then do not send the weapon data. It can be done simply like this:

Code:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(fX > 2140000000 || fY > 2140000000 || fZ > 2140000000) {
        new PlayerName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, PlayerName, sizeof PlayerName);
        printf("[BULLET ATTACK] User %s(%d) is tried to shot an invalid bullet @ fX: %f, fY: %f, fZ: %f", PlayerName, playerid, fX, fY, fZ);
        return 0;
    }
    return 1;
}

Note: In order this to work you must have enabled lagmodcomp 1 in server.cfg

EDIT: This system detects this attack but still invalid shot data still being sent. You can try to Ban attacker at the very moment when attack is detected. Simply add
Code:
 BanEx(playerid, "possible bullet crash");
just before
Code:
return 0;

Last edited by Emre__; 11/07/2015 at 02:03 PM.
Emre__ is offline  
Old 10/07/2015, 08:36 PM   #2
awsomedude
Big Clucker
 
awsomedude's Avatar
 
Join Date: Oct 2011
Posts: 193
Reputation: 29
Default Re: [SOLUTION] Invalid shot data for player(id). Offset out of bounds

There is a include that detects invalid bullet shots http://forum.sa-mp.com/showthread.php?t=581017
awsomedude is offline  
Old 10/07/2015, 08:46 PM   #3
Emre__
Big Clucker
 
Join Date: Jun 2011
Posts: 89
Reputation: 0
Default Re: [SOLUTION] Invalid shot data for player(id). Offset out of bounds

Quote:
Originally Posted by awsomedude View Post
There is a include that detects invalid bullet shots http://forum.sa-mp.com/showthread.php?t=581017
That include doesn't solve the exact problem here.
Emre__ is offline  
Old 11/07/2015, 07:25 AM   #4
Mellnik
Gangsta
 
Mellnik's Avatar
 
Join Date: Dec 2011
Location: Paradise Falls, CAℕADA
Posts: 794
Reputation: 369
Default AW: [SOLUTION] Invalid shot data for player(id). Offset out of bounds

Tbh, the SA-MP server should sort out such stuff and perform sanity checks.
Mellnik is offline  
Old 11/07/2015, 11:57 AM   #5
Lorenc_
High-roller
 
Lorenc_'s Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 4,270
Reputation: 1100
Default Re: [SOLUTION] Invalid shot data for player(id). Offset out of bounds

Quote:
Originally Posted by Emre__ View Post
That include doesn't solve the exact problem here.
If you are talking about the most recent player-crasher release, then that in fact does patch it. Most recent ones exploit the invalid weapon id to crash players, simple as that.
__________________
HostName: San Fierro Cops And Robbers (0.3.7)
Address: svr.irresistiblegaming.com:7777
Ping: 256
Mode: Cops And Robbers
Language: All (English)
Lorenc_ is offline  
Old 11/07/2015, 11:59 AM   #6
Emmet_
Guest
 
Posts: n/a
Default Re: [SOLUTION] Invalid shot data for player(id). Offset out of bounds

Quote:
Originally Posted by Emre__ View Post
That include doesn't solve the exact problem here.
You sure?

Code:
} else if ((hittype == BULLET_HIT_TYPE_NONE) && GetPlayerDistanceFromPoint(playerid, fX, fY, fZ) > 200.0 && (fX != 0.0 && fY != 0.0 && fZ != 0.0)) {
 
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[HELP] [warning] Invalid shot data for player(0). Offset out of bounds. VenomMancer Server Support 3 06/07/2015 04:28 PM
Get player offset from a vehicle Rodney Francalim Scripting Help 2 01/12/2014 01:42 AM
Offset coordinates of player aiming to another player Banditukas Scripting Help 8 02/11/2014 11:53 AM
LOSING DATA SOLUTION... - INI yos136 Scripting Help 3 08/02/2014 03:46 PM
Detect if player has Shot someone else (And been Shot)? DarrenReeder Help Archive 9 04/04/2010 05:37 PM


All times are GMT. The time now is 12:21 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.