Chapter 2: Manipulating SQL – Exploiting SQL Injection

After dealing more generally with Structured Query Language (SQL) and its characteristics and peculiarities, we are now focusing more on the main crux of this book: the injection vulnerability. We've already seen, in a broader sense, what SQL injection is, and gave a glimpse of what could be done with it, and why.

In this chapter, as a follow-up to the previous one, we are continuing with the theoretical approach to the matter, getting more in touch with the practical aspects of SQL injection attacks. This chapter includes, in fact, examples of input strings that could be used for triggering SQL injection for many different purposes.

This chapter will lay the foundation for the practical part, which will instead focus on the execution of SQL injection attacks in a controlled setup, putting into practice what we will see in this part.

After discussing SQL injection with SQL syntax, this chapter will also describe the injection vulnerability in some non-relational settings.

In this chapter, the following topics will be covered:

  • Exploitable SQL commands and syntax: We'll highlight the SQL commands and syntactic structures most open to abuse that could be exploited for carrying out SQL injection attacks.
  • Common SQL injection commands and manipulation: An overview of the main SQL attack techniques, showing actual commands used by attackers and their possible effects on an application or a system.
  • Not only SQL injection: non-relational repositories: A brief introduction to the non-relational context.
  • The injection vulnerability in non-relational repositories: An explanation of the impact of SQL injection in the non-relational environment, showing some possible techniques.
  • Wrapping up: (No-)SQL injection in theory: A final recap of the theoretical part of this book, to fix the main topics and approach the practical section with more confidence.