Including Limited Properties using BindAttribute in ASP.Net MVC | Avoiding Over-Posting Data using Bind Attribute | ASP.Net MVC Programmer Guide

Bind attribute (BindAttribute) represents an attribute that is used to provide details about how model binding to a parameter should occur in ASP.Net MVC.

Bind attribute is another important security mechanism that keeps hackers from over-posting data to your model. You should only include properties in the bind attribute that you want to change.

For example, suppose the Student entity includes a Secret property that you don't want this web page to update.

   public class Student
   {
      public int ID { get; set; }
      public string LastName { get; set; }
      public string FirstMidName { get; set; }
      public DateTime EnrollmentDate { get; set; }
      public string Secret { get; set; }

      public virtual ICollection<Enrollment> Enrollments { get; set; }
   }

Even if you don't have a Secret field on the web page, a hacker could use a tool such as  fiddler, or write some JavaScript, to post a Secret form value. Without the  Bind attribute limiting the fields that the model binder uses when it creates a Student instance, the model binder would pick up that Secret form value and use it to update the Student entity instance. Then whatever value the hacker specified for the Secret form field would be updated in your database. The following image shows the fiddler tool adding the Secret field (with the value "OverPost") to the posted form values.



The value "OverPost" would then be successfully added to the Secret property of the inserted row, although you never intended that the web page be able to update that property.

It's a security best practice to use the Include parameter with the Bind attribute to whitelist fields. It's also possible to use the Exclude parameter to blacklist fields you want to exclude. The reason Include is more secure is that when you add a new property to the entity, the new field is not automatically protected by an Exclude list.