First-order SQL injection occurs when the application processes user input from an HTTP request and incorporates the input into a SQL query in an unsafe way.当应用程序处理来自 HTTP 请求的用户输入,并以不安全的方式将输入并入 SQL 查询时,就会发生一阶 SQL 注入。
Second-order SQL injection occurs when the application takes user input from an HTTP request and stores it for future use. This is usually done by placing the input into a database, but no vulnerability occurs at the point where the data is stored. Later, when handling a different HTTP request, the application retrieves the stored data and incorporates it into a SQL query in an unsafe way. For this reason, second-order SQL injection is also known as stored SQL injection.二阶SQL注入发生在应用程序从HTTP请求中获取用户输入并将其存储以供日后使用时。这通常是通过将输入放入数据库来完成的,但在数据存储的点并不会出现漏洞。之后,在处理不同的HTTP请求时,应用程序会检索存储的数据,并以不安全的方式将其整合到SQL查询中。因此,二阶SQL注入也被称为存储型SQL注入。
Second-order SQL injection often occurs in situations where developers are aware of SQL injection vulnerabilities, and so safely handle the initial placement of the input into the database. When the data is later processed, it is deemed to be safe, since it was previously placed into the database safely. At this point, the data is handled in an unsafe way, because the developer wrongly deems it to be trusted.二阶SQL注入通常发生在开发人员已知晓SQL注入漏洞、并因此安全地将输入初始存入数据库的场景中。后续处理数据时,由于输入此前已安全存入数据库,数据被认定为安全。而此时对数据的处理方式却不安全,因为开发人员错误地认为数据是可信的。