From the course: Security in ASP.NET Core
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
SQL injection with Entity Framework Core - ASP.NET Tutorial
From the course: Security in ASP.NET Core
SQL injection with Entity Framework Core
- [Instructor] Many applications these days do not use SQL at all. It sounds a bit weird and of course most of them are using SQL in the background, but from an API perspective, the applications rely on something else. An OR mapper. An object relational mapper such as Entity Framework Core or and Hibernate. And of course the idea here is you have an API. Here is an order, add the order to the database. You don't write any SQL. And the OR mapper then of course knows what is a command, what is data, and creates secure SQL, preventing SQL injection. But that's only part of the story, because all OR mappers I'm aware of still allow running raw SQL against a database. So with Entity Framework Core there is the SqlQueryRaw method on the database, or ExecuteRawQuery, or if you have some entity you can then run FromSqlRaw there. These methods allow sending verbatim SQL to the database. If that SQL has been cobbled together using string concatenation, then you once again have SQL injection…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
OWASP Top Ten2m 45s
-
(Locked)
Cross-site scripting (XSS): The attack4m 33s
-
(Locked)
Cross-site scripting (XSS): The defense3m 25s
-
(Locked)
Cross-site scripting (XSS) in JavaScript4m 40s
-
(Locked)
Cross-site scripting (XSS) in single-page applications3m 30s
-
(Locked)
Same-origin policy and CORS4m 26s
-
(Locked)
Enabling CORS in ASP.NET Core web API6m 23s
-
(Locked)
SQL injection with ADO.NET2m 25s
-
(Locked)
SQL injection with Entity Framework Core2m 34s
-
(Locked)
Fixing SQL injection5m 23s
-
(Locked)
Cross-Site Request Forgery (CSRF): The attack5m 25s
-
(Locked)
Cross-Site Request Forgery (CSRF): The defense7m 11s
-
-
-
-
-