[EXPLOITING] How to prevent exploiters from abusing data store rollbacks and sanitizing against data store vulnerabilities

A warning to Roblox developers about a powerful exploit primitive. In this, I will detail the research I’ve conducted into this attack vector and walk you through how you as a developer, can protect against exploits with primitives like this.

.The idea I wanted to explore when pondering the above question was; can we exploit remotes to prevent data from saving? It is easy to blame the developer for not protecting themselves against such a simple exploit but it ends up being more complicated than that. I found plenty of examples of these vulnerabilities occurring in many popular games such as “Adopt Me!”, “Jailbreak”, “RoCitizens” and many other games.

The reason such an exploit becomes extremely powerful is because of different types of a game’s economy design. Some games may not be affected by such a vulnerability and other games might. An RPG could have a boss that you can only fight once per day per player and it could have a chance to drop a rare in-game item, the vulnerability would allow an exploiter to constantly rollback their data and attempt to get the item again. A great example is “Adopt Me!” where the game has a very stable economy due to the effort put in place to prevent exploits, the game economy could become compromised due to a wide-spread duplication exploit using a rollback.

Read the entire gist on github: Data store vulnerabilities · GitHub

MIRROR: https://github.com/TheFrogGod/Gists/blob/main/Gists/DataStoreVulnerabilities.md

WARNING: THIS HAS BEEN UPDATED

Hi all, a while ago I released this github gist detailing various ways a malicious actor could cause a data rollback.

In an example explaining how simply a short 1 character string can cause a data store error there use to be a different patch I presented, someone posted a what I thought was a better solution using utf8.len but yesterday I found out that it isn’t a solution because it can be bypassed. I’ve updated my gist since to remedy this. The new patch, instead of utf8.len can be found here.

34 Likes

This is a nice little comprehensive report for newer developers who don’t quite understand the importance of checking data sent from clients. In my opinion, you do seem to be heavily dramatizing the topic of “remotes can be exploited if the developer doesn’t check the data sent from the client” throughout this writeup.

5 Likes

I am not heavily dramatizing. This is a rather big issue that developers ignore, all remotes should have their parameter types checked at run-time and protected against any case. The fact that these primitives are so common in popular Roblox games and the fact that this same primitive is becoming more known to exploiters is a huge issue. The vulnerability can affect game economy which I detailed in the third paragraph.

Game economies improve metrics in analytics and revenue so most games have some type of economy. Game economy becomes a very complex topic when it comes to multiplayer games, this includes trading and having a stable economy. There needs to be a clear balance between a “tap” and a “sink” which also influences player motivation (look into the pinch point). This vulnerability is quite a big issue when it comes to such aspects and why developers should put effort into properly securing their remotes.

8 Likes

You mean new developers” ?

Most of the games that fall short on fundamental remote security typically aren’t games that have enough players for the economy entering a downwards spiral to take any nonnegligible player count with it.

2 Likes

Why would I mean “new developers” I mean all developers in general. If you read the write up you’d see that the primitive has been present on popular games made by “experienced developers”. I talked to quite a few different developers who are very experienced to make sure the document was explaining everything properly.

1 Like

I’ve been developing for a long time, and only months ago was I made aware of some of the more serious ways people will try to take advantage of your game.

You are severely underplaying the value of this thread, as it is in fact a useful thread. Dont hate on people for no reason. This isnt dramatized. You should see the things exploiters do for an economy advantage.

7 Likes

I am impressed. Mostly because the possibility of an exploit like never crossed my mind. Didn’t even think this could happen either.

Thanks for the tutorial! Really informative and taught me lots of stuff I did not know :+1:

10/10

3 Likes

Thanks to this post, I’ve just found one of these rollback vulnerabilities. Thanks! It had to do with the NaN thing

1 Like

Yes it is.

I never said it wasn’t useful.

I know a lot about the topic myself. I’ve strangulated too many economies to count, in my time.

How exactly is this dramatized? Rollbacking your saves could be a serious issue that can destroy an economy. i.e:

  • mass rerolling cases to get rare items
  • preventing saving when a trade completes, which allows for duplication methods
2 Likes

This point is actually explained in my small explanation about game economy in the 3rd paragraph

An RPG could have a boss that you can only fight once per day per player and it could have a chance to drop a rare in-game item, the vulnerability would allow an exploiter to constantly rollback their data and attempt to get the item again.

1 Like

Hello, Thank you for bringing this to light!

I do believe this is on the developers, because something like this is easily avoidable given you filter the arguments received by the client, which I believe should be standard practice?

I think it bundles down to the more widely used quote; Do not ever trust what the client sends this rule being ignored in the above exception.

And so, I’m grateful someone wrote about it, hopefully this can attract more eyes!


I actually learned about this a while ago ~ people sending instances through remotes can be exploited using tables…

Server.lua

Event.OnServerEvent:Connect(function(player, intValue)
  player.Money.Value += intValue.Value
end)

Client.lua

-- this comes off as an Instance - however it is a table :joy:

Event:FireServer({ Value = 1000 })
1 Like

A few of the points are rather obscure to even know about, such as saving invalid bytes and NaN. I could only find 2 lines in the data store documentation mentioning how these bytes cant be saved and the NaN vulnerability is caused by needing a serializer.

ChangePetName:FireServer({
	PetId = 1,
	PetName = "\255" --// Originally a name
})
ChangeSetting:FireServer("ViewDistance", 0/0)

True, they are obscure, but the point of filtration is to filter these points ~ as an example, if I wanted to allow the player to choose a name for their pet;


Event.OnServerEvent:Connect(function(player, petId, petName)
   Ser.AssertType(petName, "simple-str")

   -- Ser being short for Serialisation
   -- AssertType validating that string with an serialisation function of the name of "simple-str"
   -- if AssertType fails ~ this function will error.

   doServerFunction()
end)

I do still believe this is down to the server and how you program your code, and I do believe exceptions like these will happen, and they should be documented.

But at no point can you blame anyone else except for the developers for being unable to comprehend that exploiters can leverage these methods…

I’ve also a question ~ As for my DataStores, I encode and decode my data using a custom JSON parser, so would this really have an effect?

I am honestly not sure if you would be affected by a JSON injection. The game I tested it on had a house editor and had a billboard furniture item so I had managed to do an injection after figuring out the format and injecting a 2nd furniture item. You should read the article and test if you are protected against such injection attacks.

Oooh, that raises a good point ~ Assuming the JSON injection would look something like the following?

:FireServer('Hello! ", "abc": 123')

They could potentially overwrite previous statements in the DataStore JSON - but I wouldn’t think it would get past the generic serialisations I use since it is somewhat obstructed characters like :, "

This makes me question if I should create some sort of library for advanced assertions ~ would it be helpful if I could narrow or try to eliminate as many of these as I can :smile:

I doubt any exploiter on Roblox would be smart enough to attempt a JSON injection since most of the time the exploiter does not know that you are using a JSON on the server unless that information is on the client and a reverse engineer would attempt to abuse it (and know how)

In the article I provided you can find this simple example of a JSON injection
unknown

This has been around for a while it’s good that this has been brought to light I just hope developers take it seriously.

1 Like

relatively large games actually don’t check for these types of exploits because they’ve only started sprouting up in the past few months hence they aren’t really used in public release when it comes to data abuse. there isn’t really any reason to direct this to ‘newer developers’ and the appropriate target is all Roblox programmers :]

thank you @EtSapientisMagna for this useful resource, hopefully developers can take this into account when developing games that allow data manipulation via remotes.

honestly the “NaN” value on Roblox isn’t documented properly in the wiki and frankly really shouldn’t exist as it is just problematic.

cheers

Yes an example would be Adopt Me as last time I checked they didn’t.

1 Like