I'm testing a site that behaves like this:
- When I change my username, I submit a POST request with JSON data like this
{"username":"John"}
. - If I change that to for example
{"username":{"test":"test"}}
, my username is printed like this:[object Object]
- Therefore I concluded that I can inject objects and have tried to override the toString method of my object doing this:
{"username":{"test":"test","toString":"function() {return 1;}"}}
, but when I load a page where the username should be printed, I just get a runtime error in the console saying that toString is not a function.
I assume that I have successfully managed to overwrite the toString method, but it seems that I have just replaced it with a string, and therefore it is not a method anymore and cannot be executed.
Any ideas if this could be exploitable?