Skip to content

Latest commit

 

History

History
36 lines (23 loc) · 799 Bytes

Sql Injection 代码审计 2018-08-21.md

File metadata and controls

36 lines (23 loc) · 799 Bytes

title: Sql Injection 代码审计 2018-08-21

=======

0x01 环境和工具

0x02 漏洞位置

org.owasp.webgoat.plugin.introduction.SqlInjectionLesson5a.java
数据污染流如下POST参数数据未经过处理直接进入函数最终进入query语句导致sql注入

sql1

0x03 漏洞验证,开启IDEA debug,下断点,查看脏数据流

sql2

0x04 漏洞修补

   String query= "SELECT * FROM user_data WHERE last_name =? ;
   PreparedStatement preState = conn.prepareStatement(query);
   preState.setString(1, accountName);
   ResultSet rs = preState.executeQuery();