Why is client-side validation a security risk as opposed to server-side validation?

前端 未结 5 512
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-09 12:23

I don\'t quite understand why client side validation is a potential security risk or more of a security risk than server side validation? Can someone give me some scenarios

5条回答
  •  醉梦人生
    2020-12-09 13:09

    Using various tools, such as Fiddler, Noscript, Web Developer, etc., I could disable the client-side javascript validation, and modify the data being sent to your server. Depending on the type of data and what the server does with it, one could initiate a SQL injection attack, attempt to compromise the server security, or simply store bogus data.

    A lightweight example: Say you have client-side validation to ensure that a zip code is 5 digits or 5+4 digits. If I disable the client-side script, I could leave my 24-digit value in place. If your server doesn't further check the value, and the database is capable of storing all 24 digits, then I have saved the bogus data.

提交回复
热议问题