JohnCharles117
JohnCharles117

Reputation: 311

Can JavaScript variables be easily modified maliciously?

I am setting up a quiz that uses boolean variables for correct/incorrect and then passes those variable values to a PHP script via Ajax for processing and storing in a database.

How easily could someone override the values set by my code with after finding the var names with "view source"?

Upvotes: 1

Views: 384

Answers (3)

Ryan Florence
Ryan Florence

Reputation: 13483

Yes.

You should send the answers to the server and let the server grade the quiz.

Upvotes: 2

Naresh Chauhan
Naresh Chauhan

Reputation: 79

for testing purpose you can use firefox add on firebug or chrome's developer tool kit. Change your javascript variable using inspect element and than perform action of button which posts your data. On server side you should make sure that posted variable must be any of variable that is in option of answer of that question.

Upvotes: 0

Ananth
Ananth

Reputation: 4397

They can do it easily using Chrome/Firebug Console by issuing a Javascript command over there like

var your_var_name = 60;

You must have backend synchronization also to prevent this.

Upvotes: 0

Related Questions