Roger Lipscombe
Roger Lipscombe

Reputation: 91845

Website security pitfalls and what can I do in ASP.NET MVC to avoid/mitigate them?

I've just started working on implementing my first public-facing website. Since I'm new to this, I think if a list of common pitfalls, what they are, and how to avoid them is warranted.

I'm looking for things like:

If a topic has been dealt with in another question, a quick summary and a link to that question would be a good idea.

Upvotes: 4

Views: 727

Answers (1)

Matt Kocaj
Matt Kocaj

Reputation: 11535

  • SQL injection - Use parameterized queries! If you are using the StringBuilder class or string concatenation to build SQL queries, you're most likely vulnerable to SQL injection.
  • XSS - provided you use MVC helpers like =Html.Encode(yourPossibleCompromisedData) to render data to your page you should be fine. these helpers are designed to stop injected code being executed on the browser. ASP.NET also has form protection stopping malicious code from being posted to your actions (this is not MVC but aspnet itself).
  • Incorrect storage of passwords. Use the built-in aspnet Membership provider - it uses good patterns (salt..) to store passwords etc.
  • Login rate limiting - i believe there are contrib projects that are available to mitigate this (if the built-in provider does not already do it)
  • What exactly is XSS and what tools are in the ASP.NET MVC toolbox for avoiding it? read: XSS. MVC 1.0 provides the =Html.ValidationSummary() hidden field for forms so to mitigate cross-site scripting.

Upvotes: 1

Related Questions